-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_release.sh
More file actions
executable file
·88 lines (82 loc) · 2.81 KB
/
build_release.sh
File metadata and controls
executable file
·88 lines (82 loc) · 2.81 KB
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
#!/bin/bash
if [ ! -f build.conf ]; then
echo "File build.conf does not exist, creating it."
echo "UpdateRustTargets=true" >>build.conf
echo "BuildWindows=true" >>build.conf
echo "BuildLinux=true" >>build.conf
echo "BuildMac=true" >>build.conf
exit 0
fi
UpdateRustTargets=$(cat build.conf | grep UpdateRustTargets | cut -d "=" -f 2)
BuildWindows=$(cat build.conf | grep BuildWindows | cut -d "=" -f 2)
BuildLinux=$(cat build.conf | grep BuildLinux | cut -d "=" -f 2)
BuildMac=$(cat build.conf | grep BuildMac | cut -d "=" -f 2)
if [ "$UpdateRustTargets" == "true" ]; then
echo -e "\e[94mUpdating/Downloading rust targets\e[0m"
if [ "BuildWindows" == "true" ]; then
rustup target remove x86_64-pc-windows-gnu
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to update or download rust targets\e[0m"
fi
fi
if [ "BuildLinux" == "true" ]; then
rustup target remove x86_64-unknown-linux-gnu
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to update or download rust targets\e[0m"
fi
fi
if [ "BuildMac" == "true" ]; then
rustup target remove x86_64-apple-darwin
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to update or download rust targets\e[0m"
fi
fi
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to update or download rust targets\e[0m"
else
echo -e "\e[92mRust targets updated/downloaded\e[0m"
fi
elif [ "$UpdateRustTargets" == "false" ]; then
echo -e "\e[94mSkipping rust target update.\e[0m"
else
echo -e "\e[31mError: Invalid value for UpdateRustTargets: $UpdateRustTargets\e[0m"
fi
if [ "$BuildWindows" == "true" ]; then
echo -e "\e[94mBuilding for Windows\e[0m"
cargo build --release --target x86_64-pc-windows-gnu
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to build for Windows\e[0m"
else
echo -e "\e[92mDone!\e[0m"
fi
elif [ "$BuildWindows" == "false" ]; then
echo -e "\e[94mSkipping Windows build.\e[0m"
else
echo -e "\e[31mError: Invalid value for BuildWindows: $BuildWindows\e[0m"
fi
if [ "$BuildLinux" == "true" ]; then
echo -e "\e[94mBuilding for Linux\e[0m"
cargo build --release --target x86_64-unknown-linux-gnu
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to build for Linux\e[0m"
else
echo -e "\e[92mDone!\e[0m"
fi
elif [ "$BuildLinux" == "false" ]; then
echo -e "\e[94mSkipping Linux build.\e[0m"
else
echo -e "\e[31mError: Invalid value for BuildLinux: $BuildLinux\e[0m"
fi
if [ "$BuildMac" == "true" ]; then
echo -e "\e[94mBuilding for Mac\e[0m"
cargo build --release --target x86_64-apple-darwin
if [ $? -ne 0 ]; then
echo -e "\e[31mError: Failed to build for Mac\e[0m"
else
echo -e "\e[92mDone!\e[0m"
fi
elif [ "$BuildMac" == "false" ]; then
echo -e "\e[94mSkipping Mac build.\e[0m"
else
echo -e "\e[31mError: Invalid value for BuildMac: $BuildMac\e[0m"
fi