cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2026.1.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.ci/scripts/linux/build-packages.sh

60lines · modecode

1#!/bin/bash
2set -e -u -o pipefail
3
4# Check if architecture argument is provided
5if [ $# -eq 0 ]; then
6 echo "Error: Architecture argument is required"
7 echo "Usage: $0 <architecture>"
8 exit 1
9fi
10
11# Parameters
12arch=$1
13
14# Get Version
15VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*")
16echo $VERSION
17
18# Disable FIPS module in go-boring
19export GOEXPERIMENT=noboringcrypto
20export CGO_ENABLED=0
21
22# This controls the directory the built artifacts go into
23export ARTIFACT_DIR=artifacts/
24mkdir -p $ARTIFACT_DIR
25
26export TARGET_OS=linux
27
28unset TARGET_ARM
29export TARGET_ARCH=$arch
30
31## Support for arm platforms without hardware FPU enabled
32if [[ $arch == arm ]] ; then
33 export TARGET_ARCH=arm
34 export TARGET_ARM=5
35fi
36
37## Support for armhf builds
38if [[ $arch == armhf ]] ; then
39 export TARGET_ARCH=arm
40 export TARGET_ARM=7
41fi
42
43make cloudflared-deb
44mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
45
46# rpm packages invert the - and _ and use x86_64 instead of amd64.
47RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
48RPMARCH=$arch
49if [ $arch == "amd64" ];then
50 RPMARCH="x86_64"
51fi
52if [ $arch == "arm64" ]; then
53 RPMARCH="aarch64"
54fi
55make cloudflared-rpm
56mv cloudflared-$RPMVERSION-1.$RPMARCH.rpm $ARTIFACT_DIR/cloudflared-linux-$RPMARCH.rpm
57
58# finally move the linux binary as well.
59mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
60
61