Now that we offer a semi-sane standards-ish set of #include files in

the stand environment that's safe to use (and insulated from whatever
build env you might normally have), stop hacking the bzlib and zlib
sources with sed. There's no longer any need.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-12-05 21:38:24 +00:00
parent 05f37f4d86
commit 09d8a81a0c

@ -86,49 +86,14 @@ SRCS+= _setjmp.S
# loader(8) with LOADER_BZIP2_SUPPORT defined # loader(8) with LOADER_BZIP2_SUPPORT defined
.PATH: ${SRCTOP}/contrib/bzip2 .PATH: ${SRCTOP}/contrib/bzip2
CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
SRCS+= libsa_bzlib_private.h
.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c SRCS+=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|" \
${.ALLSRC} > ${.TARGET}
.endfor
CLEANFILES+= libsa_bzlib_private.h
libsa_bzlib_private.h: bzlib_private.h
sed -e 's|<stdlib.h>|"stand.h"|' \
${.ALLSRC} > ${.TARGET}
# decompression functionality from zlib # decompression functionality from zlib
.PATH: ${SRCTOP}/contrib/zlib .PATH: ${SRCTOP}/contrib/zlib
CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib
SRCS+= adler32.c crc32.c libsa_zutil.h libsa_gzguts.h SRCS+= adler32.c crc32.c
SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c
.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
SRCS+= _${file}
CLEANFILES+= _${file}
_${file}: ${file}
sed -e "s|zutil\.h|libsa_zutil.h|" \
-e "s|gzguts\.h|libsa_gzguts.h|" \
${.ALLSRC} > ${.TARGET}
.endfor
# depend on stand.h being able to be included multiple times
.for file in zutil.h gzguts.h
CLEANFILES+= libsa_${file}
libsa_${file}: ${file}
sed -e 's|<fcntl.h>|"stand.h"|' \
-e 's|<stddef.h>|"stand.h"|' \
-e 's|<string.h>|"stand.h"|' \
-e 's|<stdio.h>|"stand.h"|' \
-e 's|<stdlib.h>|"stand.h"|' \
${.ALLSRC} > ${.TARGET}
.endfor
# Create a subset of includes that are safe, as well as adjusting those that aren't # 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 # The lists may drive people nuts, but they are explicitly opt-in
@ -146,7 +111,7 @@ beforedepend:
for i in _time.h _strings.h _string.h; do \ for i in _time.h _strings.h _string.h; do \
[ -f xlocale/$$i ] || cp /dev/null xlocale/$$i; \ [ -f xlocale/$$i ] || cp /dev/null xlocale/$$i; \
done; \ done; \
for i in ctype.h stdio.h stdlib.h; do \ for i in ctype.h fcntl.h stdio.h stdlib.h; do \
ln -sf ${SASRC}/stand.h $$i; \ ln -sf ${SASRC}/stand.h $$i; \
done done