-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkfile
248 lines (229 loc) · 5.04 KB
/
mkfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/env bash
set -xe
d:
pnpm run dev
c:
pnpm run check
b:
pnpm run build
p:
pnpm run preview
artifacts: */artifacts
libs/:
pushd packages/libs
b:
pnpm run build
popd
compiler/:
pushd packages/compiler
b:
pnpm run build
popd
testing/:
pushd packages/testing
b:
pnpm run build
popd
js/:
pushd packages/javascript-runtime
b:
pnpm run build
popd
ts/:
pushd packages/typescript-runtime
b:
pnpm run build
popd
php/:
pushd packages/php-runtime
b:
pnpm run build
popd
python/:
pushd packages/python-runtime
b:
pnpm run build
popd
go/:
pushd packages/go-runtime
p:
bun run probe/index.ts
b:
pnpm run build
artifacts: compiler/build
compiler/:
pushd go
build:
GOOS=js GOARCH=wasm go build -o ../public/compiler.wasm cmd/compiler/main.go
probe:
go run cmd/probe/main.go
tidy:
go mod tidy
popd
popd
gleam/:
pushd packages/gleam-runtime
p:
bun run probe/index.ts
b:
pnpm run build
artifacts: compiler/* stdlib/*
compiler/:
pushd gleam/compiler-wasm
build:
CC=clang CXX=clang++ wasm-pack build --release --target web
copy:
mkdir -p ../../src/vendor/compiler
cp -r pkg/* ../../src/vendor/compiler/
# Remove link to wasm file to prevent
# Asset embedding by Vite
refine:
sed -i '/async function __wbg_init/,/^}/{
/^async function __wbg_init/!{
/^}/!d
}
}' ../../src/vendor/compiler/gleam_wasm.js
cleanup:
rm -rf ../target pkg
popd
stdlib/:
pushd gleamstd
build:
gleam run
copy:
mkdir -p ../src/vendor/stdlib
cp -r dist/* ../src/vendor/stdlib/
cleanup:
rm -rf dist build
popd
popd
dotnet/:
pushd packages/dotnet-runtime
b:
pnpm run build
artifacts: compiler/build
workloads:
workloads=("wasm-experimental" "wasm-tools")
installed_workloads=$(dotnet workload list | awk 'NR>3 && NF>0 && !/^Use/ {print $1}')
uninstalled_workloads=()
for workload in "${workloads[@]}"; do
if [[ ! $installed_workloads =~ $workload ]] then
uninstalled_workloads+=("$workload")
fi
done
for workload in "${uninstalled_workloads[@]}"; do
sudo dotnet workload install "${workload}"
done
compiler/: workloads
build: release copy cleanup
TARGET=Release
dev: compile link
TARGET=Debug
pushd compiler
compile:
dotnet build /p:WasmNativeDebugSymbols=true
release:
dotnet publish
link:
rm -rf ../src/vendor/compiler
ln -s $(pwd)/bin/${TARGET}/net9.0/wwwroot/_framework ../src/vendor/compiler
rm -rf ../src/vendor/lib
ln -s $(pwd)/bin/${TARGET}/net9.0/ ../src/vendor/lib
copy:
rm -rf ../src/vendor/compiler
rsync -r ./bin/${TARGET}/net9.0/wwwroot/_framework/ ../src/vendor/compiler --delete
rm -rf ../src/vendor/lib
mkdir -p ../src/vendor/lib
cp ./bin/${TARGET}/net9.0/*.dll ../src/vendor/lib/
cleanup:
rm -rf bin obj
popd
workloads:
for workload in "${uninstalled_workloads[@]}"; do
sudo dotnet workload uninstall "${workload}"
done
p:
pushd probe
rsync -r ../src/vendor/compiler/ ./compiler/ --delete
rsync -r ../src/vendor/lib/ ./lib/ --delete
python server.py
popd
popd
ruby/:
pushd packages/ruby-runtime
b:
pnpm run build
p/:
pushd probe
i:
bun install
cp node_modules/@ruby/3.3-wasm-wasi/dist/ruby+stdlib.wasm public/
bun run index.ts
popd
rust/:
pushd packages/rust-runtime
p:
bun run probe/index.ts
b:
pnpm run build
artifacts: compiler/*
compiler/:
pushd rust
sdk:
if [ ! -f wasi-sdk-20.0-linux.tar.gz ]; then
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar -xzvf wasi-sdk-20.0-linux.tar.gz
fi
install:
nix develop ../../..#rust --command bash -xe -c "./x.py install"
copy:
cp dist/bin/miri.wasm ../public
cp -r dist/lib/rustlib/x86_64-unknown-linux-gnu/lib/* ../public/lib/
cleanup:
rm -rf wasi-sdk-20.0* build dist
popd
popd
java/:
pushd packages/java-runtime
b:
pnpm run build
c:
pnpm run check
artifacts: jvm/*
jvm/:
pushd doppio
build/:
nix develop ../../..#java --command bash -xe <<EOF
install:
npm install -g grunt-cli yarn
SKIP_YARN_COREPACK_CHECK=1 yarn install
release:
grunt release --force
cli:
grunt release-cli
EOF
copy:
rsync -rL build/release/ ../src/vendor/ --delete
rm -rf ../src/vendor/classes/test ../src/vendor/*.js* \
../src/vendor/vendor/java_home/lib/ext
compress:
pushd ../src/vendor
zip -r doppio.zip *
rm -rf classes vendor
popd
cleanup:
rm -rf build dist node_modules
popd
p/:
pushd probe
i:
bun install
s:
cp ../src/vendor/doppio.zip public
b:
bun run build
p:
bun run preview
bun run dev
popd
popd