-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathbuild.sh
executable file
·61 lines (50 loc) · 1.41 KB
/
build.sh
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
#!/bin/bash
set -eo pipefail
if [ "$DEBUG_MODE" = "1" ]; then
echo "[*] Building debug mode binary."
release_arg=""
target_subdir="debug"
else
release_arg="--release"
target_subdir="release"
fi
if [ "$SKIP_PREBUILD" = "1" ]; then
echo "[*] Prebuild skipped."
else
echo "[*] Running pre-build."
mkdir -p jsland/dist
echo "" > jsland/dist/bundle.js
echo -n "" > jsland.snapshot
cargo build $release_arg
fi
echo "[*] Generating schema."
MKIMAGE_PRINT_SCHEMA=1 ./target/$target_subdir/blueboat_mkimage > jsland/native_schema.json
echo "[*] Building jsland."
cd jsland
rm -r dist || true
mkdir dist
node ./scripts/build_schema.mjs
pnpm run build
cd ..
./jsland-types/build.sh
echo "[*] Generating jsland snapshot."
RUST_LOG=debug ./target/$target_subdir/blueboat_mkimage -i ./jsland/dist/bundle.js -o jsland.snapshot
if [ "$SKIP_FINAL_BUILD" = "1" ]; then
echo "[*] Final build skipped."
exit 0
fi
echo "[*] Running final build."
cargo build $release_arg
echo "[*] Fixing dynamic library loading order."
ldd ./target/$target_subdir/blueboat_server
elfpromote -o ./target/$target_subdir/blueboat_server --lib libfdb_c.so ./target/$target_subdir/blueboat_server
if [ "$BLUEBOAT_DEB" = "1" ]; then
if [ "$DEBUG_MODE" = "1" ]; then
echo "[-] Cannot build DEB in debug mode."
else
echo "[*] Building DEB package."
cargo deb --no-build
fi
fi
ldd ./target/$target_subdir/blueboat_server
echo "[+] Build completed."