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.
This commit is contained in:
Sudarsan Reddy 2022-06-20 12:05:03 +01:00
parent 420e80ea50
commit 135c8e6d13
3 changed files with 22 additions and 4 deletions

View File

@ -98,6 +98,16 @@ else
TARGET_PUBLIC_REPO ?= $(FLAVOR) TARGET_PUBLIC_REPO ?= $(FLAVOR)
endif 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 .PHONY: all
all: cloudflared test all: cloudflared test
@ -111,7 +121,7 @@ ifeq ($(FIPS), true)
$(info Building cloudflared with go-fips) $(info Building cloudflared with go-fips)
cp -f fips/fips.go.linux-amd64 cmd/cloudflared/fips.go cp -f fips/fips.go.linux-amd64 cmd/cloudflared/fips.go
endif 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) ifeq ($(FIPS), true)
rm -f cmd/cloudflared/fips.go rm -f cmd/cloudflared/fips.go
./check-fips.sh cloudflared ./check-fips.sh cloudflared
@ -171,7 +181,7 @@ define build_package
--license 'Apache License Version 2.0' \ --license 'Apache License Version 2.0' \
--url 'https://github.com/cloudflare/cloudflared' \ --url 'https://github.com/cloudflare/cloudflared' \
-m 'Cloudflare <support@cloudflare.com>' \ -m 'Cloudflare <support@cloudflare.com>' \
-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) cloudflared=$(INSTALL_BINDIR) cloudflared.1=$(INSTALL_MANDIR)
endef endef

View File

@ -17,10 +17,18 @@ for arch in ${windowsArchs[@]}; do
done done
linuxArchs=("386" "amd64" "arm" "arm64") linuxArchs=("386" "amd64" "arm" "armhf" "arm64")
export TARGET_OS=linux export TARGET_OS=linux
for arch in ${linuxArchs[@]}; do for arch in ${linuxArchs[@]}; do
unset TARGET_ARM
export TARGET_ARCH=$arch export TARGET_ARCH=$arch
## Support for armhf builds
if [[ $arch == armhf ]] ; then
export TARGET_ARCH=arm
export TARGET_ARM=7
fi
make cloudflared-deb make cloudflared-deb
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb

View File

@ -354,7 +354,7 @@ def parse_args():
) )
parser.add_argument( 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\ 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." will not build binaries or create their debs."
) )