TUN-4761: Added a build-all-packages target to cfsetup

This commit is contained in:
Sudarsan Reddy 2021-07-22 16:36:49 +01:00
parent 38af26e232
commit dff694b218
4 changed files with 51 additions and 12 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ cscope.*
*-session.log *-session.log
ssh_server_tests/.env ssh_server_tests/.env
/.cover /.cover
built_artifacts/

View File

@ -88,7 +88,7 @@ clean:
go clean go clean
.PHONY: cloudflared .PHONY: cloudflared
cloudflared: tunnel-deps cloudflared:
ifeq ($(FIPS), true) ifeq ($(FIPS), true)
$(info Building cloudflared with go-fips) $(info Building cloudflared with go-fips)
-test -f fips/fips.go && mv fips/fips.go fips/fips.go.linux-amd64 -test -f fips/fips.go && mv fips/fips.go fips/fips.go.linux-amd64
@ -157,6 +157,14 @@ cloudflared-deb: cloudflared
cloudflared-rpm: cloudflared cloudflared-rpm: cloudflared
$(call build_package,rpm) $(call build_package,rpm)
.PHONY: cloudflared-pkg
cloudflared-pkg: cloudflared
$(call build_package,osxpkg)
.PHONY: cloudflared-msi
cloudflared-msi: cloudflared
wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) --output cloudflared-$(VERSION)-$(TARGET_ARCH).msi cloudflared.wxs
.PHONY: cloudflared-darwin-amd64.tgz .PHONY: cloudflared-darwin-amd64.tgz
cloudflared-darwin-amd64.tgz: cloudflared cloudflared-darwin-amd64.tgz: cloudflared
tar czf cloudflared-darwin-amd64.tgz cloudflared tar czf cloudflared-darwin-amd64.tgz cloudflared
@ -227,10 +235,6 @@ homebrew-release: homebrew-upload
release: bin/equinox release: bin/equinox
bin/equinox release $(EQUINOX_FLAGS) -- $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared bin/equinox release $(EQUINOX_FLAGS) -- $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared
.PHONY: build-msi
build-msi:
wixl --define Version=$(VERSION) --define Path=$(EXECUTABLE_PATH) cloudflared.wxs
.PHONY: github-release .PHONY: github-release
github-release: cloudflared github-release: cloudflared
python3 github_release.py --path $(EXECUTABLE_PATH) --release-version $(VERSION) python3 github_release.py --path $(EXECUTABLE_PATH) --release-version $(VERSION)
@ -248,10 +252,9 @@ bin/equinox:
mkdir -p bin mkdir -p bin
curl -s https://bin.equinox.io/c/75JtLRTsJ3n/release-tool-beta-$(EQUINOX_PLATFORM).tgz | tar xz -C bin/ curl -s https://bin.equinox.io/c/75JtLRTsJ3n/release-tool-beta-$(EQUINOX_PLATFORM).tgz | tar xz -C bin/
.PHONY: tunnel-deps
tunnel-deps: tunnelrpc/tunnelrpc.capnp.go
tunnelrpc/tunnelrpc.capnp.go: tunnelrpc/tunnelrpc.capnp .PHONY: tunnelrpc-deps
tunnelrpc-deps:
which capnp # https://capnproto.org/install.html which capnp # https://capnproto.org/install.html
which capnpc-go # go get zombiezen.com/go/capnproto2/capnpc-go which capnpc-go # go get zombiezen.com/go/capnproto2/capnpc-go
capnp compile -ogo tunnelrpc/tunnelrpc.capnp capnp compile -ogo tunnelrpc/tunnelrpc.capnp
@ -268,10 +271,6 @@ vet:
which go-sumtype # go get github.com/BurntSushi/go-sumtype (don't do this in build directory or this will cause vendor issues) which go-sumtype # go get github.com/BurntSushi/go-sumtype (don't do this in build directory or this will cause vendor issues)
go-sumtype $$(go list -mod=vendor ./...) go-sumtype $$(go list -mod=vendor ./...)
.PHONY: msi
msi: cloudflared
go-msi make --msi cloudflared.msi --version $(MSI_VERSION)
.PHONY: goimports .PHONY: goimports
goimports: goimports:
for d in $$(go list -mod=readonly -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -w $$d ; done for d in $$(go list -mod=readonly -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -w $$d ; done

22
build-packages.sh Executable file
View File

@ -0,0 +1,22 @@
# This controls the directory the built artifacts go into
export ARTIFACT_DIR=built_artifacts/
mkdir -p $ARTIFACT_DIR
windowsArchs=("amd64" "386")
export TARGET_OS=windows
for arch in ${windowsArchs[@]}; do
export TARGET_ARCH=$arch
make cloudflared-msi
done
mv *.msi $ARTIFACT_DIR
linuxArchs=("amd64" "386" "arm")
export TARGET_OS=linux
for arch in ${linuxArchs[@]}; do
export TARGET_ARCH=$arch
make cloudflared-deb
make cloudflared-rpm
done
mv *.deb $ARTIFACT_DIR
mv *.rpm $ARTIFACT_DIR

View File

@ -14,6 +14,23 @@ stretch: &stretch
- export GOARCH=amd64 - export GOARCH=amd64
- export FIPS=true - export FIPS=true
- make cloudflared - make cloudflared
build-all-packages: #except osxpkg
build_dir: *build_dir
builddeps:
- *pinned_go_fips
- build-essential
- fakeroot
- rubygem-fpm
- rpm
- wget
# libmsi and libgcab are libraries the wixl binary depends on.
- libmsi-dev
- libgcab-dev
pre-cache:
- wget https://github.com/sudarshan-reddy/msitools/releases/download/v0.101b/wixl -P /usr/local/bin
- chmod a+x /usr/local/bin/wixl
post-cache:
- ./build-packages.sh
build-deb: build-deb:
build_dir: *build_dir build_dir: *build_dir
builddeps: &build_deb_deps builddeps: &build_deb_deps