From 1ebff73b8865606ff4bc14e372e07d22a260d819 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Wed, 30 Dec 2015 11:11:33 +0100 Subject: stdenv/setup.sh: don't skip post-hooks (close #12032) So far if no configure script is found or no makefile, the rest of the phase is skipped, *including* post-hooks. I find that behavior unexpected/unintuitive. Earlier version of this patch had problems due to me assuming that $configureScript is always a simple path, but that turned out to be false in many cases, e.g. perl. --- pkgs/stdenv/generic/setup.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'pkgs/stdenv/generic/setup.sh') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index a01af7db70a3..4693974a2b77 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -612,12 +612,8 @@ fixLibtool() { configurePhase() { runHook preConfigure - if [ -z "$configureScript" ]; then + if [ -z "$configureScript" -a -x ./configure ]; then configureScript=./configure - if ! [ -x $configureScript ]; then - echo "no configure script, doing nothing" - return - fi fi if [ -z "$dontFixLibtool" ]; then @@ -645,8 +641,12 @@ configurePhase() { fi fi - echo "configure flags: $configureFlags ${configureFlagsArray[@]}" - $configureScript $configureFlags "${configureFlagsArray[@]}" + if [ -n "$configureScript" ]; then + echo "configure flags: $configureFlags ${configureFlagsArray[@]}" + $configureScript $configureFlags "${configureFlagsArray[@]}" + else + echo "no configure script, doing nothing" + fi runHook postConfigure } @@ -657,17 +657,16 @@ buildPhase() { if [ -z "$makeFlags" ] && ! [ -n "$makefile" -o -e "Makefile" -o -e "makefile" -o -e "GNUmakefile" ]; then echo "no Makefile, doing nothing" - return - fi - - # See https://github.com/NixOS/nixpkgs/pull/1354#issuecomment-31260409 - makeFlags="SHELL=$SHELL $makeFlags" + else + # See https://github.com/NixOS/nixpkgs/pull/1354#issuecomment-31260409 + makeFlags="SHELL=$SHELL $makeFlags" - echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}" - make ${makefile:+-f $makefile} \ - ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \ - $makeFlags "${makeFlagsArray[@]}" \ - $buildFlags "${buildFlagsArray[@]}" + echo "make flags: $makeFlags ${makeFlagsArray[@]} $buildFlags ${buildFlagsArray[@]}" + make ${makefile:+-f $makefile} \ + ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} \ + $makeFlags "${makeFlagsArray[@]}" \ + $buildFlags "${buildFlagsArray[@]}" + fi runHook postBuild } -- cgit 1.4.1 From f31fbadac38df98932df1f4c69b696aed3b6b5d9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 3 Dec 2015 11:49:32 +0100 Subject: Set a fallback default value for SOURCE_DATE_EPOCH This is used by some build tools to provide reproducible builds. See https://reproducible-builds.org/specs/source-date-epoch/ for more info. Later, we'll want to set this to a more intelligent value (such as the most recent mtime of any source file). --- pkgs/stdenv/generic/setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkgs/stdenv/generic/setup.sh') diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 4693974a2b77..d8de9ab2390b 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -184,6 +184,14 @@ installBin() { # Initialisation. +# Set a fallback default value for SOURCE_DATE_EPOCH, used by some +# build tools to provide a deterministic substitute for the "current" +# time. Note that 1 = 1970-01-01 00:00:01. We don't use 0 because it +# confuses some applications. +export SOURCE_DATE_EPOCH +: ${SOURCE_DATE_EPOCH:=1} + + # Wildcard expansions that don't match should expand to an empty list. # This ensures that, for instance, "for i in *; do ...; done" does the # right thing. -- cgit 1.4.1