Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build staticly with musl for better compatibility #1054

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down