waf: make executable runnable (#388010)

Changed files
+12 -5
doc
pkgs
by-name
+1 -1
doc/hooks/waf.section.md
···
Location of the `waf` tool. It defaults to `./waf`, to honor software projects that include it directly inside their source trees.
-
If `wafPath` doesn't exist, then `wafHook` will copy the `waf` provided from Nixpkgs to it.
#### `wafFlags` {#waf-flags}
···
Location of the `waf` tool. It defaults to `./waf`, to honor software projects that include it directly inside their source trees.
+
If the file pointed by `wafPath` doesn't exist, then `waf` provided by Nixpkgs will be used.
#### `wafFlags` {#waf-flags}
+10 -2
pkgs/by-name/wa/waf/package.nix
···
, callPackage
, ensureNewerSourcesForZipFilesHook
, python3
# optional list of extra waf tools, e.g. `[ "doxygen" "pytest" ]`
, extraTools ? []
}:
···
nativeBuildInputs = [
ensureNewerSourcesForZipFilesHook
python3
];
buildInputs = [
···
runHook preBuild
python waf-light build ${extraToolsList}
runHook postBuild
'';
···
installPhase = ''
runHook preInstall
-
install -D waf $out/bin/waf
-
runHook postInstall
'';
···
, callPackage
, ensureNewerSourcesForZipFilesHook
, python3
+
, makeWrapper
# optional list of extra waf tools, e.g. `[ "doxygen" "pytest" ]`
, extraTools ? []
}:
···
nativeBuildInputs = [
ensureNewerSourcesForZipFilesHook
python3
+
makeWrapper
];
buildInputs = [
···
runHook preBuild
python waf-light build ${extraToolsList}
+
+
substituteInPlace waf \
+
--replace "w = test(i + '/lib/' + dirname)" \
+
"w = test('$out/${python3.sitePackages}')"
runHook postBuild
'';
···
installPhase = ''
runHook preInstall
+
install -D waf "$out"/bin/waf
+
wrapProgram "$out"/bin/waf --set PYTHONPATH "$out"/${python3.sitePackages}
+
mkdir -p "$out"/${python3.sitePackages}/
+
cp -r waflib "$out"/${python3.sitePackages}/
runHook postInstall
'';
+1 -2
pkgs/by-name/wa/waf/setup-hook.sh
···
runHook preConfigure
if ! [ -f "${wafPath:=./waf}" ]; then
-
echo "copying waf to $wafPath..."
-
cp @waf@/bin/waf "$wafPath"
fi
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then
···
runHook preConfigure
if ! [ -f "${wafPath:=./waf}" ]; then
+
wafPath="@waf@/bin/waf"
fi
if [ -z "${dontAddPrefix:-}" ] && [ -n "$prefix" ]; then