fixed a bug related to parsing multiple platforms when '-t all' is specified
This commit is contained in:
@@ -61,7 +61,8 @@ CURRENT_TARGET="$(go env GOOS)/$(go env GOARCH)"
|
|||||||
TARGETS=${TARGETS:-"current"}
|
TARGETS=${TARGETS:-"current"}
|
||||||
|
|
||||||
TARGETS=$(decipher_targets "${TARGETS}")
|
TARGETS=$(decipher_targets "${TARGETS}")
|
||||||
TARGETS=${TARGETS//,/ }
|
TARGETS=${TARGETS%$'\n'}
|
||||||
|
IFS=' ' TARGETS=(${TARGETS//,/ })
|
||||||
|
|
||||||
BUILD_DIR=$(pwd)/tmp_build_$$
|
BUILD_DIR=$(pwd)/tmp_build_$$
|
||||||
rm -rf "${BUILD_DIR}"
|
rm -rf "${BUILD_DIR}"
|
||||||
@@ -77,21 +78,21 @@ pushd "${BUILD_DIR}/ConsoleClient" > /dev/null
|
|||||||
|
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
|
|
||||||
for PLATFORM in ${TARGETS}
|
for PLATFORM in "${TARGETS[@]}"
|
||||||
do
|
do
|
||||||
IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}"
|
echo "Building for ${PLATFORM}..."
|
||||||
|
IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}"
|
||||||
export GOOS=${OS}
|
export GOOS=${OS}
|
||||||
export GOARCH=${ARCH}
|
export GOARCH=${ARCH}
|
||||||
if [[ -n "${VARIANT}" ]]; then
|
if [[ -n "${VARIANT}" ]]; then
|
||||||
export GOARM=${VARIANT#v}
|
export GOARM=${VARIANT#v}
|
||||||
fi
|
fi
|
||||||
GOEXT=""
|
GOEXT=""
|
||||||
if [[ "${OS}" == "windows" ]]; then
|
if [[ "${OS}" == "windows" ]]; then
|
||||||
GOEXT=".exe"
|
GOEXT=".exe"
|
||||||
fi
|
fi
|
||||||
${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}"
|
${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}"
|
||||||
unset GOOS GOARCH GOARM
|
unset GOOS GOARCH GOARM
|
||||||
done
|
done
|
||||||
|
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|||||||
@@ -7,10 +7,13 @@ function help_message() {
|
|||||||
echo "Usage: $0 [OPTIONS]"
|
echo "Usage: $0 [OPTIONS]"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --targets, -t <targets> Comma-separated list of target platforms (default: current, use 'all' for all supported targets)"
|
echo " --targets, -t <targets> Comma-separated list of target platforms (default: current, use 'all' for all supported targets)"
|
||||||
echo " --version, -v <version> Psiphon version to build (default: 2.0.32)"
|
echo " --version, -v <version> Psiphon version to build (default: latest available)"
|
||||||
echo " --go, -g <version> Go version to use (default: 1.22.7)"
|
echo " --go, -g <version> Go version to use (default: 1.22.7)"
|
||||||
echo " --help, -h Show this help message and exit"
|
echo " --load Load the built image into local Docker (cannot be used with --push)"
|
||||||
|
echo " --push Push the built image to Docker Hub (cannot be used with --load)"
|
||||||
echo " --supported-targets Show supported targets and exit"
|
echo " --supported-targets Show supported targets and exit"
|
||||||
|
echo " --current-target Show current target platform and exit"
|
||||||
|
echo " --help, -h Show this help message and exit"
|
||||||
exit ${1:-1}
|
exit ${1:-1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user