abstract-synthesizer 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.nix_shell_env.sh ADDED
@@ -0,0 +1,2134 @@
1
+ unset shellHook
2
+ PATH=${PATH:-}
3
+ nix_saved_PATH="$PATH"
4
+ XDG_DATA_DIRS=${XDG_DATA_DIRS:-}
5
+ nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS"
6
+ AR='ar'
7
+ export AR
8
+ AS='as'
9
+ export AS
10
+ BASH='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash'
11
+ CC='gcc'
12
+ export CC
13
+ CONFIG_SHELL='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash'
14
+ export CONFIG_SHELL
15
+ CXX='g++'
16
+ export CXX
17
+ HOSTTYPE='x86_64'
18
+ HOST_PATH='/nix/store/2lvq4hvwz6agf1ynak8pjnlnv44fi940-abstract-synthesizer/bin:/nix/store/c1bq963y8v93fbbl6fyvas5j7wf8w3nz-abstract-synthesizer-ruby/bin:/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7/bin:/nix/store/c14zwgl8hf1wm0izij2i16xvk8ak70cy-findutils-4.10.0/bin:/nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12/bin:/nix/store/pr318zsl44jdwpk9wk0sdrn19b6in7ah-gnused-4.9/bin:/nix/store/bc6zxzjnkjp4r9nhz5imy3cypvdh6r4n-gnugrep-3.12/bin:/nix/store/nv3y7zb1cwz1h9qy7nwz0s54j8dl1kqj-gawk-5.3.2/bin:/nix/store/lp82dcnrzljyix6yigwzrlpr1smvpmb0-gnutar-1.35/bin:/nix/store/6ag5dhk7sma61p6vl0kazfmpbrq08nqh-gzip-1.14/bin:/nix/store/ykdv4id6893gmkqwdmbimq237c1xqvq7-bzip2-1.0.8-bin/bin:/nix/store/6bwp1y45zlyvpr4ja2sk1yi9v5mrs94x-gnumake-4.4.1/bin:/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin:/nix/store/c9xmgszbf6i4dfq9r953khk9d7fdqigw-patch-2.8/bin:/nix/store/ikfwx7kbwz9zr7fziiac7f57jgbh3bnv-xz-5.8.1-bin/bin:/nix/store/3pdmbqy86wsbjdazxv1n3vrmj60vn0ri-file-5.45/bin'
19
+ export HOST_PATH
20
+ IFS='
21
+ '
22
+ IN_NIX_SHELL='impure'
23
+ export IN_NIX_SHELL
24
+ LD='ld'
25
+ export LD
26
+ LINENO='76'
27
+ MACHTYPE='x86_64-pc-linux-gnu'
28
+ NIX_BINTOOLS='/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44'
29
+ export NIX_BINTOOLS
30
+ NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1'
31
+ export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
32
+ NIX_BUILD_CORES='16'
33
+ export NIX_BUILD_CORES
34
+ NIX_CC='/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0'
35
+ export NIX_CC
36
+ NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1'
37
+ export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
38
+ NIX_CFLAGS_COMPILE=' -frandom-seed=dykn08578l'
39
+ export NIX_CFLAGS_COMPILE
40
+ NIX_ENFORCE_NO_NATIVE='1'
41
+ export NIX_ENFORCE_NO_NATIVE
42
+ NIX_HARDENING_ENABLE='bindnow format fortify fortify3 pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs'
43
+ export NIX_HARDENING_ENABLE
44
+ NIX_LDFLAGS='-rpath /home/luis/code/github/drzln/abstract-synthesizer/outputs/out/lib '
45
+ export NIX_LDFLAGS
46
+ NIX_NO_SELF_RPATH='1'
47
+ NIX_STORE='/nix/store'
48
+ export NIX_STORE
49
+ NM='nm'
50
+ export NM
51
+ OBJCOPY='objcopy'
52
+ export OBJCOPY
53
+ OBJDUMP='objdump'
54
+ export OBJDUMP
55
+ OLDPWD=''
56
+ export OLDPWD
57
+ OPTERR='1'
58
+ OSTYPE='linux-gnu'
59
+ PATH='/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0/bin:/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin:/nix/store/sa7j7cddyblhcb3ch3ds10w7nw75yjj1-gcc-14.3.0/bin:/nix/store/mdmsnfcvxyk5ynz7nx8nhss1wig0gljx-glibc-2.40-66-bin/bin:/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7/bin:/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44/bin:/nix/store/z3za8hfc24wb117s50p8b10agjkgm039-binutils-2.44/bin:/nix/store/2lvq4hvwz6agf1ynak8pjnlnv44fi940-abstract-synthesizer/bin:/nix/store/c1bq963y8v93fbbl6fyvas5j7wf8w3nz-abstract-synthesizer-ruby/bin:/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7/bin:/nix/store/c14zwgl8hf1wm0izij2i16xvk8ak70cy-findutils-4.10.0/bin:/nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12/bin:/nix/store/pr318zsl44jdwpk9wk0sdrn19b6in7ah-gnused-4.9/bin:/nix/store/bc6zxzjnkjp4r9nhz5imy3cypvdh6r4n-gnugrep-3.12/bin:/nix/store/nv3y7zb1cwz1h9qy7nwz0s54j8dl1kqj-gawk-5.3.2/bin:/nix/store/lp82dcnrzljyix6yigwzrlpr1smvpmb0-gnutar-1.35/bin:/nix/store/6ag5dhk7sma61p6vl0kazfmpbrq08nqh-gzip-1.14/bin:/nix/store/ykdv4id6893gmkqwdmbimq237c1xqvq7-bzip2-1.0.8-bin/bin:/nix/store/6bwp1y45zlyvpr4ja2sk1yi9v5mrs94x-gnumake-4.4.1/bin:/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin:/nix/store/c9xmgszbf6i4dfq9r953khk9d7fdqigw-patch-2.8/bin:/nix/store/ikfwx7kbwz9zr7fziiac7f57jgbh3bnv-xz-5.8.1-bin/bin:/nix/store/3pdmbqy86wsbjdazxv1n3vrmj60vn0ri-file-5.45/bin'
60
+ export PATH
61
+ PS4='+ '
62
+ RANLIB='ranlib'
63
+ export RANLIB
64
+ READELF='readelf'
65
+ export READELF
66
+ SHELL='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash'
67
+ export SHELL
68
+ SIZE='size'
69
+ export SIZE
70
+ SOURCE_DATE_EPOCH='315532800'
71
+ export SOURCE_DATE_EPOCH
72
+ STRINGS='strings'
73
+ export STRINGS
74
+ STRIP='strip'
75
+ export STRIP
76
+ XDG_DATA_DIRS='/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0/share'
77
+ export XDG_DATA_DIRS
78
+ __structuredAttrs=''
79
+ export __structuredAttrs
80
+ _substituteStream_has_warned_replace_deprecation='false'
81
+ buildInputs='/nix/store/2lvq4hvwz6agf1ynak8pjnlnv44fi940-abstract-synthesizer /nix/store/c1bq963y8v93fbbl6fyvas5j7wf8w3nz-abstract-synthesizer-ruby'
82
+ export buildInputs
83
+ buildPhase='{ echo "------------------------------------------------------------";
84
+ echo " WARNING: the existence of this path is not guaranteed.";
85
+ echo " It is an internal implementation detail for pkgs.mkShell.";
86
+ echo "------------------------------------------------------------";
87
+ echo;
88
+ # Record all build inputs as runtime dependencies
89
+ export;
90
+ } >> "$out"
91
+ '
92
+ export buildPhase
93
+ builder='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash'
94
+ export builder
95
+ cmakeFlags=''
96
+ export cmakeFlags
97
+ configureFlags=''
98
+ export configureFlags
99
+ defaultBuildInputs=''
100
+ defaultNativeBuildInputs='/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0 /nix/store/063qqmawmq7bg75b56mgynw9s3rbx2ww-update-autotools-gnu-config-scripts-hook /nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh /nix/store/cwvwai4ni9hmzaqvnvf1i5pvjh1hj36c-audit-tmpdir.sh /nix/store/4bawv6x85435v6s624sfk5cdpg9gr6yq-compress-man-pages.sh /nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh /nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh /nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh /nix/store/cq0kx53m7qhq7dvk5s96fazjlqf1bg4j-parallel.sh /nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh /nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh /nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0'
101
+ depsBuildBuild=''
102
+ export depsBuildBuild
103
+ depsBuildBuildPropagated=''
104
+ export depsBuildBuildPropagated
105
+ depsBuildTarget=''
106
+ export depsBuildTarget
107
+ depsBuildTargetPropagated=''
108
+ export depsBuildTargetPropagated
109
+ depsHostHost=''
110
+ export depsHostHost
111
+ depsHostHostPropagated=''
112
+ export depsHostHostPropagated
113
+ depsTargetTarget=''
114
+ export depsTargetTarget
115
+ depsTargetTargetPropagated=''
116
+ export depsTargetTargetPropagated
117
+ doCheck=''
118
+ export doCheck
119
+ doInstallCheck=''
120
+ export doInstallCheck
121
+ dontAddDisableDepTrack='1'
122
+ export dontAddDisableDepTrack
123
+ declare -a envBuildBuildHooks=()
124
+ declare -a envBuildHostHooks=()
125
+ declare -a envBuildTargetHooks=()
126
+ declare -a envHostHostHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' )
127
+ declare -a envHostTargetHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' )
128
+ declare -a envTargetTargetHooks=()
129
+ declare -a fixupOutputHooks=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi' 'if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi' 'if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi' '_moveLib64' '_moveSbin' '_moveSystemdUserUnits' 'patchShebangsAuto' '_pruneLibtoolFiles' '_doStrip' )
130
+ guess='16'
131
+ initialPath='/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7 /nix/store/c14zwgl8hf1wm0izij2i16xvk8ak70cy-findutils-4.10.0 /nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12 /nix/store/pr318zsl44jdwpk9wk0sdrn19b6in7ah-gnused-4.9 /nix/store/bc6zxzjnkjp4r9nhz5imy3cypvdh6r4n-gnugrep-3.12 /nix/store/nv3y7zb1cwz1h9qy7nwz0s54j8dl1kqj-gawk-5.3.2 /nix/store/lp82dcnrzljyix6yigwzrlpr1smvpmb0-gnutar-1.35 /nix/store/6ag5dhk7sma61p6vl0kazfmpbrq08nqh-gzip-1.14 /nix/store/ykdv4id6893gmkqwdmbimq237c1xqvq7-bzip2-1.0.8-bin /nix/store/6bwp1y45zlyvpr4ja2sk1yi9v5mrs94x-gnumake-4.4.1 /nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37 /nix/store/c9xmgszbf6i4dfq9r953khk9d7fdqigw-patch-2.8 /nix/store/ikfwx7kbwz9zr7fziiac7f57jgbh3bnv-xz-5.8.1-bin /nix/store/3pdmbqy86wsbjdazxv1n3vrmj60vn0ri-file-5.45'
132
+ mesonFlags=''
133
+ export mesonFlags
134
+ name='nix-shell-env'
135
+ export name
136
+ nativeBuildInputs=''
137
+ export nativeBuildInputs
138
+ out='/home/luis/code/github/drzln/abstract-synthesizer/outputs/out'
139
+ export out
140
+ outputBin='out'
141
+ outputDev='out'
142
+ outputDevdoc='REMOVE'
143
+ outputDevman='out'
144
+ outputDoc='out'
145
+ outputInclude='out'
146
+ outputInfo='out'
147
+ outputLib='out'
148
+ outputMan='out'
149
+ outputs='out'
150
+ export outputs
151
+ patches=''
152
+ export patches
153
+ phases='buildPhase'
154
+ export phases
155
+ pkg='/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0'
156
+ declare -a pkgsBuildBuild=()
157
+ declare -a pkgsBuildHost=('/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0' '/nix/store/063qqmawmq7bg75b56mgynw9s3rbx2ww-update-autotools-gnu-config-scripts-hook' '/nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh' '/nix/store/cwvwai4ni9hmzaqvnvf1i5pvjh1hj36c-audit-tmpdir.sh' '/nix/store/4bawv6x85435v6s624sfk5cdpg9gr6yq-compress-man-pages.sh' '/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh' '/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh' '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh' '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh' '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh' '/nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh' '/nix/store/cq0kx53m7qhq7dvk5s96fazjlqf1bg4j-parallel.sh' '/nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh' '/nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh' '/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0' '/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44' )
158
+ declare -a pkgsBuildTarget=()
159
+ declare -a pkgsHostHost=()
160
+ declare -a pkgsHostTarget=('/nix/store/2lvq4hvwz6agf1ynak8pjnlnv44fi940-abstract-synthesizer' '/nix/store/c1bq963y8v93fbbl6fyvas5j7wf8w3nz-abstract-synthesizer-ruby' )
161
+ declare -a pkgsTargetTarget=()
162
+ declare -a postFixupHooks=('noBrokenSymlinksInAllOutputs' '_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' )
163
+ declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' )
164
+ declare -a preConfigureHooks=('_multioutConfig' )
165
+ preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase'
166
+ declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' )
167
+ preferLocalBuild='1'
168
+ export preferLocalBuild
169
+ prefix='/home/luis/code/github/drzln/abstract-synthesizer/outputs/out'
170
+ declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' )
171
+ propagatedBuildInputs=''
172
+ export propagatedBuildInputs
173
+ declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' )
174
+ propagatedNativeBuildInputs=''
175
+ export propagatedNativeBuildInputs
176
+ declare -a propagatedTargetDepFiles=('propagated-target-target-deps' )
177
+ shell='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash'
178
+ export shell
179
+ shellHook=''
180
+ export shellHook
181
+ stdenv='/nix/store/nlqc1vm5psq2jjr5df6z25gkxkfqbvxx-stdenv-linux'
182
+ export stdenv
183
+ strictDeps=''
184
+ export strictDeps
185
+ system='x86_64-linux'
186
+ export system
187
+ declare -a unpackCmdHooks=('_defaultUnpack' )
188
+ _activatePkgs ()
189
+ {
190
+
191
+ local hostOffset targetOffset;
192
+ local pkg;
193
+ for hostOffset in "${allPlatOffsets[@]}";
194
+ do
195
+ local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}";
196
+ for targetOffset in "${allPlatOffsets[@]}";
197
+ do
198
+ (( hostOffset <= targetOffset )) || continue;
199
+ local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]";
200
+ local pkgsSlice="${!pkgsRef}[@]";
201
+ for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
202
+ do
203
+ activatePackage "$pkg" "$hostOffset" "$targetOffset";
204
+ done;
205
+ done;
206
+ done
207
+ }
208
+ _addRpathPrefix ()
209
+ {
210
+
211
+ if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then
212
+ export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}";
213
+ fi
214
+ }
215
+ _addToEnv ()
216
+ {
217
+
218
+ local depHostOffset depTargetOffset;
219
+ local pkg;
220
+ for depHostOffset in "${allPlatOffsets[@]}";
221
+ do
222
+ local hookVar="${pkgHookVarVars[depHostOffset + 1]}";
223
+ local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}";
224
+ for depTargetOffset in "${allPlatOffsets[@]}";
225
+ do
226
+ (( depHostOffset <= depTargetOffset )) || continue;
227
+ local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]";
228
+ if [[ -z "${strictDeps-}" ]]; then
229
+ local visitedPkgs="";
230
+ for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}";
231
+ do
232
+ if [[ "$visitedPkgs" = *"$pkg"* ]]; then
233
+ continue;
234
+ fi;
235
+ runHook "${!hookRef}" "$pkg";
236
+ visitedPkgs+=" $pkg";
237
+ done;
238
+ else
239
+ local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]";
240
+ local pkgsSlice="${!pkgsRef}[@]";
241
+ for pkg in ${!pkgsSlice+"${!pkgsSlice}"};
242
+ do
243
+ runHook "${!hookRef}" "$pkg";
244
+ done;
245
+ fi;
246
+ done;
247
+ done
248
+ }
249
+ _allFlags ()
250
+ {
251
+
252
+ export system pname name version;
253
+ while IFS='' read -r varName; do
254
+ nixTalkativeLog "@${varName}@ -> ${!varName}";
255
+ args+=("--subst-var" "$varName");
256
+ done < <(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }')
257
+ }
258
+ _assignFirst ()
259
+ {
260
+
261
+ local varName="$1";
262
+ local _var;
263
+ local REMOVE=REMOVE;
264
+ shift;
265
+ for _var in "$@";
266
+ do
267
+ if [ -n "${!_var-}" ]; then
268
+ eval "${varName}"="${_var}";
269
+ return;
270
+ fi;
271
+ done;
272
+ echo;
273
+ echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}.";
274
+ echo " The following variables were all unset or empty:";
275
+ echo " $*";
276
+ if [ -z "${out:-}" ]; then
277
+ echo ' If you do not want an "out" output in your derivation, make sure to define';
278
+ echo ' the other specific required outputs. This can be achieved by picking one';
279
+ echo " of the above as an output.";
280
+ echo ' You do not have to remove "out" if you want to have a different default';
281
+ echo ' output, because the first output is taken as a default.';
282
+ echo;
283
+ fi;
284
+ return 1
285
+ }
286
+ _callImplicitHook ()
287
+ {
288
+
289
+ local def="$1";
290
+ local hookName="$2";
291
+ if declare -F "$hookName" > /dev/null; then
292
+ nixTalkativeLog "calling implicit '$hookName' function hook";
293
+ "$hookName";
294
+ else
295
+ if type -p "$hookName" > /dev/null; then
296
+ nixTalkativeLog "sourcing implicit '$hookName' script hook";
297
+ source "$hookName";
298
+ else
299
+ if [ -n "${!hookName:-}" ]; then
300
+ nixTalkativeLog "evaling implicit '$hookName' string hook";
301
+ eval "${!hookName}";
302
+ else
303
+ return "$def";
304
+ fi;
305
+ fi;
306
+ fi
307
+ }
308
+ _defaultUnpack ()
309
+ {
310
+
311
+ local fn="$1";
312
+ local destination;
313
+ if [ -d "$fn" ]; then
314
+ destination="$(stripHash "$fn")";
315
+ if [ -e "$destination" ]; then
316
+ echo "Cannot copy $fn to $destination: destination already exists!";
317
+ echo "Did you specify two \"srcs\" with the same \"name\"?";
318
+ return 1;
319
+ fi;
320
+ cp -r --preserve=timestamps --reflink=auto -- "$fn" "$destination";
321
+ else
322
+ case "$fn" in
323
+ *.tar.xz | *.tar.lzma | *.txz)
324
+ ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn";
325
+ true ) | tar xf - --mode=+w --warning=no-timestamp
326
+ ;;
327
+ *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
328
+ tar xf "$fn" --mode=+w --warning=no-timestamp
329
+ ;;
330
+ *)
331
+ return 1
332
+ ;;
333
+ esac;
334
+ fi
335
+ }
336
+ _doStrip ()
337
+ {
338
+
339
+ local -ra flags=(dontStripHost dontStripTarget);
340
+ local -ra debugDirs=(stripDebugList stripDebugListTarget);
341
+ local -ra allDirs=(stripAllList stripAllListTarget);
342
+ local -ra stripCmds=(STRIP STRIP_FOR_TARGET);
343
+ local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET);
344
+ stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin Applications Library/Frameworks};
345
+ stripDebugListTarget=${stripDebugListTarget[*]:-};
346
+ stripAllList=${stripAllList[*]:-};
347
+ stripAllListTarget=${stripAllListTarget[*]:-};
348
+ local i;
349
+ for i in ${!stripCmds[@]};
350
+ do
351
+ local -n flag="${flags[$i]}";
352
+ local -n debugDirList="${debugDirs[$i]}";
353
+ local -n allDirList="${allDirs[$i]}";
354
+ local -n stripCmd="${stripCmds[$i]}";
355
+ local -n ranlibCmd="${ranlibCmds[$i]}";
356
+ if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then
357
+ continue;
358
+ fi;
359
+ stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}";
360
+ stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}";
361
+ done
362
+ }
363
+ _eval ()
364
+ {
365
+
366
+ if declare -F "$1" > /dev/null 2>&1; then
367
+ "$@";
368
+ else
369
+ eval "$1";
370
+ fi
371
+ }
372
+ _logHook ()
373
+ {
374
+
375
+ if [[ -z ${NIX_LOG_FD-} ]]; then
376
+ return;
377
+ fi;
378
+ local hookKind="$1";
379
+ local hookExpr="$2";
380
+ shift 2;
381
+ if declare -F "$hookExpr" > /dev/null 2>&1; then
382
+ nixTalkativeLog "calling '$hookKind' function hook '$hookExpr'" "$@";
383
+ else
384
+ if type -p "$hookExpr" > /dev/null; then
385
+ nixTalkativeLog "sourcing '$hookKind' script hook '$hookExpr'";
386
+ else
387
+ if [[ "$hookExpr" != "_callImplicitHook"* ]]; then
388
+ local exprToOutput;
389
+ if [[ ${NIX_DEBUG:-0} -ge 5 ]]; then
390
+ exprToOutput="$hookExpr";
391
+ else
392
+ local hookExprLine;
393
+ while IFS= read -r hookExprLine; do
394
+ hookExprLine="${hookExprLine#"${hookExprLine%%[![:space:]]*}"}";
395
+ if [[ -n "$hookExprLine" ]]; then
396
+ exprToOutput+="$hookExprLine\\n ";
397
+ fi;
398
+ done <<< "$hookExpr";
399
+ exprToOutput="${exprToOutput%%\\n }";
400
+ fi;
401
+ nixTalkativeLog "evaling '$hookKind' string hook '$exprToOutput'";
402
+ fi;
403
+ fi;
404
+ fi
405
+ }
406
+ _makeSymlinksRelative ()
407
+ {
408
+
409
+ local symlinkTarget;
410
+ if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then
411
+ return;
412
+ fi;
413
+ while IFS= read -r -d '' f; do
414
+ symlinkTarget=$(readlink "$f");
415
+ if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then
416
+ continue;
417
+ fi;
418
+ if [ ! -e "$symlinkTarget" ]; then
419
+ echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)";
420
+ fi;
421
+ echo "rewriting symlink $f to be relative to $prefix";
422
+ ln -snrf "$symlinkTarget" "$f";
423
+ done < <(find $prefix -type l -print0)
424
+ }
425
+ _makeSymlinksRelativeInAllOutputs ()
426
+ {
427
+
428
+ local output;
429
+ for output in $(getAllOutputNames);
430
+ do
431
+ prefix="${!output}" _makeSymlinksRelative;
432
+ done
433
+ }
434
+ _moveLib64 ()
435
+ {
436
+
437
+ if [ "${dontMoveLib64-}" = 1 ]; then
438
+ return;
439
+ fi;
440
+ if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then
441
+ return;
442
+ fi;
443
+ echo "moving $prefix/lib64/* to $prefix/lib";
444
+ mkdir -p $prefix/lib;
445
+ shopt -s dotglob;
446
+ for i in $prefix/lib64/*;
447
+ do
448
+ mv --no-clobber "$i" $prefix/lib;
449
+ done;
450
+ shopt -u dotglob;
451
+ rmdir $prefix/lib64;
452
+ ln -s lib $prefix/lib64
453
+ }
454
+ _moveSbin ()
455
+ {
456
+
457
+ if [ "${dontMoveSbin-}" = 1 ]; then
458
+ return;
459
+ fi;
460
+ if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then
461
+ return;
462
+ fi;
463
+ echo "moving $prefix/sbin/* to $prefix/bin";
464
+ mkdir -p $prefix/bin;
465
+ shopt -s dotglob;
466
+ for i in $prefix/sbin/*;
467
+ do
468
+ mv "$i" $prefix/bin;
469
+ done;
470
+ shopt -u dotglob;
471
+ rmdir $prefix/sbin;
472
+ ln -s bin $prefix/sbin
473
+ }
474
+ _moveSystemdUserUnits ()
475
+ {
476
+
477
+ if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then
478
+ return;
479
+ fi;
480
+ if [ ! -e "${prefix:?}/lib/systemd/user" ]; then
481
+ return;
482
+ fi;
483
+ local source="$prefix/lib/systemd/user";
484
+ local target="$prefix/share/systemd/user";
485
+ echo "moving $source/* to $target";
486
+ mkdir -p "$target";
487
+ ( shopt -s dotglob;
488
+ for i in "$source"/*;
489
+ do
490
+ mv "$i" "$target";
491
+ done );
492
+ rmdir "$source";
493
+ ln -s "$target" "$source"
494
+ }
495
+ _moveToShare ()
496
+ {
497
+
498
+ if [ -n "$__structuredAttrs" ]; then
499
+ if [ -z "${forceShare-}" ]; then
500
+ forceShare=(man doc info);
501
+ fi;
502
+ else
503
+ forceShare=(${forceShare:-man doc info});
504
+ fi;
505
+ if [[ -z "$out" ]]; then
506
+ return;
507
+ fi;
508
+ for d in "${forceShare[@]}";
509
+ do
510
+ if [ -d "$out/$d" ]; then
511
+ if [ -d "$out/share/$d" ]; then
512
+ echo "both $d/ and share/$d/ exist!";
513
+ else
514
+ echo "moving $out/$d to $out/share/$d";
515
+ mkdir -p $out/share;
516
+ mv $out/$d $out/share/;
517
+ fi;
518
+ fi;
519
+ done
520
+ }
521
+ _multioutConfig ()
522
+ {
523
+
524
+ if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then
525
+ return;
526
+ fi;
527
+ if [ -z "${shareDocName:-}" ]; then
528
+ local confScript="${configureScript:-}";
529
+ if [ -z "$confScript" ] && [ -x ./configure ]; then
530
+ confScript=./configure;
531
+ fi;
532
+ if [ -f "$confScript" ]; then
533
+ local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")";
534
+ fi;
535
+ if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then
536
+ shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')";
537
+ fi;
538
+ fi;
539
+ prependToVar configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!outputInclude}"/include --mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info --docdir="${!outputDoc}"/share/doc/"${shareDocName}" --libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec --localedir="${!outputLib}"/share/locale;
540
+ prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal
541
+ }
542
+ _multioutDevs ()
543
+ {
544
+
545
+ if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then
546
+ return;
547
+ fi;
548
+ moveToOutput include "${!outputInclude}";
549
+ moveToOutput lib/pkgconfig "${!outputDev}";
550
+ moveToOutput share/pkgconfig "${!outputDev}";
551
+ moveToOutput lib/cmake "${!outputDev}";
552
+ moveToOutput share/aclocal "${!outputDev}";
553
+ for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc;
554
+ do
555
+ echo "Patching '$f' includedir to output ${!outputInclude}";
556
+ sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f";
557
+ done
558
+ }
559
+ _multioutDocs ()
560
+ {
561
+
562
+ local REMOVE=REMOVE;
563
+ moveToOutput share/info "${!outputInfo}";
564
+ moveToOutput share/doc "${!outputDoc}";
565
+ moveToOutput share/gtk-doc "${!outputDevdoc}";
566
+ moveToOutput share/devhelp/books "${!outputDevdoc}";
567
+ moveToOutput share/man "${!outputMan}";
568
+ moveToOutput share/man/man3 "${!outputDevman}"
569
+ }
570
+ _multioutPropagateDev ()
571
+ {
572
+
573
+ if [ "$(getAllOutputNames)" = "out" ]; then
574
+ return;
575
+ fi;
576
+ local outputFirst;
577
+ for outputFirst in $(getAllOutputNames);
578
+ do
579
+ break;
580
+ done;
581
+ local propagaterOutput="$outputDev";
582
+ if [ -z "$propagaterOutput" ]; then
583
+ propagaterOutput="$outputFirst";
584
+ fi;
585
+ if [ -z "${propagatedBuildOutputs+1}" ]; then
586
+ local po_dirty="$outputBin $outputInclude $outputLib";
587
+ set +o pipefail;
588
+ propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `;
589
+ set -o pipefail;
590
+ fi;
591
+ if [ -z "$propagatedBuildOutputs" ]; then
592
+ return;
593
+ fi;
594
+ mkdir -p "${!propagaterOutput}"/nix-support;
595
+ for output in $propagatedBuildOutputs;
596
+ do
597
+ echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs;
598
+ done
599
+ }
600
+ _nixLogWithLevel ()
601
+ {
602
+
603
+ [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0;
604
+ local logLevel;
605
+ case "${1:?}" in
606
+ 0)
607
+ logLevel=ERROR
608
+ ;;
609
+ 1)
610
+ logLevel=WARN
611
+ ;;
612
+ 2)
613
+ logLevel=NOTICE
614
+ ;;
615
+ 3)
616
+ logLevel=INFO
617
+ ;;
618
+ 4)
619
+ logLevel=TALKATIVE
620
+ ;;
621
+ 5)
622
+ logLevel=CHATTY
623
+ ;;
624
+ 6)
625
+ logLevel=DEBUG
626
+ ;;
627
+ 7)
628
+ logLevel=VOMIT
629
+ ;;
630
+ *)
631
+ echo "_nixLogWithLevel: called with invalid log level: ${1:?}" >&"$NIX_LOG_FD";
632
+ return 1
633
+ ;;
634
+ esac;
635
+ local callerName="${FUNCNAME[2]}";
636
+ if [[ $callerName == "_callImplicitHook" ]]; then
637
+ callerName="${hookName:?}";
638
+ fi;
639
+ printf "%s: %s: %s\n" "$logLevel" "$callerName" "${2:?}" >&"$NIX_LOG_FD"
640
+ }
641
+ _overrideFirst ()
642
+ {
643
+
644
+ if [ -z "${!1-}" ]; then
645
+ _assignFirst "$@";
646
+ fi
647
+ }
648
+ _pruneLibtoolFiles ()
649
+ {
650
+
651
+ if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
652
+ return;
653
+ fi;
654
+ find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \;
655
+ }
656
+ _updateSourceDateEpochFromSourceRoot ()
657
+ {
658
+
659
+ if [ -n "$sourceRoot" ]; then
660
+ updateSourceDateEpoch "$sourceRoot";
661
+ fi
662
+ }
663
+ activatePackage ()
664
+ {
665
+
666
+ local pkg="$1";
667
+ local -r hostOffset="$2";
668
+ local -r targetOffset="$3";
669
+ (( hostOffset <= targetOffset )) || exit 1;
670
+ if [ -f "$pkg" ]; then
671
+ nixTalkativeLog "sourcing setup hook '$pkg'";
672
+ source "$pkg";
673
+ fi;
674
+ if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then
675
+ addToSearchPath _PATH "$pkg/bin";
676
+ fi;
677
+ if (( hostOffset <= -1 )); then
678
+ addToSearchPath _XDG_DATA_DIRS "$pkg/share";
679
+ fi;
680
+ if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
681
+ addToSearchPath _HOST_PATH "$pkg/bin";
682
+ fi;
683
+ if [[ -f "$pkg/nix-support/setup-hook" ]]; then
684
+ nixTalkativeLog "sourcing setup hook '$pkg/nix-support/setup-hook'";
685
+ source "$pkg/nix-support/setup-hook";
686
+ fi
687
+ }
688
+ addEnvHooks ()
689
+ {
690
+
691
+ local depHostOffset="$1";
692
+ shift;
693
+ local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]";
694
+ local pkgHookVar;
695
+ for pkgHookVar in "${!pkgHookVarsSlice}";
696
+ do
697
+ eval "${pkgHookVar}s"'+=("$@")';
698
+ done
699
+ }
700
+ addToSearchPath ()
701
+ {
702
+
703
+ addToSearchPathWithCustomDelimiter ":" "$@"
704
+ }
705
+ addToSearchPathWithCustomDelimiter ()
706
+ {
707
+
708
+ local delimiter="$1";
709
+ local varName="$2";
710
+ local dir="$3";
711
+ if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then
712
+ export "${varName}=${!varName:+${!varName}${delimiter}}${dir}";
713
+ fi
714
+ }
715
+ appendToVar ()
716
+ {
717
+
718
+ local -n nameref="$1";
719
+ local useArray type;
720
+ if [ -n "$__structuredAttrs" ]; then
721
+ useArray=true;
722
+ else
723
+ useArray=false;
724
+ fi;
725
+ if type=$(declare -p "$1" 2> /dev/null); then
726
+ case "${type#* }" in
727
+ -A*)
728
+ echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2;
729
+ return 1
730
+ ;;
731
+ -a*)
732
+ useArray=true
733
+ ;;
734
+ *)
735
+ useArray=false
736
+ ;;
737
+ esac;
738
+ fi;
739
+ shift;
740
+ if $useArray; then
741
+ nameref=(${nameref+"${nameref[@]}"} "$@");
742
+ else
743
+ nameref="${nameref-} $*";
744
+ fi
745
+ }
746
+ auditTmpdir ()
747
+ {
748
+
749
+ local dir="$1";
750
+ [ -e "$dir" ] || return 0;
751
+ echo "checking for references to $TMPDIR/ in $dir...";
752
+ function _processFile ()
753
+ {
754
+ local file="$1";
755
+ if isELF "$file"; then
756
+ if {
757
+ printf :;
758
+ patchelf --print-rpath "$file"
759
+ } | grep -q -F ":$TMPDIR/"; then
760
+ echo "RPATH of binary $file contains a forbidden reference to $TMPDIR/";
761
+ exit 1;
762
+ fi;
763
+ else
764
+ if isScript "$file"; then
765
+ filename=${i##*/};
766
+ dir=${i%/*};
767
+ if [ -e "$dir/.$filename-wrapped" ]; then
768
+ if grep -q -F "$TMPDIR/" "$file"; then
769
+ echo "wrapper script $file contains a forbidden reference to $TMPDIR/";
770
+ exit 1;
771
+ fi;
772
+ fi;
773
+ fi;
774
+ fi
775
+ };
776
+ find "$dir" -type f -not -path '*/.build-id/*' -print0 | parallelMap _processFile;
777
+ unset -f _processFile
778
+ }
779
+ bintoolsWrapper_addLDVars ()
780
+ {
781
+
782
+ local role_post;
783
+ getHostRoleEnvHook;
784
+ if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then
785
+ export NIX_LDFLAGS${role_post}+=" -L$1/lib64";
786
+ fi;
787
+ if [[ -d "$1/lib" ]]; then
788
+ local -a glob=($1/lib/lib*);
789
+ if [ "${#glob[*]}" -gt 0 ]; then
790
+ export NIX_LDFLAGS${role_post}+=" -L$1/lib";
791
+ fi;
792
+ fi
793
+ }
794
+ buildPhase ()
795
+ {
796
+
797
+ runHook preBuild;
798
+ if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then
799
+ echo "no Makefile or custom buildPhase, doing nothing";
800
+ else
801
+ foundMakefile=1;
802
+ local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL="$SHELL");
803
+ concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray;
804
+ echoCmd 'build flags' "${flagsArray[@]}";
805
+ make ${makefile:+-f $makefile} "${flagsArray[@]}";
806
+ unset flagsArray;
807
+ fi;
808
+ runHook postBuild
809
+ }
810
+ ccWrapper_addCVars ()
811
+ {
812
+
813
+ local role_post;
814
+ getHostRoleEnvHook;
815
+ if [ -d "$1/include" ]; then
816
+ export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include";
817
+ fi;
818
+ if [ -d "$1/Library/Frameworks" ]; then
819
+ export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks";
820
+ fi
821
+ }
822
+ checkPhase ()
823
+ {
824
+
825
+ runHook preCheck;
826
+ if [[ -z "${foundMakefile:-}" ]]; then
827
+ echo "no Makefile or custom checkPhase, doing nothing";
828
+ runHook postCheck;
829
+ return;
830
+ fi;
831
+ if [[ -z "${checkTarget:-}" ]]; then
832
+ if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then
833
+ checkTarget="check";
834
+ else
835
+ if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then
836
+ checkTarget="test";
837
+ fi;
838
+ fi;
839
+ fi;
840
+ if [[ -z "${checkTarget:-}" ]]; then
841
+ echo "no check/test target in ${makefile:-Makefile}, doing nothing";
842
+ else
843
+ local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL");
844
+ concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget;
845
+ echoCmd 'check flags' "${flagsArray[@]}";
846
+ make ${makefile:+-f $makefile} "${flagsArray[@]}";
847
+ unset flagsArray;
848
+ fi;
849
+ runHook postCheck
850
+ }
851
+ compressManPages ()
852
+ {
853
+
854
+ local dir="$1";
855
+ if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then
856
+ return;
857
+ fi;
858
+ echo "gzipping man pages under $dir/share/man/";
859
+ find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | xargs -0 -n1 -P "$NIX_BUILD_CORES" gzip -f;
860
+ find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do
861
+ local target;
862
+ target="$(readlink -f "$f")";
863
+ if [ -f "$target".gz ]; then
864
+ ln -sf "$target".gz "$f".gz && rm "$f";
865
+ fi;
866
+ done
867
+ }
868
+ concatStringsSep ()
869
+ {
870
+
871
+ local sep="$1";
872
+ local name="$2";
873
+ local type oldifs;
874
+ if type=$(declare -p "$name" 2> /dev/null); then
875
+ local -n nameref="$name";
876
+ case "${type#* }" in
877
+ -A*)
878
+ echo "concatStringsSep(): ERROR: trying to use concatStringsSep on an associative array." 1>&2;
879
+ return 1
880
+ ;;
881
+ -a*)
882
+ local IFS="$(printf '\036')"
883
+ ;;
884
+ *)
885
+ local IFS=" "
886
+ ;;
887
+ esac;
888
+ local ifs_separated="${nameref[*]}";
889
+ echo -n "${ifs_separated//"$IFS"/"$sep"}";
890
+ fi
891
+ }
892
+ concatTo ()
893
+ {
894
+
895
+ local -;
896
+ set -o noglob;
897
+ local -n targetref="$1";
898
+ shift;
899
+ local arg default name type;
900
+ for arg in "$@";
901
+ do
902
+ IFS="=" read -r name default <<< "$arg";
903
+ local -n nameref="$name";
904
+ if [[ -z "${nameref[*]}" && -n "$default" ]]; then
905
+ targetref+=("$default");
906
+ else
907
+ if type=$(declare -p "$name" 2> /dev/null); then
908
+ case "${type#* }" in
909
+ -A*)
910
+ echo "concatTo(): ERROR: trying to use concatTo on an associative array." 1>&2;
911
+ return 1
912
+ ;;
913
+ -a*)
914
+ targetref+=("${nameref[@]}")
915
+ ;;
916
+ *)
917
+ if [[ "$name" = *"Array" ]]; then
918
+ nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future";
919
+ targetref+=(${nameref+"${nameref[@]}"});
920
+ else
921
+ targetref+=(${nameref-});
922
+ fi
923
+ ;;
924
+ esac;
925
+ fi;
926
+ fi;
927
+ done
928
+ }
929
+ configurePhase ()
930
+ {
931
+
932
+ runHook preConfigure;
933
+ : "${configureScript=}";
934
+ if [[ -z "$configureScript" && -x ./configure ]]; then
935
+ configureScript=./configure;
936
+ fi;
937
+ if [ -z "${dontFixLibtool:-}" ]; then
938
+ export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}";
939
+ local i;
940
+ find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do
941
+ echo "fixing libtool script $i";
942
+ fixLibtool "$i";
943
+ done;
944
+ CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX);
945
+ find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;;
946
+ rm -f "$CONFIGURE_MTIME_REFERENCE";
947
+ fi;
948
+ if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then
949
+ prependToVar configureFlags "${prefixKey:---prefix=}$prefix";
950
+ fi;
951
+ if [[ -f "$configureScript" ]]; then
952
+ if [ -z "${dontAddDisableDepTrack:-}" ]; then
953
+ if grep -q dependency-tracking "$configureScript"; then
954
+ prependToVar configureFlags --disable-dependency-tracking;
955
+ fi;
956
+ fi;
957
+ if [ -z "${dontDisableStatic:-}" ]; then
958
+ if grep -q enable-static "$configureScript"; then
959
+ prependToVar configureFlags --disable-static;
960
+ fi;
961
+ fi;
962
+ if [ -z "${dontPatchShebangsInConfigure:-}" ]; then
963
+ patchShebangs --build "$configureScript";
964
+ fi;
965
+ fi;
966
+ if [ -n "$configureScript" ]; then
967
+ local -a flagsArray;
968
+ concatTo flagsArray configureFlags configureFlagsArray;
969
+ echoCmd 'configure flags' "${flagsArray[@]}";
970
+ $configureScript "${flagsArray[@]}";
971
+ unset flagsArray;
972
+ else
973
+ echo "no configure script, doing nothing";
974
+ fi;
975
+ runHook postConfigure
976
+ }
977
+ consumeEntire ()
978
+ {
979
+
980
+ if IFS='' read -r -d '' "$1"; then
981
+ echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2;
982
+ return 1;
983
+ fi
984
+ }
985
+ distPhase ()
986
+ {
987
+
988
+ runHook preDist;
989
+ local flagsArray=();
990
+ concatTo flagsArray distFlags distFlagsArray distTarget=dist;
991
+ echo 'dist flags: %q' "${flagsArray[@]}";
992
+ make ${makefile:+-f $makefile} "${flagsArray[@]}";
993
+ if [ "${dontCopyDist:-0}" != 1 ]; then
994
+ mkdir -p "$out/tarballs";
995
+ cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs";
996
+ fi;
997
+ runHook postDist
998
+ }
999
+ dumpVars ()
1000
+ {
1001
+
1002
+ if [ "${noDumpEnvVars:-0}" != 1 ]; then
1003
+ {
1004
+ install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" && export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars"
1005
+ } || true;
1006
+ fi
1007
+ }
1008
+ echoCmd ()
1009
+ {
1010
+
1011
+ printf "%s:" "$1";
1012
+ shift;
1013
+ printf ' %q' "$@";
1014
+ echo
1015
+ }
1016
+ exitHandler ()
1017
+ {
1018
+
1019
+ exitCode="$?";
1020
+ set +e;
1021
+ if [ -n "${showBuildStats:-}" ]; then
1022
+ read -r -d '' -a buildTimes < <(times);
1023
+ echo "build times:";
1024
+ echo "user time for the shell ${buildTimes[0]}";
1025
+ echo "system time for the shell ${buildTimes[1]}";
1026
+ echo "user time for all child processes ${buildTimes[2]}";
1027
+ echo "system time for all child processes ${buildTimes[3]}";
1028
+ fi;
1029
+ if (( "$exitCode" != 0 )); then
1030
+ runHook failureHook;
1031
+ if [ -n "${succeedOnFailure:-}" ]; then
1032
+ echo "build failed with exit code $exitCode (ignored)";
1033
+ mkdir -p "$out/nix-support";
1034
+ printf "%s" "$exitCode" > "$out/nix-support/failed";
1035
+ exit 0;
1036
+ fi;
1037
+ else
1038
+ runHook exitHook;
1039
+ fi;
1040
+ return "$exitCode"
1041
+ }
1042
+ findInputs ()
1043
+ {
1044
+
1045
+ local -r pkg="$1";
1046
+ local -r hostOffset="$2";
1047
+ local -r targetOffset="$3";
1048
+ (( hostOffset <= targetOffset )) || exit 1;
1049
+ local varVar="${pkgAccumVarVars[hostOffset + 1]}";
1050
+ local varRef="$varVar[$((targetOffset - hostOffset))]";
1051
+ local var="${!varRef}";
1052
+ unset -v varVar varRef;
1053
+ local varSlice="$var[*]";
1054
+ case " ${!varSlice-} " in
1055
+ *" $pkg "*)
1056
+ return 0
1057
+ ;;
1058
+ esac;
1059
+ unset -v varSlice;
1060
+ eval "$var"'+=("$pkg")';
1061
+ if ! [ -e "$pkg" ]; then
1062
+ echo "build input $pkg does not exist" 1>&2;
1063
+ exit 1;
1064
+ fi;
1065
+ function mapOffset ()
1066
+ {
1067
+ local -r inputOffset="$1";
1068
+ local -n outputOffset="$2";
1069
+ if (( inputOffset <= 0 )); then
1070
+ outputOffset=$((inputOffset + hostOffset));
1071
+ else
1072
+ outputOffset=$((inputOffset - 1 + targetOffset));
1073
+ fi
1074
+ };
1075
+ local relHostOffset;
1076
+ for relHostOffset in "${allPlatOffsets[@]}";
1077
+ do
1078
+ local files="${propagatedDepFilesVars[relHostOffset + 1]}";
1079
+ local hostOffsetNext;
1080
+ mapOffset "$relHostOffset" hostOffsetNext;
1081
+ (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue;
1082
+ local relTargetOffset;
1083
+ for relTargetOffset in "${allPlatOffsets[@]}";
1084
+ do
1085
+ (( "$relHostOffset" <= "$relTargetOffset" )) || continue;
1086
+ local fileRef="${files}[$relTargetOffset - $relHostOffset]";
1087
+ local file="${!fileRef}";
1088
+ unset -v fileRef;
1089
+ local targetOffsetNext;
1090
+ mapOffset "$relTargetOffset" targetOffsetNext;
1091
+ (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue;
1092
+ [[ -f "$pkg/nix-support/$file" ]] || continue;
1093
+ local pkgNext;
1094
+ read -r -d '' pkgNext < "$pkg/nix-support/$file" || true;
1095
+ for pkgNext in $pkgNext;
1096
+ do
1097
+ findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext";
1098
+ done;
1099
+ done;
1100
+ done
1101
+ }
1102
+ fixLibtool ()
1103
+ {
1104
+
1105
+ local search_path;
1106
+ for flag in $NIX_LDFLAGS;
1107
+ do
1108
+ case $flag in
1109
+ -L*)
1110
+ search_path+=" ${flag#-L}"
1111
+ ;;
1112
+ esac;
1113
+ done;
1114
+ sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^'
1115
+ }
1116
+ fixupPhase ()
1117
+ {
1118
+
1119
+ local output;
1120
+ for output in $(getAllOutputNames);
1121
+ do
1122
+ if [ -e "${!output}" ]; then
1123
+ chmod -R u+w,u-s,g-s "${!output}";
1124
+ fi;
1125
+ done;
1126
+ runHook preFixup;
1127
+ local output;
1128
+ for output in $(getAllOutputNames);
1129
+ do
1130
+ prefix="${!output}" runHook fixupOutput;
1131
+ done;
1132
+ recordPropagatedDependencies;
1133
+ if [ -n "${setupHook:-}" ]; then
1134
+ mkdir -p "${!outputDev}/nix-support";
1135
+ substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook";
1136
+ fi;
1137
+ if [ -n "${setupHooks:-}" ]; then
1138
+ mkdir -p "${!outputDev}/nix-support";
1139
+ local hook;
1140
+ for hook in ${setupHooks[@]};
1141
+ do
1142
+ local content;
1143
+ consumeEntire content < "$hook";
1144
+ substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook";
1145
+ unset -v content;
1146
+ done;
1147
+ unset -v hook;
1148
+ fi;
1149
+ if [ -n "${propagatedUserEnvPkgs[*]:-}" ]; then
1150
+ mkdir -p "${!outputBin}/nix-support";
1151
+ printWords "${propagatedUserEnvPkgs[@]}" > "${!outputBin}/nix-support/propagated-user-env-packages";
1152
+ fi;
1153
+ runHook postFixup
1154
+ }
1155
+ genericBuild ()
1156
+ {
1157
+
1158
+ export GZIP_NO_TIMESTAMPS=1;
1159
+ if [ -f "${buildCommandPath:-}" ]; then
1160
+ source "$buildCommandPath";
1161
+ return;
1162
+ fi;
1163
+ if [ -n "${buildCommand:-}" ]; then
1164
+ eval "$buildCommand";
1165
+ return;
1166
+ fi;
1167
+ if [ -z "${phases[*]:-}" ]; then
1168
+ phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}";
1169
+ fi;
1170
+ for curPhase in ${phases[*]};
1171
+ do
1172
+ runPhase "$curPhase";
1173
+ done
1174
+ }
1175
+ getAllOutputNames ()
1176
+ {
1177
+
1178
+ if [ -n "$__structuredAttrs" ]; then
1179
+ echo "${!outputs[*]}";
1180
+ else
1181
+ echo "$outputs";
1182
+ fi
1183
+ }
1184
+ getHostRole ()
1185
+ {
1186
+
1187
+ getRole "$hostOffset"
1188
+ }
1189
+ getHostRoleEnvHook ()
1190
+ {
1191
+
1192
+ getRole "$depHostOffset"
1193
+ }
1194
+ getRole ()
1195
+ {
1196
+
1197
+ case $1 in
1198
+ -1)
1199
+ role_post='_FOR_BUILD'
1200
+ ;;
1201
+ 0)
1202
+ role_post=''
1203
+ ;;
1204
+ 1)
1205
+ role_post='_FOR_TARGET'
1206
+ ;;
1207
+ *)
1208
+ echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2;
1209
+ return 1
1210
+ ;;
1211
+ esac
1212
+ }
1213
+ getTargetRole ()
1214
+ {
1215
+
1216
+ getRole "$targetOffset"
1217
+ }
1218
+ getTargetRoleEnvHook ()
1219
+ {
1220
+
1221
+ getRole "$depTargetOffset"
1222
+ }
1223
+ getTargetRoleWrapper ()
1224
+ {
1225
+
1226
+ case $targetOffset in
1227
+ -1)
1228
+ export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1
1229
+ ;;
1230
+ 0)
1231
+ export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1
1232
+ ;;
1233
+ 1)
1234
+ export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1
1235
+ ;;
1236
+ *)
1237
+ echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2;
1238
+ return 1
1239
+ ;;
1240
+ esac
1241
+ }
1242
+ installCheckPhase ()
1243
+ {
1244
+
1245
+ runHook preInstallCheck;
1246
+ if [[ -z "${foundMakefile:-}" ]]; then
1247
+ echo "no Makefile or custom installCheckPhase, doing nothing";
1248
+ else
1249
+ if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then
1250
+ echo "no installcheck target in ${makefile:-Makefile}, doing nothing";
1251
+ else
1252
+ local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL");
1253
+ concatTo flagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray installCheckTarget=installcheck;
1254
+ echoCmd 'installcheck flags' "${flagsArray[@]}";
1255
+ make ${makefile:+-f $makefile} "${flagsArray[@]}";
1256
+ unset flagsArray;
1257
+ fi;
1258
+ fi;
1259
+ runHook postInstallCheck
1260
+ }
1261
+ installPhase ()
1262
+ {
1263
+
1264
+ runHook preInstall;
1265
+ if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then
1266
+ echo "no Makefile or custom installPhase, doing nothing";
1267
+ runHook postInstall;
1268
+ return;
1269
+ else
1270
+ foundMakefile=1;
1271
+ fi;
1272
+ if [ -n "$prefix" ]; then
1273
+ mkdir -p "$prefix";
1274
+ fi;
1275
+ local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL="$SHELL");
1276
+ concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install;
1277
+ echoCmd 'install flags' "${flagsArray[@]}";
1278
+ make ${makefile:+-f $makefile} "${flagsArray[@]}";
1279
+ unset flagsArray;
1280
+ runHook postInstall
1281
+ }
1282
+ isELF ()
1283
+ {
1284
+
1285
+ local fn="$1";
1286
+ local fd;
1287
+ local magic;
1288
+ exec {fd}< "$fn";
1289
+ read -r -n 4 -u "$fd" magic;
1290
+ exec {fd}>&-;
1291
+ if [ "$magic" = 'ELF' ]; then
1292
+ return 0;
1293
+ else
1294
+ return 1;
1295
+ fi
1296
+ }
1297
+ isMachO ()
1298
+ {
1299
+
1300
+ local fn="$1";
1301
+ local fd;
1302
+ local magic;
1303
+ exec {fd}< "$fn";
1304
+ read -r -n 4 -u "$fd" magic;
1305
+ exec {fd}>&-;
1306
+ if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then
1307
+ return 0;
1308
+ else
1309
+ if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then
1310
+ return 0;
1311
+ else
1312
+ if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then
1313
+ return 0;
1314
+ else
1315
+ return 1;
1316
+ fi;
1317
+ fi;
1318
+ fi
1319
+ }
1320
+ isScript ()
1321
+ {
1322
+
1323
+ local fn="$1";
1324
+ local fd;
1325
+ local magic;
1326
+ exec {fd}< "$fn";
1327
+ read -r -n 2 -u "$fd" magic;
1328
+ exec {fd}>&-;
1329
+ if [[ "$magic" =~ \#! ]]; then
1330
+ return 0;
1331
+ else
1332
+ return 1;
1333
+ fi
1334
+ }
1335
+ mapOffset ()
1336
+ {
1337
+
1338
+ local -r inputOffset="$1";
1339
+ local -n outputOffset="$2";
1340
+ if (( inputOffset <= 0 )); then
1341
+ outputOffset=$((inputOffset + hostOffset));
1342
+ else
1343
+ outputOffset=$((inputOffset - 1 + targetOffset));
1344
+ fi
1345
+ }
1346
+ moveToOutput ()
1347
+ {
1348
+
1349
+ local patt="$1";
1350
+ local dstOut="$2";
1351
+ local output;
1352
+ for output in $(getAllOutputNames);
1353
+ do
1354
+ if [ "${!output}" = "$dstOut" ]; then
1355
+ continue;
1356
+ fi;
1357
+ local srcPath;
1358
+ for srcPath in "${!output}"/$patt;
1359
+ do
1360
+ if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then
1361
+ continue;
1362
+ fi;
1363
+ if [ "$dstOut" = REMOVE ]; then
1364
+ echo "Removing $srcPath";
1365
+ rm -r "$srcPath";
1366
+ else
1367
+ local dstPath="$dstOut${srcPath#${!output}}";
1368
+ echo "Moving $srcPath to $dstPath";
1369
+ if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then
1370
+ rmdir "$srcPath" --ignore-fail-on-non-empty;
1371
+ if [ -d "$srcPath" ]; then
1372
+ mv -t "$dstPath" "$srcPath"/*;
1373
+ rmdir "$srcPath";
1374
+ fi;
1375
+ else
1376
+ mkdir -p "$(readlink -m "$dstPath/..")";
1377
+ mv "$srcPath" "$dstPath";
1378
+ fi;
1379
+ fi;
1380
+ local srcParent="$(readlink -m "$srcPath/..")";
1381
+ if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then
1382
+ echo "Removing empty $srcParent/ and (possibly) its parents";
1383
+ rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true;
1384
+ fi;
1385
+ done;
1386
+ done
1387
+ }
1388
+ nixChattyLog ()
1389
+ {
1390
+
1391
+ _nixLogWithLevel 5 "$*"
1392
+ }
1393
+ nixDebugLog ()
1394
+ {
1395
+
1396
+ _nixLogWithLevel 6 "$*"
1397
+ }
1398
+ nixErrorLog ()
1399
+ {
1400
+
1401
+ _nixLogWithLevel 0 "$*"
1402
+ }
1403
+ nixInfoLog ()
1404
+ {
1405
+
1406
+ _nixLogWithLevel 3 "$*"
1407
+ }
1408
+ nixLog ()
1409
+ {
1410
+
1411
+ [[ -z ${NIX_LOG_FD-} ]] && return 0;
1412
+ local callerName="${FUNCNAME[1]}";
1413
+ if [[ $callerName == "_callImplicitHook" ]]; then
1414
+ callerName="${hookName:?}";
1415
+ fi;
1416
+ printf "%s: %s\n" "$callerName" "$*" >&"$NIX_LOG_FD"
1417
+ }
1418
+ nixNoticeLog ()
1419
+ {
1420
+
1421
+ _nixLogWithLevel 2 "$*"
1422
+ }
1423
+ nixTalkativeLog ()
1424
+ {
1425
+
1426
+ _nixLogWithLevel 4 "$*"
1427
+ }
1428
+ nixVomitLog ()
1429
+ {
1430
+
1431
+ _nixLogWithLevel 7 "$*"
1432
+ }
1433
+ nixWarnLog ()
1434
+ {
1435
+
1436
+ _nixLogWithLevel 1 "$*"
1437
+ }
1438
+ noBrokenSymlinks ()
1439
+ {
1440
+
1441
+ local -r output="${1:?}";
1442
+ local path;
1443
+ local pathParent;
1444
+ local symlinkTarget;
1445
+ local -i numDanglingSymlinks=0;
1446
+ local -i numReflexiveSymlinks=0;
1447
+ local -i numUnreadableSymlinks=0;
1448
+ if [[ ! -e $output ]]; then
1449
+ nixWarnLog "skipping non-existent output $output";
1450
+ return 0;
1451
+ fi;
1452
+ nixInfoLog "running on $output";
1453
+ while IFS= read -r -d '' path; do
1454
+ pathParent="$(dirname "$path")";
1455
+ if ! symlinkTarget="$(readlink "$path")"; then
1456
+ nixErrorLog "the symlink $path is unreadable";
1457
+ numUnreadableSymlinks+=1;
1458
+ continue;
1459
+ fi;
1460
+ if [[ $symlinkTarget == /* ]]; then
1461
+ nixInfoLog "symlink $path points to absolute target $symlinkTarget";
1462
+ else
1463
+ nixInfoLog "symlink $path points to relative target $symlinkTarget";
1464
+ symlinkTarget="$(realpath --no-symlinks --canonicalize-missing "$pathParent/$symlinkTarget")";
1465
+ fi;
1466
+ if [[ $symlinkTarget != "$NIX_STORE"/* ]]; then
1467
+ nixInfoLog "symlink $path points outside the Nix store; ignoring";
1468
+ continue;
1469
+ fi;
1470
+ if [[ $path == "$symlinkTarget" ]]; then
1471
+ nixErrorLog "the symlink $path is reflexive";
1472
+ numReflexiveSymlinks+=1;
1473
+ else
1474
+ if [[ ! -e $symlinkTarget ]]; then
1475
+ nixErrorLog "the symlink $path points to a missing target: $symlinkTarget";
1476
+ numDanglingSymlinks+=1;
1477
+ else
1478
+ nixDebugLog "the symlink $path is irreflexive and points to a target which exists";
1479
+ fi;
1480
+ fi;
1481
+ done < <(find "$output" -type l -print0);
1482
+ if ((numDanglingSymlinks > 0 || numReflexiveSymlinks > 0 || numUnreadableSymlinks > 0)); then
1483
+ nixErrorLog "found $numDanglingSymlinks dangling symlinks, $numReflexiveSymlinks reflexive symlinks and $numUnreadableSymlinks unreadable symlinks";
1484
+ exit 1;
1485
+ fi;
1486
+ return 0
1487
+ }
1488
+ noBrokenSymlinksInAllOutputs ()
1489
+ {
1490
+
1491
+ if [[ -z ${dontCheckForBrokenSymlinks-} ]]; then
1492
+ for output in $(getAllOutputNames);
1493
+ do
1494
+ noBrokenSymlinks "${!output}";
1495
+ done;
1496
+ fi
1497
+ }
1498
+ parallelMap ()
1499
+ {
1500
+
1501
+ function _wrapper ()
1502
+ {
1503
+ while IFS= read -r -d '' job; do
1504
+ "$@" "$job";
1505
+ done
1506
+ };
1507
+ parallelRun _wrapper "$@";
1508
+ unset -f _wrapper
1509
+ }
1510
+ parallelRun ()
1511
+ {
1512
+
1513
+ local pids;
1514
+ local lock;
1515
+ pids=();
1516
+ lock=$(mktemp -u);
1517
+ mkfifo "$lock";
1518
+ for ((i=0; i<NIX_BUILD_CORES; i++))
1519
+ do
1520
+ {
1521
+ exec 3< "$lock";
1522
+ exec 4> "$lock";
1523
+ local job;
1524
+ while :; do
1525
+ read -r -n1 > /dev/null 0<&3;
1526
+ if ! IFS= read -r -d '' job; then
1527
+ printf 'x' 1>&4;
1528
+ break;
1529
+ fi;
1530
+ printf 'y' 1>&4;
1531
+ printf '%s\0' "$job";
1532
+ done | "$@"
1533
+ } & pids[$i]=$!;
1534
+ done;
1535
+ printf 'a' > "$lock" & for pid in "${pids[@]}";
1536
+ do
1537
+ if ! wait "$pid"; then
1538
+ echo "A parallel job failed with exit code $? (check for errors above)" 1>&2;
1539
+ echo -e "Failing Command:\n $@" 1>&2;
1540
+ exit 1;
1541
+ fi;
1542
+ done;
1543
+ rm "$lock"
1544
+ }
1545
+ patchELF ()
1546
+ {
1547
+
1548
+ local dir="$1";
1549
+ [ -e "$dir" ] || return 0;
1550
+ echo "shrinking RPATHs of ELF executables and libraries in $dir";
1551
+ local i;
1552
+ while IFS= read -r -d '' i; do
1553
+ if [[ "$i" =~ .build-id ]]; then
1554
+ continue;
1555
+ fi;
1556
+ if ! isELF "$i"; then
1557
+ continue;
1558
+ fi;
1559
+ echo "shrinking $i";
1560
+ patchelf --shrink-rpath "$i" || true;
1561
+ done < <(find "$dir" -type f -print0)
1562
+ }
1563
+ patchPhase ()
1564
+ {
1565
+
1566
+ runHook prePatch;
1567
+ local -a patchesArray;
1568
+ concatTo patchesArray patches;
1569
+ for i in "${patchesArray[@]}";
1570
+ do
1571
+ echo "applying patch $i";
1572
+ local uncompress=cat;
1573
+ case "$i" in
1574
+ *.gz)
1575
+ uncompress="gzip -d"
1576
+ ;;
1577
+ *.bz2)
1578
+ uncompress="bzip2 -d"
1579
+ ;;
1580
+ *.xz)
1581
+ uncompress="xz -d"
1582
+ ;;
1583
+ *.lzma)
1584
+ uncompress="lzma -d"
1585
+ ;;
1586
+ esac;
1587
+ local -a flagsArray;
1588
+ concatTo flagsArray patchFlags=-p1;
1589
+ $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}";
1590
+ done;
1591
+ runHook postPatch
1592
+ }
1593
+ patchShebangs ()
1594
+ {
1595
+
1596
+ local pathName;
1597
+ local update=false;
1598
+ while [[ $# -gt 0 ]]; do
1599
+ case "$1" in
1600
+ --host)
1601
+ pathName=HOST_PATH;
1602
+ shift
1603
+ ;;
1604
+ --build)
1605
+ pathName=PATH;
1606
+ shift
1607
+ ;;
1608
+ --update)
1609
+ update=true;
1610
+ shift
1611
+ ;;
1612
+ --)
1613
+ shift;
1614
+ break
1615
+ ;;
1616
+ -* | --*)
1617
+ echo "Unknown option $1 supplied to patchShebangs" 1>&2;
1618
+ return 1
1619
+ ;;
1620
+ *)
1621
+ break
1622
+ ;;
1623
+ esac;
1624
+ done;
1625
+ echo "patching script interpreter paths in $@";
1626
+ local f;
1627
+ local oldPath;
1628
+ local newPath;
1629
+ local arg0;
1630
+ local args;
1631
+ local oldInterpreterLine;
1632
+ local newInterpreterLine;
1633
+ if [[ $# -eq 0 ]]; then
1634
+ echo "No arguments supplied to patchShebangs" 1>&2;
1635
+ return 0;
1636
+ fi;
1637
+ local f;
1638
+ while IFS= read -r -d '' f; do
1639
+ isScript "$f" || continue;
1640
+ read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ];
1641
+ read -r oldPath arg0 args <<< "${oldInterpreterLine:2}";
1642
+ if [[ -z "${pathName:-}" ]]; then
1643
+ if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then
1644
+ pathName=HOST_PATH;
1645
+ else
1646
+ pathName=PATH;
1647
+ fi;
1648
+ fi;
1649
+ if [[ "$oldPath" == *"/bin/env" ]]; then
1650
+ if [[ $arg0 == "-S" ]]; then
1651
+ arg0=${args%% *};
1652
+ [[ "$args" == *" "* ]] && args=${args#* } || args=;
1653
+ newPath="$(PATH="${!pathName}" type -P "env" || true)";
1654
+ args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args";
1655
+ else
1656
+ if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then
1657
+ echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2;
1658
+ exit 1;
1659
+ else
1660
+ newPath="$(PATH="${!pathName}" type -P "$arg0" || true)";
1661
+ fi;
1662
+ fi;
1663
+ else
1664
+ if [[ -z $oldPath ]]; then
1665
+ oldPath="/bin/sh";
1666
+ fi;
1667
+ newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)";
1668
+ args="$arg0 $args";
1669
+ fi;
1670
+ newInterpreterLine="$newPath $args";
1671
+ newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}};
1672
+ if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then
1673
+ if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then
1674
+ echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\"";
1675
+ escapedInterpreterLine=${newInterpreterLine//\\/\\\\};
1676
+ timestamp=$(stat --printf "%y" "$f");
1677
+ sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f";
1678
+ touch --date "$timestamp" "$f";
1679
+ fi;
1680
+ fi;
1681
+ done < <(find "$@" -type f -perm -0100 -print0)
1682
+ }
1683
+ patchShebangsAuto ()
1684
+ {
1685
+
1686
+ if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then
1687
+ if [[ "$output" != out && "$output" = "$outputDev" ]]; then
1688
+ patchShebangs --build "$prefix";
1689
+ else
1690
+ patchShebangs --host "$prefix";
1691
+ fi;
1692
+ fi
1693
+ }
1694
+ prependToVar ()
1695
+ {
1696
+
1697
+ local -n nameref="$1";
1698
+ local useArray type;
1699
+ if [ -n "$__structuredAttrs" ]; then
1700
+ useArray=true;
1701
+ else
1702
+ useArray=false;
1703
+ fi;
1704
+ if type=$(declare -p "$1" 2> /dev/null); then
1705
+ case "${type#* }" in
1706
+ -A*)
1707
+ echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2;
1708
+ return 1
1709
+ ;;
1710
+ -a*)
1711
+ useArray=true
1712
+ ;;
1713
+ *)
1714
+ useArray=false
1715
+ ;;
1716
+ esac;
1717
+ fi;
1718
+ shift;
1719
+ if $useArray; then
1720
+ nameref=("$@" ${nameref+"${nameref[@]}"});
1721
+ else
1722
+ nameref="$* ${nameref-}";
1723
+ fi
1724
+ }
1725
+ printLines ()
1726
+ {
1727
+
1728
+ (( "$#" > 0 )) || return 0;
1729
+ printf '%s\n' "$@"
1730
+ }
1731
+ printWords ()
1732
+ {
1733
+
1734
+ (( "$#" > 0 )) || return 0;
1735
+ printf '%s ' "$@"
1736
+ }
1737
+ recordPropagatedDependencies ()
1738
+ {
1739
+
1740
+ declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated);
1741
+ declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}");
1742
+ local propagatedInputsIndex;
1743
+ for propagatedInputsIndex in "${!flatVars[@]}";
1744
+ do
1745
+ local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]";
1746
+ local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}";
1747
+ [[ -n "${!propagatedInputsSlice}" ]] || continue;
1748
+ mkdir -p "${!outputDev}/nix-support";
1749
+ printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile";
1750
+ done
1751
+ }
1752
+ runHook ()
1753
+ {
1754
+
1755
+ local hookName="$1";
1756
+ shift;
1757
+ local hooksSlice="${hookName%Hook}Hooks[@]";
1758
+ local hook;
1759
+ for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1760
+ do
1761
+ _logHook "$hookName" "$hook" "$@";
1762
+ _eval "$hook" "$@";
1763
+ done;
1764
+ return 0
1765
+ }
1766
+ runOneHook ()
1767
+ {
1768
+
1769
+ local hookName="$1";
1770
+ shift;
1771
+ local hooksSlice="${hookName%Hook}Hooks[@]";
1772
+ local hook ret=1;
1773
+ for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"};
1774
+ do
1775
+ _logHook "$hookName" "$hook" "$@";
1776
+ if _eval "$hook" "$@"; then
1777
+ ret=0;
1778
+ break;
1779
+ fi;
1780
+ done;
1781
+ return "$ret"
1782
+ }
1783
+ runPhase ()
1784
+ {
1785
+
1786
+ local curPhase="$*";
1787
+ if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then
1788
+ return;
1789
+ fi;
1790
+ if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then
1791
+ return;
1792
+ fi;
1793
+ if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then
1794
+ return;
1795
+ fi;
1796
+ if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then
1797
+ return;
1798
+ fi;
1799
+ if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then
1800
+ return;
1801
+ fi;
1802
+ if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then
1803
+ return;
1804
+ fi;
1805
+ if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then
1806
+ return;
1807
+ fi;
1808
+ if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then
1809
+ return;
1810
+ fi;
1811
+ if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then
1812
+ return;
1813
+ fi;
1814
+ showPhaseHeader "$curPhase";
1815
+ dumpVars;
1816
+ local startTime endTime;
1817
+ startTime=$(date +"%s");
1818
+ eval "${!curPhase:-$curPhase}";
1819
+ endTime=$(date +"%s");
1820
+ showPhaseFooter "$curPhase" "$startTime" "$endTime";
1821
+ if [ "$curPhase" = unpackPhase ]; then
1822
+ [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}";
1823
+ cd -- "${sourceRoot:-.}";
1824
+ fi
1825
+ }
1826
+ showPhaseFooter ()
1827
+ {
1828
+
1829
+ local phase="$1";
1830
+ local startTime="$2";
1831
+ local endTime="$3";
1832
+ local delta=$(( endTime - startTime ));
1833
+ (( delta < 30 )) && return;
1834
+ local H=$((delta/3600));
1835
+ local M=$((delta%3600/60));
1836
+ local S=$((delta%60));
1837
+ echo -n "$phase completed in ";
1838
+ (( H > 0 )) && echo -n "$H hours ";
1839
+ (( M > 0 )) && echo -n "$M minutes ";
1840
+ echo "$S seconds"
1841
+ }
1842
+ showPhaseHeader ()
1843
+ {
1844
+
1845
+ local phase="$1";
1846
+ echo "Running phase: $phase";
1847
+ if [[ -z ${NIX_LOG_FD-} ]]; then
1848
+ return;
1849
+ fi;
1850
+ printf "@nix { \"action\": \"setPhase\", \"phase\": \"%s\" }\n" "$phase" >&"$NIX_LOG_FD"
1851
+ }
1852
+ stripDirs ()
1853
+ {
1854
+
1855
+ local cmd="$1";
1856
+ local ranlibCmd="$2";
1857
+ local paths="$3";
1858
+ local stripFlags="$4";
1859
+ local excludeFlags=();
1860
+ local pathsNew=;
1861
+ [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1;
1862
+ [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1;
1863
+ local pattern;
1864
+ if [ -n "${stripExclude:-}" ]; then
1865
+ for pattern in "${stripExclude[@]}";
1866
+ do
1867
+ excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')');
1868
+ done;
1869
+ fi;
1870
+ local p;
1871
+ for p in ${paths};
1872
+ do
1873
+ if [ -e "$prefix/$p" ]; then
1874
+ pathsNew="${pathsNew} $prefix/$p";
1875
+ fi;
1876
+ done;
1877
+ paths=${pathsNew};
1878
+ if [ -n "${paths}" ]; then
1879
+ echo "stripping (with command $cmd and flags $stripFlags) in $paths";
1880
+ local striperr;
1881
+ striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')";
1882
+ find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -printf '%D-%i,%p\0' | sort -t, -k1,1 -u -z | cut -d, -f2- -z | xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2> "$striperr" || exit_code=$?;
1883
+ [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 );
1884
+ rm "$striperr";
1885
+ find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null;
1886
+ fi
1887
+ }
1888
+ stripHash ()
1889
+ {
1890
+
1891
+ local strippedName casematchOpt=0;
1892
+ strippedName="$(basename -- "$1")";
1893
+ shopt -q nocasematch && casematchOpt=1;
1894
+ shopt -u nocasematch;
1895
+ if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then
1896
+ echo "${strippedName:33}";
1897
+ else
1898
+ echo "$strippedName";
1899
+ fi;
1900
+ if (( casematchOpt )); then
1901
+ shopt -s nocasematch;
1902
+ fi
1903
+ }
1904
+ substitute ()
1905
+ {
1906
+
1907
+ local input="$1";
1908
+ local output="$2";
1909
+ shift 2;
1910
+ if [ ! -f "$input" ]; then
1911
+ echo "substitute(): ERROR: file '$input' does not exist" 1>&2;
1912
+ return 1;
1913
+ fi;
1914
+ local content;
1915
+ consumeEntire content < "$input";
1916
+ if [ -e "$output" ]; then
1917
+ chmod +w "$output";
1918
+ fi;
1919
+ substituteStream content "file '$input'" "$@" > "$output"
1920
+ }
1921
+ substituteAll ()
1922
+ {
1923
+
1924
+ local input="$1";
1925
+ local output="$2";
1926
+ local -a args=();
1927
+ _allFlags;
1928
+ substitute "$input" "$output" "${args[@]}"
1929
+ }
1930
+ substituteAllInPlace ()
1931
+ {
1932
+
1933
+ local fileName="$1";
1934
+ shift;
1935
+ substituteAll "$fileName" "$fileName" "$@"
1936
+ }
1937
+ substituteAllStream ()
1938
+ {
1939
+
1940
+ local -a args=();
1941
+ _allFlags;
1942
+ substituteStream "$1" "$2" "${args[@]}"
1943
+ }
1944
+ substituteInPlace ()
1945
+ {
1946
+
1947
+ local -a fileNames=();
1948
+ for arg in "$@";
1949
+ do
1950
+ if [[ "$arg" = "--"* ]]; then
1951
+ break;
1952
+ fi;
1953
+ fileNames+=("$arg");
1954
+ shift;
1955
+ done;
1956
+ if ! [[ "${#fileNames[@]}" -gt 0 ]]; then
1957
+ echo "substituteInPlace called without any files to operate on (files must come before options!)" 1>&2;
1958
+ return 1;
1959
+ fi;
1960
+ for file in "${fileNames[@]}";
1961
+ do
1962
+ substitute "$file" "$file" "$@";
1963
+ done
1964
+ }
1965
+ substituteStream ()
1966
+ {
1967
+
1968
+ local var=$1;
1969
+ local description=$2;
1970
+ shift 2;
1971
+ while (( "$#" )); do
1972
+ local replace_mode="$1";
1973
+ case "$1" in
1974
+ --replace)
1975
+ if ! "$_substituteStream_has_warned_replace_deprecation"; then
1976
+ echo "substituteStream() in derivation $name: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2;
1977
+ _substituteStream_has_warned_replace_deprecation=true;
1978
+ fi;
1979
+ replace_mode='--replace-warn'
1980
+ ;&
1981
+ --replace-quiet | --replace-warn | --replace-fail)
1982
+ pattern="$2";
1983
+ replacement="$3";
1984
+ shift 3;
1985
+ if ! [[ "${!var}" == *"$pattern"* ]]; then
1986
+ if [ "$replace_mode" == --replace-warn ]; then
1987
+ printf "substituteStream() in derivation $name: WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2;
1988
+ else
1989
+ if [ "$replace_mode" == --replace-fail ]; then
1990
+ printf "substituteStream() in derivation $name: ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2;
1991
+ return 1;
1992
+ fi;
1993
+ fi;
1994
+ fi;
1995
+ eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'
1996
+ ;;
1997
+ --subst-var)
1998
+ local varName="$2";
1999
+ shift 2;
2000
+ if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then
2001
+ echo "substituteStream() in derivation $name: ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2;
2002
+ return 1;
2003
+ fi;
2004
+ if [ -z ${!varName+x} ]; then
2005
+ echo "substituteStream() in derivation $name: ERROR: variable \$$varName is unset" 1>&2;
2006
+ return 1;
2007
+ fi;
2008
+ pattern="@$varName@";
2009
+ replacement="${!varName}";
2010
+ eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'
2011
+ ;;
2012
+ --subst-var-by)
2013
+ pattern="@$2@";
2014
+ replacement="$3";
2015
+ eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}';
2016
+ shift 3
2017
+ ;;
2018
+ *)
2019
+ echo "substituteStream() in derivation $name: ERROR: Invalid command line argument: $1" 1>&2;
2020
+ return 1
2021
+ ;;
2022
+ esac;
2023
+ done;
2024
+ printf "%s" "${!var}"
2025
+ }
2026
+ unpackFile ()
2027
+ {
2028
+
2029
+ curSrc="$1";
2030
+ echo "unpacking source archive $curSrc";
2031
+ if ! runOneHook unpackCmd "$curSrc"; then
2032
+ echo "do not know how to unpack source archive $curSrc";
2033
+ exit 1;
2034
+ fi
2035
+ }
2036
+ unpackPhase ()
2037
+ {
2038
+
2039
+ runHook preUnpack;
2040
+ if [ -z "${srcs:-}" ]; then
2041
+ if [ -z "${src:-}" ]; then
2042
+ echo 'variable $src or $srcs should point to the source';
2043
+ exit 1;
2044
+ fi;
2045
+ srcs="$src";
2046
+ fi;
2047
+ local -a srcsArray;
2048
+ concatTo srcsArray srcs;
2049
+ local dirsBefore="";
2050
+ for i in *;
2051
+ do
2052
+ if [ -d "$i" ]; then
2053
+ dirsBefore="$dirsBefore $i ";
2054
+ fi;
2055
+ done;
2056
+ for i in "${srcsArray[@]}";
2057
+ do
2058
+ unpackFile "$i";
2059
+ done;
2060
+ : "${sourceRoot=}";
2061
+ if [ -n "${setSourceRoot:-}" ]; then
2062
+ runOneHook setSourceRoot;
2063
+ else
2064
+ if [ -z "$sourceRoot" ]; then
2065
+ for i in *;
2066
+ do
2067
+ if [ -d "$i" ]; then
2068
+ case $dirsBefore in
2069
+ *\ $i\ *)
2070
+
2071
+ ;;
2072
+ *)
2073
+ if [ -n "$sourceRoot" ]; then
2074
+ echo "unpacker produced multiple directories";
2075
+ exit 1;
2076
+ fi;
2077
+ sourceRoot="$i"
2078
+ ;;
2079
+ esac;
2080
+ fi;
2081
+ done;
2082
+ fi;
2083
+ fi;
2084
+ if [ -z "$sourceRoot" ]; then
2085
+ echo "unpacker appears to have produced no directories";
2086
+ exit 1;
2087
+ fi;
2088
+ echo "source root is $sourceRoot";
2089
+ if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then
2090
+ chmod -R u+w -- "$sourceRoot";
2091
+ fi;
2092
+ runHook postUnpack
2093
+ }
2094
+ updateAutotoolsGnuConfigScriptsPhase ()
2095
+ {
2096
+
2097
+ if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then
2098
+ return;
2099
+ fi;
2100
+ for script in config.sub config.guess;
2101
+ do
2102
+ for f in $(find . -type f -name "$script");
2103
+ do
2104
+ echo "Updating Autotools / GNU config script to a newer upstream version: $f";
2105
+ cp -f "/nix/store/s3dj57ywp7j6az9xbc3yssjlwnlw335q-gnu-config-2024-01-01/$script" "$f";
2106
+ done;
2107
+ done
2108
+ }
2109
+ updateSourceDateEpoch ()
2110
+ {
2111
+
2112
+ local path="$1";
2113
+ [[ $path == -* ]] && path="./$path";
2114
+ local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ "%p"\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1));
2115
+ local time="${res[0]//\.[0-9]*/}";
2116
+ local newestFile="${res[1]}";
2117
+ if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then
2118
+ echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile";
2119
+ export SOURCE_DATE_EPOCH="$time";
2120
+ local now="$(date +%s)";
2121
+ if [ "$time" -gt $((now - 60)) ]; then
2122
+ echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic";
2123
+ fi;
2124
+ fi
2125
+ }
2126
+ PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}"
2127
+ XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}"
2128
+ export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)"
2129
+ export TMP="$NIX_BUILD_TOP"
2130
+ export TMPDIR="$NIX_BUILD_TOP"
2131
+ export TEMP="$NIX_BUILD_TOP"
2132
+ export TEMPDIR="$NIX_BUILD_TOP"
2133
+ eval "${shellHook:-}"
2134
+