diff --git a/Makefile b/Makefile index cc365ab6..d5e60f08 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,24 @@ VERSION := $(shell git describe --tags --always --dirty="-dev") DATE := $(shell date -u '+%Y-%m-%d-%H%M UTC') VERSION_FLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"' +IMPORT_PATH := github.com/cloudflare/cloudflared +PACKAGE_DIR := $(CURDIR)/packaging +INSTALL_BINDIR := usr/local/bin + .PHONY: all all: cloudflared test .PHONY: cloudflared cloudflared: - go build -v $(VERSION_FLAGS) ./... + go build -v $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared .PHONY: test test: go test -v -race $(VERSION_FLAGS) ./... + +.PHONY: cloudflared-deb +cloudflared-deb: cloudflared + mkdir -p $(PACKAGE_DIR) + cp cloudflared $(PACKAGE_DIR)/cloudflared + fakeroot fpm -C $(PACKAGE_DIR) -s dir -t deb --deb-compression bzip2 \ + -a $(GOARCH) -v $(VERSION) -n cloudflared diff --git a/cfsetup.yaml b/cfsetup.yaml index b77b7d8e..4936fc62 100644 --- a/cfsetup.yaml +++ b/cfsetup.yaml @@ -11,4 +11,28 @@ stretch: - export CGO_ENABLED=1 - export GOOS=linux - export GOARCH=amd64 - - make all + - make cloudflared + build-deb: + build_dir: *build_dir + builddeps: + - *pinned_go + - build-essential + - fakeroot + - rubygem-fpm + post-cache: + - export GOPATH=/cfsetup_build/ + - export CGO_ENABLED=1 + - export GOOS=linux + - export GOARCH=amd64 + - make cloudflared-deb + test: + build_dir: *build_dir + builddeps: + - *pinned_go + - build-essential + post-cache: + - export GOPATH=/cfsetup_build/ + - export CGO_ENABLED=1 + - export GOOS=linux + - export GOARCH=amd64 + - make test