about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2014-10-09 11:13:29 +0200
committerMoritz Ulrich <moritz@tarn-vedra.de>2014-10-13 23:29:26 +0200
commita4834a3e849ab47dff83e4e6a29281eb4e87919f (patch)
tree0f85b2a436eff9ed6fb51d0a398a71f9bacf23b7
parente17781f8b1a10e40f4ec110e01610c8afaae4c38 (diff)
downloadnixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar.gz
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar.bz2
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar.lz
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar.xz
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.tar.zst
nixlib-a4834a3e849ab47dff83e4e6a29281eb4e87919f.zip
chicken: Implement support for bootstrap-builds
This is necessary in order to apply custom patches, as chicken needs a
bootstrap build to regenerate *.c files. This is also necessary when
building from git.
-rw-r--r--pkgs/development/compilers/chicken/default.nix24
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 26 insertions, 2 deletions
diff --git a/pkgs/development/compilers/chicken/default.nix b/pkgs/development/compilers/chicken/default.nix
index 8fd99973cbc1..9e2fbc368fcb 100644
--- a/pkgs/development/compilers/chicken/default.nix
+++ b/pkgs/development/compilers/chicken/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, bootstrap-chicken ? null }:
 
 let
   version = "4.9.0.1";
@@ -20,6 +20,28 @@ stdenv.mkDerivation {
   buildFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib";
   installFlags = "PLATFORM=${platform} PREFIX=$(out) VARDIR=$(out)/var/lib";
 
+  # We need a bootstrap-chicken to regenerate the c-files after
+  # applying a patch to add support for CHICKEN_REPOSITORY_EXTRA
+  patches = stdenv.lib.ifEnable (bootstrap-chicken != null) [
+    ./0001-Introduce-CHICKEN_REPOSITORY_EXTRA.patch
+  ];
+
+  buildInputs = stdenv.lib.ifEnable (bootstrap-chicken != null) [
+    bootstrap-chicken
+  ];
+
+  preBuild = stdenv.lib.ifEnable (bootstrap-chicken != null) ''
+    # Backup the build* files - those are generated from hostname,
+    # git-tag, etc. and we don't need/want that
+    mkdir -p build-backup
+    mv buildid buildbranch buildtag.h build-backup
+
+    # Regenerate eval.c after the patch
+    make spotless $buildFlags
+
+    mv build-backup/* .
+  '';
+
   meta = {
     homepage = http://www.call-cc.org/;
     license = "BSD";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c29ca8a04701..33b9b86e8414 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2791,7 +2791,9 @@ let
 
   bigloo = callPackage ../development/compilers/bigloo { };
 
-  chicken = callPackage ../development/compilers/chicken { };
+  chicken = callPackage ../development/compilers/chicken {
+    bootstrap-chicken = chicken.override { bootstrap-chicken = null; }; 
+  };
 
   ccl = builderDefsPackage ../development/compilers/ccl {};