forked from doraemonkeys/WindSend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_linux.sh
executable file
·95 lines (73 loc) · 3.65 KB
/
build_linux.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
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
#!/bin/bash
#shellcheck source=/dev/null
source ./env.sh
chmod +x ./*.sh
WINDSEND_RUST_SERVER_BIN_NAME="WindSend-S-Rust"
mkdir -p ./bin
# 检查环境变量是否已经设置
if [ -z "$WINDSEND_PROJECT_VERSION" ]; then
read -rp "WINDSEND_PROJECT_VERSION:v" WINDSEND_PROJECT_VERSION
fi
# 若指定了版本号,则修改项目中的版本号
if [ -n "$WINDSEND_PROJECT_VERSION" ]; then
echo "WINDSEND_PROJECT_VERSION: $WINDSEND_PROJECT_VERSION"
export WINDSEND_PROJECT_VERSION
./version.sh
fi
######################################################################################
# Build WindSend Rust for Linux x86_64
WindSendRustBin_X86_64LinuxDirName="WindSend-S-Rust-x86_64-linux"
rustBinName="wind_send"
cd "$WINDSEND_PROJECT_PATH" || exit
cd "$WINDSEND_RUST_PROJECT_PATH" || exit
cargo build --release
mkdir -p ../bin/$WindSendRustBin_X86_64LinuxDirName
cp -r target/release/$rustBinName ../bin/$WindSendRustBin_X86_64LinuxDirName
mv ../bin/$WindSendRustBin_X86_64LinuxDirName/$rustBinName ../bin/$WindSendRustBin_X86_64LinuxDirName/$WINDSEND_RUST_SERVER_BIN_NAME
cp install.sh ../bin/$WindSendRustBin_X86_64LinuxDirName
cp uninstall.sh ../bin/$WindSendRustBin_X86_64LinuxDirName
cd "$WINDSEND_PROJECT_PATH" || exit
cp README.md ./bin/$WindSendRustBin_X86_64LinuxDirName
cp README-EN.md ./bin/$WindSendRustBin_X86_64LinuxDirName
cp "$WINDSEND_RUST_PROJECT_PATH/$SERVER_PROGRAM_ICON_NAME" ./bin/$WindSendRustBin_X86_64LinuxDirName
cd ./bin || exit
zip -r $WindSendRustBin_X86_64LinuxDirName.zip $WindSendRustBin_X86_64LinuxDirName
######################################################################################
# Build WindSend for linux-musl x86_64
WindSend_Rust_Bin_X86_64_LinuxMusl_DirName="WindSend-S-Rust-x86_64-linux-musl"
Rust_Target="x86_64-unknown-linux-musl"
cd "$WINDSEND_PROJECT_PATH" || exit
cd "$WINDSEND_RUST_PROJECT_PATH" || exit
rustup target add $Rust_Target
cargo build --release --target $Rust_Target
mkdir -p ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cp -r target/$Rust_Target/release/$rustBinName ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
mv ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName/$rustBinName ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName/$WINDSEND_RUST_SERVER_BIN_NAME
cp install.sh ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cp uninstall.sh ../bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cd "$WINDSEND_PROJECT_PATH" || exit
cp README.md ./bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cp README-EN.md ./bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cp "$WINDSEND_RUST_PROJECT_PATH/$SERVER_PROGRAM_ICON_NAME" ./bin/$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
cd ./bin || exit
# Add Z to sort it to the end
zip -r Z-$WindSend_Rust_Bin_X86_64_LinuxMusl_DirName.zip $WindSend_Rust_Bin_X86_64_LinuxMusl_DirName
######################################################################################
# Build WindSend for linux aarch64
######################################################################################
# Press Enter to continue building WindSend Flutter for Linux x86_64
if ! TheVariableIsTrue "$CI_RUNNING"; then
read -rp "Press Enter to continue..."
fi
flutterX86_64LinuxDirName="WindSend-flutter-x86_64-linux"
# Build WindSend Flutter for Linux x86_64
cd "$WINDSEND_PROJECT_PATH" || exit
cd "$WINDSEND_FLUTTER_PATH" || exit
flutter build linux --release
mkdir -p ../../bin/$flutterX86_64LinuxDirName
cp -r build/linux/x64/release/bundle/* ../../bin/$flutterX86_64LinuxDirName
cd "$WINDSEND_PROJECT_PATH" || exit
cp README.md ./bin/$flutterX86_64LinuxDirName
cp README-EN.md ./bin/$flutterX86_64LinuxDirName
cd ./bin || exit
zip -r $flutterX86_64LinuxDirName.zip $flutterX86_64LinuxDirName