From 49924c4a02e6438269a5ef550953333daad898dd Mon Sep 17 00:00:00 2001 From: David Six Date: Fri, 8 Nov 2019 22:22:51 +0000 Subject: [PATCH 1/2] Build staticly with musl for better compatibility --- .goreleaser.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 15409199a..ce0a0e8d2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -25,6 +25,9 @@ builds: main: ./cmd/cfssl ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssl-windows binary: cfssl env: @@ -58,6 +61,9 @@ builds: main: ./cmd/cfssl-bundle ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssl-bundle-windows binary: cfssl-bundle env: @@ -91,6 +97,9 @@ builds: main: ./cmd/cfssl-certinfo ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssl-certinfo-windows binary: cfssl-certinfo env: @@ -124,6 +133,9 @@ builds: main: ./cmd/cfssl-newkey ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssl-newkey-windows binary: cfssl-newkey env: @@ -157,6 +169,9 @@ builds: main: ./cmd/cfssl-scan ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssl-scan-windows binary: cfssl-scan env: @@ -190,6 +205,9 @@ builds: main: ./cmd/cfssljson ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: cfssljson-windows binary: cfssljson env: @@ -223,6 +241,9 @@ builds: main: ./cmd/mkbundle ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: mkbundle-windows binary: mkbundle env: @@ -256,6 +277,9 @@ builds: main: ./cmd/multirootca ldflags: - -s -w -X github.com/cloudflare/cfssl/cli/version.version={{.Version}} + - -linkmode external -extldflags "-static" + env: + - CC=/usr/bin/musl-gcc - id: multirootca-windows binary: multirootca env: From 69fa54a3e275939077528092eb8b8a504d74088e Mon Sep 17 00:00:00 2001 From: David Six Date: Mon, 11 Nov 2019 13:06:08 +0000 Subject: [PATCH 2/2] Update goreleaser tag to musl version --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ef5d319d2..10a52fc06 100644 --- a/Makefile +++ b/Makefile @@ -49,10 +49,14 @@ __check_defined = \ $(if $(value $1),, \ $(error Undefined $1$(if $2, ($2)))) +.PHONY: snapshot +snapshot: + docker run --rm -v $(PWD):/workdir -w /workdir cbroglie/goreleaser-cgo:1.12.12-musl goreleaser --rm-dist --snapshot --skip-publish + .PHONY: release release: @:$(call check_defined, GITHUB_TOKEN) - docker run -e GITHUB_TOKEN=$(GITHUB_TOKEN) --rm -v $(PWD):/workdir -w /workdir cbroglie/goreleaser-cgo:1.12.12 goreleaser --rm-dist + docker run -e GITHUB_TOKEN=$(GITHUB_TOKEN) --rm -v $(PWD):/workdir -w /workdir cbroglie/goreleaser-cgo:1.12.12-musl goreleaser --rm-dist BUILD_PATH := $(CURDIR)/build INSTALL_PATH := $(BUILD_PATH)/usr/local/bin