2024-01-09 11:33:00 +00:00
|
|
|
#!/bin/bash
|
2021-11-09 11:37:51 +00:00
|
|
|
VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*")
|
2021-07-30 11:29:51 +00:00
|
|
|
echo $VERSION
|
2021-11-09 11:37:51 +00:00
|
|
|
|
2024-01-08 10:34:40 +00:00
|
|
|
# Disable FIPS module in go-boring
|
|
|
|
export GOEXPERIMENT=noboringcrypto
|
2024-01-09 11:33:00 +00:00
|
|
|
export CGO_ENABLED=0
|
2021-11-09 11:37:51 +00:00
|
|
|
|
2021-07-22 15:36:49 +00:00
|
|
|
# This controls the directory the built artifacts go into
|
|
|
|
export ARTIFACT_DIR=built_artifacts/
|
|
|
|
mkdir -p $ARTIFACT_DIR
|
|
|
|
|
2022-06-20 11:05:03 +00:00
|
|
|
linuxArchs=("386" "amd64" "arm" "armhf" "arm64")
|
2021-07-22 15:36:49 +00:00
|
|
|
export TARGET_OS=linux
|
2021-11-09 11:37:51 +00:00
|
|
|
for arch in ${linuxArchs[@]}; do
|
2022-06-20 11:05:03 +00:00
|
|
|
unset TARGET_ARM
|
2021-07-22 15:36:49 +00:00
|
|
|
export TARGET_ARCH=$arch
|
2024-01-15 21:16:34 +00:00
|
|
|
|
|
|
|
## Support for armv6 builds
|
|
|
|
if [[ $arch == arm ]] ; then
|
|
|
|
export TARGET_ARCH=arm
|
|
|
|
export TARGET_ARM=6
|
|
|
|
fi
|
2022-06-20 11:05:03 +00:00
|
|
|
|
|
|
|
## Support for armhf builds
|
|
|
|
if [[ $arch == armhf ]] ; then
|
|
|
|
export TARGET_ARCH=arm
|
|
|
|
export TARGET_ARM=7
|
|
|
|
fi
|
|
|
|
|
2021-07-22 15:36:49 +00:00
|
|
|
make cloudflared-deb
|
2021-07-30 11:29:51 +00:00
|
|
|
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
|
|
|
|
|
2021-11-09 11:37:51 +00:00
|
|
|
# rpm packages invert the - and _ and use x86_64 instead of amd64.
|
2021-07-30 11:29:51 +00:00
|
|
|
RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
|
|
|
|
RPMARCH=$arch
|
|
|
|
if [ $arch == "amd64" ];then
|
|
|
|
RPMARCH="x86_64"
|
|
|
|
fi
|
2021-08-04 07:18:43 +00:00
|
|
|
if [ $arch == "arm64" ]; then
|
|
|
|
RPMARCH="aarch64"
|
|
|
|
fi
|
2021-07-22 15:36:49 +00:00
|
|
|
make cloudflared-rpm
|
2021-07-30 11:29:51 +00:00
|
|
|
mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-linux-$RPMARCH.rpm
|
|
|
|
|
|
|
|
# finally move the linux binary as well.
|
|
|
|
mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
|
2021-07-22 15:36:49 +00:00
|
|
|
done
|