Stop building with the standard system headers.
Building with the standard system headers isn't a perfect match to the stand environment. Instead, copy over the files we know are safe to use and constrain what else is used. We use -nostdinc to achieve this. This also fixes issues with building 32-bit libraries on amd64 sometimes pulling in the wrong cpufunc.h giving an error now that we stop on errors. It will also enable an easier transition to lua boot. Sponsored by: Netflix
This commit is contained in:
parent
253d60eecc
commit
05f37f4d86
@ -41,6 +41,12 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a
|
||||
.endif
|
||||
|
||||
# Standard options:
|
||||
CFLAGS+= -nostdinc
|
||||
.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1
|
||||
CFLAGS+= -I${BOOTOBJ}/libsa32
|
||||
.else
|
||||
CFLAGS+= -I${BOOTOBJ}/libsa
|
||||
.endif
|
||||
CFLAGS+= -I${SASRC} -D_STANDALONE
|
||||
CFLAGS+= -I${SYSDIR}
|
||||
|
||||
|
@ -91,6 +91,7 @@ SRCS+= libsa_bzlib_private.h
|
||||
.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
|
||||
SRCS+= _${file}
|
||||
CLEANFILES+= _${file}
|
||||
CFLAGS._${file}+=-I${SRCTOP}/contrib/bzip2
|
||||
|
||||
_${file}: ${file}
|
||||
sed "s|bzlib_private\.h|libsa_bzlib_private.h|" \
|
||||
@ -129,6 +130,26 @@ libsa_${file}: ${file}
|
||||
${.ALLSRC} > ${.TARGET}
|
||||
.endfor
|
||||
|
||||
# Create a subset of includes that are safe, as well as adjusting those that aren't
|
||||
# The lists may drive people nuts, but they are explicitly opt-in
|
||||
beforedepend:
|
||||
echo beforedepend; \
|
||||
mkdir -p xlocale arpa; \
|
||||
for i in a.out.h assert.h elf.h limits.h nlist.h setjmp.h stddef.h stdbool.h string.h strings.h time.h unistd.h uuid.h; do \
|
||||
ln -sf ${SRCTOP}/include/$$i $$i; \
|
||||
done; \
|
||||
ln -sf ${SYSDIR}/${MACHINE}/include/stdarg.h stdarg.h; \
|
||||
ln -sf ${SYSDIR}/sys/errno.h errno.h; \
|
||||
ln -sf ${SYSDIR}/sys/stdint.h stdint.h; \
|
||||
ln -sf ${SRCTOP}/include/arpa/inet.h arpa/inet.h; \
|
||||
ln -sf ${SRCTOP}/include/arpa/tftp.h arpa/tftp.h; \
|
||||
for i in _time.h _strings.h _string.h; do \
|
||||
[ -f xlocale/$$i ] || cp /dev/null xlocale/$$i; \
|
||||
done; \
|
||||
for i in ctype.h stdio.h stdlib.h; do \
|
||||
ln -sf ${SASRC}/stand.h $$i; \
|
||||
done
|
||||
|
||||
# io routines
|
||||
SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
|
||||
fstat.c close.c lseek.c open.c read.c write.c readdir.c
|
||||
@ -148,6 +169,8 @@ SRCS+= pkgfs.c
|
||||
SRCS+= nandfs.c
|
||||
.endif
|
||||
|
||||
CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2
|
||||
|
||||
# explicit_bzero
|
||||
.PATH: ${SYSDIR}/libkern
|
||||
SRCS+= explicit_bzero.c
|
||||
|
Loading…
Reference in New Issue
Block a user