From 314b03125f348a2970b86dcf77d9dc8039c7a981 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 6 Jan 2023 01:48:11 +0200 Subject: [PATCH 1/3] stdenv: don't fail installPhase on missing makefile otherwise the build just fails with 'make: *** No rule to make target 'install'. Stop.' and update buildPhase message i don't know if the 'makefile may have been created in buildPhase' is true but i guess it might be possible --- pkgs/stdenv/generic/setup.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 From ba11c6f123afdf19681de27b433ae25b0f2b95f1 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 6 Jan 2023 02:35:37 +0200 Subject: [PATCH 2/3] setup-hooks/make-symlinks-relative.sh: match what other hooks do so the hook doesn't output the following if $prefix doesn't exist find: '/nix/store/...': No such file or directory some other hooks that do this: prune-libtool-files.sh, audit-tmpdir.sh separate-debug-info.sh --- pkgs/build-support/setup-hooks/make-symlinks-relative.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 033ec059603d268663c1fc0394f3268478033331 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 6 Jan 2023 18:57:11 +0200 Subject: [PATCH 3/3] setup-hooks/strip.sh: redirect stdout to dev/null to not unnecessarily print ``` hello> ++ type -f strip hello> strip is /nix/store/xzqzq99kbbkad23s2bf4bbrjppg6x0vj-bootstrap-stage2-gcc-wrapper-/bin/strip ``` printing what the strip command is is already done in stripDirs `echo "stripping (with command $cmd and flags $stripFlags) in $paths"` --- pkgs/build-support/setup-hooks/strip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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}"