From a4834a3e849ab47dff83e4e6a29281eb4e87919f Mon Sep 17 00:00:00 2001 From: Moritz Ulrich Date: Thu, 9 Oct 2014 11:13:29 +0200 Subject: [PATCH] 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. --- .../development/compilers/chicken/default.nix | 24 ++++++++++++++++++- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/chicken/default.nix b/pkgs/development/compilers/chicken/default.nix index 8fd99973cbc..9e2fbc368fc 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 c29ca8a0470..33b9b86e841 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 {};