Merge pull request #245420 from nagy/chicken-cross
chicken: enable cross-compilation
This commit is contained in:
commit
a9d910ddda
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null }:
|
||||
{ lib, stdenv, fetchurl, makeWrapper, darwin, bootstrap-chicken ? null, testers }:
|
||||
|
||||
let
|
||||
platform = with stdenv;
|
||||
|
@ -8,30 +8,41 @@ let
|
|||
else if isSunOS then "solaris"
|
||||
else "linux"; # Should be a sane default
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "chicken";
|
||||
version = "5.3.0";
|
||||
|
||||
binaryVersion = 11;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://code.call-cc.org/releases/${version}/chicken-${version}.tar.gz";
|
||||
url = "https://code.call-cc.org/releases/${finalAttrs.version}/chicken-${finalAttrs.version}.tar.gz";
|
||||
sha256 = "sha256-w62Z2PnhftgQkS75gaw7DC4vRvsOzAM7XDttyhvbDXY=";
|
||||
};
|
||||
|
||||
# Disable two broken tests: "static link" and "linking tests"
|
||||
postPatch = ''
|
||||
sed -i tests/runtests.sh -e "/static link/,+4 { s/^/# / }"
|
||||
sed -i tests/runtests.sh -e "/linking tests/,+11 { s/^/# / }"
|
||||
'';
|
||||
|
||||
setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh;
|
||||
|
||||
# -fno-strict-overflow is not a supported argument in clang on darwin
|
||||
hardeningDisable = lib.optionals stdenv.isDarwin ["strictoverflow"];
|
||||
# -fno-strict-overflow is not a supported argument in clang
|
||||
hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ];
|
||||
|
||||
makeFlags = [
|
||||
"PLATFORM=${platform}" "PREFIX=$(out)"
|
||||
] ++ (lib.optionals stdenv.isDarwin [
|
||||
"XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
|
||||
"PLATFORM=${platform}"
|
||||
"PREFIX=$(out)"
|
||||
"C_COMPILER=$(CC)"
|
||||
"CXX_COMPILER=$(CXX)"
|
||||
"TARGET_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
|
||||
"TARGET_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
|
||||
] ++ (lib.optionals stdenv.isDarwin [
|
||||
"XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
|
||||
"LINKER_OPTIONS=-headerpad_max_install_names"
|
||||
"POSTINSTALL_PROGRAM=install_name_tool"
|
||||
]) ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"HOSTSYSTEM=${stdenv.hostPlatform.config}"
|
||||
]);
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -44,24 +55,16 @@ stdenv.mkDerivation rec {
|
|||
bootstrap-chicken
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
for f in $out/bin/*
|
||||
do
|
||||
wrapProgram $f \
|
||||
--prefix PATH : ${lib.makeBinPath [ stdenv.cc ]}
|
||||
done
|
||||
'';
|
||||
|
||||
doCheck = !stdenv.isDarwin;
|
||||
postCheck = ''
|
||||
./csi -R chicken.pathname -R chicken.platform \
|
||||
-p "(assert (equal? \"${toString binaryVersion}\" (pathname-file (car (repository-path)))))"
|
||||
-p "(assert (equal? \"${toString finalAttrs.binaryVersion}\" (pathname-file (car (repository-path)))))"
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/chicken -version
|
||||
'';
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
command = "csi -version";
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://call-cc.org/";
|
||||
|
@ -77,4 +80,4 @@ stdenv.mkDerivation rec {
|
|||
Windows, and many Unix flavours.
|
||||
'';
|
||||
};
|
||||
}
|
||||
})
|
||||
|
|
|
@ -17,14 +17,16 @@ in
|
|||
(stdenv.mkDerivation ({
|
||||
name = "chicken-${name}";
|
||||
propagatedBuildInputs = buildInputs;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
nativeBuildInputs = [ chicken makeWrapper ];
|
||||
buildInputs = [ chicken ];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
CSC_OPTIONS = lib.concatStringsSep " " cscOptions;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
chicken-install -cached -no-install ${lib.escapeShellArgs chickenInstallFlags}
|
||||
chicken-install -cached -no-install -host ${lib.escapeShellArgs chickenInstallFlags}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
|
@ -33,7 +35,7 @@ in
|
|||
|
||||
export CHICKEN_INSTALL_PREFIX=$out
|
||||
export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion}
|
||||
chicken-install -cached ${lib.escapeShellArgs chickenInstallFlags}
|
||||
chicken-install -cached -host ${lib.escapeShellArgs chickenInstallFlags}
|
||||
|
||||
for f in $out/bin/*
|
||||
do
|
||||
|
|
Loading…
Reference in a new issue