diff options
l--------- | .direnv/flake-inputs/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source | 1 | ||||
l--------- | .direnv/flake-inputs/6c8k7jlxryb2fr4p2vr8mrcf3qbin5zs-source | 1 | ||||
l--------- | .direnv/flake-inputs/h0wcwbx2fbb1pxvhircgx6m6hc63y9md-source | 1 | ||||
l--------- | .direnv/flake-inputs/iad4n0wn9wzqhz9q9wbadfpzzl1vkbrr-source | 1 | ||||
l--------- | .direnv/flake-inputs/jpcfcha26l25gc8nid0k4jwrfsi1s41q-source | 1 | ||||
l--------- | .direnv/flake-inputs/s3l266rhgq7ar88jlli8b28g7dszcknl-source | 1 | ||||
l--------- | .direnv/flake-inputs/wqw9whwr9qkhhzjs81cv38y4ssspd0sw-source | 1 | ||||
l--------- | .direnv/flake-profile | 1 | ||||
-rw-r--r-- | .direnv/flake-profile.rc | 1504 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Cargo.toml | 25 | ||||
-rw-r--r-- | flake.lock | 126 | ||||
-rw-r--r-- | flake.nix | 95 | ||||
-rw-r--r-- | rust-toolchain.toml | 6 | ||||
-rw-r--r-- | src/lib.rs | 118 | ||||
-rw-r--r-- | src/utils.rs | 10 | ||||
-rw-r--r-- | tests/web.rs | 13 | ||||
m--------- | www | 0 |
18 files changed, 1911 insertions, 0 deletions
diff --git a/.direnv/flake-inputs/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source b/.direnv/flake-inputs/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source new file mode 120000 index 0000000..a33d059 --- /dev/null +++ b/.direnv/flake-inputs/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/6c8k7jlxryb2fr4p2vr8mrcf3qbin5zs-source b/.direnv/flake-inputs/6c8k7jlxryb2fr4p2vr8mrcf3qbin5zs-source new file mode 120000 index 0000000..11fb37e --- /dev/null +++ b/.direnv/flake-inputs/6c8k7jlxryb2fr4p2vr8mrcf3qbin5zs-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/6c8k7jlxryb2fr4p2vr8mrcf3qbin5zs-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/h0wcwbx2fbb1pxvhircgx6m6hc63y9md-source b/.direnv/flake-inputs/h0wcwbx2fbb1pxvhircgx6m6hc63y9md-source new file mode 120000 index 0000000..e6fa9d1 --- /dev/null +++ b/.direnv/flake-inputs/h0wcwbx2fbb1pxvhircgx6m6hc63y9md-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/h0wcwbx2fbb1pxvhircgx6m6hc63y9md-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/iad4n0wn9wzqhz9q9wbadfpzzl1vkbrr-source b/.direnv/flake-inputs/iad4n0wn9wzqhz9q9wbadfpzzl1vkbrr-source new file mode 120000 index 0000000..743a7e7 --- /dev/null +++ b/.direnv/flake-inputs/iad4n0wn9wzqhz9q9wbadfpzzl1vkbrr-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/iad4n0wn9wzqhz9q9wbadfpzzl1vkbrr-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/jpcfcha26l25gc8nid0k4jwrfsi1s41q-source b/.direnv/flake-inputs/jpcfcha26l25gc8nid0k4jwrfsi1s41q-source new file mode 120000 index 0000000..3979f72 --- /dev/null +++ b/.direnv/flake-inputs/jpcfcha26l25gc8nid0k4jwrfsi1s41q-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/jpcfcha26l25gc8nid0k4jwrfsi1s41q-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/s3l266rhgq7ar88jlli8b28g7dszcknl-source b/.direnv/flake-inputs/s3l266rhgq7ar88jlli8b28g7dszcknl-source new file mode 120000 index 0000000..82608d1 --- /dev/null +++ b/.direnv/flake-inputs/s3l266rhgq7ar88jlli8b28g7dszcknl-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/s3l266rhgq7ar88jlli8b28g7dszcknl-source \ No newline at end of file | |||
diff --git a/.direnv/flake-inputs/wqw9whwr9qkhhzjs81cv38y4ssspd0sw-source b/.direnv/flake-inputs/wqw9whwr9qkhhzjs81cv38y4ssspd0sw-source new file mode 120000 index 0000000..dabd230 --- /dev/null +++ b/.direnv/flake-inputs/wqw9whwr9qkhhzjs81cv38y4ssspd0sw-source | |||
@@ -0,0 +1 @@ | |||
/nix/store/wqw9whwr9qkhhzjs81cv38y4ssspd0sw-source \ No newline at end of file | |||
diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..a9be524 --- /dev/null +++ b/.direnv/flake-profile | |||
@@ -0,0 +1 @@ | |||
/nix/store/gij2p5wyrf18c97idbw6fp8p43d968jm-nix-shell-env \ No newline at end of file | |||
diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc new file mode 100644 index 0000000..3d8b1a0 --- /dev/null +++ b/.direnv/flake-profile.rc | |||
@@ -0,0 +1,1504 @@ | |||
1 | unset shellHook | ||
2 | nix_saved_PATH="$PATH" | ||
3 | AR=ar | ||
4 | export AR | ||
5 | AS=as | ||
6 | export AS | ||
7 | BASH=/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin/bash | ||
8 | CC=clang | ||
9 | export CC | ||
10 | CONFIG_SHELL=/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin/bash | ||
11 | export CONFIG_SHELL | ||
12 | CXX=clang++ | ||
13 | export CXX | ||
14 | DIRSTACK=() | ||
15 | GROUPS=() | ||
16 | HOSTTYPE=x86_64 | ||
17 | HOST_PATH=/nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/bin:/nix/store/yzvj23zkg314xjywc3dmzdlqchkqq4m0-coreutils-8.32/bin:/nix/store/l81ywa20y740zq5i0015jg3744g5qz3l-findutils-4.7.0/bin:/nix/store/yapsavlz4zx3v0xq1yq5s9r14xpj7nk7-diffutils-3.7/bin:/nix/store/fnzsi837b2xqqsfiq7hb61v5xka98avl-gnused-4.8/bin:/nix/store/y4icdyy6nfbsjirjr0vyz9kch6hyngyc-gnugrep-3.6/bin:/nix/store/8kpxw5na07ggdl2bs8kiwysif7120r6g-gawk-5.1.0/bin:/nix/store/y215y67kv3z408mdja2fy3xkk0maqhx3-gnutar-1.34/bin:/nix/store/qdzawxy3x2z07s529rdpnandf8dfk1ic-gzip-1.10/bin:/nix/store/p02br2bn70pq65yjim0ly8z99plxq920-bzip2-1.0.6.0.2-bin/bin:/nix/store/vbyx1hhgfai7jb39l6jhvdj5zimkjzhy-gnumake-4.3/bin:/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin:/nix/store/lgi0x08n4is9mdr83p5x4lddkbk10h37-patch-2.7.6/bin:/nix/store/k0dcd6x9h2bzf0rvy1s9p1armcy19qh5-xz-5.2.5-bin/bin | ||
18 | export HOST_PATH | ||
19 | IFS=$' \t\n' | ||
20 | IN_NIX_SHELL=impure | ||
21 | export IN_NIX_SHELL | ||
22 | LD=ld | ||
23 | export LD | ||
24 | LD_DYLD_PATH=/usr/lib/dyld | ||
25 | export LD_DYLD_PATH | ||
26 | MACHTYPE=x86_64-apple-darwin17.7.0 | ||
27 | MACOSX_DEPLOYMENT_TARGET=10.12 | ||
28 | export MACOSX_DEPLOYMENT_TARGET | ||
29 | NIX_BINTOOLS=/nix/store/7qk9mqi411ip2jh10d1bbj7x7mgrfksg-cctools-binutils-darwin-wrapper-949.0.1 | ||
30 | export NIX_BINTOOLS | ||
31 | NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin=1 | ||
32 | export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_apple_darwin | ||
33 | NIX_BUILD_CORES=8 | ||
34 | export NIX_BUILD_CORES | ||
35 | NIX_CC=/nix/store/d4p8v32sivk3zj3jklx3irswbwwigxcd-clang-wrapper-7.1.0 | ||
36 | export NIX_CC | ||
37 | NIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin=1 | ||
38 | export NIX_CC_WRAPPER_TARGET_HOST_x86_64_apple_darwin | ||
39 | NIX_CFLAGS_COMPILE=' -frandom-seed=gij2p5wyrf -isystem /nix/store/wrvk383z2bvgls1339bffq6ny9j3l5xh-nix-2.4pre20210601_5985b8b-dev/include -Wno-deprecated-declarations -isystem /nix/store/c33a85j8xlf79522xm53b7l9cq69s2hd-boehm-gc-8.0.4-dev/include -isystem /nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0/include -isystem /nix/store/mw8cdz4nbq523xa33zyamsylci73cd63-libcxx-7.1.0-dev/include -isystem /nix/store/i8mm0yixkl8c10a4kmwz68zp99cb3nrs-libcxxabi-7.1.0-dev/include -isystem /nix/store/xcix5ygyy05z2q9v6901xlm4ljw2yvs8-compiler-rt-libc-7.1.0-dev/include -iframework /nix/store/293i28pj9jswm0bgx7qdnbpkckz72kwb-apple-framework-Security/Library/Frameworks -iframework /nix/store/yy952p18g4hvkgwd3hh8c4rql8ic5bwk-apple-framework-IOKit/Library/Frameworks -isystem /nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/include -iframework /nix/store/f7f3gz636cqxkav7cy1nlldkwv2b22n1-swift-corefoundation/Library/Frameworks -isystem /nix/store/wrvk383z2bvgls1339bffq6ny9j3l5xh-nix-2.4pre20210601_5985b8b-dev/include -isystem /nix/store/c33a85j8xlf79522xm53b7l9cq69s2hd-boehm-gc-8.0.4-dev/include -isystem /nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0/include -isystem /nix/store/mw8cdz4nbq523xa33zyamsylci73cd63-libcxx-7.1.0-dev/include -isystem /nix/store/i8mm0yixkl8c10a4kmwz68zp99cb3nrs-libcxxabi-7.1.0-dev/include -isystem /nix/store/xcix5ygyy05z2q9v6901xlm4ljw2yvs8-compiler-rt-libc-7.1.0-dev/include -iframework /nix/store/293i28pj9jswm0bgx7qdnbpkckz72kwb-apple-framework-Security/Library/Frameworks -iframework /nix/store/yy952p18g4hvkgwd3hh8c4rql8ic5bwk-apple-framework-IOKit/Library/Frameworks -isystem /nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/include -iframework /nix/store/f7f3gz636cqxkav7cy1nlldkwv2b22n1-swift-corefoundation/Library/Frameworks' | ||
40 | export NIX_CFLAGS_COMPILE | ||
41 | NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks | ||
42 | export NIX_COREFOUNDATION_RPATH | ||
43 | NIX_DONT_SET_RPATH=1 | ||
44 | export NIX_DONT_SET_RPATH | ||
45 | NIX_DONT_SET_RPATH_FOR_BUILD=1 | ||
46 | export NIX_DONT_SET_RPATH_FOR_BUILD | ||
47 | NIX_ENFORCE_NO_NATIVE=1 | ||
48 | export NIX_ENFORCE_NO_NATIVE | ||
49 | NIX_HARDENING_ENABLE='fortify stackprotector pic strictoverflow format relro bindnow' | ||
50 | export NIX_HARDENING_ENABLE | ||
51 | NIX_IGNORE_LD_THROUGH_GCC=1 | ||
52 | export NIX_IGNORE_LD_THROUGH_GCC | ||
53 | NIX_INDENT_MAKE=1 | ||
54 | export NIX_INDENT_MAKE | ||
55 | NIX_LDFLAGS=' -liconv -L/nix/store/85bfm4ri8rsmam7h8gr5fi3xs0kar2xn-boehm-gc-8.0.4/lib -L/nix/store/7zrf1zrpz9csbj3diij3rfzz87xz3d0s-nix-2.4pre20210601_5985b8b/lib -L/nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690/lib -L/nix/store/64d69jqbz4s8ziqbpam41sd70w338ars-libcxx-7.1.0/lib -L/nix/store/6q1rhqvyzxb3j5pb1h4qxsa0hh1i45wv-libcxxabi-7.1.0/lib -L/nix/store/pdd276ydvg3zvky684wp78q8zfjkc6d4-compiler-rt-libc-7.1.0/lib -L/nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/lib -L/nix/store/85bfm4ri8rsmam7h8gr5fi3xs0kar2xn-boehm-gc-8.0.4/lib -L/nix/store/7zrf1zrpz9csbj3diij3rfzz87xz3d0s-nix-2.4pre20210601_5985b8b/lib -L/nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690/lib -L/nix/store/64d69jqbz4s8ziqbpam41sd70w338ars-libcxx-7.1.0/lib -L/nix/store/6q1rhqvyzxb3j5pb1h4qxsa0hh1i45wv-libcxxabi-7.1.0/lib -L/nix/store/pdd276ydvg3zvky684wp78q8zfjkc6d4-compiler-rt-libc-7.1.0/lib -L/nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/lib' | ||
56 | export NIX_LDFLAGS | ||
57 | NIX_NO_SELF_RPATH=1 | ||
58 | export NIX_NO_SELF_RPATH | ||
59 | NIX_STORE=/nix/store | ||
60 | export NIX_STORE | ||
61 | NM=nm | ||
62 | export NM | ||
63 | NODE_PATH=/nix/store/v8wdcakdc4k9pbykikl7vsijq4dp6z1c-node_npm-7.15.1/lib/node_modules:/nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0/lib/node_modules | ||
64 | export NODE_PATH | ||
65 | OPTERR=1 | ||
66 | OPTIND=1 | ||
67 | OSTYPE=darwin17.7.0 | ||
68 | PATH=/nix/store/7zrf1zrpz9csbj3diij3rfzz87xz3d0s-nix-2.4pre20210601_5985b8b/bin:/nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690/bin:/nix/store/hv5snmngjz3yfgq9g8mhmafxxpfy6294-rust-analyzer-2021-06-07/bin:/nix/store/h5cmvljw25bs3ihybf0r09siwfb4sf45-rustfmt-1.52.1/bin:/nix/store/rgqprchhk58xcsfj7wqcanigbq8h36md-cargo-1.52.1/bin:/nix/store/c4gqh7f6n363h0pc6zqbkmzb9ic8864b-cargo-watch-7.8.0/bin:/nix/store/b5s2l9p2qq54iyr8iii05bizzmh6yvm6-miniserve-0.14.0/bin:/nix/store/jjpjk03xp01k949g2ifkq7s9m7wgy2h2-wasm-pack-0.9.1/bin:/nix/store/jqj6ylbi8y7l1zr0gkr5fbiv7nzrsk0w-cargo-generate-0.5.3/bin:/nix/store/v8wdcakdc4k9pbykikl7vsijq4dp6z1c-node_npm-7.15.1/bin:/nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0/bin:/nix/store/d4p8v32sivk3zj3jklx3irswbwwigxcd-clang-wrapper-7.1.0/bin:/nix/store/5im8ywgl0cilxlysvrwdnhik954nivbm-clang-7.1.0/bin:/nix/store/yzvj23zkg314xjywc3dmzdlqchkqq4m0-coreutils-8.32/bin:/nix/store/7qk9mqi411ip2jh10d1bbj7x7mgrfksg-cctools-binutils-darwin-wrapper-949.0.1/bin:/nix/store/9xawf09c90761xkxv8r1b55ja46x4wr3-cctools-binutils-darwin-949.0.1/bin:/nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50/bin:/nix/store/yzvj23zkg314xjywc3dmzdlqchkqq4m0-coreutils-8.32/bin:/nix/store/l81ywa20y740zq5i0015jg3744g5qz3l-findutils-4.7.0/bin:/nix/store/yapsavlz4zx3v0xq1yq5s9r14xpj7nk7-diffutils-3.7/bin:/nix/store/fnzsi837b2xqqsfiq7hb61v5xka98avl-gnused-4.8/bin:/nix/store/y4icdyy6nfbsjirjr0vyz9kch6hyngyc-gnugrep-3.6/bin:/nix/store/8kpxw5na07ggdl2bs8kiwysif7120r6g-gawk-5.1.0/bin:/nix/store/y215y67kv3z408mdja2fy3xkk0maqhx3-gnutar-1.34/bin:/nix/store/qdzawxy3x2z07s529rdpnandf8dfk1ic-gzip-1.10/bin:/nix/store/p02br2bn70pq65yjim0ly8z99plxq920-bzip2-1.0.6.0.2-bin/bin:/nix/store/vbyx1hhgfai7jb39l6jhvdj5zimkjzhy-gnumake-4.3/bin:/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin:/nix/store/lgi0x08n4is9mdr83p5x4lddkbk10h37-patch-2.7.6/bin:/nix/store/k0dcd6x9h2bzf0rvy1s9p1armcy19qh5-xz-5.2.5-bin/bin | ||
69 | export PATH | ||
70 | PATH_LOCALE=/nix/store/bw9c8i4kikgz9kxli0g65ld2xdjfacyp-adv_cmds-119-locale/share/locale | ||
71 | export PATH_LOCALE | ||
72 | PIPESTATUS=([0]="0") | ||
73 | PS4='+ ' | ||
74 | RANLIB=ranlib | ||
75 | export RANLIB | ||
76 | RUST_BACKTRACE=1 | ||
77 | export RUST_BACKTRACE | ||
78 | RUST_LOG=info | ||
79 | export RUST_LOG | ||
80 | RUST_SRC_PATH=/nix/store/lzi47k14rv1cgxxzilnzfr0ky0925qvm-rust-src-1.53.0-nightly-2021-03-30-74874a690/lib/rustlib/src/rust/library | ||
81 | export RUST_SRC_PATH | ||
82 | SHELL=/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin/bash | ||
83 | export SHELL | ||
84 | SIZE=size | ||
85 | export SIZE | ||
86 | SOURCE_DATE_EPOCH=315532800 | ||
87 | export SOURCE_DATE_EPOCH | ||
88 | STRINGS=strings | ||
89 | export STRINGS | ||
90 | STRIP=strip | ||
91 | export STRIP | ||
92 | XDG_DATA_DIRS=/nix/store/85bfm4ri8rsmam7h8gr5fi3xs0kar2xn-boehm-gc-8.0.4/share:/nix/store/7zrf1zrpz9csbj3diij3rfzz87xz3d0s-nix-2.4pre20210601_5985b8b/share:/nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690/share:/nix/store/rgqprchhk58xcsfj7wqcanigbq8h36md-cargo-1.52.1/share:/nix/store/b5s2l9p2qq54iyr8iii05bizzmh6yvm6-miniserve-0.14.0/share:/nix/store/v8wdcakdc4k9pbykikl7vsijq4dp6z1c-node_npm-7.15.1/share:/nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0/share | ||
93 | export XDG_DATA_DIRS | ||
94 | _=export | ||
95 | __darwinAllowLocalNetworking= | ||
96 | export __darwinAllowLocalNetworking | ||
97 | __impureHostDeps='/bin/sh /usr/lib/libSystem.B.dylib /usr/lib/system/libunc.dylib /dev/zero /dev/random /dev/urandom /bin/sh' | ||
98 | export __impureHostDeps | ||
99 | __propagatedImpureHostDeps= | ||
100 | export __propagatedImpureHostDeps | ||
101 | __propagatedSandboxProfile= | ||
102 | export __propagatedSandboxProfile | ||
103 | __sandboxProfile= | ||
104 | export __sandboxProfile | ||
105 | buildInputs='/nix/store/293i28pj9jswm0bgx7qdnbpkckz72kwb-apple-framework-Security /nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50' | ||
106 | export buildInputs | ||
107 | builder=/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin/bash | ||
108 | export builder | ||
109 | configureFlags= | ||
110 | export configureFlags | ||
111 | defaultBuildInputs=/nix/store/f7f3gz636cqxkav7cy1nlldkwv2b22n1-swift-corefoundation | ||
112 | defaultNativeBuildInputs='/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh /nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh /nix/store/cl3qd985p1yxyfkj96v0hqxiy3w69xq5-compress-man-pages.sh /nix/store/h54dzwd7rdh2jlcv91424csl6d0ccgjy-strip.sh /nix/store/bnj8d7mvbkg3vdb07yz74yhl3g107qq5-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/1i5y55x4b4m9qkx5dqbmr1r6bvrqbanw-multiple-outputs.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/pr6nzbscdpg94yvr151lrif2kg0csx7b-reproducible-builds.sh /nix/store/d4p8v32sivk3zj3jklx3irswbwwigxcd-clang-wrapper-7.1.0' | ||
113 | depsBuildBuild= | ||
114 | export depsBuildBuild | ||
115 | depsBuildBuildPropagated= | ||
116 | export depsBuildBuildPropagated | ||
117 | depsBuildTarget= | ||
118 | export depsBuildTarget | ||
119 | depsBuildTargetPropagated= | ||
120 | export depsBuildTargetPropagated | ||
121 | depsHostHost= | ||
122 | export depsHostHost | ||
123 | depsHostHostPropagated= | ||
124 | export depsHostHostPropagated | ||
125 | depsTargetTarget= | ||
126 | export depsTargetTarget | ||
127 | depsTargetTargetPropagated= | ||
128 | export depsTargetTargetPropagated | ||
129 | doCheck= | ||
130 | export doCheck | ||
131 | doInstallCheck= | ||
132 | export doInstallCheck | ||
133 | dontAddDisableDepTrack=1 | ||
134 | export dontAddDisableDepTrack | ||
135 | envBuildBuildHooks=([0]="addNodePath") | ||
136 | envBuildHostHooks=([0]="addNodePath") | ||
137 | envBuildTargetHooks=([0]="addNodePath") | ||
138 | envHostHostHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="noDeprecatedDeclarations" [3]="useSystemCoreFoundationFramework") | ||
139 | envHostTargetHooks=([0]="ccWrapper_addCVars" [1]="bintoolsWrapper_addLDVars" [2]="noDeprecatedDeclarations" [3]="useSystemCoreFoundationFramework") | ||
140 | fixupOutputHooks=([0]="_makeSymlinksRelative" [1]="if [ -z \"\${dontGzipMan-}\" ]; then compressManPages \"\$prefix\"; fi" [2]="_doStrip" [3]="patchShebangsAuto" [4]="_pruneLibtoolFiles" [5]="_moveSbin" [6]="_moveLib64" [7]="fixDarwinFrameworksIn \$prefix") | ||
141 | flag=-Wno-deprecated-declarations | ||
142 | gl_cv_func_getcwd_abort_bug=no | ||
143 | export gl_cv_func_getcwd_abort_bug | ||
144 | initialPath='/nix/store/yzvj23zkg314xjywc3dmzdlqchkqq4m0-coreutils-8.32 /nix/store/l81ywa20y740zq5i0015jg3744g5qz3l-findutils-4.7.0 /nix/store/yapsavlz4zx3v0xq1yq5s9r14xpj7nk7-diffutils-3.7 /nix/store/fnzsi837b2xqqsfiq7hb61v5xka98avl-gnused-4.8 /nix/store/y4icdyy6nfbsjirjr0vyz9kch6hyngyc-gnugrep-3.6 /nix/store/8kpxw5na07ggdl2bs8kiwysif7120r6g-gawk-5.1.0 /nix/store/y215y67kv3z408mdja2fy3xkk0maqhx3-gnutar-1.34 /nix/store/qdzawxy3x2z07s529rdpnandf8dfk1ic-gzip-1.10 /nix/store/p02br2bn70pq65yjim0ly8z99plxq920-bzip2-1.0.6.0.2-bin /nix/store/vbyx1hhgfai7jb39l6jhvdj5zimkjzhy-gnumake-4.3 /nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23 /nix/store/lgi0x08n4is9mdr83p5x4lddkbk10h37-patch-2.7.6 /nix/store/k0dcd6x9h2bzf0rvy1s9p1armcy19qh5-xz-5.2.5-bin' | ||
145 | name=nix-shell | ||
146 | export name | ||
147 | nativeBuildInputs='/nix/store/wrvk383z2bvgls1339bffq6ny9j3l5xh-nix-2.4pre20210601_5985b8b-dev /nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690 /nix/store/lzi47k14rv1cgxxzilnzfr0ky0925qvm-rust-src-1.53.0-nightly-2021-03-30-74874a690 /nix/store/hv5snmngjz3yfgq9g8mhmafxxpfy6294-rust-analyzer-2021-06-07 /nix/store/h5cmvljw25bs3ihybf0r09siwfb4sf45-rustfmt-1.52.1 /nix/store/rgqprchhk58xcsfj7wqcanigbq8h36md-cargo-1.52.1 /nix/store/c4gqh7f6n363h0pc6zqbkmzb9ic8864b-cargo-watch-7.8.0 /nix/store/b5s2l9p2qq54iyr8iii05bizzmh6yvm6-miniserve-0.14.0 /nix/store/jjpjk03xp01k949g2ifkq7s9m7wgy2h2-wasm-pack-0.9.1 /nix/store/jqj6ylbi8y7l1zr0gkr5fbiv7nzrsk0w-cargo-generate-0.5.3 /nix/store/v8wdcakdc4k9pbykikl7vsijq4dp6z1c-node_npm-7.15.1 /nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0' | ||
148 | export nativeBuildInputs | ||
149 | nobuildPhase=$'echo\necho "This derivation is not meant to be built, aborting";\necho\nexit 1\n' | ||
150 | export nobuildPhase | ||
151 | out=/Users/np/code/rust/cstea/outputs/out | ||
152 | export out | ||
153 | outputBin=out | ||
154 | outputDev=out | ||
155 | outputDevdoc=REMOVE | ||
156 | outputDevman=out | ||
157 | outputDoc=out | ||
158 | outputInclude=out | ||
159 | outputInfo=out | ||
160 | outputLib=out | ||
161 | outputMan=out | ||
162 | outputs=out | ||
163 | export outputs | ||
164 | patches= | ||
165 | export patches | ||
166 | phases=nobuildPhase | ||
167 | export phases | ||
168 | pkg=/nix/store/f7f3gz636cqxkav7cy1nlldkwv2b22n1-swift-corefoundation | ||
169 | pkgsBuildHost=([0]="/nix/store/wrvk383z2bvgls1339bffq6ny9j3l5xh-nix-2.4pre20210601_5985b8b-dev" [1]="/nix/store/c33a85j8xlf79522xm53b7l9cq69s2hd-boehm-gc-8.0.4-dev" [2]="/nix/store/85bfm4ri8rsmam7h8gr5fi3xs0kar2xn-boehm-gc-8.0.4" [3]="/nix/store/7zrf1zrpz9csbj3diij3rfzz87xz3d0s-nix-2.4pre20210601_5985b8b" [4]="/nix/store/52k8w2d1qwmh7g16578pxpbnv51vls2q-rust-1.53.0-nightly-2021-03-30-74874a690" [5]="/nix/store/lzi47k14rv1cgxxzilnzfr0ky0925qvm-rust-src-1.53.0-nightly-2021-03-30-74874a690" [6]="/nix/store/hv5snmngjz3yfgq9g8mhmafxxpfy6294-rust-analyzer-2021-06-07" [7]="/nix/store/h5cmvljw25bs3ihybf0r09siwfb4sf45-rustfmt-1.52.1" [8]="/nix/store/rgqprchhk58xcsfj7wqcanigbq8h36md-cargo-1.52.1" [9]="/nix/store/c4gqh7f6n363h0pc6zqbkmzb9ic8864b-cargo-watch-7.8.0" [10]="/nix/store/b5s2l9p2qq54iyr8iii05bizzmh6yvm6-miniserve-0.14.0" [11]="/nix/store/jjpjk03xp01k949g2ifkq7s9m7wgy2h2-wasm-pack-0.9.1" [12]="/nix/store/jqj6ylbi8y7l1zr0gkr5fbiv7nzrsk0w-cargo-generate-0.5.3" [13]="/nix/store/v8wdcakdc4k9pbykikl7vsijq4dp6z1c-node_npm-7.15.1" [14]="/nix/store/jvkhrd4b513zrsbbmssg07hpkjpc9bmh-nodejs-14.17.0" [15]="/nix/store/mjjy30kxz775bhhi6j9phw81qh6dsbrf-move-docs.sh" [16]="/nix/store/kxw6q8v6isaqjm702d71n2421cxamq68-make-symlinks-relative.sh" [17]="/nix/store/cl3qd985p1yxyfkj96v0hqxiy3w69xq5-compress-man-pages.sh" [18]="/nix/store/h54dzwd7rdh2jlcv91424csl6d0ccgjy-strip.sh" [19]="/nix/store/bnj8d7mvbkg3vdb07yz74yhl3g107qq5-patch-shebangs.sh" [20]="/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh" [21]="/nix/store/1i5y55x4b4m9qkx5dqbmr1r6bvrqbanw-multiple-outputs.sh" [22]="/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh" [23]="/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh" [24]="/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh" [25]="/nix/store/pr6nzbscdpg94yvr151lrif2kg0csx7b-reproducible-builds.sh" [26]="/nix/store/d4p8v32sivk3zj3jklx3irswbwwigxcd-clang-wrapper-7.1.0" [27]="/nix/store/7qk9mqi411ip2jh10d1bbj7x7mgrfksg-cctools-binutils-darwin-wrapper-949.0.1") | ||
170 | pkgsHostHost=([0]="/nix/store/mw8cdz4nbq523xa33zyamsylci73cd63-libcxx-7.1.0-dev" [1]="/nix/store/64d69jqbz4s8ziqbpam41sd70w338ars-libcxx-7.1.0" [2]="/nix/store/i8mm0yixkl8c10a4kmwz68zp99cb3nrs-libcxxabi-7.1.0-dev" [3]="/nix/store/6q1rhqvyzxb3j5pb1h4qxsa0hh1i45wv-libcxxabi-7.1.0" [4]="/nix/store/xcix5ygyy05z2q9v6901xlm4ljw2yvs8-compiler-rt-libc-7.1.0-dev" [5]="/nix/store/pdd276ydvg3zvky684wp78q8zfjkc6d4-compiler-rt-libc-7.1.0") | ||
171 | pkgsHostTarget=([0]="/nix/store/293i28pj9jswm0bgx7qdnbpkckz72kwb-apple-framework-Security" [1]="/nix/store/yy952p18g4hvkgwd3hh8c4rql8ic5bwk-apple-framework-IOKit" [2]="/nix/store/pgnb12anscja205zycd2l994028vas2b-libiconv-50" [3]="/nix/store/f7f3gz636cqxkav7cy1nlldkwv2b22n1-swift-corefoundation") | ||
172 | postFixupHooks=([0]="_multioutPropagateDev") | ||
173 | postUnpackHooks=([0]="_updateSourceDateEpochFromSourceRoot") | ||
174 | preConfigureHooks=([0]="_multioutConfig") | ||
175 | preFixupHooks=([0]="_moveToShare" [1]="_multioutDocs" [2]="_multioutDevs") | ||
176 | prefix=/Users/np/code/rust/cstea/outputs/out | ||
177 | propagatedBuildDepFiles=([0]="propagated-build-build-deps" [1]="propagated-native-build-inputs" [2]="propagated-build-target-deps") | ||
178 | propagatedBuildInputs= | ||
179 | export propagatedBuildInputs | ||
180 | propagatedHostDepFiles=([0]="propagated-host-host-deps" [1]="propagated-build-inputs") | ||
181 | propagatedNativeBuildInputs= | ||
182 | export propagatedNativeBuildInputs | ||
183 | propagatedTargetDepFiles=([0]="propagated-target-target-deps") | ||
184 | role_post= | ||
185 | shell=/nix/store/pcjan45rssdn01cxx3sjg70avjg6c3ni-bash-4.4-p23/bin/bash | ||
186 | export shell | ||
187 | shellHook= | ||
188 | export shellHook | ||
189 | stdenv=/nix/store/sv61k1l9fapkn1dzlvclqjl5i1sbhfyw-stdenv-darwin | ||
190 | export stdenv | ||
191 | strictDeps= | ||
192 | export strictDeps | ||
193 | stripAllFlags=' ' | ||
194 | system=x86_64-darwin | ||
195 | export system | ||
196 | unpackCmdHooks=([0]="_defaultUnpack") | ||
197 | PATH="$PATH:$nix_saved_PATH" | ||
198 | _activatePkgs () | ||
199 | { | ||
200 | local -i hostOffset targetOffset; | ||
201 | local pkg; | ||
202 | for hostOffset in "${allPlatOffsets[@]}"; | ||
203 | do | ||
204 | local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}"; | ||
205 | for targetOffset in "${allPlatOffsets[@]}"; | ||
206 | do | ||
207 | (( "$hostOffset" <= "$targetOffset" )) || continue; | ||
208 | local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; | ||
209 | local pkgsSlice="${!pkgsRef}[@]"; | ||
210 | for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; | ||
211 | do | ||
212 | activatePackage "$pkg" "$hostOffset" "$targetOffset"; | ||
213 | done; | ||
214 | done; | ||
215 | done | ||
216 | } | ||
217 | _addRpathPrefix () | ||
218 | { | ||
219 | if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then | ||
220 | export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; | ||
221 | if [ -n "${NIX_LIB64_IN_SELF_RPATH:-}" ]; then | ||
222 | export NIX_LDFLAGS="-rpath $1/lib64 ${NIX_LDFLAGS-}"; | ||
223 | fi; | ||
224 | if [ -n "${NIX_LIB32_IN_SELF_RPATH:-}" ]; then | ||
225 | export NIX_LDFLAGS="-rpath $1/lib32 ${NIX_LDFLAGS-}"; | ||
226 | fi; | ||
227 | fi | ||
228 | } | ||
229 | _addToEnv () | ||
230 | { | ||
231 | local -i depHostOffset depTargetOffset; | ||
232 | local pkg; | ||
233 | for depHostOffset in "${allPlatOffsets[@]}"; | ||
234 | do | ||
235 | local hookVar="${pkgHookVarVars[$depHostOffset + 1]}"; | ||
236 | local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}"; | ||
237 | for depTargetOffset in "${allPlatOffsets[@]}"; | ||
238 | do | ||
239 | (( "$depHostOffset" <= "$depTargetOffset" )) || continue; | ||
240 | local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; | ||
241 | if [[ -z "${strictDeps-}" ]]; then | ||
242 | local visitedPkgs=""; | ||
243 | for pkg in ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} ${pkgsBuildHost+"${pkgsBuildHost[@]}"} ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} ${pkgsHostHost+"${pkgsHostHost[@]}"} ${pkgsHostTarget+"${pkgsHostTarget[@]}"} ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}; | ||
244 | do | ||
245 | if [[ "$visitedPkgs" = *"$pkg"* ]]; then | ||
246 | continue; | ||
247 | fi; | ||
248 | runHook "${!hookRef}" "$pkg"; | ||
249 | visitedPkgs+=" $pkg"; | ||
250 | done; | ||
251 | else | ||
252 | local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; | ||
253 | local pkgsSlice="${!pkgsRef}[@]"; | ||
254 | for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; | ||
255 | do | ||
256 | runHook "${!hookRef}" "$pkg"; | ||
257 | done; | ||
258 | fi; | ||
259 | done; | ||
260 | done | ||
261 | } | ||
262 | _allFlags () | ||
263 | { | ||
264 | for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); | ||
265 | do | ||
266 | if (( "${NIX_DEBUG:-0}" >= 1 )); then | ||
267 | printf "@%s@ -> %q\n" "${varName}" "${!varName}"; | ||
268 | fi; | ||
269 | args+=("--subst-var" "$varName"); | ||
270 | done | ||
271 | } | ||
272 | _assignFirst () | ||
273 | { | ||
274 | local varName="$1"; | ||
275 | local REMOVE=REMOVE; | ||
276 | shift; | ||
277 | while (( $# )); do | ||
278 | if [ -n "${!1-}" ]; then | ||
279 | eval "${varName}"="$1"; | ||
280 | return; | ||
281 | fi; | ||
282 | shift; | ||
283 | done; | ||
284 | echo "Error: _assignFirst found no valid variant!"; | ||
285 | return 1 | ||
286 | } | ||
287 | _callImplicitHook () | ||
288 | { | ||
289 | local def="$1"; | ||
290 | local hookName="$2"; | ||
291 | if declare -F "$hookName" > /dev/null; then | ||
292 | "$hookName"; | ||
293 | else | ||
294 | if type -p "$hookName" > /dev/null; then | ||
295 | source "$hookName"; | ||
296 | else | ||
297 | if [ -n "${!hookName:-}" ]; then | ||
298 | eval "${!hookName}"; | ||
299 | else | ||
300 | return "$def"; | ||
301 | fi; | ||
302 | fi; | ||
303 | fi | ||
304 | } | ||
305 | _defaultUnpack () | ||
306 | { | ||
307 | local fn="$1"; | ||
308 | if [ -d "$fn" ]; then | ||
309 | cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"; | ||
310 | else | ||
311 | case "$fn" in | ||
312 | *.tar.xz | *.tar.lzma | *.txz) | ||
313 | xz -d < "$fn" | tar xf - | ||
314 | ;; | ||
315 | *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) | ||
316 | tar xf "$fn" | ||
317 | ;; | ||
318 | *) | ||
319 | return 1 | ||
320 | ;; | ||
321 | esac; | ||
322 | fi | ||
323 | } | ||
324 | _doStrip () | ||
325 | { | ||
326 | local -ra flags=(dontStripHost dontStripTarget); | ||
327 | local -ra stripCmds=(STRIP TARGET_STRIP); | ||
328 | if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then | ||
329 | dontStripTarget+=1; | ||
330 | fi; | ||
331 | local i; | ||
332 | for i in ${!stripCmds[@]}; | ||
333 | do | ||
334 | local -n flag="${flags[$i]}"; | ||
335 | local -n stripCmd="${stripCmds[$i]}"; | ||
336 | if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null; then | ||
337 | continue; | ||
338 | fi; | ||
339 | stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}; | ||
340 | if [ -n "$stripDebugList" ]; then | ||
341 | stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"; | ||
342 | fi; | ||
343 | stripAllList=${stripAllList:-}; | ||
344 | if [ -n "$stripAllList" ]; then | ||
345 | stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"; | ||
346 | fi; | ||
347 | done | ||
348 | } | ||
349 | _eval () | ||
350 | { | ||
351 | if declare -F "$1" > /dev/null 2>&1; then | ||
352 | "$@"; | ||
353 | else | ||
354 | eval "$1"; | ||
355 | fi | ||
356 | } | ||
357 | _makeSymlinksRelative () | ||
358 | { | ||
359 | local symlinkTarget; | ||
360 | if [ -n "${dontRewriteSymlinks-}" ]; then | ||
361 | return 0; | ||
362 | fi; | ||
363 | while IFS= read -r -d '' f; do | ||
364 | symlinkTarget=$(readlink "$f"); | ||
365 | if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then | ||
366 | continue; | ||
367 | fi; | ||
368 | if [ ! -e "$symlinkTarget" ]; then | ||
369 | echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; | ||
370 | fi; | ||
371 | echo "rewriting symlink $f to be relative to $prefix"; | ||
372 | ln -snrf "$symlinkTarget" "$f"; | ||
373 | done < <(find $prefix -type l -print0) | ||
374 | } | ||
375 | _moveLib64 () | ||
376 | { | ||
377 | if [ "${dontMoveLib64-}" = 1 ]; then | ||
378 | return; | ||
379 | fi; | ||
380 | if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then | ||
381 | return; | ||
382 | fi; | ||
383 | echo "moving $prefix/lib64/* to $prefix/lib"; | ||
384 | mkdir -p $prefix/lib; | ||
385 | shopt -s dotglob; | ||
386 | for i in $prefix/lib64/*; | ||
387 | do | ||
388 | mv --no-clobber "$i" $prefix/lib; | ||
389 | done; | ||
390 | shopt -u dotglob; | ||
391 | rmdir $prefix/lib64; | ||
392 | ln -s lib $prefix/lib64 | ||
393 | } | ||
394 | _moveSbin () | ||
395 | { | ||
396 | if [ "${dontMoveSbin-}" = 1 ]; then | ||
397 | return; | ||
398 | fi; | ||
399 | if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then | ||
400 | return; | ||
401 | fi; | ||
402 | echo "moving $prefix/sbin/* to $prefix/bin"; | ||
403 | mkdir -p $prefix/bin; | ||
404 | shopt -s dotglob; | ||
405 | for i in $prefix/sbin/*; | ||
406 | do | ||
407 | mv "$i" $prefix/bin; | ||
408 | done; | ||
409 | shopt -u dotglob; | ||
410 | rmdir $prefix/sbin; | ||
411 | ln -s bin $prefix/sbin | ||
412 | } | ||
413 | _moveToShare () | ||
414 | { | ||
415 | forceShare=${forceShare:=man doc info}; | ||
416 | if [ -z "$forceShare" -o -z "$out" ]; then | ||
417 | return; | ||
418 | fi; | ||
419 | for d in $forceShare; | ||
420 | do | ||
421 | if [ -d "$out/$d" ]; then | ||
422 | if [ -d "$out/share/$d" ]; then | ||
423 | echo "both $d/ and share/$d/ exist!"; | ||
424 | else | ||
425 | echo "moving $out/$d to $out/share/$d"; | ||
426 | mkdir -p $out/share; | ||
427 | mv $out/$d $out/share/; | ||
428 | fi; | ||
429 | fi; | ||
430 | done | ||
431 | } | ||
432 | _multioutConfig () | ||
433 | { | ||
434 | if [ "$outputs" = "out" ] || [ -z "${setOutputFlags-1}" ]; then | ||
435 | return; | ||
436 | fi; | ||
437 | if [ -z "$shareDocName" ]; then | ||
438 | local confScript="$configureScript"; | ||
439 | if [ -z "$confScript" ] && [ -x ./configure ]; then | ||
440 | confScript=./configure; | ||
441 | fi; | ||
442 | if [ -f "$confScript" ]; then | ||
443 | local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; | ||
444 | fi; | ||
445 | if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then | ||
446 | shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; | ||
447 | fi; | ||
448 | fi; | ||
449 | configureFlags=" --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info --docdir=${!outputDoc}/share/doc/${shareDocName} --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec --localedir=${!outputLib}/share/locale $configureFlags"; | ||
450 | installFlags=" pkgconfigdir=${!outputDev}/lib/pkgconfig m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal $installFlags" | ||
451 | } | ||
452 | _multioutDevs () | ||
453 | { | ||
454 | if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then | ||
455 | return; | ||
456 | fi; | ||
457 | moveToOutput include "${!outputInclude}"; | ||
458 | moveToOutput lib/pkgconfig "${!outputDev}"; | ||
459 | moveToOutput share/pkgconfig "${!outputDev}"; | ||
460 | moveToOutput lib/cmake "${!outputDev}"; | ||
461 | moveToOutput share/aclocal "${!outputDev}"; | ||
462 | for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; | ||
463 | do | ||
464 | echo "Patching '$f' includedir to output ${!outputInclude}"; | ||
465 | sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; | ||
466 | done | ||
467 | } | ||
468 | _multioutDocs () | ||
469 | { | ||
470 | local REMOVE=REMOVE; | ||
471 | moveToOutput share/info "${!outputInfo}"; | ||
472 | moveToOutput share/doc "${!outputDoc}"; | ||
473 | moveToOutput share/gtk-doc "${!outputDevdoc}"; | ||
474 | moveToOutput share/devhelp/books "${!outputDevdoc}"; | ||
475 | moveToOutput share/man "${!outputMan}"; | ||
476 | moveToOutput share/man/man3 "${!outputDevman}" | ||
477 | } | ||
478 | _multioutPropagateDev () | ||
479 | { | ||
480 | if [ "$outputs" = "out" ]; then | ||
481 | return; | ||
482 | fi; | ||
483 | local outputFirst; | ||
484 | for outputFirst in $outputs; | ||
485 | do | ||
486 | break; | ||
487 | done; | ||
488 | local propagaterOutput="$outputDev"; | ||
489 | if [ -z "$propagaterOutput" ]; then | ||
490 | propagaterOutput="$outputFirst"; | ||
491 | fi; | ||
492 | if [ -z "${propagatedBuildOutputs+1}" ]; then | ||
493 | local po_dirty="$outputBin $outputInclude $outputLib"; | ||
494 | set +o pipefail; | ||
495 | propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; | ||
496 | set -o pipefail; | ||
497 | fi; | ||
498 | if [ -z "$propagatedBuildOutputs" ]; then | ||
499 | return; | ||
500 | fi; | ||
501 | mkdir -p "${!propagaterOutput}"/nix-support; | ||
502 | for output in $propagatedBuildOutputs; | ||
503 | do | ||
504 | echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; | ||
505 | done | ||
506 | } | ||
507 | _overrideFirst () | ||
508 | { | ||
509 | if [ -z "${!1-}" ]; then | ||
510 | _assignFirst "$@"; | ||
511 | fi | ||
512 | } | ||
513 | _pruneLibtoolFiles () | ||
514 | { | ||
515 | if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then | ||
516 | return; | ||
517 | fi; | ||
518 | 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" \; | ||
519 | } | ||
520 | _updateSourceDateEpochFromSourceRoot () | ||
521 | { | ||
522 | if [ -n "$sourceRoot" ]; then | ||
523 | updateSourceDateEpoch "$sourceRoot"; | ||
524 | fi | ||
525 | } | ||
526 | activatePackage () | ||
527 | { | ||
528 | local pkg="$1"; | ||
529 | local -ri hostOffset="$2"; | ||
530 | local -ri targetOffset="$3"; | ||
531 | (( "$hostOffset" <= "$targetOffset" )) || exit -1; | ||
532 | if [ -f "$pkg" ]; then | ||
533 | source "$pkg"; | ||
534 | fi; | ||
535 | if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then | ||
536 | addToSearchPath _PATH "$pkg/bin"; | ||
537 | fi; | ||
538 | if [[ "$hostOffset" -le -1 ]]; then | ||
539 | addToSearchPath _XDG_DATA_DIRS "$pkg/share"; | ||
540 | fi; | ||
541 | if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then | ||
542 | addToSearchPath _HOST_PATH "$pkg/bin"; | ||
543 | fi; | ||
544 | if [[ -f "$pkg/nix-support/setup-hook" ]]; then | ||
545 | source "$pkg/nix-support/setup-hook"; | ||
546 | fi | ||
547 | } | ||
548 | addEnvHooks () | ||
549 | { | ||
550 | local depHostOffset="$1"; | ||
551 | shift; | ||
552 | local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; | ||
553 | local pkgHookVar; | ||
554 | for pkgHookVar in "${!pkgHookVarsSlice}"; | ||
555 | do | ||
556 | eval "${pkgHookVar}s"'+=("$@")'; | ||
557 | done | ||
558 | } | ||
559 | addNodePath () | ||
560 | { | ||
561 | addToSearchPath NODE_PATH $1/lib/node_modules | ||
562 | } | ||
563 | addToSearchPath () | ||
564 | { | ||
565 | addToSearchPathWithCustomDelimiter ":" "$@" | ||
566 | } | ||
567 | addToSearchPathWithCustomDelimiter () | ||
568 | { | ||
569 | local delimiter="$1"; | ||
570 | local varName="$2"; | ||
571 | local dir="$3"; | ||
572 | if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then | ||
573 | export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; | ||
574 | fi | ||
575 | } | ||
576 | bintoolsWrapper_addLDVars () | ||
577 | { | ||
578 | local role_post; | ||
579 | getHostRoleEnvHook; | ||
580 | if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then | ||
581 | export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; | ||
582 | fi; | ||
583 | if [[ -d "$1/lib" ]]; then | ||
584 | local -a glob=($1/lib/lib*); | ||
585 | if [ "${#glob[*]}" -gt 0 ]; then | ||
586 | export NIX_LDFLAGS${role_post}+=" -L$1/lib"; | ||
587 | fi; | ||
588 | fi | ||
589 | } | ||
590 | buildPhase () | ||
591 | { | ||
592 | runHook preBuild; | ||
593 | : ${makeFlags=}; | ||
594 | if [[ -z "$makeFlags" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then | ||
595 | echo "no Makefile, doing nothing"; | ||
596 | else | ||
597 | foundMakefile=1; | ||
598 | local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $buildFlags ${buildFlagsArray+"${buildFlagsArray[@]}"}); | ||
599 | echoCmd 'build flags' "${flagsArray[@]}"; | ||
600 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
601 | unset flagsArray; | ||
602 | fi; | ||
603 | runHook postBuild | ||
604 | } | ||
605 | ccWrapper_addCVars () | ||
606 | { | ||
607 | local role_post; | ||
608 | getHostRoleEnvHook; | ||
609 | if [ -d "$1/include" ]; then | ||
610 | export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; | ||
611 | fi; | ||
612 | if [ -d "$1/Library/Frameworks" ]; then | ||
613 | export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; | ||
614 | fi | ||
615 | } | ||
616 | checkPhase () | ||
617 | { | ||
618 | runHook preCheck; | ||
619 | if [[ -z "${foundMakefile:-}" ]]; then | ||
620 | echo "no Makefile or custom checkPhase, doing nothing"; | ||
621 | runHook postCheck; | ||
622 | return; | ||
623 | fi; | ||
624 | if [[ -z "${checkTarget:-}" ]]; then | ||
625 | if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then | ||
626 | checkTarget=check; | ||
627 | else | ||
628 | if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then | ||
629 | checkTarget=test; | ||
630 | fi; | ||
631 | fi; | ||
632 | fi; | ||
633 | if [[ -z "${checkTarget:-}" ]]; then | ||
634 | echo "no check/test target in ${makefile:-Makefile}, doing nothing"; | ||
635 | else | ||
636 | local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"} ${checkTarget}); | ||
637 | echoCmd 'check flags' "${flagsArray[@]}"; | ||
638 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
639 | unset flagsArray; | ||
640 | fi; | ||
641 | runHook postCheck | ||
642 | } | ||
643 | closeNest () | ||
644 | { | ||
645 | true | ||
646 | } | ||
647 | compressManPages () | ||
648 | { | ||
649 | local dir="$1"; | ||
650 | if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then | ||
651 | return; | ||
652 | fi; | ||
653 | echo "gzipping man pages under $dir/share/man/"; | ||
654 | find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | while IFS= read -r -d '' f; do | ||
655 | if gzip -c -n "$f" > "$f".gz; then | ||
656 | rm "$f"; | ||
657 | else | ||
658 | rm "$f".gz; | ||
659 | fi; | ||
660 | done; | ||
661 | find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do | ||
662 | local target; | ||
663 | target="$(readlink -f "$f")"; | ||
664 | if [ -f "$target".gz ]; then | ||
665 | ln -sf "$target".gz "$f".gz && rm "$f"; | ||
666 | fi; | ||
667 | done | ||
668 | } | ||
669 | configurePhase () | ||
670 | { | ||
671 | runHook preConfigure; | ||
672 | : ${configureScript=}; | ||
673 | : ${configureFlags=}; | ||
674 | if [[ -z "$configureScript" && -x ./configure ]]; then | ||
675 | configureScript=./configure; | ||
676 | fi; | ||
677 | if [ -z "${dontFixLibtool:-}" ]; then | ||
678 | local i; | ||
679 | find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do | ||
680 | echo "fixing libtool script $i"; | ||
681 | fixLibtool "$i"; | ||
682 | done; | ||
683 | fi; | ||
684 | if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then | ||
685 | configureFlags="${prefixKey:---prefix=}$prefix $configureFlags"; | ||
686 | fi; | ||
687 | if [ -z "${dontAddDisableDepTrack:-}" ]; then | ||
688 | if [ -f "$configureScript" ] && grep -q dependency-tracking "$configureScript"; then | ||
689 | configureFlags="--disable-dependency-tracking $configureFlags"; | ||
690 | fi; | ||
691 | fi; | ||
692 | if [ -z "${dontDisableStatic:-}" ]; then | ||
693 | if [ -f "$configureScript" ] && grep -q enable-static "$configureScript"; then | ||
694 | configureFlags="--disable-static $configureFlags"; | ||
695 | fi; | ||
696 | fi; | ||
697 | if [ -n "$configureScript" ]; then | ||
698 | local flagsArray=($configureFlags ${configureFlagsArray+"${configureFlagsArray[@]}"}); | ||
699 | echoCmd 'configure flags' "${flagsArray[@]}"; | ||
700 | $configureScript "${flagsArray[@]}"; | ||
701 | unset flagsArray; | ||
702 | else | ||
703 | echo "no configure script, doing nothing"; | ||
704 | fi; | ||
705 | runHook postConfigure | ||
706 | } | ||
707 | consumeEntire () | ||
708 | { | ||
709 | if IFS='' read -r -N 0 $1; then | ||
710 | echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; | ||
711 | return 1; | ||
712 | fi | ||
713 | } | ||
714 | distPhase () | ||
715 | { | ||
716 | runHook preDist; | ||
717 | local flagsArray=($distFlags ${distFlagsArray+"${distFlagsArray[@]}"} ${distTarget:-dist}); | ||
718 | echo 'dist flags: %q' "${flagsArray[@]}"; | ||
719 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
720 | if [ "${dontCopyDist:-0}" != 1 ]; then | ||
721 | mkdir -p "$out/tarballs"; | ||
722 | cp -pvd ${tarballs:-*.tar.gz} "$out/tarballs"; | ||
723 | fi; | ||
724 | runHook postDist | ||
725 | } | ||
726 | dumpVars () | ||
727 | { | ||
728 | if [ "${noDumpEnvVars:-0}" != 1 ]; then | ||
729 | export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" || true; | ||
730 | fi | ||
731 | } | ||
732 | echoCmd () | ||
733 | { | ||
734 | printf "%s:" "$1"; | ||
735 | shift; | ||
736 | printf ' %q' "$@"; | ||
737 | echo | ||
738 | } | ||
739 | exitHandler () | ||
740 | { | ||
741 | exitCode="$?"; | ||
742 | set +e; | ||
743 | if [ -n "${showBuildStats:-}" ]; then | ||
744 | times > "$NIX_BUILD_TOP/.times"; | ||
745 | local -a times=($(cat "$NIX_BUILD_TOP/.times")); | ||
746 | echo "build time elapsed: " "${times[@]}"; | ||
747 | fi; | ||
748 | if (( "$exitCode" != 0 )); then | ||
749 | runHook failureHook; | ||
750 | if [ -n "${succeedOnFailure:-}" ]; then | ||
751 | echo "build failed with exit code $exitCode (ignored)"; | ||
752 | mkdir -p "$out/nix-support"; | ||
753 | printf "%s" "$exitCode" > "$out/nix-support/failed"; | ||
754 | exit 0; | ||
755 | fi; | ||
756 | else | ||
757 | runHook exitHook; | ||
758 | fi; | ||
759 | exit "$exitCode" | ||
760 | } | ||
761 | findInputs () | ||
762 | { | ||
763 | local -r pkg="$1"; | ||
764 | local -ri hostOffset="$2"; | ||
765 | local -ri targetOffset="$3"; | ||
766 | (( "$hostOffset" <= "$targetOffset" )) || exit -1; | ||
767 | local varVar="${pkgAccumVarVars[$hostOffset + 1]}"; | ||
768 | local varRef="$varVar[\$targetOffset - \$hostOffset]"; | ||
769 | local var="${!varRef}"; | ||
770 | unset -v varVar varRef; | ||
771 | local varSlice="$var[*]"; | ||
772 | case "${!varSlice-}" in | ||
773 | *" $pkg "*) | ||
774 | return 0 | ||
775 | ;; | ||
776 | esac; | ||
777 | unset -v varSlice; | ||
778 | eval "$var"'+=("$pkg")'; | ||
779 | if ! [ -e "$pkg" ]; then | ||
780 | echo "build input $pkg does not exist" 1>&2; | ||
781 | exit 1; | ||
782 | fi; | ||
783 | local -i mapOffsetResult; | ||
784 | function mapOffset () | ||
785 | { | ||
786 | local -ri inputOffset="$1"; | ||
787 | if (( "$inputOffset" <= 0 )); then | ||
788 | local -ri outputOffset="$inputOffset + $hostOffset"; | ||
789 | else | ||
790 | local -ri outputOffset="$inputOffset - 1 + $targetOffset"; | ||
791 | fi; | ||
792 | mapOffsetResult="$outputOffset" | ||
793 | }; | ||
794 | local -i relHostOffset; | ||
795 | for relHostOffset in "${allPlatOffsets[@]}"; | ||
796 | do | ||
797 | local files="${propagatedDepFilesVars[$relHostOffset + 1]}"; | ||
798 | mapOffset relHostOffset; | ||
799 | local -i hostOffsetNext="$mapOffsetResult"; | ||
800 | [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue; | ||
801 | local -i relTargetOffset; | ||
802 | for relTargetOffset in "${allPlatOffsets[@]}"; | ||
803 | do | ||
804 | (( "$relHostOffset" <= "$relTargetOffset" )) || continue; | ||
805 | local fileRef="${files}[$relTargetOffset - $relHostOffset]"; | ||
806 | local file="${!fileRef}"; | ||
807 | unset -v fileRef; | ||
808 | mapOffset relTargetOffset; | ||
809 | local -i targetOffsetNext="$mapOffsetResult"; | ||
810 | [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue; | ||
811 | [[ -f "$pkg/nix-support/$file" ]] || continue; | ||
812 | local pkgNext; | ||
813 | read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; | ||
814 | for pkgNext in $pkgNext; | ||
815 | do | ||
816 | findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; | ||
817 | done; | ||
818 | done; | ||
819 | done | ||
820 | } | ||
821 | fixDarwinFrameworks () | ||
822 | { | ||
823 | local systemPrefix='/System/Library/Frameworks'; | ||
824 | for fn in "$@"; | ||
825 | do | ||
826 | if [ -L "$fn" ]; then | ||
827 | continue; | ||
828 | fi; | ||
829 | echo "$fn: fixing dylib"; | ||
830 | for framework in $(otool -L "$fn" | awk '/CoreFoundation\.framework/ {print $1}'); | ||
831 | do | ||
832 | install_name_tool -change "$framework" "$systemPrefix/CoreFoundation.framework/Versions/A/CoreFoundation" "$fn" 1>&2; | ||
833 | done; | ||
834 | done | ||
835 | } | ||
836 | fixDarwinFrameworksIn () | ||
837 | { | ||
838 | local dir="$1"; | ||
839 | fixDarwinFrameworks $(find "$dir" -name "*.dylib") | ||
840 | } | ||
841 | fixLibtool () | ||
842 | { | ||
843 | sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1" | ||
844 | } | ||
845 | fixupPhase () | ||
846 | { | ||
847 | local output; | ||
848 | for output in $outputs; | ||
849 | do | ||
850 | if [ -e "${!output}" ]; then | ||
851 | chmod -R u+w "${!output}"; | ||
852 | fi; | ||
853 | done; | ||
854 | runHook preFixup; | ||
855 | local output; | ||
856 | for output in $outputs; | ||
857 | do | ||
858 | prefix="${!output}" runHook fixupOutput; | ||
859 | done; | ||
860 | declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); | ||
861 | declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); | ||
862 | local propagatedInputsIndex; | ||
863 | for propagatedInputsIndex in "${!flatVars[@]}"; | ||
864 | do | ||
865 | local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; | ||
866 | local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; | ||
867 | [[ -n "${!propagatedInputsSlice}" ]] || continue; | ||
868 | mkdir -p "${!outputDev}/nix-support"; | ||
869 | printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; | ||
870 | done; | ||
871 | if [ -n "${setupHook:-}" ]; then | ||
872 | mkdir -p "${!outputDev}/nix-support"; | ||
873 | substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; | ||
874 | fi; | ||
875 | if [ -n "${setupHooks:-}" ]; then | ||
876 | mkdir -p "${!outputDev}/nix-support"; | ||
877 | local hook; | ||
878 | for hook in $setupHooks; | ||
879 | do | ||
880 | local content; | ||
881 | consumeEntire content < "$hook"; | ||
882 | substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; | ||
883 | unset -v content; | ||
884 | done; | ||
885 | unset -v hook; | ||
886 | fi; | ||
887 | if [ -n "${propagatedUserEnvPkgs:-}" ]; then | ||
888 | mkdir -p "${!outputBin}/nix-support"; | ||
889 | printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; | ||
890 | fi; | ||
891 | runHook postFixup | ||
892 | } | ||
893 | genericBuild () | ||
894 | { | ||
895 | if [ -f "${buildCommandPath:-}" ]; then | ||
896 | source "$buildCommandPath"; | ||
897 | return; | ||
898 | fi; | ||
899 | if [ -n "${buildCommand:-}" ]; then | ||
900 | eval "$buildCommand"; | ||
901 | return; | ||
902 | fi; | ||
903 | if [ -z "${phases:-}" ]; then | ||
904 | phases="${prePhases:-} unpackPhase patchPhase ${preConfigurePhases:-} configurePhase ${preBuildPhases:-} buildPhase checkPhase ${preInstallPhases:-} installPhase ${preFixupPhases:-} fixupPhase installCheckPhase ${preDistPhases:-} distPhase ${postPhases:-}"; | ||
905 | fi; | ||
906 | for curPhase in $phases; | ||
907 | do | ||
908 | if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then | ||
909 | continue; | ||
910 | fi; | ||
911 | if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then | ||
912 | continue; | ||
913 | fi; | ||
914 | if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then | ||
915 | continue; | ||
916 | fi; | ||
917 | if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then | ||
918 | continue; | ||
919 | fi; | ||
920 | if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then | ||
921 | continue; | ||
922 | fi; | ||
923 | if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then | ||
924 | continue; | ||
925 | fi; | ||
926 | if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then | ||
927 | continue; | ||
928 | fi; | ||
929 | if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then | ||
930 | continue; | ||
931 | fi; | ||
932 | if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then | ||
933 | continue; | ||
934 | fi; | ||
935 | if [[ -n $NIX_LOG_FD ]]; then | ||
936 | echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" 1>&$NIX_LOG_FD; | ||
937 | fi; | ||
938 | showPhaseHeader "$curPhase"; | ||
939 | dumpVars; | ||
940 | eval "${!curPhase:-$curPhase}"; | ||
941 | if [ "$curPhase" = unpackPhase ]; then | ||
942 | cd "${sourceRoot:-.}"; | ||
943 | fi; | ||
944 | done | ||
945 | } | ||
946 | getHostRole () | ||
947 | { | ||
948 | getRole "$hostOffset" | ||
949 | } | ||
950 | getHostRoleEnvHook () | ||
951 | { | ||
952 | getRole "$depHostOffset" | ||
953 | } | ||
954 | getRole () | ||
955 | { | ||
956 | case $1 in | ||
957 | -1) | ||
958 | role_post='_FOR_BUILD' | ||
959 | ;; | ||
960 | 0) | ||
961 | role_post='' | ||
962 | ;; | ||
963 | 1) | ||
964 | role_post='_FOR_TARGET' | ||
965 | ;; | ||
966 | *) | ||
967 | echo "libiconv-50: used as improper sort of dependency" > 2; | ||
968 | return 1 | ||
969 | ;; | ||
970 | esac | ||
971 | } | ||
972 | getTargetRole () | ||
973 | { | ||
974 | getRole "$targetOffset" | ||
975 | } | ||
976 | getTargetRoleEnvHook () | ||
977 | { | ||
978 | getRole "$depTargetOffset" | ||
979 | } | ||
980 | getTargetRoleWrapper () | ||
981 | { | ||
982 | case $targetOffset in | ||
983 | -1) | ||
984 | export NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@=1 | ||
985 | ;; | ||
986 | 0) | ||
987 | export NIX_@wrapperName@_TARGET_HOST_@suffixSalt@=1 | ||
988 | ;; | ||
989 | 1) | ||
990 | export NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@=1 | ||
991 | ;; | ||
992 | *) | ||
993 | echo "libiconv-50: used as improper sort of dependency" > 2; | ||
994 | return 1 | ||
995 | ;; | ||
996 | esac | ||
997 | } | ||
998 | header () | ||
999 | { | ||
1000 | echo "$1" | ||
1001 | } | ||
1002 | installCheckPhase () | ||
1003 | { | ||
1004 | runHook preInstallCheck; | ||
1005 | if [[ -z "${foundMakefile:-}" ]]; then | ||
1006 | echo "no Makefile or custom installCheckPhase, doing nothing"; | ||
1007 | else | ||
1008 | if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} ${installCheckTarget:-installcheck} > /dev/null 2>&1; then | ||
1009 | echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; | ||
1010 | else | ||
1011 | local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}} SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"} ${installCheckTarget:-installcheck}); | ||
1012 | echoCmd 'installcheck flags' "${flagsArray[@]}"; | ||
1013 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
1014 | unset flagsArray; | ||
1015 | fi; | ||
1016 | fi; | ||
1017 | runHook postInstallCheck | ||
1018 | } | ||
1019 | installPhase () | ||
1020 | { | ||
1021 | runHook preInstall; | ||
1022 | if [ -n "$prefix" ]; then | ||
1023 | mkdir -p "$prefix"; | ||
1024 | fi; | ||
1025 | local flagsArray=(SHELL=$SHELL $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} $installFlags ${installFlagsArray+"${installFlagsArray[@]}"} ${installTargets:-install}); | ||
1026 | echoCmd 'install flags' "${flagsArray[@]}"; | ||
1027 | make ${makefile:+-f $makefile} "${flagsArray[@]}"; | ||
1028 | unset flagsArray; | ||
1029 | runHook postInstall | ||
1030 | } | ||
1031 | isELF () | ||
1032 | { | ||
1033 | local fn="$1"; | ||
1034 | local fd; | ||
1035 | local magic; | ||
1036 | exec {fd}< "$fn"; | ||
1037 | read -r -n 4 -u "$fd" magic; | ||
1038 | exec {fd}>&-; | ||
1039 | if [ "$magic" = 'ELF' ]; then | ||
1040 | return 0; | ||
1041 | else | ||
1042 | return 1; | ||
1043 | fi | ||
1044 | } | ||
1045 | isScript () | ||
1046 | { | ||
1047 | local fn="$1"; | ||
1048 | local fd; | ||
1049 | local magic; | ||
1050 | exec {fd}< "$fn"; | ||
1051 | read -r -n 2 -u "$fd" magic; | ||
1052 | exec {fd}>&-; | ||
1053 | if [[ "$magic" =~ \#! ]]; then | ||
1054 | return 0; | ||
1055 | else | ||
1056 | return 1; | ||
1057 | fi | ||
1058 | } | ||
1059 | mapOffset () | ||
1060 | { | ||
1061 | local -ri inputOffset="$1"; | ||
1062 | if (( "$inputOffset" <= 0 )); then | ||
1063 | local -ri outputOffset="$inputOffset + $hostOffset"; | ||
1064 | else | ||
1065 | local -ri outputOffset="$inputOffset - 1 + $targetOffset"; | ||
1066 | fi; | ||
1067 | mapOffsetResult="$outputOffset" | ||
1068 | } | ||
1069 | moveToOutput () | ||
1070 | { | ||
1071 | local patt="$1"; | ||
1072 | local dstOut="$2"; | ||
1073 | local output; | ||
1074 | for output in $outputs; | ||
1075 | do | ||
1076 | if [ "${!output}" = "$dstOut" ]; then | ||
1077 | continue; | ||
1078 | fi; | ||
1079 | local srcPath; | ||
1080 | for srcPath in "${!output}"/$patt; | ||
1081 | do | ||
1082 | if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then | ||
1083 | continue; | ||
1084 | fi; | ||
1085 | if [ "$dstOut" = REMOVE ]; then | ||
1086 | echo "Removing $srcPath"; | ||
1087 | rm -r "$srcPath"; | ||
1088 | else | ||
1089 | local dstPath="$dstOut${srcPath#${!output}}"; | ||
1090 | echo "Moving $srcPath to $dstPath"; | ||
1091 | if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then | ||
1092 | rmdir "$srcPath" --ignore-fail-on-non-empty; | ||
1093 | if [ -d "$srcPath" ]; then | ||
1094 | mv -t "$dstPath" "$srcPath"/*; | ||
1095 | rmdir "$srcPath"; | ||
1096 | fi; | ||
1097 | else | ||
1098 | mkdir -p "$(readlink -m "$dstPath/..")"; | ||
1099 | mv "$srcPath" "$dstPath"; | ||
1100 | fi; | ||
1101 | fi; | ||
1102 | local srcParent="$(readlink -m "$srcPath/..")"; | ||
1103 | if rmdir "$srcParent"; then | ||
1104 | echo "Removing empty $srcParent/ and (possibly) its parents"; | ||
1105 | rmdir -p --ignore-fail-on-non-empty "$(readlink -m "$srcParent/..")" 2> /dev/null || true; | ||
1106 | fi; | ||
1107 | done; | ||
1108 | done | ||
1109 | } | ||
1110 | noDeprecatedDeclarations () | ||
1111 | { | ||
1112 | flag="-Wno-deprecated-declarations"; | ||
1113 | if [[ "${NIX_CFLAGS_COMPILE-}" != *$flag* ]]; then | ||
1114 | NIX_CFLAGS_COMPILE+=" $flag"; | ||
1115 | fi | ||
1116 | } | ||
1117 | patchPhase () | ||
1118 | { | ||
1119 | runHook prePatch; | ||
1120 | for i in ${patches:-}; | ||
1121 | do | ||
1122 | header "applying patch $i" 3; | ||
1123 | local uncompress=cat; | ||
1124 | case "$i" in | ||
1125 | *.gz) | ||
1126 | uncompress="gzip -d" | ||
1127 | ;; | ||
1128 | *.bz2) | ||
1129 | uncompress="bzip2 -d" | ||
1130 | ;; | ||
1131 | *.xz) | ||
1132 | uncompress="xz -d" | ||
1133 | ;; | ||
1134 | *.lzma) | ||
1135 | uncompress="lzma -d" | ||
1136 | ;; | ||
1137 | esac; | ||
1138 | $uncompress < "$i" 2>&1 | patch ${patchFlags:--p1}; | ||
1139 | done; | ||
1140 | runHook postPatch | ||
1141 | } | ||
1142 | patchShebangs () | ||
1143 | { | ||
1144 | local pathName; | ||
1145 | if [[ "$1" == "--host" ]]; then | ||
1146 | pathName=HOST_PATH; | ||
1147 | shift; | ||
1148 | else | ||
1149 | if [[ "$1" == "--build" ]]; then | ||
1150 | pathName=PATH; | ||
1151 | shift; | ||
1152 | fi; | ||
1153 | fi; | ||
1154 | echo "patching script interpreter paths in $@"; | ||
1155 | local f; | ||
1156 | local oldPath; | ||
1157 | local newPath; | ||
1158 | local arg0; | ||
1159 | local args; | ||
1160 | local oldInterpreterLine; | ||
1161 | local newInterpreterLine; | ||
1162 | if [[ $# -eq 0 ]]; then | ||
1163 | echo "No arguments supplied to patchShebangs" 1>&2; | ||
1164 | return 0; | ||
1165 | fi; | ||
1166 | local f; | ||
1167 | while IFS= read -r -d '' f; do | ||
1168 | isScript "$f" || continue; | ||
1169 | read -r oldInterpreterLine < "$f"; | ||
1170 | read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; | ||
1171 | if [[ -z "$pathName" ]]; then | ||
1172 | if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then | ||
1173 | pathName=HOST_PATH; | ||
1174 | else | ||
1175 | pathName=PATH; | ||
1176 | fi; | ||
1177 | fi; | ||
1178 | if [[ "$oldPath" == *"/bin/env" ]]; then | ||
1179 | if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then | ||
1180 | echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; | ||
1181 | exit 1; | ||
1182 | fi; | ||
1183 | newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; | ||
1184 | else | ||
1185 | if [[ -z $oldPath ]]; then | ||
1186 | oldPath="/bin/sh"; | ||
1187 | fi; | ||
1188 | newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; | ||
1189 | args="$arg0 $args"; | ||
1190 | fi; | ||
1191 | newInterpreterLine="$newPath $args"; | ||
1192 | newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; | ||
1193 | if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then | ||
1194 | if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then | ||
1195 | echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; | ||
1196 | escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; | ||
1197 | timestamp=$(stat --printf "%y" "$f"); | ||
1198 | sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; | ||
1199 | touch --date "$timestamp" "$f"; | ||
1200 | fi; | ||
1201 | fi; | ||
1202 | done < <(find "$@" -type f -perm -0100 -print0); | ||
1203 | stopNest | ||
1204 | } | ||
1205 | patchShebangsAuto () | ||
1206 | { | ||
1207 | if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then | ||
1208 | if [[ "$output" != out && "$output" = "$outputDev" ]]; then | ||
1209 | patchShebangs --build "$prefix"; | ||
1210 | else | ||
1211 | patchShebangs --host "$prefix"; | ||
1212 | fi; | ||
1213 | fi | ||
1214 | } | ||
1215 | printLines () | ||
1216 | { | ||
1217 | (( "$#" > 0 )) || return 0; | ||
1218 | printf '%s\n' "$@" | ||
1219 | } | ||
1220 | printWords () | ||
1221 | { | ||
1222 | (( "$#" > 0 )) || return 0; | ||
1223 | printf '%s ' "$@" | ||
1224 | } | ||
1225 | runHook () | ||
1226 | { | ||
1227 | local hookName="$1"; | ||
1228 | shift; | ||
1229 | local hooksSlice="${hookName%Hook}Hooks[@]"; | ||
1230 | local hook; | ||
1231 | for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; | ||
1232 | do | ||
1233 | _eval "$hook" "$@"; | ||
1234 | done; | ||
1235 | return 0 | ||
1236 | } | ||
1237 | runOneHook () | ||
1238 | { | ||
1239 | local hookName="$1"; | ||
1240 | shift; | ||
1241 | local hooksSlice="${hookName%Hook}Hooks[@]"; | ||
1242 | local hook ret=1; | ||
1243 | for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; | ||
1244 | do | ||
1245 | if _eval "$hook" "$@"; then | ||
1246 | ret=0; | ||
1247 | break; | ||
1248 | fi; | ||
1249 | done; | ||
1250 | return "$ret" | ||
1251 | } | ||
1252 | showPhaseHeader () | ||
1253 | { | ||
1254 | local phase="$1"; | ||
1255 | case "$phase" in | ||
1256 | unpackPhase) | ||
1257 | header "unpacking sources" | ||
1258 | ;; | ||
1259 | patchPhase) | ||
1260 | header "patching sources" | ||
1261 | ;; | ||
1262 | configurePhase) | ||
1263 | header "configuring" | ||
1264 | ;; | ||
1265 | buildPhase) | ||
1266 | header "building" | ||
1267 | ;; | ||
1268 | checkPhase) | ||
1269 | header "running tests" | ||
1270 | ;; | ||
1271 | installPhase) | ||
1272 | header "installing" | ||
1273 | ;; | ||
1274 | fixupPhase) | ||
1275 | header "post-installation fixup" | ||
1276 | ;; | ||
1277 | installCheckPhase) | ||
1278 | header "running install tests" | ||
1279 | ;; | ||
1280 | *) | ||
1281 | header "$phase" | ||
1282 | ;; | ||
1283 | esac | ||
1284 | } | ||
1285 | stopNest () | ||
1286 | { | ||
1287 | true | ||
1288 | } | ||
1289 | stripDirs () | ||
1290 | { | ||
1291 | local cmd="$1"; | ||
1292 | local dirs="$2"; | ||
1293 | local stripFlags="$3"; | ||
1294 | local dirsNew=; | ||
1295 | local d; | ||
1296 | for d in ${dirs}; | ||
1297 | do | ||
1298 | if [ -d "$prefix/$d" ]; then | ||
1299 | dirsNew="${dirsNew} $prefix/$d "; | ||
1300 | fi; | ||
1301 | done; | ||
1302 | dirs=${dirsNew}; | ||
1303 | if [ -n "${dirs}" ]; then | ||
1304 | header "stripping (with command $cmd and flags $stripFlags) in$dirs"; | ||
1305 | find $dirs -type f -exec $cmd $commonStripFlags $stripFlags '{}' \; 2> /dev/null; | ||
1306 | stopNest; | ||
1307 | fi | ||
1308 | } | ||
1309 | stripHash () | ||
1310 | { | ||
1311 | local strippedName casematchOpt=0; | ||
1312 | strippedName="$(basename -- "$1")"; | ||
1313 | shopt -q nocasematch && casematchOpt=1; | ||
1314 | shopt -u nocasematch; | ||
1315 | if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then | ||
1316 | echo "${strippedName:33}"; | ||
1317 | else | ||
1318 | echo "$strippedName"; | ||
1319 | fi; | ||
1320 | if (( casematchOpt )); then | ||
1321 | shopt -s nocasematch; | ||
1322 | fi | ||
1323 | } | ||
1324 | substitute () | ||
1325 | { | ||
1326 | local input="$1"; | ||
1327 | local output="$2"; | ||
1328 | shift 2; | ||
1329 | if [ ! -f "$input" ]; then | ||
1330 | echo "substitute(): ERROR: file '$input' does not exist" 1>&2; | ||
1331 | return 1; | ||
1332 | fi; | ||
1333 | local content; | ||
1334 | consumeEntire content < "$input"; | ||
1335 | if [ -e "$output" ]; then | ||
1336 | chmod +w "$output"; | ||
1337 | fi; | ||
1338 | substituteStream content "file '$input'" "$@" > "$output" | ||
1339 | } | ||
1340 | substituteAll () | ||
1341 | { | ||
1342 | local input="$1"; | ||
1343 | local output="$2"; | ||
1344 | local -a args=(); | ||
1345 | _allFlags; | ||
1346 | substitute "$input" "$output" "${args[@]}" | ||
1347 | } | ||
1348 | substituteAllInPlace () | ||
1349 | { | ||
1350 | local fileName="$1"; | ||
1351 | shift; | ||
1352 | substituteAll "$fileName" "$fileName" "$@" | ||
1353 | } | ||
1354 | substituteAllStream () | ||
1355 | { | ||
1356 | local -a args=(); | ||
1357 | _allFlags; | ||
1358 | substituteStream "$1" "$2" "${args[@]}" | ||
1359 | } | ||
1360 | substituteInPlace () | ||
1361 | { | ||
1362 | local fileName="$1"; | ||
1363 | shift; | ||
1364 | substitute "$fileName" "$fileName" "$@" | ||
1365 | } | ||
1366 | substituteStream () | ||
1367 | { | ||
1368 | local var=$1; | ||
1369 | local description=$2; | ||
1370 | shift 2; | ||
1371 | while (( "$#" )); do | ||
1372 | case "$1" in | ||
1373 | --replace) | ||
1374 | pattern="$2"; | ||
1375 | replacement="$3"; | ||
1376 | shift 3; | ||
1377 | local savedvar; | ||
1378 | savedvar="${!var}"; | ||
1379 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; | ||
1380 | if [ "$pattern" != "$replacement" ]; then | ||
1381 | if [ "${!var}" == "$savedvar" ]; then | ||
1382 | echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2; | ||
1383 | fi; | ||
1384 | fi | ||
1385 | ;; | ||
1386 | --subst-var) | ||
1387 | local varName="$2"; | ||
1388 | shift 2; | ||
1389 | if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then | ||
1390 | echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; | ||
1391 | return 1; | ||
1392 | fi; | ||
1393 | if [ -z ${!varName+x} ]; then | ||
1394 | echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; | ||
1395 | return 1; | ||
1396 | fi; | ||
1397 | pattern="@$varName@"; | ||
1398 | replacement="${!varName}"; | ||
1399 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' | ||
1400 | ;; | ||
1401 | --subst-var-by) | ||
1402 | pattern="@$2@"; | ||
1403 | replacement="$3"; | ||
1404 | eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; | ||
1405 | shift 3 | ||
1406 | ;; | ||
1407 | *) | ||
1408 | echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; | ||
1409 | return 1 | ||
1410 | ;; | ||
1411 | esac; | ||
1412 | done; | ||
1413 | printf "%s" "${!var}" | ||
1414 | } | ||
1415 | unpackFile () | ||
1416 | { | ||
1417 | curSrc="$1"; | ||
1418 | header "unpacking source archive $curSrc" 3; | ||
1419 | if ! runOneHook unpackCmd "$curSrc"; then | ||
1420 | echo "do not know how to unpack source archive $curSrc"; | ||
1421 | exit 1; | ||
1422 | fi | ||
1423 | } | ||
1424 | unpackPhase () | ||
1425 | { | ||
1426 | runHook preUnpack; | ||
1427 | if [ -z "${srcs:-}" ]; then | ||
1428 | if [ -z "${src:-}" ]; then | ||
1429 | echo 'variable $src or $srcs should point to the source'; | ||
1430 | exit 1; | ||
1431 | fi; | ||
1432 | srcs="$src"; | ||
1433 | fi; | ||
1434 | local dirsBefore=""; | ||
1435 | for i in *; | ||
1436 | do | ||
1437 | if [ -d "$i" ]; then | ||
1438 | dirsBefore="$dirsBefore $i "; | ||
1439 | fi; | ||
1440 | done; | ||
1441 | for i in $srcs; | ||
1442 | do | ||
1443 | unpackFile "$i"; | ||
1444 | done; | ||
1445 | : ${sourceRoot=}; | ||
1446 | if [ -n "${setSourceRoot:-}" ]; then | ||
1447 | runOneHook setSourceRoot; | ||
1448 | else | ||
1449 | if [ -z "$sourceRoot" ]; then | ||
1450 | for i in *; | ||
1451 | do | ||
1452 | if [ -d "$i" ]; then | ||
1453 | case $dirsBefore in | ||
1454 | *\ $i\ *) | ||
1455 | |||
1456 | ;; | ||
1457 | *) | ||
1458 | if [ -n "$sourceRoot" ]; then | ||
1459 | echo "unpacker produced multiple directories"; | ||
1460 | exit 1; | ||
1461 | fi; | ||
1462 | sourceRoot="$i" | ||
1463 | ;; | ||
1464 | esac; | ||
1465 | fi; | ||
1466 | done; | ||
1467 | fi; | ||
1468 | fi; | ||
1469 | if [ -z "$sourceRoot" ]; then | ||
1470 | echo "unpacker appears to have produced no directories"; | ||
1471 | exit 1; | ||
1472 | fi; | ||
1473 | echo "source root is $sourceRoot"; | ||
1474 | if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then | ||
1475 | chmod -R u+w -- "$sourceRoot"; | ||
1476 | fi; | ||
1477 | runHook postUnpack | ||
1478 | } | ||
1479 | updateSourceDateEpoch () | ||
1480 | { | ||
1481 | local path="$1"; | ||
1482 | 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)); | ||
1483 | local time="${res[0]//\.[0-9]*/}"; | ||
1484 | local newestFile="${res[1]}"; | ||
1485 | if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then | ||
1486 | echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; | ||
1487 | export SOURCE_DATE_EPOCH="$time"; | ||
1488 | local now="$(date +%s)"; | ||
1489 | if [ "$time" -gt $((now - 60)) ]; then | ||
1490 | echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; | ||
1491 | fi; | ||
1492 | fi | ||
1493 | } | ||
1494 | useSystemCoreFoundationFramework () | ||
1495 | { | ||
1496 | export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks | ||
1497 | } | ||
1498 | |||
1499 | export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" | ||
1500 | export TMP="$NIX_BUILD_TOP" | ||
1501 | export TMPDIR="$NIX_BUILD_TOP" | ||
1502 | export TEMP="$NIX_BUILD_TOP" | ||
1503 | export TEMPDIR="$NIX_BUILD_TOP" | ||
1504 | eval "$shellHook" | ||
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e30131 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,6 @@ | |||
1 | /target | ||
2 | **/*.rs.bk | ||
3 | Cargo.lock | ||
4 | bin/ | ||
5 | pkg/ | ||
6 | wasm-pack.log | ||
diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..52603a1 --- /dev/null +++ b/Cargo.toml | |||
@@ -0,0 +1,25 @@ | |||
1 | [package] | ||
2 | name = "cstea" | ||
3 | version = "0.1.0" | ||
4 | authors = ["Akshay <[email protected]>"] | ||
5 | edition = "2018" | ||
6 | |||
7 | [lib] | ||
8 | crate-type = ["cdylib", "rlib"] | ||
9 | |||
10 | [features] | ||
11 | default = ["console_error_panic_hook"] | ||
12 | |||
13 | [dependencies] | ||
14 | wasm-bindgen = "0.2.63" | ||
15 | syntax = { path = "../ref/ra-orig/crates/syntax" } | ||
16 | console_error_panic_hook = { version = "0.1.6", optional = true } | ||
17 | wee_alloc = { version = "0.4.5", optional = true } | ||
18 | js-sys = "0.3.51" | ||
19 | |||
20 | [dev-dependencies] | ||
21 | wasm-bindgen-test = "0.3.13" | ||
22 | |||
23 | [profile.release] | ||
24 | # Tell `rustc` to optimize for small code size. | ||
25 | opt-level = "s" | ||
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a157a7e --- /dev/null +++ b/flake.lock | |||
@@ -0,0 +1,126 @@ | |||
1 | { | ||
2 | "nodes": { | ||
3 | "flake-compat": { | ||
4 | "flake": false, | ||
5 | "locked": { | ||
6 | "lastModified": 1606424373, | ||
7 | "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", | ||
8 | "owner": "edolstra", | ||
9 | "repo": "flake-compat", | ||
10 | "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", | ||
11 | "type": "github" | ||
12 | }, | ||
13 | "original": { | ||
14 | "owner": "edolstra", | ||
15 | "repo": "flake-compat", | ||
16 | "type": "github" | ||
17 | } | ||
18 | }, | ||
19 | "gitignore": { | ||
20 | "flake": false, | ||
21 | "locked": { | ||
22 | "lastModified": 1611672876, | ||
23 | "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", | ||
24 | "owner": "hercules-ci", | ||
25 | "repo": "gitignore", | ||
26 | "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", | ||
27 | "type": "github" | ||
28 | }, | ||
29 | "original": { | ||
30 | "owner": "hercules-ci", | ||
31 | "repo": "gitignore", | ||
32 | "type": "github" | ||
33 | } | ||
34 | }, | ||
35 | "mozillapkgs": { | ||
36 | "flake": false, | ||
37 | "locked": { | ||
38 | "lastModified": 1612892239, | ||
39 | "narHash": "sha256-jwrdJvaDl+kCRH3LFYuL9KweXO7fCTXxLovKja6xqbk=", | ||
40 | "owner": "andersk", | ||
41 | "repo": "nixpkgs-mozilla", | ||
42 | "rev": "3499e085fb6ae1a846bcf425fa9c98a3b77480da", | ||
43 | "type": "github" | ||
44 | }, | ||
45 | "original": { | ||
46 | "owner": "andersk", | ||
47 | "ref": "stdenv.lib", | ||
48 | "repo": "nixpkgs-mozilla", | ||
49 | "type": "github" | ||
50 | } | ||
51 | }, | ||
52 | "naersk": { | ||
53 | "inputs": { | ||
54 | "nixpkgs": "nixpkgs" | ||
55 | }, | ||
56 | "locked": { | ||
57 | "lastModified": 1623324658, | ||
58 | "narHash": "sha256-TjWmZPH/xbUi7Xuj2EigB9sTOpqsiFmnv7m6+QgTDrA=", | ||
59 | "owner": "nmattia", | ||
60 | "repo": "naersk", | ||
61 | "rev": "4f7426c362809e472d03c369d3674317c32b6863", | ||
62 | "type": "github" | ||
63 | }, | ||
64 | "original": { | ||
65 | "owner": "nmattia", | ||
66 | "repo": "naersk", | ||
67 | "type": "github" | ||
68 | } | ||
69 | }, | ||
70 | "nixpkgs": { | ||
71 | "locked": { | ||
72 | "lastModified": 1623400243, | ||
73 | "narHash": "sha256-HRcjn4ljt3aWUUWpap3MfigXwP1wwl3BNMi5+z4D1Uc=", | ||
74 | "owner": "NixOS", | ||
75 | "repo": "nixpkgs", | ||
76 | "rev": "29d5b177af78dccbe1d8ff8cf6212973aeef2f23", | ||
77 | "type": "github" | ||
78 | }, | ||
79 | "original": { | ||
80 | "id": "nixpkgs", | ||
81 | "type": "indirect" | ||
82 | } | ||
83 | }, | ||
84 | "nixpkgs_2": { | ||
85 | "locked": { | ||
86 | "lastModified": 1623400243, | ||
87 | "narHash": "sha256-HRcjn4ljt3aWUUWpap3MfigXwP1wwl3BNMi5+z4D1Uc=", | ||
88 | "owner": "NixOS", | ||
89 | "repo": "nixpkgs", | ||
90 | "rev": "29d5b177af78dccbe1d8ff8cf6212973aeef2f23", | ||
91 | "type": "github" | ||
92 | }, | ||
93 | "original": { | ||
94 | "id": "nixpkgs", | ||
95 | "type": "indirect" | ||
96 | } | ||
97 | }, | ||
98 | "root": { | ||
99 | "inputs": { | ||
100 | "flake-compat": "flake-compat", | ||
101 | "gitignore": "gitignore", | ||
102 | "mozillapkgs": "mozillapkgs", | ||
103 | "naersk": "naersk", | ||
104 | "nixpkgs": "nixpkgs_2", | ||
105 | "utils": "utils" | ||
106 | } | ||
107 | }, | ||
108 | "utils": { | ||
109 | "locked": { | ||
110 | "lastModified": 1622445595, | ||
111 | "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", | ||
112 | "owner": "numtide", | ||
113 | "repo": "flake-utils", | ||
114 | "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", | ||
115 | "type": "github" | ||
116 | }, | ||
117 | "original": { | ||
118 | "owner": "numtide", | ||
119 | "repo": "flake-utils", | ||
120 | "type": "github" | ||
121 | } | ||
122 | } | ||
123 | }, | ||
124 | "root": "root", | ||
125 | "version": 7 | ||
126 | } | ||
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..450300e --- /dev/null +++ b/flake.nix | |||
@@ -0,0 +1,95 @@ | |||
1 | { | ||
2 | inputs = { | ||
3 | utils.url = "github:numtide/flake-utils"; | ||
4 | naersk.url = "github:nmattia/naersk"; | ||
5 | mozillapkgs = { | ||
6 | url = "github:andersk/nixpkgs-mozilla/stdenv.lib"; | ||
7 | flake = false; | ||
8 | }; | ||
9 | gitignore = { | ||
10 | url = "github:hercules-ci/gitignore"; | ||
11 | flake = false; | ||
12 | }; | ||
13 | flake-compat = { | ||
14 | url = "github:edolstra/flake-compat"; | ||
15 | flake = false; | ||
16 | }; | ||
17 | }; | ||
18 | |||
19 | outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }: | ||
20 | utils.lib.eachDefaultSystem (system: | ||
21 | let | ||
22 | pkgs = nixpkgs.legacyPackages."${system}"; | ||
23 | lib = pkgs.lib; | ||
24 | stdenv = pkgs.stdenv; | ||
25 | darwin = pkgs.darwin; | ||
26 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; | ||
27 | |||
28 | # Get a specific rust version | ||
29 | mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { }; | ||
30 | chanspec = { | ||
31 | date = "2021-03-31"; | ||
32 | channel = "nightly"; | ||
33 | sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date | ||
34 | }; | ||
35 | |||
36 | rustChannel = mozilla.rustChannelOf chanspec; | ||
37 | rust = rustChannel.rust.override { | ||
38 | targets = [ "wasm32-unknown-unknown" ]; | ||
39 | extensions = [ ]; | ||
40 | }; | ||
41 | rust-src = rustChannel.rust-src; | ||
42 | |||
43 | naersk-lib = naersk.lib."${system}".override { | ||
44 | cargo = rust; | ||
45 | rustc = rust; | ||
46 | }; | ||
47 | |||
48 | nativeBuildInputs = with pkgs; [ | ||
49 | nixUnstable | ||
50 | ]; | ||
51 | |||
52 | buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ | ||
53 | darwin.apple_sdk.frameworks.Security | ||
54 | darwin.libiconv | ||
55 | ]; | ||
56 | |||
57 | in | ||
58 | rec { | ||
59 | packages.cstea = naersk-lib.buildPackage { | ||
60 | pname = "cstea"; | ||
61 | version = "0.1.0"; | ||
62 | root = gitignoreSource ./.; | ||
63 | inherit nativeBuildInputs buildInputs; | ||
64 | }; | ||
65 | defaultPackage = packages.cstea; | ||
66 | apps.cstea = utils.lib.mkApp { | ||
67 | drv = packages.cstea; | ||
68 | }; | ||
69 | apps.check = { | ||
70 | type = "app"; | ||
71 | program = "${pkgs.cargo-watch}/bin/cargo-watch"; | ||
72 | }; | ||
73 | defaultApp = apps.cstea; | ||
74 | devShell = pkgs.mkShell { | ||
75 | nativeBuildInputs = nativeBuildInputs ++ [ | ||
76 | rust | ||
77 | rust-src | ||
78 | pkgs.rust-analyzer | ||
79 | pkgs.rustfmt | ||
80 | pkgs.cargo | ||
81 | pkgs.cargo-watch | ||
82 | |||
83 | pkgs.miniserve | ||
84 | pkgs.wasm-pack | ||
85 | pkgs.cargo-generate | ||
86 | pkgs.nodePackages.npm | ||
87 | pkgs.nodejs | ||
88 | ]; | ||
89 | inherit buildInputs; | ||
90 | RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; | ||
91 | RUST_LOG = "info"; | ||
92 | RUST_BACKTRACE = 1; | ||
93 | }; | ||
94 | }); | ||
95 | } | ||
diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..3fec65f --- /dev/null +++ b/rust-toolchain.toml | |||
@@ -0,0 +1,6 @@ | |||
1 | [toolchain] | ||
2 | channel = "nightly" | ||
3 | components = [ "rustfmt", "rustc-dev" ] | ||
4 | targets = [ "wasm32-unknown-unknown" ] | ||
5 | profile = "minimal" | ||
6 | |||
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..f9a6a26 --- /dev/null +++ b/src/lib.rs | |||
@@ -0,0 +1,118 @@ | |||
1 | mod utils; | ||
2 | |||
3 | use js_sys::Array; | ||
4 | |||
5 | use syntax::{ | ||
6 | ast::{self, AstNode}, | ||
7 | NodeOrToken, SourceFile, SyntaxElement, SyntaxError, SyntaxNode, | ||
8 | }; | ||
9 | use wasm_bindgen::prelude::*; | ||
10 | |||
11 | use std::{convert::From, str::FromStr}; | ||
12 | |||
13 | // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global | ||
14 | // allocator. | ||
15 | #[cfg(feature = "wee_alloc")] | ||
16 | #[global_allocator] | ||
17 | static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; | ||
18 | |||
19 | #[wasm_bindgen] | ||
20 | pub fn put_cst(source: &str) -> String { | ||
21 | let source_file = SourceFile::parse(source); | ||
22 | source_file.debug_dump() | ||
23 | } | ||
24 | |||
25 | // wrapper type to pass syntax elements to JS | ||
26 | #[wasm_bindgen] | ||
27 | #[derive(Debug, Clone)] | ||
28 | pub struct SynNode { | ||
29 | node: SyntaxElement, | ||
30 | } | ||
31 | |||
32 | impl SynNode { | ||
33 | pub fn new(node: SyntaxElement) -> Self { | ||
34 | Self { node } | ||
35 | } | ||
36 | } | ||
37 | |||
38 | #[wasm_bindgen] | ||
39 | impl SynNode { | ||
40 | pub fn children(&self) -> Vec<JsValue> { | ||
41 | match &self.node { | ||
42 | NodeOrToken::Node(n) => n | ||
43 | .children_with_tokens() | ||
44 | .map(SynNode::new) | ||
45 | .map(JsValue::from) | ||
46 | .collect(), | ||
47 | NodeOrToken::Token(_) => vec![], | ||
48 | } | ||
49 | } | ||
50 | |||
51 | pub fn is_token(&self) -> bool { | ||
52 | self.node.as_token().is_some() | ||
53 | } | ||
54 | |||
55 | pub fn to_string(&self) -> String { | ||
56 | format!("{:?}@{:?}", self.node.kind(), self.node.text_range(),) | ||
57 | } | ||
58 | |||
59 | pub fn from_str(s: &str) -> Result<JsValue, JsValue> { | ||
60 | FromStr::from_str(s) | ||
61 | .map(|p: SynNode| JsValue::from(p)) | ||
62 | .map_err(JsValue::from) | ||
63 | } | ||
64 | } | ||
65 | |||
66 | impl FromStr for SynNode { | ||
67 | type Err = Array; | ||
68 | fn from_str(s: &str) -> Result<Self, Array> { | ||
69 | let source_file = SourceFile::parse(s); | ||
70 | if source_file.errors().is_empty() { | ||
71 | Ok(Self { | ||
72 | node: NodeOrToken::Node(source_file.ok().unwrap().syntax().clone()), | ||
73 | }) | ||
74 | } else { | ||
75 | Err(source_file | ||
76 | .errors() | ||
77 | .into_iter() | ||
78 | .map(SynErr::new) | ||
79 | .map(JsValue::from) | ||
80 | .collect()) | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | |||
85 | #[wasm_bindgen] | ||
86 | #[derive(Debug, Clone)] | ||
87 | struct SynErr { | ||
88 | err: SyntaxError, | ||
89 | } | ||
90 | |||
91 | impl SynErr { | ||
92 | pub fn new(err: &SyntaxError) -> Self { | ||
93 | Self { err: err.clone() } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | #[wasm_bindgen] | ||
98 | struct TextRange { | ||
99 | start: u32, | ||
100 | end: u32, | ||
101 | } | ||
102 | |||
103 | impl From<(u32, u32)> for TextRange { | ||
104 | fn from((start, end): (u32, u32)) -> Self { | ||
105 | TextRange { start, end } | ||
106 | } | ||
107 | } | ||
108 | |||
109 | #[wasm_bindgen] | ||
110 | impl SynErr { | ||
111 | pub fn range(&self) -> TextRange { | ||
112 | let r = self.err.range(); | ||
113 | (r.start().into(), r.end().into()).into() | ||
114 | } | ||
115 | pub fn to_string(&self) -> String { | ||
116 | self.err.to_string() | ||
117 | } | ||
118 | } | ||
diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 0000000..b1d7929 --- /dev/null +++ b/src/utils.rs | |||
@@ -0,0 +1,10 @@ | |||
1 | pub fn set_panic_hook() { | ||
2 | // When the `console_error_panic_hook` feature is enabled, we can call the | ||
3 | // `set_panic_hook` function at least once during initialization, and then | ||
4 | // we will get better error messages if our code ever panics. | ||
5 | // | ||
6 | // For more details see | ||
7 | // https://github.com/rustwasm/console_error_panic_hook#readme | ||
8 | #[cfg(feature = "console_error_panic_hook")] | ||
9 | console_error_panic_hook::set_once(); | ||
10 | } | ||
diff --git a/tests/web.rs b/tests/web.rs new file mode 100644 index 0000000..de5c1da --- /dev/null +++ b/tests/web.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | //! Test suite for the Web and headless browsers. | ||
2 | |||
3 | #![cfg(target_arch = "wasm32")] | ||
4 | |||
5 | extern crate wasm_bindgen_test; | ||
6 | use wasm_bindgen_test::*; | ||
7 | |||
8 | wasm_bindgen_test_configure!(run_in_browser); | ||
9 | |||
10 | #[wasm_bindgen_test] | ||
11 | fn pass() { | ||
12 | assert_eq!(1 + 1, 2); | ||
13 | } | ||
diff --git a/www b/www new file mode 160000 | |||
Subproject 9ac3dff9ebea4675e5c478bcdcbc0fd547d1529 | |||