Skip to content

Commit

Permalink
Merge pull request #1054 from dsix-work/musl-builds
Browse files Browse the repository at this point in the history
Build staticly with musl for better compatibility
  • Loading branch information
cbroglie committed Nov 13, 2019
2 parents 358fd07 + 69fa54a commit ebe0199
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
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

0 comments on commit ebe0199

Please sign in to comment.