2025-06-14 23:16:42 +08:00
|
|
|
set -e
|
2025-06-12 21:29:43 +08:00
|
|
|
appName="openlist"
|
2022-08-29 22:44:55 +08:00
|
|
|
builtAt="$(date +'%F %T %z')"
|
2025-06-14 23:16:42 +08:00
|
|
|
gitAuthor="The OpenList Projects Contributors <noreply@openlist.team>"
|
2022-08-29 22:44:55 +08:00
|
|
|
gitCommit=$(git log --pretty=format:"%h" -1)
|
|
|
|
|
2025-06-26 13:38:37 +08:00
|
|
|
githubAuthArgs=""
|
2025-06-18 22:50:35 +08:00
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
2025-06-26 13:38:37 +08:00
|
|
|
githubAuthArgs="--header \"Authorization: Bearer $GITHUB_TOKEN\""
|
2025-06-18 22:50:35 +08:00
|
|
|
fi
|
|
|
|
|
2025-06-28 22:22:16 +08:00
|
|
|
# Check for lite parameter
|
|
|
|
useLite=false
|
|
|
|
if [[ "$*" == *"lite"* ]]; then
|
|
|
|
useLite=true
|
|
|
|
fi
|
|
|
|
|
2022-09-08 20:18:45 +08:00
|
|
|
if [ "$1" = "dev" ]; then
|
2022-08-29 22:44:55 +08:00
|
|
|
version="dev"
|
|
|
|
webVersion="dev"
|
2025-01-23 22:49:35 +08:00
|
|
|
elif [ "$1" = "beta" ]; then
|
|
|
|
version="beta"
|
|
|
|
webVersion="dev"
|
2022-09-08 20:18:45 +08:00
|
|
|
else
|
2025-06-12 21:29:43 +08:00
|
|
|
git tag -d beta || true
|
|
|
|
# Always true if there's no tag
|
2025-06-14 23:16:42 +08:00
|
|
|
version=$(git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0")
|
2025-06-26 13:38:37 +08:00
|
|
|
webVersion=$(eval "curl -fsSL --max-time 2 $githubAuthArgs \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
|
2022-08-29 22:44:55 +08:00
|
|
|
fi
|
|
|
|
|
2022-10-12 17:24:04 +08:00
|
|
|
echo "backend version: $version"
|
|
|
|
echo "frontend version: $webVersion"
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
echo "using lite frontend"
|
|
|
|
else
|
|
|
|
echo "using standard frontend"
|
|
|
|
fi
|
2022-08-29 22:44:55 +08:00
|
|
|
|
|
|
|
ldflags="\
|
|
|
|
-w -s \
|
2025-07-02 21:00:43 +08:00
|
|
|
-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=$builtAt' \
|
|
|
|
-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=$gitAuthor' \
|
|
|
|
-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=$gitCommit' \
|
|
|
|
-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.Version=$version' \
|
|
|
|
-X 'github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=$webVersion' \
|
2022-08-29 22:44:55 +08:00
|
|
|
"
|
|
|
|
|
2022-09-08 20:18:45 +08:00
|
|
|
FetchWebDev() {
|
2025-06-26 13:38:37 +08:00
|
|
|
pre_release_tag=$(eval "curl -fsSL --max-time 2 $githubAuthArgs https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases" | jq -r 'map(select(.prerelease)) | first | .tag_name')
|
2025-06-14 23:16:42 +08:00
|
|
|
if [ -z "$pre_release_tag" ] || [ "$pre_release_tag" == "null" ]; then
|
|
|
|
# fall back to latest release
|
2025-06-26 13:38:37 +08:00
|
|
|
pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"")
|
2025-06-14 23:16:42 +08:00
|
|
|
else
|
2025-06-26 13:38:37 +08:00
|
|
|
pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/tags/$pre_release_tag\"")
|
2025-06-14 23:16:42 +08:00
|
|
|
fi
|
|
|
|
pre_release_assets=$(echo "$pre_release_json" | jq -r '.assets[].browser_download_url')
|
2025-06-28 22:22:16 +08:00
|
|
|
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
pre_release_tar_url=$(echo "$pre_release_assets" | grep "openlist-frontend-dist-lite" | grep "\.tar\.gz$")
|
|
|
|
else
|
|
|
|
pre_release_tar_url=$(echo "$pre_release_assets" | grep "openlist-frontend-dist" | grep -v "lite" | grep "\.tar\.gz$")
|
|
|
|
fi
|
|
|
|
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL "$pre_release_tar_url" -o web-dist-dev.tar.gz
|
|
|
|
rm -rf public/dist && mkdir -p public/dist
|
|
|
|
tar -zxvf web-dist-dev.tar.gz -C public/dist
|
|
|
|
rm -rf web-dist-dev.tar.gz
|
2022-08-29 22:44:55 +08:00
|
|
|
}
|
|
|
|
|
2022-09-08 21:22:21 +08:00
|
|
|
FetchWebRelease() {
|
2025-06-26 13:38:37 +08:00
|
|
|
release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"")
|
2025-06-14 23:16:42 +08:00
|
|
|
release_assets=$(echo "$release_json" | jq -r '.assets[].browser_download_url')
|
2025-06-28 22:22:16 +08:00
|
|
|
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
release_tar_url=$(echo "$release_assets" | grep "openlist-frontend-dist-lite" | grep "\.tar\.gz$")
|
|
|
|
else
|
|
|
|
release_tar_url=$(echo "$release_assets" | grep "openlist-frontend-dist" | grep -v "lite" | grep "\.tar\.gz$")
|
|
|
|
fi
|
|
|
|
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL "$release_tar_url" -o dist.tar.gz
|
|
|
|
rm -rf public/dist && mkdir -p public/dist
|
|
|
|
tar -zxvf dist.tar.gz -C public/dist
|
2022-09-08 21:22:21 +08:00
|
|
|
rm -rf dist.tar.gz
|
|
|
|
}
|
|
|
|
|
2023-02-09 19:43:29 +08:00
|
|
|
BuildWinArm64() {
|
|
|
|
echo building for windows-arm64
|
2023-02-14 20:28:05 +08:00
|
|
|
chmod +x ./wrapper/zcc-arm64
|
|
|
|
chmod +x ./wrapper/zcxx-arm64
|
2023-02-09 19:43:29 +08:00
|
|
|
export GOOS=windows
|
|
|
|
export GOARCH=arm64
|
|
|
|
export CC=$(pwd)/wrapper/zcc-arm64
|
|
|
|
export CXX=$(pwd)/wrapper/zcxx-arm64
|
2023-12-15 18:22:16 +08:00
|
|
|
export CGO_ENABLED=1
|
2023-02-09 19:43:29 +08:00
|
|
|
go build -o "$1" -ldflags="$ldflags" -tags=jsoniter .
|
|
|
|
}
|
|
|
|
|
2025-07-27 00:27:31 +08:00
|
|
|
BuildWin7() {
|
|
|
|
# Setup Win7 Go compiler (patched version that supports Windows 7)
|
|
|
|
go_version=$(go version | grep -o 'go[0-9]\+\.[0-9]\+\.[0-9]\+' | sed 's/go//')
|
|
|
|
echo "Detected Go version: $go_version"
|
|
|
|
|
|
|
|
curl -fsSL --retry 3 -o go-win7.zip -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/XTLS/go-win7/releases/download/patched-${go_version}/go-for-win7-linux-amd64.zip"
|
|
|
|
|
|
|
|
rm -rf go-win7
|
|
|
|
unzip go-win7.zip -d go-win7
|
|
|
|
rm go-win7.zip
|
|
|
|
|
|
|
|
# Set permissions for all wrapper files
|
|
|
|
chmod +x ./wrapper/zcc-win7
|
|
|
|
chmod +x ./wrapper/zcxx-win7
|
|
|
|
chmod +x ./wrapper/zcc-win7-386
|
|
|
|
chmod +x ./wrapper/zcxx-win7-386
|
|
|
|
|
|
|
|
# Build for both 386 and amd64 architectures
|
|
|
|
for arch in "386" "amd64"; do
|
|
|
|
echo "building for windows7-${arch}"
|
|
|
|
export GOOS=windows
|
|
|
|
export GOARCH=${arch}
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
|
|
|
|
# Use architecture-specific wrapper files
|
|
|
|
if [ "$arch" = "386" ]; then
|
|
|
|
export CC=$(pwd)/wrapper/zcc-win7-386
|
|
|
|
export CXX=$(pwd)/wrapper/zcxx-win7-386
|
|
|
|
else
|
|
|
|
export CC=$(pwd)/wrapper/zcc-win7
|
|
|
|
export CXX=$(pwd)/wrapper/zcxx-win7
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Use the patched Go compiler for Win7 compatibility
|
|
|
|
$(pwd)/go-win7/bin/go build -o "${1}-${arch}.exe" -ldflags="$ldflags" -tags=jsoniter .
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-08-29 22:44:55 +08:00
|
|
|
BuildDev() {
|
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "dist"
|
2023-06-09 23:43:52 +08:00
|
|
|
muslflags="--extldflags '-static -fpic' $ldflags"
|
2025-06-13 17:01:24 +08:00
|
|
|
BASE="https://github.com/OpenListTeam/musl-compilers/releases/latest/download/"
|
2023-06-09 23:43:52 +08:00
|
|
|
FILES=(x86_64-linux-musl-cross aarch64-linux-musl-cross)
|
|
|
|
for i in "${FILES[@]}"; do
|
|
|
|
url="${BASE}${i}.tgz"
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL -o "${i}.tgz" "${url}"
|
2023-06-09 23:43:52 +08:00
|
|
|
sudo tar xf "${i}.tgz" --strip-components 1 -C /usr/local
|
|
|
|
done
|
|
|
|
OS_ARCHES=(linux-musl-amd64 linux-musl-arm64)
|
|
|
|
CGO_ARGS=(x86_64-linux-musl-gcc aarch64-linux-musl-gcc)
|
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc=${CGO_ARGS[$i]}
|
|
|
|
echo building for ${os_arch}
|
|
|
|
export GOOS=${os_arch%%-*}
|
|
|
|
export GOARCH=${os_arch##*-}
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
go build -o ./dist/$appName-$os_arch -ldflags="$muslflags" -tags=jsoniter .
|
|
|
|
done
|
2023-12-15 17:07:02 +08:00
|
|
|
xgo -targets=windows/amd64,darwin/amd64,darwin/arm64 -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
|
2025-06-12 21:29:43 +08:00
|
|
|
mv "$appName"-* dist
|
2022-08-29 22:44:55 +08:00
|
|
|
cd dist
|
2025-07-18 12:38:17 +08:00
|
|
|
# cp ./"$appName"-windows-amd64.exe ./"$appName"-windows-amd64-upx.exe
|
|
|
|
# upx -9 ./"$appName"-windows-amd64-upx.exe
|
2022-08-29 22:44:55 +08:00
|
|
|
find . -type f -print0 | xargs -0 md5sum >md5.txt
|
|
|
|
cat md5.txt
|
|
|
|
}
|
|
|
|
|
2024-01-05 15:52:30 +08:00
|
|
|
BuildDocker() {
|
2025-06-12 21:29:43 +08:00
|
|
|
go build -o ./bin/"$appName" -ldflags="$ldflags" -tags=jsoniter .
|
2022-09-08 20:18:45 +08:00
|
|
|
}
|
|
|
|
|
2024-05-02 22:28:13 +08:00
|
|
|
PrepareBuildDockerMusl() {
|
|
|
|
mkdir -p build/musl-libs
|
2025-06-13 17:01:24 +08:00
|
|
|
BASE="https://github.com/OpenListTeam/musl-compilers/releases/latest/download/"
|
2024-11-01 20:53:53 +08:00
|
|
|
FILES=(x86_64-linux-musl-cross aarch64-linux-musl-cross i486-linux-musl-cross s390x-linux-musl-cross armv6-linux-musleabihf-cross armv7l-linux-musleabihf-cross riscv64-linux-musl-cross powerpc64le-linux-musl-cross)
|
2024-01-05 15:52:30 +08:00
|
|
|
for i in "${FILES[@]}"; do
|
|
|
|
url="${BASE}${i}.tgz"
|
2024-05-02 22:28:13 +08:00
|
|
|
lib_tgz="build/${i}.tgz"
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL -o "${lib_tgz}" "${url}"
|
2024-05-02 22:28:13 +08:00
|
|
|
tar xf "${lib_tgz}" --strip-components 1 -C build/musl-libs
|
|
|
|
rm -f "${lib_tgz}"
|
2024-01-05 15:52:30 +08:00
|
|
|
done
|
2024-05-02 22:28:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
BuildDockerMultiplatform() {
|
2024-06-16 16:56:45 +08:00
|
|
|
go mod download
|
2024-05-02 22:28:13 +08:00
|
|
|
|
|
|
|
# run PrepareBuildDockerMusl before build
|
|
|
|
export PATH=$PATH:$PWD/build/musl-libs/bin
|
2024-01-05 15:52:30 +08:00
|
|
|
|
|
|
|
docker_lflags="--extldflags '-static -fpic' $ldflags"
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
|
2024-11-01 20:53:53 +08:00
|
|
|
OS_ARCHES=(linux-amd64 linux-arm64 linux-386 linux-s390x linux-riscv64 linux-ppc64le)
|
|
|
|
CGO_ARGS=(x86_64-linux-musl-gcc aarch64-linux-musl-gcc i486-linux-musl-gcc s390x-linux-musl-gcc riscv64-linux-musl-gcc powerpc64le-linux-musl-gcc)
|
2024-01-05 15:52:30 +08:00
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc=${CGO_ARGS[$i]}
|
|
|
|
os=${os_arch%%-*}
|
|
|
|
arch=${os_arch##*-}
|
|
|
|
export GOOS=$os
|
|
|
|
export GOARCH=$arch
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
echo "building for $os_arch"
|
2025-06-12 21:29:43 +08:00
|
|
|
go build -o build/$os/$arch/"$appName" -ldflags="$docker_lflags" -tags=jsoniter .
|
2024-01-05 15:52:30 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
DOCKER_ARM_ARCHES=(linux-arm/v6 linux-arm/v7)
|
|
|
|
CGO_ARGS=(armv6-linux-musleabihf-gcc armv7l-linux-musleabihf-gcc)
|
|
|
|
GO_ARM=(6 7)
|
|
|
|
export GOOS=linux
|
|
|
|
export GOARCH=arm
|
|
|
|
for i in "${!DOCKER_ARM_ARCHES[@]}"; do
|
|
|
|
docker_arch=${DOCKER_ARM_ARCHES[$i]}
|
|
|
|
cgo_cc=${CGO_ARGS[$i]}
|
|
|
|
export GOARM=${GO_ARM[$i]}
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
echo "building for $docker_arch"
|
2025-06-12 21:29:43 +08:00
|
|
|
go build -o build/${docker_arch%%-*}/${docker_arch##*-}/"$appName" -ldflags="$docker_lflags" -tags=jsoniter .
|
2024-01-05 15:52:30 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-09-08 21:22:21 +08:00
|
|
|
BuildRelease() {
|
2023-09-03 22:53:58 +08:00
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "build"
|
2025-06-12 21:29:43 +08:00
|
|
|
BuildWinArm64 ./build/"$appName"-windows-arm64.exe
|
2025-07-27 00:27:31 +08:00
|
|
|
BuildWin7 ./build/"$appName"-windows7
|
2023-09-03 22:53:58 +08:00
|
|
|
xgo -out "$appName" -ldflags="$ldflags" -tags=jsoniter .
|
|
|
|
# why? Because some target platforms seem to have issues with upx compression
|
2025-07-18 12:38:17 +08:00
|
|
|
# upx -9 ./"$appName"-linux-amd64
|
|
|
|
# cp ./"$appName"-windows-amd64.exe ./"$appName"-windows-amd64-upx.exe
|
|
|
|
# upx -9 ./"$appName"-windows-amd64-upx.exe
|
2025-06-12 21:29:43 +08:00
|
|
|
mv "$appName"-* build
|
2025-07-27 00:27:31 +08:00
|
|
|
|
|
|
|
# Build LoongArch with glibc (both old world abi1.0 and new world abi2.0)
|
|
|
|
# Separate from musl builds to avoid cache conflicts
|
|
|
|
BuildLoongGLIBC ./build/$appName-linux-loong64-abi1.0 abi1.0
|
|
|
|
BuildLoongGLIBC ./build/$appName-linux-loong64 abi2.0
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildLoongGLIBC() {
|
|
|
|
local target_abi="$2"
|
|
|
|
local output_file="$1"
|
|
|
|
local oldWorldGoVersion="1.24.3"
|
|
|
|
|
|
|
|
if [ "$target_abi" = "abi1.0" ]; then
|
|
|
|
echo building for linux-loong64-abi1.0
|
|
|
|
else
|
|
|
|
echo building for linux-loong64-abi2.0
|
|
|
|
target_abi="abi2.0" # Default to abi2.0 if not specified
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Note: No longer need global cache cleanup since ABI1.0 uses isolated cache directory
|
|
|
|
echo "Using optimized cache strategy: ABI1.0 has isolated cache, ABI2.0 uses standard cache"
|
|
|
|
|
|
|
|
if [ "$target_abi" = "abi1.0" ]; then
|
|
|
|
# Setup abi1.0 toolchain and patched Go compiler similar to cgo-action implementation
|
|
|
|
echo "Setting up Loongson old-world ABI1.0 toolchain and patched Go compiler..."
|
|
|
|
|
|
|
|
# Download and setup patched Go compiler for old-world
|
|
|
|
if ! curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/loong64-abi1.0-toolchains/releases/download/20250722/go${oldWorldGoVersion}.linux-amd64.tar.gz" \
|
|
|
|
-o go-loong64-abi1.0.tar.gz; then
|
|
|
|
echo "Error: Failed to download patched Go compiler for old-world ABI1.0"
|
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
|
|
echo "Error output from curl:"
|
|
|
|
curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/loong64-abi1.0-toolchains/releases/download/20250722/go${oldWorldGoVersion}.linux-amd64.tar.gz" \
|
|
|
|
-o go-loong64-abi1.0.tar.gz || true
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf go-loong64-abi1.0
|
|
|
|
mkdir go-loong64-abi1.0
|
|
|
|
if ! tar -xzf go-loong64-abi1.0.tar.gz -C go-loong64-abi1.0 --strip-components=1; then
|
|
|
|
echo "Error: Failed to extract patched Go compiler"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
rm go-loong64-abi1.0.tar.gz
|
|
|
|
|
|
|
|
# Download and setup GCC toolchain for old-world
|
|
|
|
if ! curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/loong64-abi1.0-toolchains/releases/download/20250722/loongson-gnu-toolchain-8.3.novec-x86_64-loongarch64-linux-gnu-rc1.1.tar.xz" \
|
|
|
|
-o gcc8-loong64-abi1.0.tar.xz; then
|
|
|
|
echo "Error: Failed to download GCC toolchain for old-world ABI1.0"
|
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
|
|
echo "Error output from curl:"
|
|
|
|
curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/loong64-abi1.0-toolchains/releases/download/20250722/loongson-gnu-toolchain-8.3.novec-x86_64-loongarch64-linux-gnu-rc1.1.tar.xz" \
|
|
|
|
-o gcc8-loong64-abi1.0.tar.xz || true
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf gcc8-loong64-abi1.0
|
|
|
|
mkdir gcc8-loong64-abi1.0
|
|
|
|
if ! tar -Jxf gcc8-loong64-abi1.0.tar.xz -C gcc8-loong64-abi1.0 --strip-components=1; then
|
|
|
|
echo "Error: Failed to extract GCC toolchain"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
rm gcc8-loong64-abi1.0.tar.xz
|
|
|
|
|
|
|
|
# Setup separate cache directory for ABI1.0 to avoid cache pollution
|
|
|
|
abi1_cache_dir="$(pwd)/go-loong64-abi1.0-cache"
|
|
|
|
mkdir -p "$abi1_cache_dir"
|
|
|
|
echo "Using separate cache directory for ABI1.0: $abi1_cache_dir"
|
|
|
|
|
|
|
|
# Use patched Go compiler for old-world build (critical for ABI1.0 compatibility)
|
|
|
|
echo "Building with patched Go compiler for old-world ABI1.0..."
|
|
|
|
echo "Using isolated cache directory: $abi1_cache_dir"
|
|
|
|
|
|
|
|
# Use env command to set environment variables locally without affecting global environment
|
|
|
|
if ! env GOOS=linux GOARCH=loong64 \
|
|
|
|
CC="$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-gcc" \
|
|
|
|
CXX="$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-g++" \
|
|
|
|
CGO_ENABLED=1 \
|
|
|
|
GOCACHE="$abi1_cache_dir" \
|
|
|
|
$(pwd)/go-loong64-abi1.0/bin/go build -a -o "$output_file" -ldflags="$ldflags" -tags=jsoniter .; then
|
|
|
|
echo "Error: Build failed with patched Go compiler"
|
|
|
|
echo "Attempting retry with cache cleanup..."
|
|
|
|
env GOCACHE="$abi1_cache_dir" $(pwd)/go-loong64-abi1.0/bin/go clean -cache
|
|
|
|
if ! env GOOS=linux GOARCH=loong64 \
|
|
|
|
CC="$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-gcc" \
|
|
|
|
CXX="$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-g++" \
|
|
|
|
CGO_ENABLED=1 \
|
|
|
|
GOCACHE="$abi1_cache_dir" \
|
|
|
|
$(pwd)/go-loong64-abi1.0/bin/go build -a -o "$output_file" -ldflags="$ldflags" -tags=jsoniter .; then
|
|
|
|
echo "Error: Build failed again after cache cleanup"
|
|
|
|
echo "Build environment details:"
|
|
|
|
echo "GOOS=linux"
|
|
|
|
echo "GOARCH=loong64"
|
|
|
|
echo "CC=$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-gcc"
|
|
|
|
echo "CXX=$(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-g++"
|
|
|
|
echo "CGO_ENABLED=1"
|
|
|
|
echo "GOCACHE=$abi1_cache_dir"
|
|
|
|
echo "Go version: $($(pwd)/go-loong64-abi1.0/bin/go version)"
|
|
|
|
echo "GCC version: $($(pwd)/gcc8-loong64-abi1.0/bin/loongarch64-linux-gnu-gcc --version | head -1)"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Setup abi2.0 toolchain for new world glibc build
|
|
|
|
echo "Setting up new-world ABI2.0 toolchain..."
|
|
|
|
if ! curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/cross-tools/releases/download/20250507/x86_64-cross-tools-loongarch64-unknown-linux-gnu-legacy.tar.xz" \
|
|
|
|
-o gcc12-loong64-abi2.0.tar.xz; then
|
|
|
|
echo "Error: Failed to download GCC toolchain for new-world ABI2.0"
|
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then
|
|
|
|
echo "Error output from curl:"
|
|
|
|
curl -fsSL --retry 3 -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
|
|
"https://github.com/loong64/cross-tools/releases/download/20250507/x86_64-cross-tools-loongarch64-unknown-linux-gnu-legacy.tar.xz" \
|
|
|
|
-o gcc12-loong64-abi2.0.tar.xz || true
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf gcc12-loong64-abi2.0
|
|
|
|
mkdir gcc12-loong64-abi2.0
|
|
|
|
if ! tar -Jxf gcc12-loong64-abi2.0.tar.xz -C gcc12-loong64-abi2.0 --strip-components=1; then
|
|
|
|
echo "Error: Failed to extract GCC toolchain"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
rm gcc12-loong64-abi2.0.tar.xz
|
|
|
|
|
|
|
|
export GOOS=linux
|
|
|
|
export GOARCH=loong64
|
|
|
|
export CC=$(pwd)/gcc12-loong64-abi2.0/bin/loongarch64-unknown-linux-gnu-gcc
|
|
|
|
export CXX=$(pwd)/gcc12-loong64-abi2.0/bin/loongarch64-unknown-linux-gnu-g++
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
|
|
|
|
# Use standard Go compiler for new-world build
|
|
|
|
echo "Building with standard Go compiler for new-world ABI2.0..."
|
|
|
|
if ! go build -a -o "$output_file" -ldflags="$ldflags" -tags=jsoniter .; then
|
|
|
|
echo "Error: Build failed with standard Go compiler"
|
|
|
|
echo "Attempting retry with cache cleanup..."
|
|
|
|
go clean -cache
|
|
|
|
if ! go build -a -o "$output_file" -ldflags="$ldflags" -tags=jsoniter .; then
|
|
|
|
echo "Error: Build failed again after cache cleanup"
|
|
|
|
echo "Build environment details:"
|
|
|
|
echo "GOOS=$GOOS"
|
|
|
|
echo "GOARCH=$GOARCH"
|
|
|
|
echo "CC=$CC"
|
|
|
|
echo "CXX=$CXX"
|
|
|
|
echo "CGO_ENABLED=$CGO_ENABLED"
|
|
|
|
echo "Go version: $(go version)"
|
|
|
|
echo "GCC version: $($CC --version | head -1)"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2023-09-03 22:53:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
BuildReleaseLinuxMusl() {
|
2022-09-08 21:22:21 +08:00
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "build"
|
2022-09-09 15:51:20 +08:00
|
|
|
muslflags="--extldflags '-static -fpic' $ldflags"
|
2025-06-13 17:01:24 +08:00
|
|
|
BASE="https://github.com/OpenListTeam/musl-compilers/releases/latest/download/"
|
2025-06-14 23:16:42 +08:00
|
|
|
FILES=(x86_64-linux-musl-cross aarch64-linux-musl-cross mips-linux-musl-cross mips64-linux-musl-cross mips64el-linux-musl-cross mipsel-linux-musl-cross powerpc64le-linux-musl-cross s390x-linux-musl-cross loongarch64-linux-musl-cross)
|
2022-09-08 21:22:21 +08:00
|
|
|
for i in "${FILES[@]}"; do
|
|
|
|
url="${BASE}${i}.tgz"
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL -o "${i}.tgz" "${url}"
|
2022-09-08 21:22:21 +08:00
|
|
|
sudo tar xf "${i}.tgz" --strip-components 1 -C /usr/local
|
2023-07-30 18:25:52 +08:00
|
|
|
rm -f "${i}.tgz"
|
2022-09-08 21:22:21 +08:00
|
|
|
done
|
2025-06-14 23:16:42 +08:00
|
|
|
OS_ARCHES=(linux-musl-amd64 linux-musl-arm64 linux-musl-mips linux-musl-mips64 linux-musl-mips64le linux-musl-mipsle linux-musl-ppc64le linux-musl-s390x linux-musl-loong64)
|
|
|
|
CGO_ARGS=(x86_64-linux-musl-gcc aarch64-linux-musl-gcc mips-linux-musl-gcc mips64-linux-musl-gcc mips64el-linux-musl-gcc mipsel-linux-musl-gcc powerpc64le-linux-musl-gcc s390x-linux-musl-gcc loongarch64-linux-musl-gcc)
|
2022-09-08 21:22:21 +08:00
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc=${CGO_ARGS[$i]}
|
|
|
|
echo building for ${os_arch}
|
|
|
|
export GOOS=${os_arch%%-*}
|
|
|
|
export GOARCH=${os_arch##*-}
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
export CGO_ENABLED=1
|
2022-09-09 15:51:20 +08:00
|
|
|
go build -o ./build/$appName-$os_arch -ldflags="$muslflags" -tags=jsoniter .
|
2022-09-08 21:22:21 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-08-04 19:27:14 +08:00
|
|
|
BuildReleaseLinuxMuslArm() {
|
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "build"
|
|
|
|
muslflags="--extldflags '-static -fpic' $ldflags"
|
2025-06-13 17:01:24 +08:00
|
|
|
BASE="https://github.com/OpenListTeam/musl-compilers/releases/latest/download/"
|
2023-08-04 19:27:14 +08:00
|
|
|
FILES=(arm-linux-musleabi-cross arm-linux-musleabihf-cross armel-linux-musleabi-cross armel-linux-musleabihf-cross armv5l-linux-musleabi-cross armv5l-linux-musleabihf-cross armv6-linux-musleabi-cross armv6-linux-musleabihf-cross armv7l-linux-musleabihf-cross armv7m-linux-musleabi-cross armv7r-linux-musleabihf-cross)
|
|
|
|
for i in "${FILES[@]}"; do
|
|
|
|
url="${BASE}${i}.tgz"
|
2025-06-14 23:16:42 +08:00
|
|
|
curl -fsSL -o "${i}.tgz" "${url}"
|
2023-08-04 19:27:14 +08:00
|
|
|
sudo tar xf "${i}.tgz" --strip-components 1 -C /usr/local
|
|
|
|
rm -f "${i}.tgz"
|
|
|
|
done
|
|
|
|
OS_ARCHES=(linux-musleabi-arm linux-musleabihf-arm linux-musleabi-armel linux-musleabihf-armel linux-musleabi-armv5l linux-musleabihf-armv5l linux-musleabi-armv6 linux-musleabihf-armv6 linux-musleabihf-armv7l linux-musleabi-armv7m linux-musleabihf-armv7r)
|
|
|
|
CGO_ARGS=(arm-linux-musleabi-gcc arm-linux-musleabihf-gcc armel-linux-musleabi-gcc armel-linux-musleabihf-gcc armv5l-linux-musleabi-gcc armv5l-linux-musleabihf-gcc armv6-linux-musleabi-gcc armv6-linux-musleabihf-gcc armv7l-linux-musleabihf-gcc armv7m-linux-musleabi-gcc armv7r-linux-musleabihf-gcc)
|
|
|
|
GOARMS=('' '' '' '' '5' '5' '6' '6' '7' '7' '7')
|
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc=${CGO_ARGS[$i]}
|
|
|
|
arm=${GOARMS[$i]}
|
|
|
|
echo building for ${os_arch}
|
|
|
|
export GOOS=linux
|
|
|
|
export GOARCH=arm
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
export GOARM=${arm}
|
|
|
|
go build -o ./build/$appName-$os_arch -ldflags="$muslflags" -tags=jsoniter .
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2025-07-27 00:27:31 +08:00
|
|
|
|
2024-01-09 19:00:11 +08:00
|
|
|
BuildReleaseAndroid() {
|
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "build"
|
|
|
|
wget https://dl.google.com/android/repository/android-ndk-r26b-linux.zip
|
|
|
|
unzip android-ndk-r26b-linux.zip
|
|
|
|
rm android-ndk-r26b-linux.zip
|
|
|
|
OS_ARCHES=(amd64 arm64 386 arm)
|
|
|
|
CGO_ARGS=(x86_64-linux-android24-clang aarch64-linux-android24-clang i686-linux-android24-clang armv7a-linux-androideabi24-clang)
|
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc=$(realpath android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/${CGO_ARGS[$i]})
|
|
|
|
echo building for android-${os_arch}
|
|
|
|
export GOOS=android
|
|
|
|
export GOARCH=${os_arch##*-}
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
go build -o ./build/$appName-android-$os_arch -ldflags="$ldflags" -tags=jsoniter .
|
|
|
|
android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip ./build/$appName-android-$os_arch
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2024-11-01 21:37:53 +08:00
|
|
|
BuildReleaseFreeBSD() {
|
|
|
|
rm -rf .git/
|
|
|
|
mkdir -p "build/freebsd"
|
2025-06-18 22:17:21 +08:00
|
|
|
|
2025-06-18 22:50:35 +08:00
|
|
|
# Get latest FreeBSD 14.x release version from GitHub
|
2025-06-26 13:38:37 +08:00
|
|
|
freebsd_version=$(eval "curl -fsSL --max-time 2 $githubAuthArgs \"https://api.github.com/repos/freebsd/freebsd-src/tags\"" | \
|
2025-06-18 22:17:21 +08:00
|
|
|
jq -r '.[].name' | \
|
|
|
|
grep '^release/14\.' | \
|
2025-07-24 22:41:45 +08:00
|
|
|
grep -v -- '-p[0-9]*$' | \
|
2025-06-18 22:17:21 +08:00
|
|
|
sort -V | \
|
|
|
|
tail -1 | \
|
|
|
|
sed 's/release\///' | \
|
|
|
|
sed 's/\.0$//')
|
|
|
|
|
|
|
|
if [ -z "$freebsd_version" ]; then
|
|
|
|
echo "Failed to get FreeBSD version, falling back to 14.3"
|
|
|
|
freebsd_version="14.3"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Using FreeBSD version: $freebsd_version"
|
|
|
|
|
2024-11-01 21:37:53 +08:00
|
|
|
OS_ARCHES=(amd64 arm64 i386)
|
|
|
|
GO_ARCHES=(amd64 arm64 386)
|
2025-06-18 22:17:21 +08:00
|
|
|
CGO_ARGS=(x86_64-unknown-freebsd${freebsd_version} aarch64-unknown-freebsd${freebsd_version} i386-unknown-freebsd${freebsd_version})
|
2024-11-01 21:37:53 +08:00
|
|
|
for i in "${!OS_ARCHES[@]}"; do
|
|
|
|
os_arch=${OS_ARCHES[$i]}
|
|
|
|
cgo_cc="clang --target=${CGO_ARGS[$i]} --sysroot=/opt/freebsd/${os_arch}"
|
|
|
|
echo building for freebsd-${os_arch}
|
|
|
|
sudo mkdir -p "/opt/freebsd/${os_arch}"
|
2025-06-18 22:17:21 +08:00
|
|
|
wget -q https://download.freebsd.org/releases/${os_arch}/${freebsd_version}-RELEASE/base.txz
|
2024-11-01 21:37:53 +08:00
|
|
|
sudo tar -xf ./base.txz -C /opt/freebsd/${os_arch}
|
|
|
|
rm base.txz
|
|
|
|
export GOOS=freebsd
|
|
|
|
export GOARCH=${GO_ARCHES[$i]}
|
|
|
|
export CC=${cgo_cc}
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
export CGO_LDFLAGS="-fuse-ld=lld"
|
|
|
|
go build -o ./build/$appName-freebsd-$os_arch -ldflags="$ldflags" -tags=jsoniter .
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-09-08 21:22:21 +08:00
|
|
|
MakeRelease() {
|
|
|
|
cd build
|
2025-06-12 21:29:43 +08:00
|
|
|
if [ -d compress ]; then
|
|
|
|
rm -rv compress
|
|
|
|
fi
|
2022-09-08 21:22:21 +08:00
|
|
|
mkdir compress
|
2025-06-28 22:22:16 +08:00
|
|
|
|
|
|
|
# Add -lite suffix if useLite is true
|
|
|
|
liteSuffix=""
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
liteSuffix="-lite"
|
|
|
|
fi
|
|
|
|
|
2022-09-08 21:22:21 +08:00
|
|
|
for i in $(find . -type f -name "$appName-linux-*"); do
|
2025-06-12 21:29:43 +08:00
|
|
|
cp "$i" "$appName"
|
2025-06-28 22:22:16 +08:00
|
|
|
tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
|
2025-06-12 21:29:43 +08:00
|
|
|
rm -f "$appName"
|
2024-01-09 19:00:11 +08:00
|
|
|
done
|
|
|
|
for i in $(find . -type f -name "$appName-android-*"); do
|
2025-06-12 21:29:43 +08:00
|
|
|
cp "$i" "$appName"
|
2025-06-28 22:22:16 +08:00
|
|
|
tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
|
2025-06-12 21:29:43 +08:00
|
|
|
rm -f "$appName"
|
2022-09-08 21:22:21 +08:00
|
|
|
done
|
|
|
|
for i in $(find . -type f -name "$appName-darwin-*"); do
|
2025-06-12 21:29:43 +08:00
|
|
|
cp "$i" "$appName"
|
2025-06-28 22:22:16 +08:00
|
|
|
tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
|
2025-06-12 21:29:43 +08:00
|
|
|
rm -f "$appName"
|
2022-09-08 21:22:21 +08:00
|
|
|
done
|
2024-11-01 21:37:53 +08:00
|
|
|
for i in $(find . -type f -name "$appName-freebsd-*"); do
|
2025-06-12 21:29:43 +08:00
|
|
|
cp "$i" "$appName"
|
2025-06-28 22:22:16 +08:00
|
|
|
tar -czvf compress/"$i$liteSuffix".tar.gz "$appName"
|
2025-06-12 21:29:43 +08:00
|
|
|
rm -f "$appName"
|
2024-11-01 21:37:53 +08:00
|
|
|
done
|
2025-07-27 00:27:31 +08:00
|
|
|
for i in $(find . -type f \( -name "$appName-windows-*" -o -name "$appName-windows7-*" \)); do
|
2025-06-12 21:29:43 +08:00
|
|
|
cp "$i" "$appName".exe
|
2025-06-28 22:22:16 +08:00
|
|
|
zip compress/$(echo $i | sed 's/\.[^.]*$//')$liteSuffix.zip "$appName".exe
|
2025-06-12 21:29:43 +08:00
|
|
|
rm -f "$appName".exe
|
2022-09-08 21:22:21 +08:00
|
|
|
done
|
|
|
|
cd compress
|
2025-06-28 22:22:16 +08:00
|
|
|
|
|
|
|
# Handle MD5 filename - add -lite suffix only if not already present
|
|
|
|
md5FileName="$1"
|
|
|
|
if [ "$useLite" = true ] && [[ "$1" != *"-lite.txt" ]]; then
|
|
|
|
md5FileName=$(echo "$1" | sed 's/\.txt$/-lite.txt/')
|
|
|
|
fi
|
|
|
|
|
|
|
|
find . -type f -print0 | xargs -0 md5sum >"$md5FileName"
|
|
|
|
cat "$md5FileName"
|
2022-09-08 21:22:21 +08:00
|
|
|
cd ../..
|
|
|
|
}
|
|
|
|
|
2025-06-28 22:22:16 +08:00
|
|
|
# Parse parameters to handle lite parameter position flexibility
|
|
|
|
buildType=""
|
|
|
|
dockerType=""
|
|
|
|
otherParam=""
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
case $arg in
|
|
|
|
dev|beta|release|zip|prepare)
|
|
|
|
if [ -z "$buildType" ]; then
|
|
|
|
buildType="$arg"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
docker|docker-multiplatform|linux_musl_arm|linux_musl|android|freebsd|web)
|
|
|
|
if [ -z "$dockerType" ]; then
|
|
|
|
dockerType="$arg"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
lite)
|
|
|
|
# lite parameter is already handled above
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -z "$otherParam" ]; then
|
|
|
|
otherParam="$arg"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$buildType" = "dev" ]; then
|
2022-09-08 20:18:45 +08:00
|
|
|
FetchWebDev
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$dockerType" = "docker" ]; then
|
2022-09-08 20:18:45 +08:00
|
|
|
BuildDocker
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$dockerType" = "docker-multiplatform" ]; then
|
2024-01-05 15:52:30 +08:00
|
|
|
BuildDockerMultiplatform
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$dockerType" = "web" ]; then
|
2024-08-18 00:21:48 +08:00
|
|
|
echo "web only"
|
2022-09-08 20:18:45 +08:00
|
|
|
else
|
|
|
|
BuildDev
|
|
|
|
fi
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$buildType" = "release" -o "$buildType" = "beta" ]; then
|
|
|
|
if [ "$buildType" = "beta" ]; then
|
2025-01-23 22:49:35 +08:00
|
|
|
FetchWebDev
|
|
|
|
else
|
|
|
|
FetchWebRelease
|
|
|
|
fi
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$dockerType" = "docker" ]; then
|
2022-09-08 21:22:21 +08:00
|
|
|
BuildDocker
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$dockerType" = "docker-multiplatform" ]; then
|
2024-01-05 15:52:30 +08:00
|
|
|
BuildDockerMultiplatform
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$dockerType" = "linux_musl_arm" ]; then
|
2023-08-04 19:27:14 +08:00
|
|
|
BuildReleaseLinuxMuslArm
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-linux-musl-arm-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5-linux-musl-arm.txt"
|
|
|
|
fi
|
|
|
|
elif [ "$dockerType" = "linux_musl" ]; then
|
2023-09-03 22:53:58 +08:00
|
|
|
BuildReleaseLinuxMusl
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-linux-musl-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5-linux-musl.txt"
|
|
|
|
fi
|
|
|
|
elif [ "$dockerType" = "android" ]; then
|
2024-01-09 19:00:11 +08:00
|
|
|
BuildReleaseAndroid
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-android-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5-android.txt"
|
|
|
|
fi
|
|
|
|
elif [ "$dockerType" = "freebsd" ]; then
|
2024-11-01 21:37:53 +08:00
|
|
|
BuildReleaseFreeBSD
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-freebsd-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5-freebsd.txt"
|
|
|
|
fi
|
|
|
|
elif [ "$dockerType" = "web" ]; then
|
2024-08-18 00:21:48 +08:00
|
|
|
echo "web only"
|
2022-09-08 21:22:21 +08:00
|
|
|
else
|
|
|
|
BuildRelease
|
2025-06-28 22:22:16 +08:00
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5.txt"
|
|
|
|
fi
|
2022-09-08 21:22:21 +08:00
|
|
|
fi
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$buildType" = "prepare" ]; then
|
|
|
|
if [ "$dockerType" = "docker-multiplatform" ]; then
|
2024-05-02 22:28:13 +08:00
|
|
|
PrepareBuildDockerMusl
|
|
|
|
fi
|
2025-06-28 22:22:16 +08:00
|
|
|
elif [ "$buildType" = "zip" ]; then
|
|
|
|
if [ -n "$otherParam" ]; then
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "$otherParam-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "$otherParam.txt"
|
|
|
|
fi
|
|
|
|
elif [ -n "$dockerType" ]; then
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "$dockerType-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "$dockerType.txt"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ "$useLite" = true ]; then
|
|
|
|
MakeRelease "md5-lite.txt"
|
|
|
|
else
|
|
|
|
MakeRelease "md5.txt"
|
|
|
|
fi
|
|
|
|
fi
|
2022-08-29 22:44:55 +08:00
|
|
|
else
|
|
|
|
echo -e "Parameter error"
|
2025-06-28 22:22:16 +08:00
|
|
|
echo -e "Usage: $0 {dev|beta|release|zip|prepare} [docker|docker-multiplatform|linux_musl_arm|linux_musl|android|freebsd|web] [lite] [other_params]"
|
|
|
|
echo -e "Examples:"
|
|
|
|
echo -e " $0 dev"
|
|
|
|
echo -e " $0 dev lite"
|
|
|
|
echo -e " $0 dev docker"
|
|
|
|
echo -e " $0 dev docker lite"
|
|
|
|
echo -e " $0 release"
|
|
|
|
echo -e " $0 release lite"
|
|
|
|
echo -e " $0 release docker lite"
|
2025-07-27 00:27:31 +08:00
|
|
|
echo -e " $0 release linux_musl"
|
2022-09-08 21:22:21 +08:00
|
|
|
fi
|