Merge pull request #245420 from nagy/chicken-cross

chicken: enable cross-compilation

authored by

Nick Cao and committed by
GitHub
a9d910dd 798c88ed

+30 -25
+25 -22
pkgs/development/compilers/chicken/5/chicken.nix
··· 1 - { lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null }: 2 3 let 4 platform = with stdenv; ··· 8 else if isSunOS then "solaris" 9 else "linux"; # Should be a sane default 10 in 11 - stdenv.mkDerivation rec { 12 pname = "chicken"; 13 version = "5.3.0"; 14 15 binaryVersion = 11; 16 17 src = fetchurl { 18 - url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz"; 19 sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY="; 20 }; 21 22 setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh; 23 24 - # -fno-strict-overflow is not a supported argument in clang on darwin 25 - hardeningDisable = lib.optionals stdenv.isDarwin ["strictoverflow"]; 26 27 makeFlags = [ 28 - "PLATFORM=${platform}" "PREFIX=$(out)" 29 ] ++ (lib.optionals stdenv.isDarwin [ 30 "XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin" 31 - "C_COMPILER=$(CC)" 32 - "CXX_COMPILER=$(CXX)" 33 "LINKER_OPTIONS=-headerpad_max_install_names" 34 "POSTINSTALL_PROGRAM=install_name_tool" 35 ]); 36 37 nativeBuildInputs = [ ··· 44 bootstrap-chicken 45 ]; 46 47 - postInstall = '' 48 - for f in $out/bin/* 49 - do 50 - wrapProgram $f \ 51 - --prefix PATH : ${lib.makeBinPath [ stdenv.cc ]} 52 - done 53 - ''; 54 - 55 doCheck = !stdenv.isDarwin; 56 postCheck = '' 57 ./csi -R chicken.pathname -R chicken.platform \ 58 - -p "(assert (equal? \"${toString binaryVersion}\" (pathname-file (car (repository-path)))))" 59 ''; 60 61 - doInstallCheck = true; 62 - installCheckPhase = '' 63 - $out/bin/chicken -version 64 - ''; 65 66 meta = { 67 homepage = "https://call-cc.org/"; ··· 77 Windows, and many Unix flavours. 78 ''; 79 }; 80 - }
··· 1 + { lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null, testers }: 2 3 let 4 platform = with stdenv; ··· 8 else if isSunOS then "solaris" 9 else "linux"; # Should be a sane default 10 in 11 + stdenv.mkDerivation (finalAttrs: { 12 pname = "chicken"; 13 version = "5.3.0"; 14 15 binaryVersion = 11; 16 17 src = fetchurl { 18 + url = "https://code.call-cc.org/releases/${finalAttrs.version}/chicken-${finalAttrs.version}.tar.gz"; 19 sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY="; 20 }; 21 + 22 + # Disable two broken tests: "static link" and "linking tests" 23 + postPatch = '' 24 + sed -i tests/runtests.sh -e "/static link/,+4 { s/^/# / }" 25 + sed -i tests/runtests.sh -e "/linking tests/,+11 { s/^/# / }" 26 + ''; 27 28 setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh; 29 30 + # -fno-strict-overflow is not a supported argument in clang 31 + hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ]; 32 33 makeFlags = [ 34 + "PLATFORM=${platform}" 35 + "PREFIX=$(out)" 36 + "C_COMPILER=$(CC)" 37 + "CXX_COMPILER=$(CXX)" 38 + "TARGET_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" 39 + "TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++" 40 ] ++ (lib.optionals stdenv.isDarwin [ 41 "XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin" 42 "LINKER_OPTIONS=-headerpad_max_install_names" 43 "POSTINSTALL_PROGRAM=install_name_tool" 44 + ]) ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 45 + "HOSTSYSTEM=${stdenv.hostPlatform.config}" 46 ]); 47 48 nativeBuildInputs = [ ··· 55 bootstrap-chicken 56 ]; 57 58 doCheck = !stdenv.isDarwin; 59 postCheck = '' 60 ./csi -R chicken.pathname -R chicken.platform \ 61 + -p "(assert (equal? \"${toString finalAttrs.binaryVersion}\" (pathname-file (car (repository-path)))))" 62 ''; 63 64 + passthru.tests.version = testers.testVersion { 65 + package = finalAttrs.finalPackage; 66 + command = "csi -version"; 67 + }; 68 69 meta = { 70 homepage = "https://call-cc.org/"; ··· 80 Windows, and many Unix flavours. 81 ''; 82 }; 83 + })
+5 -3
pkgs/development/compilers/chicken/5/eggDerivation.nix
··· 17 (stdenv.mkDerivation ({ 18 name = "chicken-${name}"; 19 propagatedBuildInputs = buildInputs; 20 - nativeBuildInputs = [ makeWrapper ]; 21 buildInputs = [ chicken ]; 22 23 CSC_OPTIONS = lib.concatStringsSep " " cscOptions; 24 25 buildPhase = '' 26 runHook preBuild 27 - chicken-install -cached -no-install ${lib.escapeShellArgs chickenInstallFlags} 28 runHook postBuild 29 ''; 30 ··· 33 34 export CHICKEN_INSTALL_PREFIX=$out 35 export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion} 36 - chicken-install -cached ${lib.escapeShellArgs chickenInstallFlags} 37 38 for f in $out/bin/* 39 do
··· 17 (stdenv.mkDerivation ({ 18 name = "chicken-${name}"; 19 propagatedBuildInputs = buildInputs; 20 + nativeBuildInputs = [ chicken makeWrapper ]; 21 buildInputs = [ chicken ]; 22 + 23 + strictDeps = true; 24 25 CSC_OPTIONS = lib.concatStringsSep " " cscOptions; 26 27 buildPhase = '' 28 runHook preBuild 29 + chicken-install -cached -no-install -host ${lib.escapeShellArgs chickenInstallFlags} 30 runHook postBuild 31 ''; 32 ··· 35 36 export CHICKEN_INSTALL_PREFIX=$out 37 export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion} 38 + chicken-install -cached -host ${lib.escapeShellArgs chickenInstallFlags} 39 40 for f in $out/bin/* 41 do