This repository has no description
1{
2 fetch,
3 run,
4 config,
5 lib,
6
7 bc,
8 bison,
9 clang-host ? clang,
10 clang,
11 esbuild,
12 findutils,
13 flex,
14 gnumake,
15 lld,
16 llvm,
17 perl,
18 rsync,
19 typescript ? null,
20 wabt,
21}:
22
23run
24 {
25 name = "linux";
26 src = fetch.github {
27 owner = "tombl";
28 repo = "linux";
29 rev = "refs/heads/wasm";
30 hash = "sha256-FFYZOum0bwUPmoUKW7u2oozUzb2gDwE5Cfwp4GundAg=";
31 };
32 path = [
33 bc
34 bison
35 clang
36 esbuild
37 findutils
38 flex
39 gnumake
40 lld
41 llvm
42 perl
43 rsync
44 wabt
45 ];
46 outputs = [
47 "out"
48 "site"
49 "headers"
50 ];
51 }
52 ''
53 mkdir -p $site
54 cp -r tools/wasm/{run.js,public/*,src} $site
55 ln -sf $out $site/dist
56
57 make() {
58 command make -j$NIX_BUILD_CORES HOSTCC=${clang-host}/bin/clang TSC=${
59 if typescript == null then "true" else "${typescript}/bin/tsc"
60 } "$@"
61 }
62
63 test -f .config || make defconfig ${lib.optionalString config.debug "debug.config"}
64
65 # this is a horrible dirty hack but there's some non-deterministic build failure
66 for i in $(seq 1 3); do
67 if make -C tools/wasm; then
68 break
69 fi
70 done
71
72 cp -r tools/wasm/dist $out
73 hash=$(cksum $out/index.js | cut -d' ' -f1)
74 sed -i "s/LIBRARY_VERSION/$hash/" $site/index.html
75
76 make headers_install INSTALL_HDR_PATH=$headers
77 ''