mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 12:23:55 +00:00
6149d31915
This allows the cross compilation of chicken in, at least, the following ways: ```sh nix-build -A pkgsCross.aarch64-multiplatform.chicken ``` and ```sh nix-build -A pkgsCross.raspberryPi.chicken ``` Building with clang on x86_64-linux has also been repaired. Additionally, instead of reimplementing a version tester in the `installCheckPhase`, this test has been pulled out into its own tester attribute. While two broken tests needed to be disabled, the functionality of static building is not broken. Only the tests themselves seem not to be able to handle the specification of absolute compiler paths.
57 lines
1.5 KiB
Nix
57 lines
1.5 KiB
Nix
{ callPackage, lib, stdenv, chicken, makeWrapper }:
|
|
{ name, src
|
|
, buildInputs ? []
|
|
, chickenInstallFlags ? []
|
|
, cscOptions ? []
|
|
, ...} @ args:
|
|
|
|
let
|
|
overrides = callPackage ./overrides.nix { };
|
|
baseName = lib.getName name;
|
|
override = if builtins.hasAttr baseName overrides
|
|
then
|
|
builtins.getAttr baseName overrides
|
|
else
|
|
lib.id;
|
|
in
|
|
(stdenv.mkDerivation ({
|
|
name = "chicken-${name}";
|
|
propagatedBuildInputs = buildInputs;
|
|
nativeBuildInputs = [ chicken makeWrapper ];
|
|
buildInputs = [ chicken ];
|
|
|
|
strictDeps = true;
|
|
|
|
CSC_OPTIONS = lib.concatStringsSep " " cscOptions;
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
chicken-install -cached -no-install -host ${lib.escapeShellArgs chickenInstallFlags}
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
export CHICKEN_INSTALL_PREFIX=$out
|
|
export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion}
|
|
chicken-install -cached -host ${lib.escapeShellArgs chickenInstallFlags}
|
|
|
|
for f in $out/bin/*
|
|
do
|
|
wrapProgram $f \
|
|
--prefix CHICKEN_REPOSITORY_PATH : "$out/lib/chicken/${toString chicken.binaryVersion}:$CHICKEN_REPOSITORY_PATH" \
|
|
--prefix CHICKEN_INCLUDE_PATH : "$CHICKEN_INCLUDE_PATH:$out/share" \
|
|
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_PATH"
|
|
done
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
dontConfigure = true;
|
|
|
|
meta = {
|
|
inherit (chicken.meta) platforms;
|
|
} // args.meta or {};
|
|
} // builtins.removeAttrs args ["name" "buildInputs" "meta"]) ).overrideAttrs override
|