about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2019-03-28 18:30:07 +0100
committerSymphorien Gibol <symphorien+git@xlumurb.eu>2019-03-28 18:32:29 +0100
commitf075de5c258ee9adfb300c8aee07125948b6f03d (patch)
treec605a9a8857d23fde77252696924a8d9f4fd1688
parent07b42ccf2de451342982b550657636d891c4ba35 (diff)
wafHook: let derivations use an existing waf in a non-standard location
this is necessary for talloc
-rw-r--r--doc/stdenv.xml6
-rw-r--r--pkgs/development/tools/build-managers/waf/setup-hook.sh11
2 files changed, 9 insertions, 8 deletions
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index a3990dec052fd..4a5c1ba7423ac 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -2751,9 +2751,9 @@ addEnvHooks "$hostOffset" myBashFunction
      <listitem>
       <para>
        Overrides the configure, build, and install phases. This will run the
-       "waf" script used by many projects. If waf doesn’t exist, it will copy
-       the version of waf available in Nixpkgs wafFlags can be used to pass
-       flags to the waf script.
+       "waf" script used by many projects. If wafPath (default ./waf) doesn’t
+       exist, it will copy the version of waf available in Nixpkgs. wafFlags can
+       be used to pass flags to the waf script.
       </para>
      </listitem>
     </varlistentry>
diff --git a/pkgs/development/tools/build-managers/waf/setup-hook.sh b/pkgs/development/tools/build-managers/waf/setup-hook.sh
index b8a448df8ef8d..c1ff160982a09 100644
--- a/pkgs/development/tools/build-managers/waf/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/waf/setup-hook.sh
@@ -1,8 +1,9 @@
 wafConfigurePhase() {
     runHook preConfigure
 
-    if ! [ -f ./waf ]; then
-        cp @waf@ waf
+    if ! [ -f "${wafPath:=./waf}" ]; then
+        echo "copying waf to $wafPath..."
+        cp @waf@ "$wafPath"
     fi
 
     if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
@@ -14,7 +15,7 @@ wafConfigurePhase() {
         ${configureTargets:-configure}
     )
     echoCmd 'configure flags' "${flagsArray[@]}"
-    python waf "${flagsArray[@]}"
+    python "$wafPath" "${flagsArray[@]}"
 
     runHook postConfigure
 }
@@ -33,7 +34,7 @@ wafBuildPhase () {
     )
 
     echoCmd 'build flags' "${flagsArray[@]}"
-    python waf "${flagsArray[@]}"
+    python "$wafPath" "${flagsArray[@]}"
 
     runHook postBuild
 }
@@ -52,7 +53,7 @@ wafInstallPhase() {
     )
 
     echoCmd 'install flags' "${flagsArray[@]}"
-    python waf "${flagsArray[@]}"
+    python "$wafPath" "${flagsArray[@]}"
 
     runHook postInstall
 }