summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-10-01 13:25:16 -0700
committerMichael Forney <mforney@mforney.org>2020-10-01 13:36:42 -0700
commit1f2e76986582463195a6710362d7fec9c2507ad0 (patch)
tree93e316874e09c7699347c6845491a07db25131c9
parentceb251f15ad0c90dd4bdc7da4d6bf049e0578f95 (diff)
openbsd: Explicitly list the libc headers that are required
Previously, we just added the openbsd header directories to the search path with -idirafter to prevent openbsd headers from being used where we already have musl headers. However, if the system had its own version of the headers (such as sys/tree.h), those would get preferred over the openbsd versions, which may result in build failures due to slight incompatibilities. To fix this, just isolate the few headers we do need into their own directory, and include it normally (with -I/-isystem).
-rw-r--r--pkg/acme-client/gen.lua3
-rw-r--r--pkg/elftoolchain/gen.lua3
-rw-r--r--pkg/libevent/gen.lua4
-rw-r--r--pkg/openbsd/gen.lua11
-rw-r--r--pkg/transmission/gen.lua8
5 files changed, 18 insertions, 11 deletions
diff --git a/pkg/acme-client/gen.lua b/pkg/acme-client/gen.lua
index 2efd15e4..7a39d251 100644
--- a/pkg/acme-client/gen.lua
+++ b/pkg/acme-client/gen.lua
@@ -5,12 +5,13 @@ cflags{
'-isystem $basedir/pkg/openbsd/include',
'-isystem $builddir/pkg/libressl/include',
'-isystem $builddir/pkg/libtls-bearssl/include',
- '-idirafter $basedir/pkg/openbsd/src/sys',
+ '-isystem $builddir/pkg/openbsd/include',
}
pkg.deps = {
'pkg/libressl/headers',
'pkg/libtls-bearssl/headers',
+ 'pkg/openbsd/headers',
}
yacc('parse', 'parse.y')
diff --git a/pkg/elftoolchain/gen.lua b/pkg/elftoolchain/gen.lua
index 0b389b87..3d65d22f 100644
--- a/pkg/elftoolchain/gen.lua
+++ b/pkg/elftoolchain/gen.lua
@@ -3,7 +3,7 @@ cflags{
'-I $dir',
'-I $srcdir/common',
'-I $srcdir/libelf',
- '-idirafter $basedir/pkg/openbsd/src/sys',
+ '-isystem $builddir/pkg/openbsd/include',
}
pkg.hdrs = {
@@ -11,6 +11,7 @@ pkg.hdrs = {
copy('$outdir/include', '$srcdir/common', {'elfdefinitions.h'}),
install=true,
}
+pkg.deps = {'pkg/openbsd/headers'}
rule('m4', 'm4 -D SRCDIR=$srcdir/libelf $in >$out')
build('m4', '$outdir/libelf_convert.c', {'$srcdir/libelf/libelf_convert.m4', '|', '$srcdir/libelf/elf_types.m4'})
diff --git a/pkg/libevent/gen.lua b/pkg/libevent/gen.lua
index f1fd01dc..7b614e3e 100644
--- a/pkg/libevent/gen.lua
+++ b/pkg/libevent/gen.lua
@@ -2,7 +2,7 @@ cflags{
'-I $dir',
'-I $outdir/include',
'-I $srcdir/include',
- '-idirafter $basedir/pkg/openbsd/src/sys',
+ '-isystem $builddir/pkg/openbsd/include',
}
build('sed', '$outdir/include/event2/event-config.h', {'$dir/config.h', '|', '$srcdir/make-event-config.sed'}, {
@@ -24,7 +24,7 @@ pkg.hdrs = {
}
pkg.deps = {
'$gendir/headers',
- 'pkg/openbsd/fetch',
+ 'pkg/openbsd/headers',
}
lib('libevent.a', {
diff --git a/pkg/openbsd/gen.lua b/pkg/openbsd/gen.lua
index 54ef4fed..2f7a4854 100644
--- a/pkg/openbsd/gen.lua
+++ b/pkg/openbsd/gen.lua
@@ -2,11 +2,16 @@ cflags{
'-Wall', '-Wno-pointer-sign', '-Wno-maybe-uninitialized', '-Wno-attributes',
[[-D 'DEF_WEAK(n)=_Static_assert(1, "")']],
'-I $dir/include',
- '-idirafter $srcdir/include',
- '-idirafter $srcdir/sys',
- '-idirafter $srcdir/lib/libutil',
+ '-I $outdir/include',
}
+pkg.hdrs = {
+ copy('$outdir/include', '$srcdir/sys', {'sys/queue.h', 'sys/tree.h', 'sys/_null.h'}),
+ copy('$outdir/include', '$srcdir/include', {'fts.h', 'vis.h'}),
+ copy('$outdir/include', '$srcdir/lib/libutil', {'ohash.h'}),
+}
+pkg.deps = {'$gendir/headers'}
+
-- Link arc4random.c to '$outdir' so that it doesn't include the local
-- arc4random.h
build('copy', '$outdir/lib/libc/crypt/arc4random.c', '$srcdir/lib/libc/crypt/arc4random.c')
diff --git a/pkg/transmission/gen.lua b/pkg/transmission/gen.lua
index 15df199e..e671408e 100644
--- a/pkg/transmission/gen.lua
+++ b/pkg/transmission/gen.lua
@@ -6,7 +6,7 @@ sub('libminiupnp.ninja', function()
cflags{
'-D _GNU_SOURCE',
'-I $outdir/miniupnpc',
- '-idirafter $basedir/pkg/openbsd/src/sys',
+ '-isystem $outdir/pkg/openbsd/include',
}
build('sed', '$outdir/miniupnpc/miniupnpcstrings.h', '$srcdir/third-party/miniupnpc/miniupnpcstrings.h.in', {
@@ -29,7 +29,7 @@ sub('libminiupnp.ninja', function()
upnperrors.c
upnpreplyparse.c
)
- ]], {'$outdir/miniupnpc/miniupnpcstrings.h', 'pkg/openbsd/fetch'})
+ ]], {'$outdir/miniupnpc/miniupnpcstrings.h', 'pkg/openbsd/headers'})
end)
cflags{
@@ -44,7 +44,7 @@ cflags{
'-isystem $builddir/pkg/libevent/include',
'-isystem $builddir/pkg/libutp/include',
'-isystem $builddir/pkg/zlib/include',
- '-idirafter $basedir/pkg/openbsd/src/sys',
+ '-isystem $builddir/pkg/openbsd/include',
'-include config.h',
}
@@ -53,7 +53,7 @@ pkg.deps = {
'pkg/curl/headers',
'pkg/libevent/headers',
'pkg/libutp/headers',
- 'pkg/openbsd/fetch',
+ 'pkg/openbsd/headers',
'pkg/zlib/headers',
}