diff --git a/pkgs/build-support/setup-hooks/make-symlinks-relative.sh b/pkgs/build-support/setup-hooks/make-symlinks-relative.sh index cd9c2eaa2d80..f34353a7617b 100644 --- a/pkgs/build-support/setup-hooks/make-symlinks-relative.sh +++ b/pkgs/build-support/setup-hooks/make-symlinks-relative.sh @@ -6,8 +6,8 @@ postFixupHooks+=(_makeSymlinksRelative) _makeSymlinksRelative() { local symlinkTarget - if [ -n "${dontRewriteSymlinks-}" ]; then - return 0 + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then + return fi while IFS= read -r -d $'\0' f; do diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index 104b5515b3db..f5e3bdced699 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -36,7 +36,7 @@ _doStrip() { local -n ranlibCmd="${ranlibCmds[$i]}" # `dontStrip` disables them all - if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null + if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null 1>&2 then continue; fi stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S}" diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index b07420bb4185..d37fc029cfed 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1253,7 +1253,7 @@ buildPhase() { runHook preBuild if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then - echo "no Makefile, doing nothing" + echo "no Makefile or custom buildPhase, doing nothing" else foundMakefile=1 @@ -1323,6 +1323,15 @@ checkPhase() { installPhase() { runHook preInstall + # Dont reuse 'foundMakefile' set in buildPhase, a makefile may have been created in buildPhase + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom installPhase, doing nothing" + runHook postInstall + return + else + foundMakefile=1 + fi + if [ -n "$prefix" ]; then mkdir -p "$prefix" fi