diff --git a/build.sh b/build.sh index 861a323..95f9de7 100755 --- a/build.sh +++ b/build.sh @@ -61,7 +61,8 @@ CURRENT_TARGET="$(go env GOOS)/$(go env GOARCH)" TARGETS=${TARGETS:-"current"} TARGETS=$(decipher_targets "${TARGETS}") -TARGETS=${TARGETS//,/ } +TARGETS=${TARGETS%$'\n'} +IFS=' ' TARGETS=(${TARGETS//,/ }) BUILD_DIR=$(pwd)/tmp_build_$$ rm -rf "${BUILD_DIR}" @@ -77,21 +78,21 @@ pushd "${BUILD_DIR}/ConsoleClient" > /dev/null export CGO_ENABLED=0 -for PLATFORM in ${TARGETS} +for PLATFORM in "${TARGETS[@]}" do - IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}" - - export GOOS=${OS} - export GOARCH=${ARCH} - if [[ -n "${VARIANT}" ]]; then - export GOARM=${VARIANT#v} - fi - GOEXT="" - if [[ "${OS}" == "windows" ]]; then - GOEXT=".exe" - fi - ${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}" - unset GOOS GOARCH GOARM + echo "Building for ${PLATFORM}..." + IFS='/' read -r OS ARCH VARIANT <<< "${PLATFORM}" + export GOOS=${OS} + export GOARCH=${ARCH} + if [[ -n "${VARIANT}" ]]; then + export GOARM=${VARIANT#v} + fi + GOEXT="" + if [[ "${OS}" == "windows" ]]; then + GOEXT=".exe" + fi + ${GO} build -a -tags netgo -ldflags "-s -w -extldflags '-static'" -o "${BIN_DIR}/psiphon_${PLATFORM//\//_}${GOEXT}" + unset GOOS GOARCH GOARM done popd > /dev/null diff --git a/make.bash b/make.bash index c60cd1a..6bea1ef 100755 --- a/make.bash +++ b/make.bash @@ -7,10 +7,13 @@ function help_message() { echo "Usage: $0 [OPTIONS]" echo "Options:" echo " --targets, -t Comma-separated list of target platforms (default: current, use 'all' for all supported targets)" - echo " --version, -v Psiphon version to build (default: 2.0.32)" + echo " --version, -v Psiphon version to build (default: latest available)" echo " --go, -g 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 " --current-target Show current target platform and exit" + echo " --help, -h Show this help message and exit" exit ${1:-1} }