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