Merge pull request #187412 from lourkeur/cosmopolitan

cosmopolitan: unstable-2022-03-22 -> 2.0.1
This commit is contained in:
tomberek
2022-09-17 11:33:54 -04:00
committed by GitHub
5 changed files with 33 additions and 26 deletions
@@ -6,10 +6,6 @@ stdenv.mkDerivation rec {
src = cosmopolitan.dist;
patches = [
./ioctl.patch # required /dev/tty
];
nativeBuildInputs = [ bintools-unwrapped unzip ];
# slashes are significant because upstream uses o/$(MODE)/foo.o
@@ -1,12 +0,0 @@
diff --git a/third_party/python/python.mk b/third_party/python/python.mk
index f18c15060..b17455bca 100644
--- a/third_party/python/python.mk
+++ b/third_party/python/python.mk
@@ -1818,7 +1818,6 @@ THIRD_PARTY_PYTHON_PYTEST_PYMAINS = \
third_party/python/Lib/test/test_int_literal.py \
third_party/python/Lib/test/test_bisect.py \
third_party/python/Lib/test/test_pyexpat.py \
- third_party/python/Lib/test/test_ioctl.py \
third_party/python/Lib/test/test_getopt.py \
third_party/python/Lib/test/test_sort.py \
third_party/python/Lib/test/test_slice.py \
@@ -1,16 +1,21 @@
{ lib, stdenv, fetchFromGitHub, unzip, bintools-unwrapped }:
{ lib, stdenv, fetchFromGitHub, unzip, bintools-unwrapped, coreutils, substituteAll }:
stdenv.mkDerivation rec {
pname = "cosmopolitan";
version = "unstable-2022-03-22";
version = "2.0.1";
src = fetchFromGitHub {
owner = "jart";
repo = "cosmopolitan";
rev = "5022f9e9207ff2b79ddd6de6d792d3280e12fb3a";
sha256 = "sha256-UjL4wR5HhuXiQXg6Orcx2fKiVGRPMJk15P779BP1fRA=";
repo = pname;
rev = version;
sha256 = "sha256-EPye7IRMmYHF7XYdDaJdA8alCLiF7MOkU/fVAzZA794=";
};
patches = [
# make sure tests set PATH correctly
(substituteAll { src = ./fix-paths.patch; inherit coreutils; })
];
nativeBuildInputs = [ bintools-unwrapped unzip ];
outputs = [ "out" "dist" ];
@@ -24,11 +29,16 @@ stdenv.mkDerivation rec {
dontConfigure = true;
dontFixup = true;
preCheck = ''
# some syscall tests fail because we're in a sandbox
rm test/libc/calls/sched_setscheduler_test.c
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{include,lib}
install o/cosmopolitan.h $out/include
install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} $out/lib
install o/cosmopolitan.a o/libc/crt/crt.o o/ape/ape.{o,lds} o/ape/ape-no-modify-self.o $out/lib
cp -RT . "$dist"
runHook postInstall
@@ -0,0 +1,12 @@
--- a/test/tool/plinko/plinko_test.c
+++ b/test/tool/plinko/plinko_test.c
@@ -91,8 +91,8 @@ TEST(plinko, worksOrPrintsNiceError) {
sigaction(SIGQUIT, &savequit, 0);
sigaction(SIGPIPE, &savepipe, 0);
sigprocmask(SIG_SETMASK, &savemask, 0);
execve("bin/plinko.com", (char *const[]){"bin/plinko.com", 0},
- (char *const[]){0});
+ (char *const[]){"PATH=@coreutils@/bin", 0});
_exit(127);
}
close(pfds[0][0]);
+5 -4
View File
@@ -8,18 +8,19 @@ stdenv.mkDerivation {
dontUnpack = true;
dontBuild = true;
# compiler arguments based on upstream README.md
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cat <<EOF >$out/bin/cosmoc
#!${stdenv.shell}
exec ${stdenv.cc}/bin/${stdenv.cc.targetPrefix}gcc \
-O -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
-Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
-fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs \
"\$@" \
-Wl,--gc-sections -Wl,-z,max-page-size=0x1000 \
-fuse-ld=bfd -Wl,-T,${cosmopolitan}/lib/ape.lds \
-fuse-ld=bfd -Wl,-T,${cosmopolitan}/lib/ape.lds -Wl,--gc-sections \
-include ${cosmopolitan}/include/cosmopolitan.h \
${cosmopolitan}/lib/{crt.o,ape.o,cosmopolitan.a}
${cosmopolitan}/lib/{crt.o,ape-no-modify-self.o,cosmopolitan.a}
EOF
chmod +x $out/bin/cosmoc
runHook postInstall