summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-07-06 00:01:37 -0700
committerMichael Forney <mforney@mforney.org>2019-07-06 16:22:36 -0700
commitd7cc628c0f81cc119dd8ee02023eaae9d8f3e998 (patch)
tree3fffd83a3a1614dd53319b26c1b0d73dfde6a5ff /pkg
parenta3b6be9a0e6dfa4e85bc49d59d7b816605fc29b3 (diff)
Add cproc
Diffstat (limited to 'pkg')
-rw-r--r--pkg/cproc/config.h23
-rw-r--r--pkg/cproc/gen.lua32
m---------pkg/cproc/src0
-rw-r--r--pkg/cproc/ver1
-rw-r--r--pkg/gen.lua1
5 files changed, 57 insertions, 0 deletions
diff --git a/pkg/cproc/config.h b/pkg/cproc/config.h
new file mode 100644
index 00000000..a9dff3ab
--- /dev/null
+++ b/pkg/cproc/config.h
@@ -0,0 +1,23 @@
+static char target[] = "x86_64-linux-musl";
+static char *startfiles[] = {"-l", ":crt1.o", "-l", ":crti.o"};
+static char *endfiles[] = {"-l", "c", "-l", ":crtn.o"};
+static char *preprocesscmd[] = {
+ "cpp", "-P",
+
+ /* clear preprocessor GNU C version */
+ "-U", "__GNUC__",
+ "-U", "__GNUC_MINOR__",
+
+ /* we don't yet support these optional features */
+ "-D", "__STDC_NO_ATOMICS__",
+ "-D", "__STDC_NO_COMPLEX__",
+ "-D", "__STDC_NO_VLA__",
+ "-U", "__SIZEOF_INT128__",
+
+ /* ignore attributes and extension markers */
+ "-D", "__attribute__(x)=",
+ "-D", "__extension__=",
+};
+static char *codegencmd[] = {"qbe"};
+static char *assemblecmd[] = {"as"};
+static char *linkcmd[] = {"ld", "--dynamic-linker", "/lib/ld-musl-x86_64.so.1"};
diff --git a/pkg/cproc/gen.lua b/pkg/cproc/gen.lua
new file mode 100644
index 00000000..bba3f8aa
--- /dev/null
+++ b/pkg/cproc/gen.lua
@@ -0,0 +1,32 @@
+cflags{
+ '-std=c11', '-pedantic',
+ '-Wall', '-Wno-switch', '-Wno-parentheses',
+ '-I $dir',
+}
+
+cc('util.c')
+
+exe('cproc', {'driver.c', 'util.c.o'})
+exe('cproc-qbe', {
+ 'decl.c',
+ 'eval.c',
+ 'expr.c',
+ 'init.c',
+ 'main.c',
+ 'map.c',
+ 'pp.c',
+ 'qbe.c',
+ 'scan.c',
+ 'scope.c',
+ 'siphash.c',
+ 'stmt.c',
+ 'targ.c',
+ 'token.c',
+ 'tree.c',
+ 'type.c',
+ 'util.c.o',
+})
+file('bin/cproc', '755', '$outdir/cproc')
+file('bin/cproc-qbe', '755', '$outdir/cproc-qbe')
+
+fetch 'git'
diff --git a/pkg/cproc/src b/pkg/cproc/src
new file mode 160000
+Subproject 4b3e5a6bd64335ad207167fa8fd39a098c50c1d
diff --git a/pkg/cproc/ver b/pkg/cproc/ver
new file mode 100644
index 00000000..442c8d15
--- /dev/null
+++ b/pkg/cproc/ver
@@ -0,0 +1 @@
+6f565ecfc1 r0
diff --git a/pkg/gen.lua b/pkg/gen.lua
index 9533d946..ba5cce5e 100644
--- a/pkg/gen.lua
+++ b/pkg/gen.lua
@@ -7,6 +7,7 @@ subgen 'bearssl'
subgen 'blind'
subgen 'bzip2'
subgen 'cmark'
+subgen 'cproc'
subgen 'curl'
subgen 'dosfstools'
subgen 'dmenu'