commit: d7cc628c0f81cc119dd8ee02023eaae9d8f3e998
parent a3b6be9a0e6dfa4e85bc49d59d7b816605fc29b3
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 6 Jul 2019 00:01:37 -0700
Add cproc
Diffstat:
7 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -26,6 +26,9 @@
[submodule "pkg/cmark/src"]
path = pkg/cmark/src
url = https://github.com/commonmark/cmark
+[submodule "pkg/cproc/src"]
+ path = pkg/cproc/src
+ url = https://git.sr.ht/~mcf/cproc
[submodule "pkg/dmenu/src"]
path = pkg/dmenu/src
url = git://git.suckless.org/dmenu
diff --git a/pkg/cproc/config.h 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
@@ -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
@@ -0,0 +1 @@
+Subproject commit 4b3e5a6bd64335ad207167fa8fd39a098c50c1db
diff --git a/pkg/cproc/ver b/pkg/cproc/ver
@@ -0,0 +1 @@
+6f565ecfc1 r0
diff --git 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'
diff --git a/sets.lua b/sets.lua
@@ -40,11 +40,12 @@ return {
'zstd',
},
devel={
+ 'cproc',
'make',
- 'qbe',
+ 'man-pages-posix',
'nasm',
+ 'qbe',
'strace',
- 'man-pages-posix',
},
media={
'alsa-lib',