在Linux上不通过交叉编译器编译时,也可以支持边缘脚本(在有商业版本源码的情况下)

This commit is contained in:
GoEdgeLab
2023-06-10 15:16:06 +08:00
parent e86bde245c
commit 589ca962d1

View File

@@ -55,7 +55,7 @@ function build() {
cp -R "$ROOT"/pages "$DIST"/ cp -R "$ROOT"/pages "$DIST"/
# we support TOA on linux/amd64 only # we support TOA on linux/amd64 only
if [ "$OS" == "linux" -a "$ARCH" == "amd64" ] if [ "$OS" == "linux" ] && [ "$ARCH" == "amd64" ]
then then
cp -R "$ROOT"/edge-toa "$DIST" cp -R "$ROOT"/edge-toa "$DIST"
fi fi
@@ -114,7 +114,10 @@ function build() {
if [ ! -z $CC_PATH ]; then if [ ! -z $CC_PATH ]; then
env CC=$MUSL_DIR/$CC_PATH CXX=$MUSL_DIR/$CXX_PATH GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=1 go build -trimpath -tags $BUILD_TAG -o "$DIST"/bin/${NAME} -ldflags "-linkmode external -extldflags -static -s -w" "$ROOT"/../cmd/edge-node/main.go env CC=$MUSL_DIR/$CC_PATH CXX=$MUSL_DIR/$CXX_PATH GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=1 go build -trimpath -tags $BUILD_TAG -o "$DIST"/bin/${NAME} -ldflags "-linkmode external -extldflags -static -s -w" "$ROOT"/../cmd/edge-node/main.go
else else
env GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=1 go build -trimpath -tags $TAG -o "$DIST"/bin/${NAME} -ldflags="-s -w" "$ROOT"/../cmd/edge-node/main.go if [[ `uname` == *"Linux"* ]] && [ "$OS" == "linux" ] && [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ]] && [ "$TAG" == "plus" ]; then
BUILD_TAG="plus,script"
fi
env GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=1 go build -trimpath -tags $BUILD_TAG -o "$DIST"/bin/${NAME} -ldflags="-s -w" "$ROOT"/../cmd/edge-node/main.go
fi fi
# delete hidden files # delete hidden files