summaryrefslogtreecommitdiff
path: root/ports/cproc
diff options
context:
space:
mode:
authordzwdz2023-08-27 02:06:32 +0200
committerdzwdz2023-08-27 02:06:32 +0200
commite43939bcc6123e02314aa403eef94d5ace441f7f (patch)
treeac0cea10e8708ae1a6a7a400257c4bc59175a91f /ports/cproc
parent1f938c20b4a82ca1267ab9a1ec0922878a21ca6b (diff)
ports: qbe, cproc :^)
Diffstat (limited to 'ports/cproc')
-rw-r--r--ports/cproc/files/config.h26
-rw-r--r--ports/cproc/files/config.mk5
-rw-r--r--ports/cproc/patches/0-cloexec.patch17
-rwxr-xr-xports/cproc/port13
-rw-r--r--ports/cproc/sha256sums1
5 files changed, 62 insertions, 0 deletions
diff --git a/ports/cproc/files/config.h b/ports/cproc/files/config.h
new file mode 100644
index 0000000..18b2b1e
--- /dev/null
+++ b/ports/cproc/files/config.h
@@ -0,0 +1,26 @@
+static const char target[] = "x86_64-camellia";
+static const char *const startfiles[] = {"-l", ":crt0.o"};
+static const char *const endfiles[] = {"-l", "c"};
+static const char *const preprocesscmd[] = {
+ "cpp",
+
+ /* 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__",
+
+ /* we don't generate position-independent code */
+ "-U", "__PIC__",
+
+ /* ignore attributes and extension markers */
+ "-D", "__attribute__(x)=",
+ "-D", "__extension__=",
+};
+static const char *const codegencmd[] = {"qbe"};
+static const char *const assemblecmd[] = {"as"};
+static const char *const linkcmd[] = {"ld", "-no-dynamic-linker", "-pie"};
diff --git a/ports/cproc/files/config.mk b/ports/cproc/files/config.mk
new file mode 100644
index 0000000..b58d14f
--- /dev/null
+++ b/ports/cproc/files/config.mk
@@ -0,0 +1,5 @@
+PREFIX=/usr/
+BINDIR=$(PREFIX)/bin
+CC=cc
+CFLAGS=-std=c99 -Wall -Wpedantic -Wno-parentheses -Wno-switch -g -pipe
+LDFLAGS=
diff --git a/ports/cproc/patches/0-cloexec.patch b/ports/cproc/patches/0-cloexec.patch
new file mode 100644
index 0000000..4102e05
--- /dev/null
+++ b/ports/cproc/patches/0-cloexec.patch
@@ -0,0 +1,17 @@
+--- driver.c.orig
++++ driver.c
+@@ -165,12 +165,10 @@ spawnphase(struct stageinfo *phase, int *fd, char *input, char *output, bool las
+ goto err1;
+ }
+ if (fcntl(pipefd[0], F_SETFD, FD_CLOEXEC) < 0) {
+- ret = errno;
+- goto err2;
++ warn("fcntl(..., F_SETFD, FD_CLOEXEC):");
+ }
+ if (fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) < 0) {
+- ret = errno;
+- goto err2;
++ warn("fcntl(..., F_SETFD, FD_CLOEXEC):");
+ }
+ ret = posix_spawn_file_actions_adddup2(&actions, pipefd[1], 1);
+ if (ret)
diff --git a/ports/cproc/port b/ports/cproc/port
new file mode 100755
index 0000000..54f649e
--- /dev/null
+++ b/ports/cproc/port
@@ -0,0 +1,13 @@
+#!/bin/sh
+. ports/pre
+
+pkg=cproc
+tarball=michaelforney-cproc-0985a78.tar.gz
+tarball_dir=michaelforney-cproc-0985a78
+url=https://github.com/michaelforney/cproc/tarball/0985a7893a4b5de63a67ebab445892d9fffe275b
+
+relink() {
+ rm $tarball_dir/cproc
+}
+
+. ports/post
diff --git a/ports/cproc/sha256sums b/ports/cproc/sha256sums
new file mode 100644
index 0000000..568912f
--- /dev/null
+++ b/ports/cproc/sha256sums
@@ -0,0 +1 @@
+cf9a4de550303eedcc8b8ee22f11b085a9387b911fa16a6fa7551382a3d7a1ea michaelforney-cproc-0985a78.tar.gz