-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_release.sh
executable file
·41 lines (33 loc) · 970 Bytes
/
build_release.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
LDFLAGS="-s -w"
YT_DLP_DL="yt-dlp"
YT_DLP="yt-dlp"
GTG_NOUPX="GoTubeGUI-noupx"
GTG_UPX="GoTubeGUI-upx"
if [ "$GOOS" = "windows" ]; then
LDFLAGS="$LDFLAGS -H=windowsgui"
YT_DLP_DL="$YT_DLP_DL.exe"
YT_DLP="$YT_DLP.exe"
GTG_NOUPX="$GTG_NOUPX.exe"
GTG_UPX="$GTG_UPX.exe"
elif [ "$GOOS" = "linux" ]; then
YT_DLP_DL="${YT_DLP_DL}_linux"
else
echo "Set the GOOS environment variable!"
exit
fi
mkdir -p release-out
# Download yt-dlp
# TODO: This should be handled by GoTubeGUI itself!!!
if [ ! -f "release-out/$YT_DLP" ]; then
echo "$YT_DLP doesn't exist, downloading..."
curl -L "https://github.com/yt-dlp/yt-dlp/releases/download/2024.11.04/$YT_DLP_DL" -o "release-out/$YT_DLP"
fi
echo "Building $GTG_NOUPX"
go build -ldflags "$LDFLAGS" -o "release-out/$GTG_NOUPX"
if [ -f "upx" ] || [ -f "upx.exe" ]; then
echo "upx-ing..."
./upx -o"release-out/$GTG_UPX" -f "release-out/$GTG_NOUPX"
else
echo "upx doesn't exist. Not compressing!"
exit
fi