summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-12-11 13:49:20 -0800
committerMichael Forney <mforney@mforney.org>2016-12-11 14:01:55 -0800
commit50f5b78310c78d882c1fe620a3d55c0797c9572f (patch)
tree3076dcde3272ee91e62281a228dfbe6433d0ecd9
parent41cd318bb5d7796b39258cecb06f7992b6b5401c (diff)
plan9port: Make sure u.h is included first
Otherwise, the system headers get included before u.h is able to define feature test macros.
-rw-r--r--core/plan9port/gen.rc5
-rw-r--r--core/plan9port/patch/0005-Include-u.h-before-any-other-system-headers.patch23
-rw-r--r--core/plan9port/rev2
-rw-r--r--rules.ninja3
4 files changed, 31 insertions, 2 deletions
diff --git a/core/plan9port/gen.rc b/core/plan9port/gen.rc
index dcddbd8c..92415e0e 100644
--- a/core/plan9port/gen.rc
+++ b/core/plan9port/gen.rc
@@ -355,7 +355,10 @@ lib libplumb.a src/libplumb/^(event.c fid.c mesg.c)
# src/src/cmd/rc/mkfile:/^OFILES
yacc rc/x '$srcdir'/src/cmd/rc/syn.y
-exe bin/rc -d '$outdir'/rc/x.tab.h '$outdir'/rc/x.tab.c src/cmd/rc/^(\
+# remove stdlib.h and string.h includes so that u.h comes first.
+build '$outdir'/rc/syn.c grep '$outdir'/rc/x.tab.c ; with\
+ expr '-F -x -v -e ''#include <stdlib.h>'' -e ''#include <string.h>'''
+exe bin/rc -d '$outdir'/rc/x.tab.h '$outdir'/rc/syn.c src/cmd/rc/^(\
code.c\
exec.c\
getflags.c\
diff --git a/core/plan9port/patch/0005-Include-u.h-before-any-other-system-headers.patch b/core/plan9port/patch/0005-Include-u.h-before-any-other-system-headers.patch
new file mode 100644
index 00000000..0b022c64
--- /dev/null
+++ b/core/plan9port/patch/0005-Include-u.h-before-any-other-system-headers.patch
@@ -0,0 +1,23 @@
+From c35ccfd7b03be1770ba3894e2e97b7faf87b8634 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 11 Dec 2016 13:28:47 -0800
+Subject: [PATCH] Include <u.h> before any other system headers
+
+Otherwise, the system headers may provide different values for feature test
+macros than we do in u.h.
+---
+ src/cmd/rc/io.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cmd/rc/io.c b/src/cmd/rc/io.c
+index bb8af4ab..ac3b7585 100644
+--- a/src/cmd/rc/io.c
++++ b/src/cmd/rc/io.c
+@@ -1,3 +1,4 @@
++#include <u.h>
+ #include <limits.h>
+ #include "rc.h"
+ #include "exec.h"
+--
+2.11.0
+
diff --git a/core/plan9port/rev b/core/plan9port/rev
index 0cfbf088..00750edc 100644
--- a/core/plan9port/rev
+++ b/core/plan9port/rev
@@ -1 +1 @@
-2
+3
diff --git a/rules.ninja b/rules.ninja
index 27cf1219..ae79edb1 100644
--- a/rules.ninja
+++ b/rules.ninja
@@ -53,6 +53,9 @@ rule sed
rule awk
command = awk $expr $in >$out.tmp && mv $out.tmp $out
+rule grep
+ command = grep $expr $in >$out.tmp && mv $out.tmp $out
+
rule tic
command = tic $ticflags $in