@ifunny/ifunny-api-types 1.2.0 → 1.2.2

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