Merge pull request #72347 from NixOS/bash-no-undef-vars
treewide: `set -u` everywhere
This commit is contained in:
commit
acd2d19484
@ -125,6 +125,13 @@
|
|||||||
<link linkend="opt-networking.interfaces">networking.interfaces.<name>.…</link> options.
|
<link linkend="opt-networking.interfaces">networking.interfaces.<name>.…</link> options.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The stdenv now runs all bash with <literal>set -u</literal>, to catch the use of undefined variables.
|
||||||
|
Before, it itself used <literal>set -u</literal> but was careful to unset it so other packages' code ran as before.
|
||||||
|
Now, all bash code is held to the same high standard, and the rather complex stateful manipulation of the options can be discarded.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -111,17 +111,13 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
installPhase =
|
installPhase =
|
||||||
''
|
''
|
||||||
set -u
|
|
||||||
|
|
||||||
mkdir -p $out/bin $out/nix-support
|
mkdir -p $out/bin $out/nix-support
|
||||||
|
|
||||||
wrap() {
|
wrap() {
|
||||||
local dst="$1"
|
local dst="$1"
|
||||||
local wrapper="$2"
|
local wrapper="$2"
|
||||||
export prog="$3"
|
export prog="$3"
|
||||||
set +u
|
|
||||||
substituteAll "$wrapper" "$out/bin/$dst"
|
substituteAll "$wrapper" "$out/bin/$dst"
|
||||||
set -u
|
|
||||||
chmod +x "$out/bin/$dst"
|
chmod +x "$out/bin/$dst"
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
@ -163,8 +159,6 @@ stdenv.mkDerivation {
|
|||||||
[[ -e "$underlying" ]] || continue
|
[[ -e "$underlying" ]] || continue
|
||||||
wrap ${targetPrefix}$variant ${./ld-wrapper.sh} $underlying
|
wrap ${targetPrefix}$variant ${./ld-wrapper.sh} $underlying
|
||||||
done
|
done
|
||||||
|
|
||||||
set +u
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
emulation = let
|
emulation = let
|
||||||
@ -307,7 +301,6 @@ stdenv.mkDerivation {
|
|||||||
''
|
''
|
||||||
|
|
||||||
+ ''
|
+ ''
|
||||||
set +u
|
|
||||||
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
||||||
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
|
||||||
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
||||||
|
@ -29,9 +29,9 @@ attrsOrig @
|
|||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
[ -z "$dontPlacateNuget" ] && placate-nuget.sh
|
[ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
|
||||||
[ -z "$dontPlacatePaket" ] && placate-paket.sh
|
[ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
|
||||||
[ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh
|
[ -z "''${dontPatchFSharpTargets-}" ] && patch-fsharp-targets.sh
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
@ -69,7 +69,7 @@ attrsOrig @
|
|||||||
|
|
||||||
cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"
|
cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"
|
||||||
|
|
||||||
if [ -z "$dontRemoveDuplicatedDlls" ]
|
if [ -z "''${dontRemoveDuplicatedDlls-}" ]
|
||||||
then
|
then
|
||||||
pushd "$out"
|
pushd "$out"
|
||||||
remove-duplicated-dlls.sh
|
remove-duplicated-dlls.sh
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# the moment that would produce too many spurious errors (e.g. debug
|
# the moment that would produce too many spurious errors (e.g. debug
|
||||||
# info or assertion messages that refer to $TMPDIR).
|
# info or assertion messages that refer to $TMPDIR).
|
||||||
|
|
||||||
fixupOutputHooks+=('if [ -z "$noAuditTmpdir" -a -e "$prefix" ]; then auditTmpdir "$prefix"; fi')
|
fixupOutputHooks+=('if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi')
|
||||||
|
|
||||||
auditTmpdir() {
|
auditTmpdir() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
@ -228,7 +228,7 @@ autoPatchelf() {
|
|||||||
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in
|
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in
|
||||||
# fixupOutput and the postFixup hook runs later.
|
# fixupOutput and the postFixup hook runs later.
|
||||||
postFixupHooks+=('
|
postFixupHooks+=('
|
||||||
if [ -z "$dontAutoPatchelf" ]; then
|
if [ -z "${dontAutoPatchelf-}" ]; then
|
||||||
autoPatchelf -- $(for output in $outputs; do
|
autoPatchelf -- $(for output in $outputs; do
|
||||||
[ -e "${!output}" ] || continue
|
[ -e "${!output}" ] || continue
|
||||||
echo "${!output}"
|
echo "${!output}"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; fi')
|
fixupOutputHooks+=('if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi')
|
||||||
|
|
||||||
compressManPages() {
|
compressManPages() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
@ -11,12 +11,12 @@ addXMLCatalogs () {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$libxmlHookDone" ]; then
|
if [ -z "${libxmlHookDone-}" ]; then
|
||||||
libxmlHookDone=1
|
libxmlHookDone=1
|
||||||
|
|
||||||
# Set up XML_CATALOG_FILES. An empty initial value prevents
|
# Set up XML_CATALOG_FILES. An empty initial value prevents
|
||||||
# xmllint and xsltproc from looking in /etc/xml/catalog.
|
# xmllint and xsltproc from looking in /etc/xml/catalog.
|
||||||
export XML_CATALOG_FILES
|
export XML_CATALOG_FILES=''
|
||||||
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
|
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
|
||||||
addEnvHooks "$hostOffset" addXMLCatalogs
|
addEnvHooks "$hostOffset" addXMLCatalogs
|
||||||
fi
|
fi
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
fixupOutputHooks+=(_moveLib64)
|
fixupOutputHooks+=(_moveLib64)
|
||||||
|
|
||||||
_moveLib64() {
|
_moveLib64() {
|
||||||
if [ "$dontMoveLib64" = 1 ]; then return; fi
|
if [ "${dontMoveLib64-}" = 1 ]; then return; fi
|
||||||
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
|
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
|
||||||
echo "moving $prefix/lib64/* to $prefix/lib"
|
echo "moving $prefix/lib64/* to $prefix/lib"
|
||||||
mkdir -p $prefix/lib
|
mkdir -p $prefix/lib
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
fixupOutputHooks+=(_moveSbin)
|
fixupOutputHooks+=(_moveSbin)
|
||||||
|
|
||||||
_moveSbin() {
|
_moveSbin() {
|
||||||
if [ "$dontMoveSbin" = 1 ]; then return; fi
|
if [ "${dontMoveSbin-}" = 1 ]; then return; fi
|
||||||
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
|
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
|
||||||
echo "moving $prefix/sbin/* to $prefix/bin"
|
echo "moving $prefix/sbin/* to $prefix/bin"
|
||||||
mkdir -p $prefix/bin
|
mkdir -p $prefix/bin
|
||||||
|
@ -9,8 +9,8 @@ _assignFirst() {
|
|||||||
local varName="$1"
|
local varName="$1"
|
||||||
local REMOVE=REMOVE # slightly hacky - we allow REMOVE (i.e. not a variable name)
|
local REMOVE=REMOVE # slightly hacky - we allow REMOVE (i.e. not a variable name)
|
||||||
shift
|
shift
|
||||||
while [ $# -ge 1 ]; do
|
while (( $# )); do
|
||||||
if [ -n "${!1}" ]; then eval "${varName}"="$1"; return; fi
|
if [ -n "${!1-}" ]; then eval "${varName}"="$1"; return; fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
echo "Error: _assignFirst found no valid variant!"
|
echo "Error: _assignFirst found no valid variant!"
|
||||||
@ -19,7 +19,7 @@ _assignFirst() {
|
|||||||
|
|
||||||
# Same as _assignFirst, but only if "$1" = ""
|
# Same as _assignFirst, but only if "$1" = ""
|
||||||
_overrideFirst() {
|
_overrideFirst() {
|
||||||
if [ -z "${!1}" ]; then
|
if [ -z "${!1-}" ]; then
|
||||||
_assignFirst "$@"
|
_assignFirst "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ patchShebangs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patchShebangsAuto () {
|
patchShebangsAuto () {
|
||||||
if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then
|
if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then
|
||||||
|
|
||||||
# Dev output will end up being run on the build platform. An
|
# Dev output will end up being run on the build platform. An
|
||||||
# example case of this is sdl2-config. Otherwise, we can just
|
# example case of this is sdl2-config. Otherwise, we can just
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
fixupOutputHooks+=(_pruneLibtoolFiles)
|
fixupOutputHooks+=(_pruneLibtoolFiles)
|
||||||
|
|
||||||
_pruneLibtoolFiles() {
|
_pruneLibtoolFiles() {
|
||||||
if [ "$dontPruneLibtoolFiles" ] || [ ! -e "$prefix" ]; then
|
if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ _doStrip() {
|
|||||||
local -ra stripCmds=(STRIP TARGET_STRIP)
|
local -ra stripCmds=(STRIP TARGET_STRIP)
|
||||||
|
|
||||||
# Optimization
|
# Optimization
|
||||||
if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
|
if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then
|
||||||
dontStripTarget+=1
|
dontStripTarget+=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ _doStrip() {
|
|||||||
local -n stripCmd="${stripCmds[$i]}"
|
local -n stripCmd="${stripCmds[$i]}"
|
||||||
|
|
||||||
# `dontStrip` disables them all
|
# `dontStrip` disables them all
|
||||||
if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
|
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
|
||||||
then continue; fi
|
then continue; fi
|
||||||
|
|
||||||
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
|
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
|
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
|
||||||
|
|
||||||
updateAutotoolsGnuConfigScriptsPhase() {
|
updateAutotoolsGnuConfigScriptsPhase() {
|
||||||
if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi
|
if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi
|
||||||
|
|
||||||
for script in config.sub config.guess; do
|
for script in config.sub config.guess; do
|
||||||
for f in $(find . -type f -name "$script"); do
|
for f in $(find . -type f -name "$script"); do
|
||||||
|
@ -15,7 +15,7 @@ wrapGApp() {
|
|||||||
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
|
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set.
|
# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
|
||||||
wrapGAppsHook() {
|
wrapGAppsHook() {
|
||||||
# guard against running multiple times (e.g. due to propagation)
|
# guard against running multiple times (e.g. due to propagation)
|
||||||
[ -z "$wrapGAppsHookHasRun" ] || return 0
|
[ -z "$wrapGAppsHookHasRun" ] || return 0
|
||||||
|
@ -37,7 +37,7 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ let result = stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> "$out/nix-support/setup-hook"
|
cat <<EOF >> "$out/nix-support/setup-hook"
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ in rec {
|
|||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat <<EOF > $out/nix-support/setup-hook
|
cat <<EOF > $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
postFixup = openjdk.postFixup or null;
|
postFixup = openjdk.postFixup or null;
|
||||||
|
@ -72,7 +72,7 @@ let
|
|||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat <<EOF > $out/nix-support/setup-hook
|
cat <<EOF > $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ let
|
|||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat <<EOF > $out/nix-support/setup-hook
|
cat <<EOF > $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ let
|
|||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat <<EOF > $out/nix-support/setup-hook
|
cat <<EOF > $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ let
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ let
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ let
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ let
|
|||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
cat <<EOF > $out/nix-support/setup-hook
|
cat <<EOF > $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ let result = stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Fix 'failed to open: /homeless-shelter/.cargo/.package-cache' in rust 1.36.
|
# Fix 'failed to open: /homeless-shelter/.cargo/.package-cache' in rust 1.36.
|
||||||
if [[ -z $IN_NIX_SHELL && -z $CARGO_HOME ]]; then
|
if [[ -z ${IN_NIX_SHELL-} && -z ${CARGO_HOME-} ]]; then
|
||||||
export CARGO_HOME=$TMPDIR
|
export CARGO_HOME=$TMPDIR
|
||||||
fi
|
fi
|
||||||
|
@ -58,7 +58,7 @@ in stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ in stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Set JAVA_HOME automatically.
|
# Set JAVA_HOME automatically.
|
||||||
cat <<EOF >> $out/nix-support/setup-hook
|
cat <<EOF >> $out/nix-support/setup-hook
|
||||||
if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ flitBuildPhase () {
|
|||||||
echo "Finished executing flitBuildPhase"
|
echo "Finished executing flitBuildPhase"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseFlitBuild" ] && [ -z "$buildPhase" ]; then
|
if [ -z "${dontUseFlitBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||||
echo "Using flitBuildPhase"
|
echo "Using flitBuildPhase"
|
||||||
buildPhase=flitBuildPhase
|
buildPhase=flitBuildPhase
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +31,7 @@ pipShellHook() {
|
|||||||
echo "Finished executing pipShellHook"
|
echo "Finished executing pipShellHook"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePipBuild" ] && [ -z "$buildPhase" ]; then
|
if [ -z "${dontUsePipBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||||
echo "Using pipBuildPhase"
|
echo "Using pipBuildPhase"
|
||||||
buildPhase=pipBuildPhase
|
buildPhase=pipBuildPhase
|
||||||
fi
|
fi
|
||||||
|
@ -18,7 +18,7 @@ pipInstallPhase() {
|
|||||||
echo "Finished executing pipInstallPhase"
|
echo "Finished executing pipInstallPhase"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePipInstall" ] && [ -z "$installPhase" ]; then
|
if [ -z "${dontUsePipInstall-}" ] && [ -z "${installPhase-}" ]; then
|
||||||
echo "Using pipInstallPhase"
|
echo "Using pipInstallPhase"
|
||||||
installPhase=pipInstallPhase
|
installPhase=pipInstallPhase
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +43,7 @@ function pytestCheckPhase() {
|
|||||||
echo "Finished executing pytestCheckPhase"
|
echo "Finished executing pytestCheckPhase"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePytestCheck" ] && [ -z "$installCheckPhase" ]; then
|
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||||
echo "Using pytestCheckPhase"
|
echo "Using pytestCheckPhase"
|
||||||
preDistPhases+=" pytestCheckPhase"
|
preDistPhases+=" pytestCheckPhase"
|
||||||
fi
|
fi
|
||||||
|
@ -5,6 +5,6 @@ pythonCatchConflictsPhase() {
|
|||||||
@pythonInterpreter@ @catchConflicts@
|
@pythonInterpreter@ @catchConflicts@
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePythonCatchConflicts" ]; then
|
if [ -z "${dontUsePythonCatchConflicts-}" ]; then
|
||||||
preDistPhases+=" pythonCatchConflictsPhase"
|
preDistPhases+=" pythonCatchConflictsPhase"
|
||||||
fi
|
fi
|
||||||
|
@ -10,7 +10,7 @@ pythonImportsCheckPhase () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePythonImportsCheck" ]; then
|
if [ -z "${dontUsePythonImportsCheck-}" ]; then
|
||||||
echo "Using pythonImportsCheckPhase"
|
echo "Using pythonImportsCheckPhase"
|
||||||
preDistPhases+=" pythonImportsCheckPhase"
|
preDistPhases+=" pythonImportsCheckPhase"
|
||||||
fi
|
fi
|
||||||
|
@ -12,6 +12,6 @@ pythonRemoveBinBytecodePhase () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUsePythonRemoveBinBytecode" ]; then
|
if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then
|
||||||
preDistPhases+=" pythonRemoveBinBytecodePhase"
|
preDistPhases+=" pythonRemoveBinBytecodePhase"
|
||||||
fi
|
fi
|
||||||
|
@ -36,12 +36,12 @@ setuptoolsShellHook() {
|
|||||||
echo "Finished executing setuptoolsShellHook"
|
echo "Finished executing setuptoolsShellHook"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseSetuptoolsBuild" ] && [ -z "$buildPhase" ]; then
|
if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "${buildPhase-}" ]; then
|
||||||
echo "Using setuptoolsBuildPhase"
|
echo "Using setuptoolsBuildPhase"
|
||||||
buildPhase=setuptoolsBuildPhase
|
buildPhase=setuptoolsBuildPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$dontUseSetuptoolsShellHook" ] && [ -z "$shellHook" ]; then
|
if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "${shellHook-}" ]; then
|
||||||
echo "Using setuptoolsShellHook"
|
echo "Using setuptoolsShellHook"
|
||||||
shellHook=setuptoolsShellHook
|
shellHook=setuptoolsShellHook
|
||||||
fi
|
fi
|
||||||
|
@ -12,7 +12,7 @@ setuptoolsCheckPhase() {
|
|||||||
echo "Finished executing setuptoolsCheckPhase"
|
echo "Finished executing setuptoolsCheckPhase"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseSetuptoolsCheck" ] && [ -z "$installCheckPhase" ]; then
|
if [ -z "${dontUseSetuptoolsCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
||||||
echo "Using setuptoolsCheckPhase"
|
echo "Using setuptoolsCheckPhase"
|
||||||
preDistPhases+=" setuptoolsCheckPhase"
|
preDistPhases+=" setuptoolsCheckPhase"
|
||||||
fi
|
fi
|
||||||
|
@ -12,7 +12,7 @@ wheelUnpackPhase(){
|
|||||||
echo "Finished executing wheelUnpackPhase"
|
echo "Finished executing wheelUnpackPhase"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseWheelUnpack" ] && [ -z "$unpackPhase" ]; then
|
if [ -z "${dontUseWheelUnpack-}" ] && [ -z "${unpackPhase-}" ]; then
|
||||||
echo "Using wheelUnpackPhase"
|
echo "Using wheelUnpackPhase"
|
||||||
unpackPhase=wheelUnpackPhase
|
unpackPhase=wheelUnpackPhase
|
||||||
fi
|
fi
|
||||||
|
@ -10,7 +10,7 @@ addEnvHooks "$hostOffset" gettextDataDirsHook
|
|||||||
|
|
||||||
# libintl must be listed in load flags on non-Glibc
|
# libintl must be listed in load flags on non-Glibc
|
||||||
# it doesn't hurt to have it in Glibc either though
|
# it doesn't hurt to have it in Glibc either though
|
||||||
if [ -n "@gettextNeedsLdflags@" -a -z "$dontAddExtraLibs" ]; then
|
if [ -n "@gettextNeedsLdflags@" -a -z "${dontAddExtraLibs-}" ]; then
|
||||||
# See pkgs/build-support/setup-hooks/role.bash
|
# See pkgs/build-support/setup-hooks/role.bash
|
||||||
getHostRole
|
getHostRole
|
||||||
export NIX_${role_pre}LDFLAGS+=" -lintl"
|
export NIX_${role_pre}LDFLAGS+=" -lintl"
|
||||||
|
@ -16,4 +16,4 @@ dropIconThemeCache() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
preFixupPhases="$preFixupPhases dropIconThemeCache"
|
preFixupPhases="${preFixupPhases-} dropIconThemeCache"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# it doesn't hurt to have it in Glibc either though
|
# it doesn't hurt to have it in Glibc either though
|
||||||
|
|
||||||
# See pkgs/build-support/setup-hooks/role.bash
|
# See pkgs/build-support/setup-hooks/role.bash
|
||||||
if [ -z "$dontAddExtraLibs" ]; then
|
if [ -z "${dontAddExtraLibs-}" ]; then
|
||||||
getHostRole
|
getHostRole
|
||||||
export NIX_${role_pre}LDFLAGS+=" -liconv"
|
export NIX_${role_pre}LDFLAGS+=" -liconv"
|
||||||
fi
|
fi
|
||||||
|
@ -31,6 +31,6 @@ qmakeConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
|
if [ -z "${dontUseQmakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
configurePhase=qmakeConfigurePhase
|
configurePhase=qmakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -61,6 +61,6 @@ postPatchMkspecs() {
|
|||||||
fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
|
fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [ -z "$dontPatchMkspecs" ]; then
|
if [ -z "${dontPatchMkspecs-}" ]; then
|
||||||
postPhases="${postPhases}${postPhases:+ }postPatchMkspecs"
|
postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
|
||||||
fi
|
fi
|
||||||
|
@ -64,10 +64,10 @@ qtOwnPathsHook() {
|
|||||||
|
|
||||||
preFixupPhases+=" qtOwnPathsHook"
|
preFixupPhases+=" qtOwnPathsHook"
|
||||||
|
|
||||||
# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set.
|
# Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set.
|
||||||
wrapQtAppsHook() {
|
wrapQtAppsHook() {
|
||||||
# skip this hook when requested
|
# skip this hook when requested
|
||||||
[ -z "$dontWrapQtApps" ] || return 0
|
[ -z "${dontWrapQtApps-}" ] || return 0
|
||||||
|
|
||||||
# guard against running multiple times (e.g. due to propagation)
|
# guard against running multiple times (e.g. due to propagation)
|
||||||
[ -z "$wrapQtAppsHookHasRun" ] || return 0
|
[ -z "$wrapQtAppsHookHasRun" ] || return 0
|
||||||
|
@ -363,7 +363,7 @@ let
|
|||||||
|
|
||||||
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
|
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
|
||||||
|
|
||||||
if [ "$dontNpmInstall" != "1" ]
|
if [ "''${dontNpmInstall-}" != "1" ]
|
||||||
then
|
then
|
||||||
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
|
||||||
rm -f npm-shrinkwrap.json
|
rm -f npm-shrinkwrap.json
|
||||||
|
@ -43,8 +43,8 @@ buildPythonPackage rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
[ -z "$dontPlacateNuget" ] && placate-nuget.sh
|
[ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
|
||||||
[ -z "$dontPlacatePaket" ] && placate-paket.sh
|
[ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -99,7 +99,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
|
|||||||
runHook preUnpack
|
runHook preUnpack
|
||||||
|
|
||||||
if [[ -f $src && $src == *.gem ]]; then
|
if [[ -f $src && $src == *.gem ]]; then
|
||||||
if [[ -z "$dontBuild" ]]; then
|
if [[ -z "''${dontBuild-}" ]]; then
|
||||||
# we won't know the name of the directory that RubyGems creates,
|
# we won't know the name of the directory that RubyGems creates,
|
||||||
# so we'll just use a glob to find it and move it over.
|
# so we'll just use a glob to find it and move it over.
|
||||||
gempkg="$src"
|
gempkg="$src"
|
||||||
|
@ -46,14 +46,14 @@ stdenv.mkDerivation {
|
|||||||
# JRE by looking for java. The latter allows just the JRE to be
|
# JRE by looking for java. The latter allows just the JRE to be
|
||||||
# used with (say) ECJ as the compiler. Finally, allow the GNU
|
# used with (say) ECJ as the compiler. Finally, allow the GNU
|
||||||
# JVM.
|
# JVM.
|
||||||
if [ -z "\$JAVA_HOME" ]; then
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
||||||
for i in javac java gij; do
|
for i in javac java gij; do
|
||||||
if p="\$(type -p \$i)"; then
|
if p="\$(type -p \$i)"; then
|
||||||
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
|
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -z "\$JAVA_HOME" ]; then
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
||||||
echo "\$0: cannot find the JDK or JRE" >&2
|
echo "\$0: cannot find the JDK or JRE" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -46,14 +46,14 @@ stdenv.mkDerivation {
|
|||||||
# JRE by looking for java. The latter allows just the JRE to be
|
# JRE by looking for java. The latter allows just the JRE to be
|
||||||
# used with (say) ECJ as the compiler. Finally, allow the GNU
|
# used with (say) ECJ as the compiler. Finally, allow the GNU
|
||||||
# JVM.
|
# JVM.
|
||||||
if [ -z "\$JAVA_HOME" ]; then
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
||||||
for i in javac java gij; do
|
for i in javac java gij; do
|
||||||
if p="\$(type -p \$i)"; then
|
if p="\$(type -p \$i)"; then
|
||||||
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
|
export JAVA_HOME="\$(${coreutils}/bin/dirname \$(${coreutils}/bin/dirname \$(${coreutils}/bin/readlink -f \$p)))"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -z "\$JAVA_HOME" ]; then
|
if [ -z "\''${JAVA_HOME-}" ]; then
|
||||||
echo "\$0: cannot find the JDK or JRE" >&2
|
echo "\$0: cannot find the JDK or JRE" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -20,17 +20,17 @@ cmakeConfigurePhase() {
|
|||||||
export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES
|
export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$dontFixCmake" ]; then
|
if [ -z "${dontFixCmake-}" ]; then
|
||||||
fixCmakeFiles .
|
fixCmakeFiles .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$dontUseCmakeBuildDir" ]; then
|
if [ -z "${dontUseCmakeBuildDir-}" ]; then
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
cmakeDir=${cmakeDir:-..}
|
cmakeDir=${cmakeDir:-..}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$dontAddPrefix" ]; then
|
if [ -z "${dontAddPrefix-}" ]; then
|
||||||
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ cmakeConfigurePhase() {
|
|||||||
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_LOCALEDIR=${!outputLib}/share/locale $cmakeFlags"
|
||||||
|
|
||||||
# Don’t build tests when doCheck = false
|
# Don’t build tests when doCheck = false
|
||||||
if [ -z "$doCheck" ]; then
|
if [ -z "${doCheck-}" ]; then
|
||||||
cmakeFlags="-DBUILD_TESTING=OFF $cmakeFlags"
|
cmakeFlags="-DBUILD_TESTING=OFF $cmakeFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ cmakeConfigurePhase() {
|
|||||||
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON $cmakeFlags"
|
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON $cmakeFlags"
|
||||||
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON $cmakeFlags"
|
cmakeFlags="-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON $cmakeFlags"
|
||||||
|
|
||||||
if [ "$buildPhase" = ninjaBuildPhase ]; then
|
if [ "${buildPhase-}" = ninjaBuildPhase ]; then
|
||||||
cmakeFlags="-GNinja $cmakeFlags"
|
cmakeFlags="-GNinja $cmakeFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ cmakeConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then
|
if [ -z "${dontUseCmakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
setOutputFlags=
|
setOutputFlags=
|
||||||
configurePhase=cmakeConfigurePhase
|
configurePhase=cmakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -9,6 +9,6 @@ gnConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseGnConfigure" -a -z "$configurePhase" ]; then
|
if [ -z "${dontUseGnConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
configurePhase=gnConfigurePhase
|
configurePhase=gnConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mesonConfigurePhase() {
|
mesonConfigurePhase() {
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
if [ -z "$dontAddPrefix" ]; then
|
if [ -z "${dontAddPrefix-}" ]; then
|
||||||
mesonFlags="--prefix=$prefix $mesonFlags"
|
mesonFlags="--prefix=$prefix $mesonFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ mesonConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseMesonConfigure" -a -z "$configurePhase" ]; then
|
if [ -z "${dontUseMesonConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
setOutputFlags=
|
setOutputFlags=
|
||||||
configurePhase=mesonConfigurePhase
|
configurePhase=mesonConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -19,7 +19,7 @@ ninjaBuildPhase() {
|
|||||||
runHook postBuild
|
runHook postBuild
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseNinjaBuild" -a -z "$buildPhase" ]; then
|
if [ -z "${dontUseNinjaBuild-}" -a -z "${buildPhase-}" ]; then
|
||||||
buildPhase=ninjaBuildPhase
|
buildPhase=ninjaBuildPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ ninjaInstallPhase() {
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseNinjaInstall" -a -z "$installPhase" ]; then
|
if [ -z "${dontUseNinjaInstall-}" -a -z "${installPhase-}" ]; then
|
||||||
installPhase=ninjaInstallPhase
|
installPhase=ninjaInstallPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -73,6 +73,6 @@ ninjaCheckPhase() {
|
|||||||
runHook postCheck
|
runHook postCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseNinjaCheck" -a -z "$checkPhase" ]; then
|
if [ -z "${dontUseNinjaCheck-}" -a -z "${checkPhase-}" ]; then
|
||||||
checkPhase=ninjaCheckPhase
|
checkPhase=ninjaCheckPhase
|
||||||
fi
|
fi
|
||||||
|
@ -71,14 +71,14 @@ sconsCheckPhase() {
|
|||||||
runHook postCheck
|
runHook postCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$buildPhase" ]; then
|
if [ -z "${buildPhase-}" ]; then
|
||||||
buildPhase=sconsBuildPhase
|
buildPhase=sconsBuildPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$dontUseSconsInstall" -a -z "$installPhase" ]; then
|
if [ -z "${dontUseSconsInstall-}" -a -z "${installPhase-}" ]; then
|
||||||
installPhase=sconsInstallPhase
|
installPhase=sconsInstallPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$checkPhase" ]; then
|
if [ -z "${checkPhase-}" ]; then
|
||||||
checkPhase=sconsCheckPhase
|
checkPhase=sconsCheckPhase
|
||||||
fi
|
fi
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# directories from the RPATH of every library or executable in every
|
# directories from the RPATH of every library or executable in every
|
||||||
# output.
|
# output.
|
||||||
|
|
||||||
fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
|
fixupOutputHooks+=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi')
|
||||||
|
|
||||||
patchELF() {
|
patchELF() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
@ -14,6 +14,6 @@ premakeConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$configurePhase" ]; then
|
if [ -z "${configurePhase-}" ]; then
|
||||||
configurePhase=premakeConfigurePhase
|
configurePhase=premakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -64,7 +64,7 @@ index 00000000..3ea84e2d
|
|||||||
+header() { echo "$1"; }
|
+header() { echo "$1"; }
|
||||||
+stopNest() { true; }
|
+stopNest() { true; }
|
||||||
+
|
+
|
||||||
+fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
|
+fixupOutputHooks+=('if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
|
||||||
+
|
+
|
||||||
+patchShebangs() {
|
+patchShebangs() {
|
||||||
+ local dir="$1"
|
+ local dir="$1"
|
||||||
|
@ -20,7 +20,7 @@ xcbuildInstallPhase () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildPhase=xcbuildBuildPhase
|
buildPhase=xcbuildBuildPhase
|
||||||
if [ -z "$installPhase" ]; then
|
if [ -z "${installPhase-}" ]; then
|
||||||
installPhase=xcbuildInstallPhase
|
installPhase=xcbuildInstallPhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ let
|
|||||||
'' else "") + (if isModular then ''
|
'' else "") + (if isModular then ''
|
||||||
mkdir -p $dev
|
mkdir -p $dev
|
||||||
cp vmlinux $dev/
|
cp vmlinux $dev/
|
||||||
if [ -z "$dontStrip" ]; then
|
if [ -z "''${dontStrip-}" ]; then
|
||||||
installFlagsArray+=("INSTALL_MOD_STRIP=1")
|
installFlagsArray+=("INSTALL_MOD_STRIP=1")
|
||||||
fi
|
fi
|
||||||
make modules_install $makeFlags "''${makeFlagsArray[@]}" \
|
make modules_install $makeFlags "''${makeFlagsArray[@]}" \
|
||||||
|
@ -14,6 +14,6 @@ imakeConfigurePhase() {
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$dontUseImakeConfigure" -a -z "$configurePhase" ]; then
|
if [ -z "${dontUseImakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||||
configurePhase=imakeConfigurePhase
|
configurePhase=imakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
fixupOutputHooks+=(_cygwinFixAutoImageBase)
|
fixupOutputHooks+=(_cygwinFixAutoImageBase)
|
||||||
|
|
||||||
_cygwinFixAutoImageBase() {
|
_cygwinFixAutoImageBase() {
|
||||||
if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then
|
if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
find "$prefix" -name "*.dll" -type f | while read DLL; do
|
find "$prefix" -name "*.dll" -type f | while read DLL; do
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
fixupOutputHooks+=(_cygwinFixAutoImageBase)
|
fixupOutputHooks+=(_cygwinFixAutoImageBase)
|
||||||
|
|
||||||
_cygwinFixAutoImageBase() {
|
_cygwinFixAutoImageBase() {
|
||||||
if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then
|
if [ "${dontRebase-}" == 1 ] || [ ! -d "$prefix" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
find "$prefix" -name "*.dll" -type f | while read DLL; do
|
find "$prefix" -name "*.dll" -type f | while read DLL; do
|
||||||
|
@ -17,10 +17,6 @@ fi
|
|||||||
# code). The hooks for <hookName> are the shell function or variable
|
# code). The hooks for <hookName> are the shell function or variable
|
||||||
# <hookName>, and the values of the shell array ‘<hookName>Hooks’.
|
# <hookName>, and the values of the shell array ‘<hookName>Hooks’.
|
||||||
runHook() {
|
runHook() {
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set -u # May be called from elsewhere, so do `set -u`.
|
|
||||||
|
|
||||||
local hookName="$1"
|
local hookName="$1"
|
||||||
shift
|
shift
|
||||||
local hooksSlice="${hookName%Hook}Hooks[@]"
|
local hooksSlice="${hookName%Hook}Hooks[@]"
|
||||||
@ -30,10 +26,8 @@ runHook() {
|
|||||||
# undefined.
|
# undefined.
|
||||||
for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; do
|
for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; do
|
||||||
_eval "$hook" "$@"
|
_eval "$hook" "$@"
|
||||||
set -u # To balance `_eval`
|
|
||||||
done
|
done
|
||||||
|
|
||||||
set "$oldOpts"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,10 +35,6 @@ runHook() {
|
|||||||
# Run all hooks with the specified name, until one succeeds (returns a
|
# Run all hooks with the specified name, until one succeeds (returns a
|
||||||
# zero exit code). If none succeed, return a non-zero exit code.
|
# zero exit code). If none succeed, return a non-zero exit code.
|
||||||
runOneHook() {
|
runOneHook() {
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set -u # May be called from elsewhere, so do `set -u`.
|
|
||||||
|
|
||||||
local hookName="$1"
|
local hookName="$1"
|
||||||
shift
|
shift
|
||||||
local hooksSlice="${hookName%Hook}Hooks[@]"
|
local hooksSlice="${hookName%Hook}Hooks[@]"
|
||||||
@ -56,10 +46,8 @@ runOneHook() {
|
|||||||
ret=0
|
ret=0
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
set -u # To balance `_eval`
|
|
||||||
done
|
done
|
||||||
|
|
||||||
set "$oldOpts"
|
|
||||||
return "$ret"
|
return "$ret"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,17 +58,13 @@ runOneHook() {
|
|||||||
# environment variables) and from shell scripts (as functions). If you
|
# environment variables) and from shell scripts (as functions). If you
|
||||||
# want to allow multiple hooks, use runHook instead.
|
# want to allow multiple hooks, use runHook instead.
|
||||||
_callImplicitHook() {
|
_callImplicitHook() {
|
||||||
set -u
|
|
||||||
local def="$1"
|
local def="$1"
|
||||||
local hookName="$2"
|
local hookName="$2"
|
||||||
if declare -F "$hookName" > /dev/null; then
|
if declare -F "$hookName" > /dev/null; then
|
||||||
set +u
|
|
||||||
"$hookName"
|
"$hookName"
|
||||||
elif type -p "$hookName" > /dev/null; then
|
elif type -p "$hookName" > /dev/null; then
|
||||||
set +u
|
|
||||||
source "$hookName"
|
source "$hookName"
|
||||||
elif [ -n "${!hookName:-}" ]; then
|
elif [ -n "${!hookName:-}" ]; then
|
||||||
set +u
|
|
||||||
eval "${!hookName}"
|
eval "${!hookName}"
|
||||||
else
|
else
|
||||||
return "$def"
|
return "$def"
|
||||||
@ -96,13 +80,10 @@ _callImplicitHook() {
|
|||||||
# command can take them
|
# command can take them
|
||||||
_eval() {
|
_eval() {
|
||||||
if declare -F "$1" > /dev/null 2>&1; then
|
if declare -F "$1" > /dev/null 2>&1; then
|
||||||
set +u
|
|
||||||
"$@" # including args
|
"$@" # including args
|
||||||
else
|
else
|
||||||
set +u
|
|
||||||
eval "$1"
|
eval "$1"
|
||||||
fi
|
fi
|
||||||
# `run*Hook` reenables `set -u`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,12 +171,12 @@ addToSearchPath() {
|
|||||||
# so it is defined here but tried after the hook.
|
# so it is defined here but tried after the hook.
|
||||||
_addRpathPrefix() {
|
_addRpathPrefix() {
|
||||||
if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then
|
if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then
|
||||||
export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS"
|
export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"
|
||||||
if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then
|
if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then
|
||||||
export NIX_LDFLAGS="-rpath $1/lib64 $NIX_LDFLAGS"
|
export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}"
|
||||||
fi
|
fi
|
||||||
if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then
|
if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then
|
||||||
export NIX_LDFLAGS="-rpath $1/lib32 $NIX_LDFLAGS"
|
export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -489,11 +470,7 @@ activatePackage() {
|
|||||||
(( "$hostOffset" <= "$targetOffset" )) || exit -1
|
(( "$hostOffset" <= "$targetOffset" )) || exit -1
|
||||||
|
|
||||||
if [ -f "$pkg" ]; then
|
if [ -f "$pkg" ]; then
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set +u
|
|
||||||
source "$pkg"
|
source "$pkg"
|
||||||
set "$oldOpts"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only dependencies whose host platform is guaranteed to match the
|
# Only dependencies whose host platform is guaranteed to match the
|
||||||
@ -512,11 +489,7 @@ activatePackage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$pkg/nix-support/setup-hook" ]]; then
|
if [[ -f "$pkg/nix-support/setup-hook" ]]; then
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set +u
|
|
||||||
source "$pkg/nix-support/setup-hook"
|
source "$pkg/nix-support/setup-hook"
|
||||||
set "$oldOpts"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1264,19 +1237,11 @@ showPhaseHeader() {
|
|||||||
|
|
||||||
genericBuild() {
|
genericBuild() {
|
||||||
if [ -f "${buildCommandPath:-}" ]; then
|
if [ -f "${buildCommandPath:-}" ]; then
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set +u
|
|
||||||
source "$buildCommandPath"
|
source "$buildCommandPath"
|
||||||
set "$oldOpts"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -n "${buildCommand:-}" ]; then
|
if [ -n "${buildCommand:-}" ]; then
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set +u
|
|
||||||
eval "$buildCommand"
|
eval "$buildCommand"
|
||||||
set "$oldOpts"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1306,11 +1271,7 @@ genericBuild() {
|
|||||||
|
|
||||||
# Evaluate the variable named $curPhase if it exists, otherwise the
|
# Evaluate the variable named $curPhase if it exists, otherwise the
|
||||||
# function named $curPhase.
|
# function named $curPhase.
|
||||||
local oldOpts="-u"
|
|
||||||
shopt -qo nounset || oldOpts="+u"
|
|
||||||
set +u
|
|
||||||
eval "${!curPhase:-$curPhase}"
|
eval "${!curPhase:-$curPhase}"
|
||||||
set "$oldOpts"
|
|
||||||
|
|
||||||
if [ "$curPhase" = unpackPhase ]; then
|
if [ "$curPhase" = unpackPhase ]; then
|
||||||
cd "${sourceRoot:-.}"
|
cd "${sourceRoot:-.}"
|
||||||
|
@ -3,4 +3,4 @@ mimeinfoPreFixupPhase() {
|
|||||||
rm -f $out/share/applications/mimeinfo.cache
|
rm -f $out/share/applications/mimeinfo.cache
|
||||||
}
|
}
|
||||||
|
|
||||||
preFixupPhases="$preFixupPhases mimeinfoPreFixupPhase"
|
preFixupPhases="${preFixupPhases-} mimeinfoPreFixupPhase"
|
||||||
|
Loading…
Reference in New Issue
Block a user