build-packages.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*")
  3. echo $VERSION
  4. # Disable FIPS module in go-boring
  5. export GOEXPERIMENT=noboringcrypto
  6. export CGO_ENABLED=0
  7. # This controls the directory the built artifacts go into
  8. export ARTIFACT_DIR=artifacts/
  9. mkdir -p $ARTIFACT_DIR
  10. linuxArchs=("386" "amd64" "arm" "armhf" "arm64")
  11. export TARGET_OS=linux
  12. for arch in ${linuxArchs[@]}; do
  13. unset TARGET_ARM
  14. export TARGET_ARCH=$arch
  15. ## Support for arm platforms without hardware FPU enabled
  16. if [[ $arch == arm ]] ; then
  17. export TARGET_ARCH=arm
  18. export TARGET_ARM=5
  19. fi
  20. ## Support for armhf builds
  21. if [[ $arch == armhf ]] ; then
  22. export TARGET_ARCH=arm
  23. export TARGET_ARM=7
  24. fi
  25. make cloudflared-deb
  26. mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
  27. # rpm packages invert the - and _ and use x86_64 instead of amd64.
  28. RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
  29. RPMARCH=$arch
  30. if [ $arch == "amd64" ];then
  31. RPMARCH="x86_64"
  32. fi
  33. if [ $arch == "arm64" ]; then
  34. RPMARCH="aarch64"
  35. fi
  36. make cloudflared-rpm
  37. mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-linux-$RPMARCH.rpm
  38. # finally move the linux binary as well.
  39. mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
  40. done