mirror of
https://github.com/OwO-Network/DeepLX.git
synced 2024-11-16 13:22:20 +08:00
Create .cross_compile.sh
This commit is contained in:
parent
548237e176
commit
19d7177e8b
34
.cross_compile.sh
Normal file
34
.cross_compile.sh
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
set -e
|
||||
|
||||
DIST_PREFIX="deeplx"
|
||||
DEBUG_MODE=${2}
|
||||
TARGET_DIR="dist"
|
||||
PLATFORMS="darwin/amd64 darwin/arm64 linux/386 linux/amd64 linux/arm64 linux/mips openbsd/amd64 openbsd/arm64 freebsd/amd64 freebsd/arm64"
|
||||
|
||||
rm -rf ${TARGET_DIR}
|
||||
mkdir ${TARGET_DIR}
|
||||
|
||||
for pl in ${PLATFORMS}; do
|
||||
export GOOS=$(echo ${pl} | cut -d'/' -f1)
|
||||
export GOARCH=$(echo ${pl} | cut -d'/' -f2)
|
||||
export TARGET=${TARGET_DIR}/${DIST_PREFIX}_${GOOS}_${GOARCH}
|
||||
if [ "${GOOS}" == "windows" ]; then
|
||||
export TARGET=${TARGET_DIR}/${DIST_PREFIX}_${GOOS}_${GOARCH}.exe
|
||||
fi
|
||||
|
||||
echo "build => ${TARGET}"
|
||||
if [ "${DEBUG_MODE}" == "debug" ]; then
|
||||
go build -trimpath -gcflags "all=-N -l" -o ${TARGET} \
|
||||
-ldflags "-X 'main.version=${BUILD_VERSION}' \
|
||||
-X 'main.buildDate=${BUILD_DATE}' \
|
||||
-X 'main.commitID=${COMMIT_SHA1}'\
|
||||
-w -s"
|
||||
else
|
||||
go build -trimpath -o ${TARGET} \
|
||||
-ldflags "-X 'main.version=${BUILD_VERSION}' \
|
||||
-X 'main.buildDate=${BUILD_DATE}' \
|
||||
-X 'main.commitID=${COMMIT_SHA1}'\
|
||||
-w -s"
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user