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