From 3a08f8d91c5c3f81fadc3a8a2ff8361e0966d27b Mon Sep 17 00:00:00 2001 From: Louis Bettens Date: Tue, 29 Mar 2022 10:40:40 +0200 Subject: [PATCH] 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. --- pkgs/development/libraries/cosmopolitan/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/cosmopolitan/default.nix b/pkgs/development/libraries/cosmopolitan/default.nix index ca303fdeaea3..16a14875d9c8 100644 --- a/pkgs/development/libraries/cosmopolitan/default.nix +++ b/pkgs/development/libraries/cosmopolitan/default.nix @@ -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