about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/chicken
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/chicken')
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix9
-rw-r--r--nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh2
2 files changed, 9 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix b/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix
index f33e594b7e25..29cf5b115b30 100644
--- a/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/chicken.nix
@@ -20,6 +20,13 @@ stdenv.mkDerivation {
     sha256 = "0hvckhi5gfny3mlva6d7y9pmx7cbwvq0r7mk11k3sdiik9hlkmdd";
   };
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    # There is not enough space in the load command to accomodate a full path to the store,
+    # so use `@executable_path` to specify a relative path to chicken’s lib folder.
+    sed -e '/POSTINSTALL_PROGRAM_FLAGS = /{s|$(LIBDIR)|@executable_path/../lib|}' \
+      -i Makefile.macosx
+  '';
+
   setupHook = lib.optional (bootstrap-chicken != null) ./setup-hook.sh;
 
   # -fno-strict-overflow is not a supported argument in clang on darwin
@@ -31,7 +38,7 @@ stdenv.mkDerivation {
   ] ++ (lib.optionals stdenv.isDarwin [
     "XCODE_TOOL_PATH=${darwin.binutils.bintools}/bin"
     "C_COMPILER=$(CC)"
-    "POSTINSTALL_PROGRAM=install_name_tool"
+    "POSTINSTALL_PROGRAM=${stdenv.cc.targetPrefix}install_name_tool"
   ]);
 
   # We need a bootstrap-chicken to regenerate the c-files after
diff --git a/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh
index cb56eabc5d78..78535382a7ca 100644
--- a/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh
+++ b/nixpkgs/pkgs/development/compilers/chicken/4/fetchegg/builder.sh
@@ -1,4 +1,4 @@
-if [ -e .attrs.sh ]; then source .attrs.sh; fi
+if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
 source $stdenv/setup
 
 echo "exporting egg ${eggName} (version $version) into $out"