From 1ebff73b8865606ff4bc14e372e07d22a260d819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 30 Dec 2015 11:11:33 +0100 Subject: [PATCH] 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(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index a01af7db70a..4693974a2b7 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,18 +657,17 @@ buildPhase() { if [ -z "$makeFlags" ] && ! [ -n "$makefile" -o -e "Makefile" -o -e "makefile" -o -e "GNUmakefile" ]; then echo "no Makefile, doing nothing" - return + 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[@]}" fi - # 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[@]}" - runHook postBuild }