|
|
@ -11,8 +11,8 @@ function ChToScriptFileDir() {
|
|
|
|
function Help() {
|
|
|
|
function Help() {
|
|
|
|
echo "-h get help"
|
|
|
|
echo "-h get help"
|
|
|
|
echo "-v set build version (default: dev)"
|
|
|
|
echo "-v set build version (default: dev)"
|
|
|
|
echo "-w set web version (default: latest releases)"
|
|
|
|
echo "-w init web version (default: build version)"
|
|
|
|
echo "-s sekp init dep (default: false)"
|
|
|
|
echo "-s skip init web"
|
|
|
|
echo "-m set build mode (default: pie)"
|
|
|
|
echo "-m set build mode (default: pie)"
|
|
|
|
echo "-l set ldflags (default: -s -w --extldflags \"-static -fpic -Wl,-z,relro,-z,now\")"
|
|
|
|
echo "-l set ldflags (default: -s -w --extldflags \"-static -fpic -Wl,-z,relro,-z,now\")"
|
|
|
|
echo "-p set platform (default: host platform, support: all, linux, darwin, windows)"
|
|
|
|
echo "-p set platform (default: host platform, support: all, linux, darwin, windows)"
|
|
|
@ -36,7 +36,7 @@ function Init() {
|
|
|
|
LDFLAGS='-s -w --extldflags "-static -fpic -Wl,-z,relro,-z,now"'
|
|
|
|
LDFLAGS='-s -w --extldflags "-static -fpic -Wl,-z,relro,-z,now"'
|
|
|
|
PLATFORM=""
|
|
|
|
PLATFORM=""
|
|
|
|
TRIM_PATH=""
|
|
|
|
TRIM_PATH=""
|
|
|
|
SKIP_INIT_DEP=""
|
|
|
|
SKIP_INIT_WEB=""
|
|
|
|
BUILD_DIR="build"
|
|
|
|
BUILD_DIR="build"
|
|
|
|
TAGS="jsoniter"
|
|
|
|
TAGS="jsoniter"
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -52,7 +52,7 @@ function ParseArgs() {
|
|
|
|
VERSION="$(echo "$OPTARG" | sed 's/ //g' | sed 's/"//g' | sed 's/\n//g')"
|
|
|
|
VERSION="$(echo "$OPTARG" | sed 's/ //g' | sed 's/"//g' | sed 's/\n//g')"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
s)
|
|
|
|
s)
|
|
|
|
SKIP_INIT_DEP="true"
|
|
|
|
SKIP_INIT_WEB="true"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
w)
|
|
|
|
w)
|
|
|
|
WEB_VERSION="$OPTARG"
|
|
|
|
WEB_VERSION="$OPTARG"
|
|
|
@ -104,7 +104,7 @@ function GetLatestWebVersion() {
|
|
|
|
|
|
|
|
|
|
|
|
# Comply with golang version rules
|
|
|
|
# Comply with golang version rules
|
|
|
|
function CheckVersionFormat() {
|
|
|
|
function CheckVersionFormat() {
|
|
|
|
if [ "$1" == "dev" ] || [ "$(echo "$1" | grep -oE "^v?[0-9]+\.[0-9]+\.[0-9]+$")" ]; then
|
|
|
|
if [ "$1" == "dev" ] || [ "$(echo "$1" | grep -oE "^v?[0-9]+\.[0-9]+\.[0-9]+(\-beta.*|\-rc.*|\-alpha.*)?$")" ]; then
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "version format error: $1"
|
|
|
|
echo "version format error: $1"
|
|
|
@ -115,9 +115,9 @@ function CheckVersionFormat() {
|
|
|
|
function FixArgs() {
|
|
|
|
function FixArgs() {
|
|
|
|
CheckAllPlatform
|
|
|
|
CheckAllPlatform
|
|
|
|
CheckVersionFormat "$VERSION"
|
|
|
|
CheckVersionFormat "$VERSION"
|
|
|
|
if [ ! "$WEB_VERSION" ]; then
|
|
|
|
if [ "$SKIP_INIT_WEB" && ! "$WEB_VERSION" ]; then
|
|
|
|
if [ "$VERSION" == "dev" ]; then
|
|
|
|
if [ "$VERSION" != "" ]; then
|
|
|
|
WEB_VERSION="dev"
|
|
|
|
WEB_VERSION="$VERSION"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
GetLatestWebVersion "synctv-org/synctv-web"
|
|
|
|
GetLatestWebVersion "synctv-org/synctv-web"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
@ -131,13 +131,17 @@ function FixArgs() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function InitDep() {
|
|
|
|
function InitDep() {
|
|
|
|
if [ "$SKIP_INIT_DEP" ]; then
|
|
|
|
if [ ! "$SKIP_INIT_WEB" ]; then
|
|
|
|
echo "skip init dep"
|
|
|
|
echo "skip init web"
|
|
|
|
return
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -rf public/dist/*
|
|
|
|
rm -rf public/dist/*
|
|
|
|
echo "download: https://github.com/synctv-org/synctv-web/releases/download/${WEB_VERSION}/dist.tar.gz"
|
|
|
|
echo "download: https://github.com/synctv-org/synctv-web/releases/download/${WEB_VERSION}/dist.tar.gz"
|
|
|
|
curl -sL "https://github.com/synctv-org/synctv-web/releases/download/${WEB_VERSION}/dist.tar.gz" | tar --strip-components 1 -C "public/dist" -z -x -v -f -
|
|
|
|
curl -sL "https://github.com/synctv-org/synctv-web/releases/download/${WEB_VERSION}/dist.tar.gz" | tar --strip-components 1 -C "public/dist" -z -x -v -f -
|
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
|
|
|
echo "download web error"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# sqlite3 not support linux/loong64,linux/mips linux/mips64,linux/mips64le,linux/mipsle,linux/ppc64,
|
|
|
|
# sqlite3 not support linux/loong64,linux/mips linux/mips64,linux/mips64le,linux/mipsle,linux/ppc64,
|
|
|
|