cosmopolitan: don't extend include path

The intended idiom according to upstream is to have no `#includes` for
the libc. This works because the combined header `cosmopolitan.h` has
always been on the command line.
This commit is contained in:
Louis Bettens 2022-03-29 10:40:40 +02:00
parent e801b166e5
commit 3a08f8d91c

View file

@ -38,7 +38,6 @@ stdenv.mkDerivation rec {
-Wl,--gc-sections -Wl,-z,max-page-size=0x1000 \
-fuse-ld=bfd -Wl,-T,$out/lib/ape.lds \
-include $out/include/cosmopolitan.h \
-I $out/include \
$out/lib/{crt.o,ape.o,cosmopolitan.a}
EOF
chmod +x $out/bin/cosmoc
@ -53,18 +52,17 @@ stdenv.mkDerivation rec {
passthru.tests = lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform) {
hello = runCommand "hello-world" { } ''
printf '#include "libc/stdio/stdio.h"\nmain() { printf("hello world\\n"); }\n' >hello.c
printf 'main() { printf("hello world\\n"); }\n' >hello.c
${stdenv.cc}/bin/gcc -g -O -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone -o hello.com.dbg hello.c \
-fuse-ld=bfd -Wl,-T,${cosmopolitan}/lib/ape.lds \
-include ${cosmopolitan}/include/cosmopolitan.h \
-I ${cosmopolitan}/include \
${cosmopolitan}/lib/{crt.o,ape.o,cosmopolitan.a}
${stdenv.cc.bintools.bintools_bin}/bin/objcopy -S -O binary hello.com.dbg hello.com
./hello.com
printf "test successful" > $out
'';
cosmoc = runCommand "cosmoc-hello" { } ''
printf '#include "libc/stdio/stdio.h"\nmain() { printf("hello world\\n"); }\n' >hello.c
printf 'main() { printf("hello world\\n"); }\n' >hello.c
${cosmopolitan}/bin/cosmoc hello.c
./a.out
printf "test successful" > $out