From 135c8e6d13663d2aa2d3c9169cde0cfc1e6e2062 Mon Sep 17 00:00:00 2001 From: Sudarsan Reddy Date: Mon, 20 Jun 2022 12:05:03 +0100 Subject: [PATCH] TUN-6362: Add armhf support to cloudflare packaging We now will have `armhf` based debs on our github pages This will also sync to our R2 Release process allowing legacy rpi users to eventually be able to apt-get install cloudflared. --- Makefile | 14 ++++++++++++-- build-packages.sh | 10 +++++++++- release_pkgs.py | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0b103775..0fc54935 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,16 @@ else TARGET_PUBLIC_REPO ?= $(FLAVOR) endif +ifneq ($(TARGET_ARM), ) + ARM_COMMAND := GOARM=$(TARGET_ARM) +endif + +ifeq ($(TARGET_ARM), 7) + PACKAGE_ARCH := armhf +else + PACKAGE_ARCH := $(TARGET_ARCH) +endif + .PHONY: all all: cloudflared test @@ -111,7 +121,7 @@ ifeq ($(FIPS), true) $(info Building cloudflared with go-fips) cp -f fips/fips.go.linux-amd64 cmd/cloudflared/fips.go endif - GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -v -mod=vendor $(GO_BUILD_TAGS) $(LDFLAGS) $(IMPORT_PATH)/cmd/cloudflared + GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(ARM_COMMAND) go build -v -mod=vendor $(GO_BUILD_TAGS) $(LDFLAGS) $(IMPORT_PATH)/cmd/cloudflared ifeq ($(FIPS), true) rm -f cmd/cloudflared/fips.go ./check-fips.sh cloudflared @@ -171,7 +181,7 @@ define build_package --license 'Apache License Version 2.0' \ --url 'https://github.com/cloudflare/cloudflared' \ -m 'Cloudflare ' \ - -a $(TARGET_ARCH) -v $(VERSION) -n $(DEB_PACKAGE_NAME) $(NIGHTLY_FLAGS) --after-install postinst.sh --after-remove postrm.sh \ + -a $(PACKAGE_ARCH) -v $(VERSION) -n $(DEB_PACKAGE_NAME) $(NIGHTLY_FLAGS) --after-install postinst.sh --after-remove postrm.sh \ cloudflared=$(INSTALL_BINDIR) cloudflared.1=$(INSTALL_MANDIR) endef diff --git a/build-packages.sh b/build-packages.sh index 2c01bf9b..97c5b681 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -17,10 +17,18 @@ for arch in ${windowsArchs[@]}; do done -linuxArchs=("386" "amd64" "arm" "arm64") +linuxArchs=("386" "amd64" "arm" "armhf" "arm64") export TARGET_OS=linux for arch in ${linuxArchs[@]}; do + unset TARGET_ARM export TARGET_ARCH=$arch + + ## Support for armhf builds + if [[ $arch == armhf ]] ; then + export TARGET_ARCH=arm + export TARGET_ARM=7 + fi + make cloudflared-deb mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb diff --git a/release_pkgs.py b/release_pkgs.py index c5a26a76..e916e249 100644 --- a/release_pkgs.py +++ b/release_pkgs.py @@ -354,7 +354,7 @@ def parse_args(): ) parser.add_argument( - "--archs", default=["amd64", "386", "arm64", "arm"], help="list of architectures we want to package for. Note that\ + "--archs", default=["amd64", "386", "arm64", "arm", "armhf"], help="list of architectures we want to package for. Note that\ it is the caller's responsiblity to ensure that these debs are already present in a directory. This script\ will not build binaries or create their debs." )