diff options
Diffstat (limited to 'frontend/.direnv')
l--------- | frontend/.direnv/flake-profile | 1 | ||||
-rw-r--r-- | frontend/.direnv/flake-profile.rc | 1473 |
2 files changed, 0 insertions, 1474 deletions
diff --git a/frontend/.direnv/flake-profile b/frontend/.direnv/flake-profile deleted file mode 120000 index 6e8a8e9..0000000 --- a/frontend/.direnv/flake-profile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | /nix/store/m4z2i7h8x7xwac09q8gw4km9vhmi88ka-furby-env \ No newline at end of file | ||
diff --git a/frontend/.direnv/flake-profile.rc b/frontend/.direnv/flake-profile.rc deleted file mode 100644 index dff177f..0000000 --- a/frontend/.direnv/flake-profile.rc +++ /dev/null | |||
@@ -1,1473 +0,0 @@ | |||
1 | unset shellHook | ||
2 | nix_saved_PATH="$PATH" | ||
3 | AR=ar | ||
4 | export AR | ||
5 | AS=as | ||
6 | export AS | ||
7 | BASH=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash | ||
8 | CC=gcc | ||
9 | export CC | ||
10 | CONFIG_SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash | ||
11 | export CONFIG_SHELL | ||
12 | CXX=g++ | ||
13 | export CXX | ||
14 | DIRSTACK=() | ||
15 | GROUPS=() | ||
16 | HOSTTYPE=x86_64 | ||
17 | HOST_PATH=/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin | ||
18 | export HOST_PATH | ||
19 | IFS=$' \t\n' | ||
20 | IN_NIX_SHELL=impure | ||
21 | export IN_NIX_SHELL | ||
22 | LD=ld | ||
23 | export LD | ||
24 | MACHTYPE=x86_64-unknown-linux-gnu | ||
25 | NIX_BINTOOLS=/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1 | ||
26 | export NIX_BINTOOLS | ||
27 | NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 | ||
28 | export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST | ||
29 | NIX_BUILD_CORES=8 | ||
30 | export NIX_BUILD_CORES | ||
31 | NIX_CC=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 | ||
32 | export NIX_CC | ||
33 | NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 | ||
34 | export NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST | ||
35 | NIX_ENFORCE_NO_NATIVE=1 | ||
36 | export NIX_ENFORCE_NO_NATIVE | ||
37 | NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow' | ||
38 | export NIX_HARDENING_ENABLE | ||
39 | NIX_INDENT_MAKE=1 | ||
40 | export NIX_INDENT_MAKE | ||
41 | NIX_LDFLAGS='-rpath /home/np/code/elmstuff/app-furby/outputs/out/lib64 -rpath /home/np/code/elmstuff/app-furby/outputs/out/lib ' | ||
42 | export NIX_LDFLAGS | ||
43 | NIX_LIB64_IN_SELF_RPATH=1 | ||
44 | NIX_NO_SELF_RPATH=1 | ||
45 | NIX_STORE=/nix/store | ||
46 | export NIX_STORE | ||
47 | NM=nm | ||
48 | export NM | ||
49 | OBJCOPY=objcopy | ||
50 | export OBJCOPY | ||
51 | OBJDUMP=objdump | ||
52 | export OBJDUMP | ||
53 | OPTERR=1 | ||
54 | OPTIND=1 | ||
55 | OSTYPE=linux-gnu | ||
56 | PATH=/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9/bin:/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0/bin:/nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1/bin:/nix/store/hrkc2sf2883l16d5yq3zg0y339kfw4xv-binutils-2.31.1/bin:/nix/store/0k65d30z9xsixil10yw3bwajbdk4yskv-glibc-2.30-bin/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1/bin:/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3/bin:/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3/bin:/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1/bin:/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2/bin:/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31/bin:/nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0/bin:/nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7/bin:/nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8/bin:/nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4/bin:/nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1/bin:/nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32/bin:/nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10/bin:/nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin/bin:/nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1/bin:/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin:/nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6/bin:/nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin/bin | ||
57 | export PATH | ||
58 | PIPESTATUS=([0]="0") | ||
59 | PS4='+ ' | ||
60 | RANLIB=ranlib | ||
61 | export RANLIB | ||
62 | READELF=readelf | ||
63 | export READELF | ||
64 | SHELL=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash | ||
65 | export SHELL | ||
66 | SIZE=size | ||
67 | export SIZE | ||
68 | SOURCE_DATE_EPOCH=1 | ||
69 | export SOURCE_DATE_EPOCH | ||
70 | STRINGS=strings | ||
71 | export STRINGS | ||
72 | STRIP=strip | ||
73 | export STRIP | ||
74 | _=export | ||
75 | buildInputs='/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1 /nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3 /nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3 /nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1 /nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2' | ||
76 | export buildInputs | ||
77 | builder=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash | ||
78 | export builder | ||
79 | commonStripFlags=--enable-deterministic-archives | ||
80 | configureFlags= | ||
81 | export configureFlags | ||
82 | defaultBuildInputs= | ||
83 | defaultNativeBuildInputs='/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9 /nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh /nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh /nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh /nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0' | ||
84 | depsBuildBuild= | ||
85 | export depsBuildBuild | ||
86 | depsBuildBuildPropagated= | ||
87 | export depsBuildBuildPropagated | ||
88 | depsBuildTarget= | ||
89 | export depsBuildTarget | ||
90 | depsBuildTargetPropagated= | ||
91 | export depsBuildTargetPropagated | ||
92 | depsHostHost= | ||
93 | export depsHostHost | ||
94 | depsHostHostPropagated= | ||
95 | export depsHostHostPropagated | ||
96 | depsTargetTarget= | ||
97 | export depsTargetTarget | ||
98 | depsTargetTargetPropagated= | ||
99 | export depsTargetTargetPropagated | ||
100 | doCheck= | ||
101 | export doCheck | ||
102 | doInstallCheck= | ||
103 | export doInstallCheck | ||
104 | dontAddDisableDepTrack=1 | ||
105 | export dontAddDisableDepTrack | ||
106 | envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars") | ||
107 | envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars") | ||
108 | fixupOutputHooks=([0]="if [ -z \"\${dontPatchELF-}\" ]; then patchELF \"\$prefix\"; fi" [1]="_makeSymlinksRelative" [2]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [3]="_doStrip" [4]="patchShebangsAuto" [5]="_pruneLibtoolFiles" [6]="if [[ -z \"\${noAuditTmpdir-}\" && -e \"\$prefix\" ]]; then auditTmpdir \"\$prefix\"; fi" [7]="_moveSbin" [8]="_moveLib64") | ||
109 | initialPath='/nix/store/x0jla3hpxrwz76hy9yckg1iyc9hns81k-coreutils-8.31 /nix/store/97vambzyvpvrd9wgrrw7i7svi0s8vny5-findutils-4.7.0 /nix/store/dqq1bvpi3g0h4v05111b3i0ymqj4v5x1-diffutils-3.7 /nix/store/p34p7ysy84579lndk7rbrz6zsfr03y71-gnused-4.8 /nix/store/b0vjq4r4sp9z4l2gbkc5dyyw5qfgyi3r-gnugrep-3.4 /nix/store/c8balm59sxfkw9ik1fqbkadsvjqhmbx4-gawk-5.0.1 /nix/store/g7dr83wnkx4gxa5ykcljc5jg04416z60-gnutar-1.32 /nix/store/kkvgr3avpp7yd5hzmc4syh43jqj03sgb-gzip-1.10 /nix/store/rw96psqzgyqrcd12qr6ivk9yiskjm3ab-bzip2-1.0.6.0.1-bin /nix/store/dp6y0n9cba79wwc54n1brg7xbjsq5hka-gnumake-4.2.1 /nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23 /nix/store/xac1zfclx1xxgcd84vqb6hy3apl171n8-patch-2.7.6 /nix/store/mm0w8jc58rn01c4kz2n9jvwd6bibcihs-xz-5.2.4-bin' | ||
110 | name=furby | ||
111 | export name | ||
112 | nativeBuildInputs= | ||
113 | export nativeBuildInputs | ||
114 | out=/home/np/code/elmstuff/app-furby/outputs/out | ||
115 | export out | ||
116 | outputBin=out | ||
117 | outputDev=out | ||
118 | outputDevdoc=REMOVE | ||
119 | outputDevman=out | ||
120 | outputDoc=out | ||
121 | outputInclude=out | ||
122 | outputInfo=out | ||
123 | outputLib=out | ||
124 | outputMan=out | ||
125 | outputs=out | ||
126 | export outputs | ||
127 | patches= | ||
128 | export patches | ||
129 | pkg=/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 | ||
130 | pkgsBuildHost=([0]="/nix/store/71n1xcigc00w3z7yc836jqcx9cb2dys8-patchelf-0.9" [1]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [2]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [3]="/nix/store/rvg5a5nwa7cihpmbzlwzh931w3g4q108-compress-man-pages.sh" [4]="/nix/store/4ygqr4w06zwcd2kcxa6w3441jijv0pvx-strip.sh" [5]="/nix/store/g6hzqyjd3ricwbs0bbx4806fiwg15vnc-patch-shebangs.sh" [6]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [7]="/nix/store/8zxndz5ag0p6s526c2xyllhk1nrn4c3i-audit-tmpdir.sh" [8]="/nix/store/aknix5zw9cj7hd1m3h1d6nnmncl1vkvn-multiple-outputs.sh" [9]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [10]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [11]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [12]="/nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0" [13]="/nix/store/n48b8n251dwwb04q7f3fwxdmirsakllz-binutils-wrapper-2.31.1") | ||
131 | pkgsHostTarget=([0]="/nix/store/603kisq28l3prqr92z5hffh7fmwwsc9f-elm-0.19.1" [1]="/nix/store/amj35xgl7bhifnih0mh39j8kbvsvg2xn-node__at_elm-tooling_slash_elm-language-server-1.6.3" [2]="/nix/store/hzxpv4ha44w9pg8ynkfsgjhi3kb13h27-elm-format-0.8.3" [3]="/nix/store/w3sh9aki5wrchcrq2wlg2xb394f8brh4-node_elm-oracle-1.1.1" [4]="/nix/store/3yl8y2fkc1wsyqm008is2pdw5dja2icy-node_elm-test-0.19.1-revision2") | ||
132 | postFixupHooks=([0]="_multioutPropagateDev") | ||
133 | postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot") | ||
134 | preConfigureHooks=([0]="_multioutConfig") | ||
135 | preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs") | ||
136 | prefix=/home/np/code/elmstuff/app-furby/outputs/out | ||
137 | propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps") | ||
138 | propagatedBuildInputs= | ||
139 | export propagatedBuildInputs | ||
140 | propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs") | ||
141 | propagatedNativeBuildInputs= | ||
142 | export propagatedNativeBuildInputs | ||
143 | propagatedTargetDepFiles=([0]="propagated-target-target-deps") | ||
144 | shell=/nix/store/hrpvwkjz04s9i4nmli843hyw9z4pwhww-bash-4.4-p23/bin/bash | ||
145 | export shell | ||
146 | src=./. | ||
147 | export src | ||
148 | stdenv=/nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux | ||
149 | export stdenv | ||
150 | strictDeps= | ||
151 | export strictDeps | ||
152 | system=x86_64-linux | ||
153 | export system | ||
154 | unpackCmdHooks=([0]="_defaultUnpack") | ||
155 | PATH="$PATH:$nix_saved_PATH" | ||
156 | _activatePkgs () | ||
157 | { | ||
158 | local -i hostOffset targetOffset; | ||
159 | local pkg; | ||
160 | for hostOffset in "${allPlatOffsets[@]}"; | ||
161 | do | ||
162 | local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}"; | ||
163 | for targetOffset in "${allPlatOffsets[@]}"; | ||
164 | do | ||
165 | (( "$hostOffset" <= "$targetOffset" )) || continue; | ||
166 | local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; | ||
167 | local pkgsSlice="${!pkgsRef}[@]"; | ||
168 | for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; | ||
169 | do | ||
170 | activatePackage "$pkg" "$hostOffset" "$targetOffset"; | ||
171 | done; | ||
172 | done; | ||
173 | done | ||
174 | } | ||
175 | _addRpathPrefix () | ||
176 | { | ||
177 | if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then | ||
178 | export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; | ||
179 | if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then | ||
180 | export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}"; | ||
181 | fi; | ||
182 | if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then | ||
183 | export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}"; | ||
184 | fi; | ||
185 | fi | ||
186 | } | ||
187 | _addToEnv () | ||
188 | { | ||
189 | local -i depHostOffset depTargetOffset; | ||
190 | local pkg; | ||
191 | for depHostOffset in "${allPlatOffsets[@]}"; | ||
192 | do | ||
193 | local hookVar="${pkgHookVarVars[$depHostOffset + 1]}"; | ||
194 | local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}"; | ||
195 | for depTargetOffset in "${allPlatOffsets[@]}"; | ||
196 | do | ||
197 | (( "$depHostOffset" <= "$depTargetOffset" )) || continue; | ||
198 | local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; | ||
199 | if [[ -z "${strictDeps-}" ]]; then | ||
200 | local visitedPkgs=""; | ||
201 | for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}; | ||
202 | do | ||
203 | if [[ "$visitedPkgs" = *"$pkg"* ]]; then | ||
204 | continue; | ||
205 | fi; | ||
206 | runHook "${!hookRef}" "$pkg"; | ||
207 | visitedPkgs+=" $pkg"; | ||
208 | done; | ||
209 | else | ||
210 | local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; | ||
211 | local pkgsSlice="${!pkgsRef}[@]"; | ||
212 | for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; | ||
213 | do | ||
214 | runHook "${!hookRef}" "$pkg"; | ||
215 | done; | ||
216 | fi; | ||
217 | done; | ||
218 | done | ||
219 | } | ||
220 | _allFlags () | ||
221 | { | ||
222 | for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); | ||
223 | do | ||
224 | if (( "${NIX_DEBUG:-0}" >= 1 )); then | ||
225 | printf "@%s@ -> %q\n" "${varName}" "${!varName}"; | ||
226 | fi; | ||
227 | args+=("--subst-var" "$varName"); | ||
228 | done | ||
229 | } | ||
230 | _assignFirst () | ||
231 | { | ||
232 | local varName="$1"; | ||
233 | local REMOVE=REMOVE; | ||
234 | shift; | ||
235 | while (( $# )); do | ||
236 | if [ -n "${!1-}" ]; then | ||
237 | eval "${varName}"="$1"; | ||
238 | return; | ||
239 | fi; | ||
240 | shift; | ||
241 | done; | ||
242 | echo "Error: _assignFirst found no valid variant!"; | ||
243 | return 1 | ||
244 | } | ||
245 | _callImplicitHook () | ||
246 | { | ||
247 | local def="$1"; | ||
248 | local hookName="$2"; | ||
249 | if declare -F "$hookName" > /dev/null; then | ||
250 | "$hookName"; | ||
251 | else | ||
252 | if type -p "$hookName" > /dev/null; then | ||
253 | source "$hookName"; | ||
254 | else | ||
255 | if [ -n "${!hookName:-}" ]; then | ||
256 | eval "${!hookName}"; | ||
257 | else | ||
258 | return "$def"; | ||
259 | fi; | ||
260 | fi; | ||
261 | fi | ||
262 | } | ||
263 | _defaultUnpack () | ||
264 | { | ||
265 | local fn="$1"; | ||
266 | if [ -d "$fn" ]; then | ||
267 | cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"; | ||
268 | else | ||
269 | case "$fn" in | ||
270 | *.tar.xz | *.tar.lzma | *.txz) | ||
271 | xz -d < "$fn" | tar xf - | ||
272 | ;; | ||
273 | *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) | ||
274 | tar xf "$fn" | ||
275 | ;; | ||
276 | *) | ||
277 | return 1 | ||
278 | ;; | ||
279 | esac; | ||
280 | fi | ||
281 | } | ||
282 | _doStrip () | ||
283 | { | ||
284 | local -ra flags=(dontStripHost dontStripTarget); | ||
285 | local -ra stripCmds=(STRIP TARGET_STRIP); | ||
286 | if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then | ||
287 | dontStripTarget+=1; | ||
288 | fi; | ||
289 | local i; | ||
290 | for i in ${!stripCmds[@]}; | ||
291 | do | ||
292 | local -n flag="${flags[$i]}"; | ||
293 | local -n stripCmd="${stripCmds[$i]}"; | ||
294 | if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then | ||
295 | continue; | ||
296 | fi; | ||
297 | stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}; | ||
298 | if [ -n "$stripDebugList" ]; then | ||
299 | stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"; | ||
300 | fi; | ||
301 | stripAllList=${stripAllList:-}; | ||
302 | if [ -n "$stripAllList" ]; then | ||
303 | stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"; | ||
304 | fi; | ||
305 | done | ||
306 | } | ||
307 | _eval () | ||
308 | { | ||
309 | if declare -F "$1" > /dev/null 2>&1; then | ||
310 | "$@"; | ||
311 | else | ||
312 | eval "$1"; | ||
313 | fi | ||
314 | } | ||
315 | _makeSymlinksRelative () | ||
316 | { | ||
317 | local symlinkTarget; | ||
318 | if [ -n "${dontRewriteSymlinks-}" ]; then | ||
319 | return 0; | ||
320 | fi; | ||
321 | while IFS= read -r -d '' f; do | ||
322 | symlinkTarget=$(readlink "$f"); | ||
323 | if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then | ||
324 | continue; | ||
325 | fi; | ||
326 | if [ ! -e "$symlinkTarget" ]; then | ||
327 | echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; | ||
328 | fi; | ||
329 | echo "rewriting symlink $f to be relative to $prefix"; | ||
330 | ln -snrf "$symlinkTarget" "$f"; | ||
331 | done < <(find $prefix -type l -print0) | ||
332 | } | ||
333 | _moveLib64 () | ||
334 | { | ||
335 | if [ "${dontMoveLib64-}" = 1 ]; then | ||
336 | return; | ||
337 | fi; | ||
338 | if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then | ||
339 | return; | ||
340 | fi; | ||
341 | echo "moving $prefix/lib64/* to $prefix/lib"; | ||
342 | mkdir -p $prefix/lib; | ||
343 | shopt -s dotglob; | ||
344 | for i in $prefix/lib64/*; | ||
345 | do | ||
346 | mv --no-clobber "$i" $prefix/lib; | ||
347 | done; | ||
348 | shopt -u dotglob; | ||
349 | rmdir $prefix/lib64; | ||
350 | ln -s lib $prefix/lib64 | ||
351 | } | ||
352 | _moveSbin () | ||
353 | { | ||
354 | if [ "${dontMoveSbin-}" = 1 ]; then | ||
355 | return; | ||
356 | fi; | ||
357 | if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then | ||
358 | return; | ||
359 | fi; | ||
360 | echo "moving $prefix/sbin/* to $prefix/bin"; | ||
361 | mkdir -p $prefix/bin; | ||
362 | shopt -s dotglob; | ||
363 | for i in $prefix/sbin/*; | ||
364 | do | ||
365 | mv "$i" $prefix/bin; | ||
366 | done; | ||
367 | shopt -u dotglob; | ||
368 | rmdir $prefix/sbin; | ||
369 | ln -s bin $prefix/sbin | ||
370 | } | ||
371 | _moveToShare () | ||
372 | { | ||
373 | forceShare=${forceShare:=man doc info}; | ||
374 | if [ -z "$forceShare" -o -z "$out" ]; then | ||
375 | return; | ||
376 | fi; | ||
377 | for d in $forceShare; | ||
378 | do | ||
379 | if [ -d "$out/$d" ]; then | ||
380 | if [ -d "$out/share/$d" ]; then | ||
381 | echo "both $d/ and share/$d/ exist!"; | ||
382 | else | ||
383 | echo "moving $out/$d to $out/share/$d"; | ||
384 | mkdir -p $out/share; | ||
385 | mv $out/$d $out/share/; | ||
386 | fi; | ||
387 | fi; | ||
388 | done | ||
389 | } | ||
390 | _multioutConfig () | ||
391 | { | ||
392 | if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then | ||
393 | return; | ||
394 | fi; | ||
395 | if [ -z "$shareDocName" ]; then | ||
396 | local confScript="$configureScript"; | ||
397 | if [ -z "$confScript" ] && [ -x ./configure ]; then | ||
398 | confScript=./configure; | ||
399 | fi; | ||
400 | if [ -f "$confScript" ]; then | ||
401 | local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; | ||
402 | fi; | ||
403 | if [ -n "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then | ||
404 | shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; | ||
405 | fi; | ||
406 | fi; | ||
407 | configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!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 $configureFlags"; | ||
408 | installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags" | ||
409 | } | ||
410 | _multioutDevs () | ||
411 | { | ||
412 | if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then | ||
413 | return; | ||
414 | fi; | ||
415 | moveToOutput include "${!outputInclude}"; | ||
416 | moveToOutput lib/pkgconfig "${!outputDev}"; | ||
417 | moveToOutput share/pkgconfig "${!outputDev}"; | ||
418 | moveToOutput lib/cmake "${!outputDev}"; | ||
419 | moveToOutput share/aclocal "${!outputDev}"; | ||
420 | for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; | ||
421 | do | ||
422 | echo "Patching '$f' includedir to output ${!outputInclude}"; | ||
423 | sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; | ||
424 | done | ||
425 | } | ||
426 | _multioutDocs () | ||
427 | { | ||
428 | local REMOVE=REMOVE; | ||
429 | moveToOutput share/info "${!outputInfo}"; | ||
430 | moveToOutput share/doc "${!outputDoc}"; | ||
431 | moveToOutput share/gtk-doc "${!outputDevdoc}"; | ||
432 | moveToOutput share/devhelp/books "${!outputDevdoc}"; | ||
433 | moveToOutput share/man "${!outputMan}"; | ||
434 | moveToOutput share/man/man3 "${!outputDevman}" | ||
435 | } | ||
436 | _multioutPropagateDev () | ||
437 | { | ||
438 | if [ "$outputs" = "out" ]; then | ||
439 | return; | ||
440 | fi; | ||
441 | local outputFirst; | ||
442 | for outputFirst in $outputs; | ||
443 | do | ||
444 | break; | ||
445 | done; | ||
446 | local propagaterOutput="$outputDev"; | ||
447 | if [ -z "$propagaterOutput" ]; then | ||
448 | propagaterOutput="$outputFirst"; | ||
449 | fi; | ||
450 | if [ -z "${propagatedBuildOutputs+1}" ]; then | ||
451 | local po_dirty="$outputBin $outputInclude $outputLib"; | ||
452 | set +o pipefail; | ||
453 | propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; | ||
454 | set -o pipefail; | ||
455 | fi; | ||
456 | if [ -z "$propagatedBuildOutputs" ]; then | ||
457 | return; | ||
458 | fi; | ||
459 | mkdir -p "${!propagaterOutput}"/nix-support; | ||
460 | for output in $propagatedBuildOutputs; | ||
461 | do | ||
462 | echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; | ||
463 | done | ||
464 | } | ||
465 | _overrideFirst () | ||
466 | { | ||
467 | if [ -z "${!1-}" ]; then | ||
468 | _assignFirst "$@"; | ||
469 | fi | ||
470 | } | ||
471 | _pruneLibtoolFiles () | ||
472 | { | ||
473 | if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then | ||
474 | return; | ||
475 | fi; | ||
476 | 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" \; | ||
477 | } | ||
478 | _updateSourceDateEpochFromSourceRoot () | ||
479 | { | ||
480 | if [ -n "$sourceRoot" ]; then | ||
481 | updateSourceDateEpoch "$sourceRoot"; | ||
482 | fi | ||
483 | } | ||
484 | activatePackage () | ||
485 | { | ||
486 | local pkg="$1"; | ||
487 | local -ri hostOffset="$2"; | ||
488 | local -ri targetOffset="$3"; | ||
489 | (( "$hostOffset" <= "$targetOffset" )) || exit -1; | ||
490 | if [ -f "$pkg" ]; then | ||
491 | source "$pkg"; | ||
492 | fi; | ||
493 | if [[ ( -z "${strictDeps-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then | ||
494 | addToSearchPath _PATH "$pkg/bin"; | ||
495 | fi; | ||
496 | if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then | ||
497 | addToSearchPath _HOST_PATH "$pkg/bin"; | ||
498 | fi; | ||
499 | if [[ -f "$pkg/nix-support/setup-hook" ]]; then | ||
500 | source "$pkg/nix-support/setup-hook"; | ||
501 | fi | ||
502 | } | ||
503 | addEnvHooks () | ||
504 | { | ||
505 | local depHostOffset="$1"; | ||
506 | shift; | ||
507 | local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; | ||
508 | local pkgHookVar; | ||
509 | for pkgHookVar in "${!pkgHookVarsSlice}"; | ||
510 | do | ||
511 | eval "${pkgHookVar}s"'+=("$@")'; | ||
512 | done | ||
513 | } | ||
514 | addToSearchPath () | ||
515 | { | ||
516 | addToSearchPathWithCustomDelimiter ":" "$@" | ||
517 | } | ||
518 | addToSearchPathWithCustomDelimiter () | ||
519 | { | ||
520 | local delimiter="$1"; | ||
521 | local varName="$2"; | ||
522 | local dir="$3"; | ||
523 | if [ -d "$dir" ]; then | ||
524 | export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; | ||
525 | fi | ||
526 | } | ||
527 | auditTmpdir () | ||
528 | { | ||
529 | local dir="$1"; | ||
530 | [ -e "$dir" ] || return 0; | ||
531 | header "checking for references to $TMPDIR/ in $dir..."; | ||
532 | local i; | ||
533 | while IFS= read -r -d '' i; do | ||
534 | if [[ "$i" =~ .build-id ]]; then | ||
535 | continue; | ||
536 | fi; | ||
537 | if isELF "$i"; then | ||
538 | if { | ||
539 | printf :; | ||
540 | patchelf --print-rpath "$i" | ||
541 | } | grep -q -F ":$TMPDIR/"; then | ||
542 | echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; | ||
543 | exit 1; | ||
544 | fi; | ||
545 | fi; | ||
546 | if isScript "$i"; then | ||
547 | if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then | ||
548 | if grep -q -F "$TMPDIR/" "$i"; then | ||
549 | echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; | ||
550 | exit 1; | ||
551 | fi; | ||
552 | fi; | ||
553 | fi; | ||
554 | done < <(find "$dir" -type f -print0); | ||
555 | stopNest | ||
556 | } | ||
557 | bintoolsWrapper_addLDVars () | ||
558 | { | ||
559 | local role_post role_pre; | ||
560 | getHostRoleEnvHook; | ||
561 | if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then | ||
562 | export NIX_${role_pre}LDFLAGS+=" -L$1/lib64"; | ||
563 | fi; | ||
564 | if [[ -d "$1/lib" ]]; then | ||
565 | local -a glob=($1/lib/lib*); | ||
566 | if [ "${#glob[*]}" -gt 0 ]; then | ||
567 | export NIX_${role_pre}LDFLAGS+=" -L$1/lib"; | ||
568 | fi; | ||
569 | fi | ||
570 | } | ||
571 | buildPhase () | ||
572 | { | ||
573 | runHook preBuild; | ||
574 | : ${makeFlags=}; | ||
575 | if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then | ||
576 | echo "no Makefile, doing nothing"; | ||
577 | else | ||
578 | foundMakefile=1; | ||
579 | local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}); | ||
580 | echoCmd 'build flags' "${flagsArray[@]}"; | ||
581 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
582 | unset flagsArray; | ||
583 | fi; | ||
584 | runHook postBuild | ||
585 | } | ||
586 | ccWrapper_addCVars () | ||
587 | { | ||
588 | local role_post role_pre; | ||
589 | getHostRoleEnvHook; | ||
590 | if [ -d "$1/include" ]; then | ||
591 | export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include"; | ||
592 | fi; | ||
593 | if [ -d "$1/Library/Frameworks" ]; then | ||
594 | export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks"; | ||
595 | fi | ||
596 | } | ||
597 | checkPhase () | ||
598 | { | ||
599 | runHook preCheck; | ||
600 | if [[ -z "${foundMakefile:-}" ]]; then | ||
601 | echo "no Makefile or custom buildPhase, doing nothing"; | ||
602 | runHook postCheck; | ||
603 | return; | ||
604 | fi; | ||
605 | if [[ -z "${checkTarget:-}" ]]; then | ||
606 | if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then | ||
607 | checkTarget=check; | ||
608 | else | ||
609 | if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then | ||
610 | checkTarget=test; | ||
611 | fi; | ||
612 | fi; | ||
613 | fi; | ||
614 | if [[ -z "${checkTarget:-}" ]]; then | ||
615 | echo "no check/test target in ${makefile:-Makefile}, doing nothing"; | ||
616 | else | ||
617 | local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget}); | ||
618 | echoCmd 'check flags' "${flagsArray[@]}"; | ||
619 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
620 | unset flagsArray; | ||
621 | fi; | ||
622 | runHook postCheck | ||
623 | } | ||
624 | closeNest () | ||
625 | { | ||
626 | true | ||
627 | } | ||
628 | compressManPages () | ||
629 | { | ||
630 | local dir="$1"; | ||
631 | if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then | ||
632 | return; | ||
633 | fi; | ||
634 | echo "gzipping man pages under $dir/share/man/"; | ||
635 | find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do | ||
636 | if gzip -c -n "$f" > "$f".gz; then | ||
637 | rm "$f"; | ||
638 | else | ||
639 | rm "$f".gz; | ||
640 | fi; | ||
641 | done; | ||
642 | find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do | ||
643 | local target; | ||
644 | target="$(readlink -f "$f")"; | ||
645 | if [ -f "$target".gz ]; then | ||
646 | ln -sf "$target".gz "$f".gz && rm "$f"; | ||
647 | fi; | ||
648 | done | ||
649 | } | ||
650 | configurePhase () | ||
651 | { | ||
652 | runHook preConfigure; | ||
653 | : ${configureScript=}; | ||
654 | : ${configureFlags=}; | ||
655 | if [[ -z "$configureScript" && -x ./configure ]]; then | ||
656 | configureScript=./configure; | ||
657 | fi; | ||
658 | if [ -z "${dontFixLibtool:-}" ]; then | ||
659 | local i; | ||
660 | find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do | ||
661 | echo "fixing libtool script $i"; | ||
662 | fixLibtool "$i"; | ||
663 | done; | ||
664 | fi; | ||
665 | if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then | ||
666 | configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"; | ||
667 | fi; | ||
668 | if [ -z "${dontAddDisableDepTrack:-}" ]; then | ||
669 | if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then | ||
670 | configureFlags="--disable-dependency-tracking $configureFlags"; | ||
671 | fi; | ||
672 | fi; | ||
673 | if [ -z "${dontDisableStatic:-}" ]; then | ||
674 | if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then | ||
675 | configureFlags="--disable-static $configureFlags"; | ||
676 | fi; | ||
677 | fi; | ||
678 | if [ -n "$configureScript" ]; then | ||
679 | local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"}); | ||
680 | echoCmd 'configure flags' "${flagsArray[@]}"; | ||
681 | $configureScript "${flagsArray[@]}"; | ||
682 | unset flagsArray; | ||
683 | else | ||
684 | echo "no configure script, doing nothing"; | ||
685 | fi; | ||
686 | runHook postConfigure | ||
687 | } | ||
688 | consumeEntire () | ||
689 | { | ||
690 | if IFS='' read -r -N 0 $1; then | ||
691 | echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; | ||
692 | return 1; | ||
693 | fi | ||
694 | } | ||
695 | distPhase () | ||
696 | { | ||
697 | runHook preDist; | ||
698 | local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}); | ||
699 | echo 'dist flags: %q' "${flagsArray[@]}"; | ||
700 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
701 | if [ "${dontCopyDist:-0}" != 1 ]; then | ||
702 | mkdir -p "$out/tarballs"; | ||
703 | cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"; | ||
704 | fi; | ||
705 | runHook postDist | ||
706 | } | ||
707 | dumpVars () | ||
708 | { | ||
709 | if [ "${noDumpEnvVars:-0}" != 1 ]; then | ||
710 | export > "$NIX_BUILD_TOP/env-vars" || true; | ||
711 | fi | ||
712 | } | ||
713 | echoCmd () | ||
714 | { | ||
715 | printf "%s:" "$1"; | ||
716 | shift; | ||
717 | printf ' %q' "$@"; | ||
718 | echo | ||
719 | } | ||
720 | exitHandler () | ||
721 | { | ||
722 | exitCode="$?"; | ||
723 | set +e; | ||
724 | if [ -n "${showBuildStats:-}" ]; then | ||
725 | times > "$NIX_BUILD_TOP/.times"; | ||
726 | local -a times=($(cat "$NIX_BUILD_TOP/.times")); | ||
727 | echo "build time elapsed: " "${times[@]}"; | ||
728 | fi; | ||
729 | if (( "$exitCode" != 0 )); then | ||
730 | runHook failureHook; | ||
731 | if [ -n "${succeedOnFailure:-}" ]; then | ||
732 | echo "build failed with exit code $exitCode (ignored)"; | ||
733 | mkdir -p "$out/nix-support"; | ||
734 | printf "%s" "$exitCode" > "$out/nix-support/failed"; | ||
735 | exit 0; | ||
736 | fi; | ||
737 | else | ||
738 | runHook exitHook; | ||
739 | fi; | ||
740 | exit "$exitCode" | ||
741 | } | ||
742 | findInputs () | ||
743 | { | ||
744 | local -r pkg="$1"; | ||
745 | local -ri hostOffset="$2"; | ||
746 | local -ri targetOffset="$3"; | ||
747 | (( "$hostOffset" <= "$targetOffset" )) || exit -1; | ||
748 | local varVar="${pkgAccumVarVars[$hostOffset + 1]}"; | ||
749 | local varRef="$varVar[\$targetOffset - \$hostOffset]"; | ||
750 | local var="${!varRef}"; | ||
751 | unset -v varVar varRef; | ||
752 | local varSlice="$var[*]"; | ||
753 | case "${!varSlice-}" in | ||
754 | *" $pkg "*) | ||
755 | return 0 | ||
756 | ;; | ||
757 | esac; | ||
758 | unset -v varSlice; | ||
759 | eval "$var"'+=("$pkg")'; | ||
760 | if ! [ -e "$pkg" ]; then | ||
761 | echo "build input $pkg does not exist" 1>&2; | ||
762 | exit 1; | ||
763 | fi; | ||
764 | local -i mapOffsetResult; | ||
765 | function mapOffset () | ||
766 | { | ||
767 | local -ri inputOffset="$1"; | ||
768 | if (( "$inputOffset" <= 0 )); then | ||
769 | local -ri outputOffset="$inputOffset + $hostOffset"; | ||
770 | else | ||
771 | local -ri outputOffset="$inputOffset - 1 + $targetOffset"; | ||
772 | fi; | ||
773 | mapOffsetResult="$outputOffset" | ||
774 | }; | ||
775 | local -i relHostOffset; | ||
776 | for relHostOffset in "${allPlatOffsets[@]}"; | ||
777 | do | ||
778 | local files="${propagatedDepFilesVars[$relHostOffset + 1]}"; | ||
779 | mapOffset relHostOffset; | ||
780 | local -i hostOffsetNext="$mapOffsetResult"; | ||
781 | [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue; | ||
782 | local -i relTargetOffset; | ||
783 | for relTargetOffset in "${allPlatOffsets[@]}"; | ||
784 | do | ||
785 | (( "$relHostOffset" <= "$relTargetOffset" )) || continue; | ||
786 | local fileRef="${files}[$relTargetOffset - $relHostOffset]"; | ||
787 | local file="${!fileRef}"; | ||
788 | unset -v fileRef; | ||
789 | mapOffset relTargetOffset; | ||
790 | local -i targetOffsetNext="$mapOffsetResult"; | ||
791 | [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue; | ||
792 | [[ -f "$pkg/nix-support/$file" ]] || continue; | ||
793 | local pkgNext; | ||
794 | read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; | ||
795 | for pkgNext in $pkgNext; | ||
796 | do | ||
797 | findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; | ||
798 | done; | ||
799 | done; | ||
800 | done | ||
801 | } | ||
802 | fixLibtool () | ||
803 | { | ||
804 | sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1" | ||
805 | } | ||
806 | fixupPhase () | ||
807 | { | ||
808 | local output; | ||
809 | for output in $outputs; | ||
810 | do | ||
811 | if [ -e "${!output}" ]; then | ||
812 | chmod -R u+w "${!output}"; | ||
813 | fi; | ||
814 | done; | ||
815 | runHook preFixup; | ||
816 | local output; | ||
817 | for output in $outputs; | ||
818 | do | ||
819 | prefix="${!output}" runHook fixupOutput; | ||
820 | done; | ||
821 | declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); | ||
822 | declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); | ||
823 | local propagatedInputsIndex; | ||
824 | for propagatedInputsIndex in "${!flatVars[@]}"; | ||
825 | do | ||
826 | local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; | ||
827 | local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; | ||
828 | [[ -n "${!propagatedInputsSlice}" ]] || continue; | ||
829 | mkdir -p "${!outputDev}/nix-support"; | ||
830 | printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; | ||
831 | done; | ||
832 | if [ -n "${setupHook:-}" ]; then | ||
833 | mkdir -p "${!outputDev}/nix-support"; | ||
834 | substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; | ||
835 | fi; | ||
836 | if [ -n "${setupHooks:-}" ]; then | ||
837 | mkdir -p "${!outputDev}/nix-support"; | ||
838 | local hook; | ||
839 | for hook in $setupHooks; | ||
840 | do | ||
841 | local content; | ||
842 | consumeEntire content < "$hook"; | ||
843 | substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; | ||
844 | unset -v content; | ||
845 | done; | ||
846 | unset -v hook; | ||
847 | fi; | ||
848 | if [ -n "${propagatedUserEnvPkgs:-}" ]; then | ||
849 | mkdir -p "${!outputBin}/nix-support"; | ||
850 | printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; | ||
851 | fi; | ||
852 | runHook postFixup | ||
853 | } | ||
854 | genericBuild () | ||
855 | { | ||
856 | if [ -f "${buildCommandPath:-}" ]; then | ||
857 | source "$buildCommandPath"; | ||
858 | return; | ||
859 | fi; | ||
860 | if [ -n "${buildCommand:-}" ]; then | ||
861 | eval "$buildCommand"; | ||
862 | return; | ||
863 | fi; | ||
864 | if [ -z "${phases:-}" ]; then | ||
865 | phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}"; | ||
866 | fi; | ||
867 | for curPhase in $phases; | ||
868 | do | ||
869 | if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then | ||
870 | continue; | ||
871 | fi; | ||
872 | if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then | ||
873 | continue; | ||
874 | fi; | ||
875 | if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then | ||
876 | continue; | ||
877 | fi; | ||
878 | if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then | ||
879 | continue; | ||
880 | fi; | ||
881 | if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then | ||
882 | continue; | ||
883 | fi; | ||
884 | if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then | ||
885 | continue; | ||
886 | fi; | ||
887 | if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then | ||
888 | continue; | ||
889 | fi; | ||
890 | if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then | ||
891 | continue; | ||
892 | fi; | ||
893 | if [[ -n $NIX_LOG_FD ]]; then | ||
894 | echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD; | ||
895 | fi; | ||
896 | showPhaseHeader "$curPhase"; | ||
897 | dumpVars; | ||
898 | eval "${!curPhase:-$curPhase}"; | ||
899 | if [ "$curPhase" = unpackPhase ]; then | ||
900 | cd "${sourceRoot:-.}"; | ||
901 | fi; | ||
902 | done | ||
903 | } | ||
904 | getHostRole () | ||
905 | { | ||
906 | getRole "$hostOffset" | ||
907 | } | ||
908 | getHostRoleEnvHook () | ||
909 | { | ||
910 | getRole "$depHostOffset" | ||
911 | } | ||
912 | getRole () | ||
913 | { | ||
914 | case $1 in | ||
915 | -1) | ||
916 | role_pre='BUILD_'; | ||
917 | role_post='_FOR_BUILD' | ||
918 | ;; | ||
919 | 0) | ||
920 | role_pre=''; | ||
921 | role_post='' | ||
922 | ;; | ||
923 | 1) | ||
924 | role_pre='TARGET_'; | ||
925 | role_post='_FOR_TARGET' | ||
926 | ;; | ||
927 | *) | ||
928 | echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; | ||
929 | return 1 | ||
930 | ;; | ||
931 | esac | ||
932 | } | ||
933 | getTargetRole () | ||
934 | { | ||
935 | getRole "$targetOffset" | ||
936 | } | ||
937 | getTargetRoleEnvHook () | ||
938 | { | ||
939 | getRole "$depTargetOffset" | ||
940 | } | ||
941 | getTargetRoleWrapper () | ||
942 | { | ||
943 | case $targetOffset in | ||
944 | -1) | ||
945 | export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_BUILD=1 | ||
946 | ;; | ||
947 | 0) | ||
948 | export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST=1 | ||
949 | ;; | ||
950 | 1) | ||
951 | export NIX_BINTOOLS_WRAPPER_x86_64_unknown_linux_gnu_TARGET_TARGET=1 | ||
952 | ;; | ||
953 | *) | ||
954 | echo "binutils-wrapper-2.31.1: used as improper sort of dependency" > 2; | ||
955 | return 1 | ||
956 | ;; | ||
957 | esac | ||
958 | } | ||
959 | header () | ||
960 | { | ||
961 | echo "$1" | ||
962 | } | ||
963 | installCheckPhase () | ||
964 | { | ||
965 | runHook preInstallCheck; | ||
966 | if [[ -z "${foundMakefile:-}" ]]; then | ||
967 | echo "no Makefile or custom buildPhase, doing nothing"; | ||
968 | else | ||
969 | if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then | ||
970 | echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; | ||
971 | else | ||
972 | local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck}); | ||
973 | echoCmd 'installcheck flags' "${flagsArray[@]}"; | ||
974 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
975 | unset flagsArray; | ||
976 | fi; | ||
977 | fi; | ||
978 | runHook postInstallCheck | ||
979 | } | ||
980 | installPhase () | ||
981 | { | ||
982 | runHook preInstall; | ||
983 | if [ -n "$prefix" ]; then | ||
984 | mkdir -p "$prefix"; | ||
985 | fi; | ||
986 | local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install}); | ||
987 | echoCmd 'install flags' "${flagsArray[@]}"; | ||
988 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
989 | unset flagsArray; | ||
990 | runHook postInstall | ||
991 | } | ||
992 | isELF () | ||
993 | { | ||
994 | local fn="$1"; | ||
995 | local fd; | ||
996 | local magic; | ||
997 | exec {fd}< "$fn"; | ||
998 | read -r -n 4 -u "$fd" magic; | ||
999 | exec {fd}>&-; | ||
1000 | if [ "$magic" = 'ELF' ]; then | ||
1001 | return 0; | ||
1002 | else | ||
1003 | return 1; | ||
1004 | fi | ||
1005 | } | ||
1006 | isScript () | ||
1007 | { | ||
1008 | local fn="$1"; | ||
1009 | local fd; | ||
1010 | local magic; | ||
1011 | exec {fd}< "$fn"; | ||
1012 | read -r -n 2 -u "$fd" magic; | ||
1013 | exec {fd}>&-; | ||
1014 | if [[ "$magic" =~ \#! ]]; then | ||
1015 | return 0; | ||
1016 | else | ||
1017 | return 1; | ||
1018 | fi | ||
1019 | } | ||
1020 | mapOffset () | ||
1021 | { | ||
1022 | local -ri inputOffset="$1"; | ||
1023 | if (( "$inputOffset" <= 0 )); then | ||
1024 | local -ri outputOffset="$inputOffset + $hostOffset"; | ||
1025 | else | ||
1026 | local -ri outputOffset="$inputOffset - 1 + $targetOffset"; | ||
1027 | fi; | ||
1028 | mapOffsetResult="$outputOffset" | ||
1029 | } | ||
1030 | moveToOutput () | ||
1031 | { | ||
1032 | local patt="$1"; | ||
1033 | local dstOut="$2"; | ||
1034 | local output; | ||
1035 | for output in $outputs; | ||
1036 | do | ||
1037 | if [ "${!output}" = "$dstOut" ]; then | ||
1038 | continue; | ||
1039 | fi; | ||
1040 | local srcPath; | ||
1041 | for srcPath in "${!output}"/$patt; | ||
1042 | do | ||
1043 | if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then | ||
1044 | continue; | ||
1045 | fi; | ||
1046 | if [ "$dstOut" = REMOVE ]; then | ||
1047 | echo "Removing $srcPath"; | ||
1048 | rm -r "$srcPath"; | ||
1049 | else | ||
1050 | local dstPath="$dstOut${srcPath#${!output}}"; | ||
1051 | echo "Moving $srcPath to $dstPath"; | ||
1052 | if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then | ||
1053 | rmdir "$srcPath" --ignore-fail-on-non-empty; | ||
1054 | if [ -d "$srcPath" ]; then | ||
1055 | mv -t "$dstPath" "$srcPath"/*; | ||
1056 | rmdir "$srcPath"; | ||
1057 | fi; | ||
1058 | else | ||
1059 | mkdir -p "$(readlink -m "$dstPath/..")"; | ||
1060 | mv "$srcPath" "$dstPath"; | ||
1061 | fi; | ||
1062 | fi; | ||
1063 | local srcParent="$(readlink -m "$srcPath/..")"; | ||
1064 | if rmdir "$srcParent"; then | ||
1065 | echo "Removing empty $srcParent/ and (possibly) its parents"; | ||
1066 | rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true; | ||
1067 | fi; | ||
1068 | done; | ||
1069 | done | ||
1070 | } | ||
1071 | patchELF () | ||
1072 | { | ||
1073 | local dir="$1"; | ||
1074 | [ -e "$dir" ] || return 0; | ||
1075 | header "shrinking RPATHs of ELF executables and libraries in $dir"; | ||
1076 | local i; | ||
1077 | while IFS= read -r -d '' i; do | ||
1078 | if [[ "$i" =~ .build-id ]]; then | ||
1079 | continue; | ||
1080 | fi; | ||
1081 | if ! isELF "$i"; then | ||
1082 | continue; | ||
1083 | fi; | ||
1084 | echo "shrinking $i"; | ||
1085 | patchelf --shrink-rpath "$i" || true; | ||
1086 | done < <(find "$dir" -type f -print0); | ||
1087 | stopNest | ||
1088 | } | ||
1089 | patchPhase () | ||
1090 | { | ||
1091 | runHook prePatch; | ||
1092 | for i in ${patches:-}; | ||
1093 | do | ||
1094 | header "applying patch $i" 3; | ||
1095 | local uncompress=cat; | ||
1096 | case "$i" in | ||
1097 | *.gz) | ||
1098 | uncompress="gzip -d" | ||
1099 | ;; | ||
1100 | *.bz2) | ||
1101 | uncompress="bzip2 -d" | ||
1102 | ;; | ||
1103 | *.xz) | ||
1104 | uncompress="xz -d" | ||
1105 | ;; | ||
1106 | *.lzma) | ||
1107 | uncompress="lzma -d" | ||
1108 | ;; | ||
1109 | esac; | ||
1110 | $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1}; | ||
1111 | done; | ||
1112 | runHook postPatch | ||
1113 | } | ||
1114 | patchShebangs () | ||
1115 | { | ||
1116 | local pathName; | ||
1117 | if [ "$1" = "--host" ]; then | ||
1118 | pathName=HOST_PATH; | ||
1119 | shift; | ||
1120 | else | ||
1121 | if [ "$1" = "--build" ]; then | ||
1122 | pathName=PATH; | ||
1123 | shift; | ||
1124 | fi; | ||
1125 | fi; | ||
1126 | echo "patching script interpreter paths in $@"; | ||
1127 | local f; | ||
1128 | local oldPath; | ||
1129 | local newPath; | ||
1130 | local arg0; | ||
1131 | local args; | ||
1132 | local oldInterpreterLine; | ||
1133 | local newInterpreterLine; | ||
1134 | if [ $# -eq 0 ]; then | ||
1135 | echo "No arguments supplied to patchShebangs" > 0; | ||
1136 | return 0; | ||
1137 | fi; | ||
1138 | local f; | ||
1139 | while IFS= read -r -d '' f; do | ||
1140 | isScript "$f" || continue; | ||
1141 | oldInterpreterLine=$(head -1 "$f" | tail -c+3); | ||
1142 | read -r oldPath arg0 args <<< "$oldInterpreterLine"; | ||
1143 | if [ -z "$pathName" ]; then | ||
1144 | if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then | ||
1145 | pathName=HOST_PATH; | ||
1146 | else | ||
1147 | pathName=PATH; | ||
1148 | fi; | ||
1149 | fi; | ||
1150 | if $(echo "$oldPath" | grep -q "/bin/env$"); then | ||
1151 | if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then | ||
1152 | echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" > 0; | ||
1153 | exit 1; | ||
1154 | fi; | ||
1155 | newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; | ||
1156 | else | ||
1157 | if [ "$oldPath" = "" ]; then | ||
1158 | oldPath="/bin/sh"; | ||
1159 | fi; | ||
1160 | newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; | ||
1161 | args="$arg0 $args"; | ||
1162 | fi; | ||
1163 | newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"; | ||
1164 | if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then | ||
1165 | if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then | ||
1166 | echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; | ||
1167 | escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g'); | ||
1168 | timestamp=$(mktemp); | ||
1169 | touch -r "$f" "$timestamp"; | ||
1170 | sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; | ||
1171 | touch -r "$timestamp" "$f"; | ||
1172 | rm "$timestamp"; | ||
1173 | fi; | ||
1174 | fi; | ||
1175 | done < <(find "$@" -type f -perm -0100 -print0); | ||
1176 | stopNest | ||
1177 | } | ||
1178 | patchShebangsAuto () | ||
1179 | { | ||
1180 | if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then | ||
1181 | if [ "$output" != out ] && [ "$output" = "$outputDev" ]; then | ||
1182 | patchShebangs --build "$prefix"; | ||
1183 | else | ||
1184 | patchShebangs --host "$prefix"; | ||
1185 | fi; | ||
1186 | fi | ||
1187 | } | ||
1188 | printLines () | ||
1189 | { | ||
1190 | (( "$#" > 0 )) || return 0; | ||
1191 | printf '%s\n' "$@" | ||
1192 | } | ||
1193 | printWords () | ||
1194 | { | ||
1195 | (( "$#" > 0 )) || return 0; | ||
1196 | printf '%s ' "$@" | ||
1197 | } | ||
1198 | runHook () | ||
1199 | { | ||
1200 | local hookName="$1"; | ||
1201 | shift; | ||
1202 | local hooksSlice="${hookName%Hook}Hooks[@]"; | ||
1203 | local hook; | ||
1204 | for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; | ||
1205 | do | ||
1206 | _eval "$hook" "$@"; | ||
1207 | done; | ||
1208 | return 0 | ||
1209 | } | ||
1210 | runOneHook () | ||
1211 | { | ||
1212 | local hookName="$1"; | ||
1213 | shift; | ||
1214 | local hooksSlice="${hookName%Hook}Hooks[@]"; | ||
1215 | local hook ret=1; | ||
1216 | for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; | ||
1217 | do | ||
1218 | if _eval "$hook" "$@"; then | ||
1219 | ret=0; | ||
1220 | break; | ||
1221 | fi; | ||
1222 | done; | ||
1223 | return "$ret" | ||
1224 | } | ||
1225 | showPhaseHeader () | ||
1226 | { | ||
1227 | local phase="$1"; | ||
1228 | case "$phase" in | ||
1229 | unpackPhase) | ||
1230 | header "unpacking sources" | ||
1231 | ;; | ||
1232 | patchPhase) | ||
1233 | header "patching sources" | ||
1234 | ;; | ||
1235 | configurePhase) | ||
1236 | header "configuring" | ||
1237 | ;; | ||
1238 | buildPhase) | ||
1239 | header "building" | ||
1240 | ;; | ||
1241 | checkPhase) | ||
1242 | header "running tests" | ||
1243 | ;; | ||
1244 | installPhase) | ||
1245 | header "installing" | ||
1246 | ;; | ||
1247 | fixupPhase) | ||
1248 | header "post-installation fixup" | ||
1249 | ;; | ||
1250 | installCheckPhase) | ||
1251 | header "running install tests" | ||
1252 | ;; | ||
1253 | *) | ||
1254 | header "$phase" | ||
1255 | ;; | ||
1256 | esac | ||
1257 | } | ||
1258 | stopNest () | ||
1259 | { | ||
1260 | true | ||
1261 | } | ||
1262 | stripDirs () | ||
1263 | { | ||
1264 | local cmd="$1"; | ||
1265 | local dirs="$2"; | ||
1266 | local stripFlags="$3"; | ||
1267 | local dirsNew=; | ||
1268 | local d; | ||
1269 | for d in ${dirs}; | ||
1270 | do | ||
1271 | if [ -d "$prefix/$d" ]; then | ||
1272 | dirsNew="${dirsNew} $prefix/$d "; | ||
1273 | fi; | ||
1274 | done; | ||
1275 | dirs=${dirsNew}; | ||
1276 | if [ -n "${dirs}" ]; then | ||
1277 | header "stripping (with command $cmd and flags $stripFlags) in$dirs"; | ||
1278 | find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2> /dev/null || true; | ||
1279 | stopNest; | ||
1280 | fi | ||
1281 | } | ||
1282 | stripHash () | ||
1283 | { | ||
1284 | local strippedName casematchOpt=0; | ||
1285 | strippedName="$(basename -- "$1")"; | ||
1286 | shopt -q nocasematch && casematchOpt=1; | ||
1287 | shopt -u nocasematch; | ||
1288 | if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then | ||
1289 | echo "${strippedName:33}"; | ||
1290 | else | ||
1291 | echo "$strippedName"; | ||
1292 | fi; | ||
1293 | if (( casematchOpt )); then | ||
1294 | shopt -s nocasematch; | ||
1295 | fi | ||
1296 | } | ||
1297 | substitute () | ||
1298 | { | ||
1299 | local input="$1"; | ||
1300 | local output="$2"; | ||
1301 | shift 2; | ||
1302 | if [ ! -f "$input" ]; then | ||
1303 | echo "substitute(): ERROR: file '$input' does not exist" 1>&2; | ||
1304 | return 1; | ||
1305 | fi; | ||
1306 | local content; | ||
1307 | consumeEntire content < "$input"; | ||
1308 | if [ -e "$output" ]; then | ||
1309 | chmod +w "$output"; | ||
1310 | fi; | ||
1311 | substituteStream content "file '$input'" "$@" > "$output" | ||
1312 | } | ||
1313 | substituteAll () | ||
1314 | { | ||
1315 | local input="$1"; | ||
1316 | local output="$2"; | ||
1317 | local -a args=(); | ||
1318 | _allFlags; | ||
1319 | substitute "$input" "$output" "${args[@]}" | ||
1320 | } | ||
1321 | substituteAllInPlace () | ||
1322 | { | ||
1323 | local fileName="$1"; | ||
1324 | shift; | ||
1325 | substituteAll "$fileName" "$fileName" "$@" | ||
1326 | } | ||
1327 | substituteAllStream () | ||
1328 | { | ||
1329 | local -a args=(); | ||
1330 | _allFlags; | ||
1331 | substituteStream "$1" "$2" "${args[@]}" | ||
1332 | } | ||
1333 | substituteInPlace () | ||
1334 | { | ||
1335 | local fileName="$1"; | ||
1336 | shift; | ||
1337 | substitute "$fileName" "$fileName" "$@" | ||
1338 | } | ||
1339 | substituteStream () | ||
1340 | { | ||
1341 | local var=$1; | ||
1342 | local description=$2; | ||
1343 | shift 2; | ||
1344 | while (( "$#" )); do | ||
1345 | case "$1" in | ||
1346 | --replace) | ||
1347 | pattern="$2"; | ||
1348 | replacement="$3"; | ||
1349 | shift 3; | ||
1350 | local savedvar; | ||
1351 | savedvar="${!var}"; | ||
1352 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; | ||
1353 | if [ "$pattern" != "$replacement" ]; then | ||
1354 | if [ "${!var}" == "$savedvar" ]; then | ||
1355 | echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2; | ||
1356 | fi; | ||
1357 | fi | ||
1358 | ;; | ||
1359 | --subst-var) | ||
1360 | local varName="$2"; | ||
1361 | shift 2; | ||
1362 | if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then | ||
1363 | echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; | ||
1364 | return 1; | ||
1365 | fi; | ||
1366 | if [ -z ${!varName+x} ]; then | ||
1367 | echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; | ||
1368 | return 1; | ||
1369 | fi; | ||
1370 | pattern="@$varName@"; | ||
1371 | replacement="${!varName}"; | ||
1372 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' | ||
1373 | ;; | ||
1374 | --subst-var-by) | ||
1375 | pattern="@$2@"; | ||
1376 | replacement="$3"; | ||
1377 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; | ||
1378 | shift 3 | ||
1379 | ;; | ||
1380 | *) | ||
1381 | echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; | ||
1382 | return 1 | ||
1383 | ;; | ||
1384 | esac; | ||
1385 | done; | ||
1386 | printf "%s" "${!var}" | ||
1387 | } | ||
1388 | unpackFile () | ||
1389 | { | ||
1390 | curSrc="$1"; | ||
1391 | header "unpacking source archive $curSrc" 3; | ||
1392 | if ! runOneHook unpackCmd "$curSrc"; then | ||
1393 | echo "do not know how to unpack source archive $curSrc"; | ||
1394 | exit 1; | ||
1395 | fi | ||
1396 | } | ||
1397 | unpackPhase () | ||
1398 | { | ||
1399 | runHook preUnpack; | ||
1400 | if [ -z "${srcs:-}" ]; then | ||
1401 | if [ -z "${src:-}" ]; then | ||
1402 | echo 'variable $src or $srcs should point to the source'; | ||
1403 | exit 1; | ||
1404 | fi; | ||
1405 | srcs="$src"; | ||
1406 | fi; | ||
1407 | local dirsBefore=""; | ||
1408 | for i in *; | ||
1409 | do | ||
1410 | if [ -d "$i" ]; then | ||
1411 | dirsBefore="$dirsBefore $i "; | ||
1412 | fi; | ||
1413 | done; | ||
1414 | for i in $srcs; | ||
1415 | do | ||
1416 | unpackFile "$i"; | ||
1417 | done; | ||
1418 | : ${sourceRoot=}; | ||
1419 | if [ -n "${setSourceRoot:-}" ]; then | ||
1420 | runOneHook setSourceRoot; | ||
1421 | else | ||
1422 | if [ -z "$sourceRoot" ]; then | ||
1423 | for i in *; | ||
1424 | do | ||
1425 | if [ -d "$i" ]; then | ||
1426 | case $dirsBefore in | ||
1427 | *\ $i\ *) | ||
1428 | |||
1429 | ;; | ||
1430 | *) | ||
1431 | if [ -n "$sourceRoot" ]; then | ||
1432 | echo "unpacker produced multiple directories"; | ||
1433 | exit 1; | ||
1434 | fi; | ||
1435 | sourceRoot="$i" | ||
1436 | ;; | ||
1437 | esac; | ||
1438 | fi; | ||
1439 | done; | ||
1440 | fi; | ||
1441 | fi; | ||
1442 | if [ -z "$sourceRoot" ]; then | ||
1443 | echo "unpacker appears to have produced no directories"; | ||
1444 | exit 1; | ||
1445 | fi; | ||
1446 | echo "source root is $sourceRoot"; | ||
1447 | if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then | ||
1448 | chmod -R u+w -- "$sourceRoot"; | ||
1449 | fi; | ||
1450 | runHook postUnpack | ||
1451 | } | ||
1452 | updateSourceDateEpoch () | ||
1453 | { | ||
1454 | local path="$1"; | ||
1455 | 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)); | ||
1456 | local time="${res[0]//\.[0-9]*/}"; | ||
1457 | local newestFile="${res[1]}"; | ||
1458 | if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then | ||
1459 | echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; | ||
1460 | export SOURCE_DATE_EPOCH="$time"; | ||
1461 | local now="$(date +%s)"; | ||
1462 | if [ "$time" -gt $((now - 60)) ]; then | ||
1463 | echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; | ||
1464 | fi; | ||
1465 | fi | ||
1466 | } | ||
1467 | |||
1468 | export NIX_BUILD_TOP="$(mktemp -d --tmpdir nix-shell.XXXXXX)" | ||
1469 | export TMP="$NIX_BUILD_TOP" | ||
1470 | export TMPDIR="$NIX_BUILD_TOP" | ||
1471 | export TEMP="$NIX_BUILD_TOP" | ||
1472 | export TEMPDIR="$NIX_BUILD_TOP" | ||
1473 | eval "$shellHook" | ||