-
Notifications
You must be signed in to change notification settings - Fork 2
/
.justfile
36 lines (30 loc) · 1.34 KB
/
.justfile
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
target-linux := "x86_64-unknown-linux-gnu"
target-win := "x86_64-pc-windows-gnu"
bin_name := "ventoy-toybox"
# have to hardcode it for now
version := "0.5.0"
target_name := replace(bin_name, "-", "_") + "-" + version + "-amd64"
dist_dir := "./target/dist"
# build for linux & win64 on a linux host
default: _pre-build build-linux build-win _post-build
_pre-build:
mkdir -p {{dist_dir}}
rm -f {{dist_dir}}/{{replace(bin_name, "-", "_")}}-{{version}}*
build-host:
cargo b --release
build-linux:
rustup target add {{target-linux}}
cross b --release --target {{target-linux}}
cp -T ./target/{{target-linux}}/release/{{bin_name}} {{dist_dir}}/{{replace(bin_name, "-", "_")}}.bin
cd {{dist_dir}} && tar -czf {{target_name}}-linux.tar.gz {{replace(bin_name, "-", "_")}}.bin
rm {{dist_dir}}/{{replace(bin_name, "-", "_")}}.bin
# upx --best --lzma ./target/{{target-linux}}/release/{{bin_name}}
# cp -T ./target/{{target-linux}}/release/{{bin_name}} {{dist_dir}}/{{target_name}}-linux-upxed.bin
build-win:
rustup target add {{target-win}}
cross b --release --target {{target-win}}
cp -T ./target/{{target-win}}/release/{{bin_name}}.exe {{dist_dir}}/{{target_name}}-windows.exe
# upx --best --lzma ./target/{{target_win}}/release/{{bin_name}}.exe
_post-build:
cd {{dist_dir}} && \
sha256sum {{target_name}}* > checksums.sha256sum