TUN-8546: rework MacOS build script
The rework consists in building and packaging the cloudflared binary based on the OS & ARCH of the system. read TARGET_ARCH from export and exit if TARGET_ARCH is not set
This commit is contained in:
parent
db239e7319
commit
c2183bd814
|
@ -7,6 +7,12 @@ if [[ "$(uname)" != "Darwin" ]] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "amd64" != "${TARGET_ARCH}" && "arm64" != "${TARGET_ARCH}" ]]
|
||||||
|
then
|
||||||
|
echo "TARGET_ARCH must be amd64 or arm64"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
go version
|
go version
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
@ -137,13 +143,10 @@ fi
|
||||||
|
|
||||||
# cleanup the build directory because the previous execution might have failed without cleaning up.
|
# cleanup the build directory because the previous execution might have failed without cleaning up.
|
||||||
rm -rf "${TARGET_DIRECTORY}"
|
rm -rf "${TARGET_DIRECTORY}"
|
||||||
archs=("amd64" "arm64")
|
export TARGET_OS="darwin"
|
||||||
export TARGET_OS=darwin
|
FILENAME="$(pwd)/artifacts/cloudflared-darwin-$TARGET_ARCH.tgz"
|
||||||
for arch in ${archs[@]}; do
|
PKGNAME="$(pwd)/artifacts/cloudflared-$TARGET_ARCH.pkg"
|
||||||
|
GOCACHE="$PWD/../../../../" GOPATH="$PWD/../../../../" CGO_ENABLED=1 make cloudflared
|
||||||
FILENAME="$(pwd)/artifacts/cloudflared-darwin-$arch.tgz"
|
|
||||||
PKGNAME="$(pwd)/artifacts/cloudflared-$arch.pkg"
|
|
||||||
TARGET_ARCH=$arch GOCACHE="$PWD/../../../../" GOPATH="$PWD/../../../../" CGO_ENABLED=1 make cloudflared
|
|
||||||
|
|
||||||
# sign the cloudflared binary
|
# sign the cloudflared binary
|
||||||
if [[ ! -z "$CODE_SIGN_NAME" ]]; then
|
if [[ ! -z "$CODE_SIGN_NAME" ]]; then
|
||||||
|
@ -186,7 +189,6 @@ for arch in ${archs[@]}; do
|
||||||
--install-location /usr/local/bin \
|
--install-location /usr/local/bin \
|
||||||
${PKGNAME}
|
${PKGNAME}
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# cleanup build directory because this script is not ran within containers,
|
# cleanup build directory because this script is not ran within containers,
|
||||||
# which might lead to future issues in subsequent runs.
|
# which might lead to future issues in subsequent runs.
|
||||||
|
|
Loading…
Reference in New Issue