Build system improvements

- build PIE binaries using goreleaser
- add snapshot target to Makefile
- add -trimpath option to go build
This commit is contained in:
Jan Dittberner 2022-12-02 09:44:52 +01:00
parent 37d3b1e021
commit 7837164e6e
2 changed files with 15 additions and 3 deletions

View file

@ -16,6 +16,9 @@ builds:
env: env:
- CC=x86_64-linux-gnu-gcc - CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++ - CXX=x86_64-linux-gnu-g++
flags:
- -buildmode=pie
- -trimpath
- id: linux-arm64 - id: linux-arm64
main: ./cmd/signer main: ./cmd/signer
binary: cacert-gosigner binary: cacert-gosigner
@ -29,6 +32,9 @@ builds:
- CC=aarch64-linux-gnu-gcc - CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++ - CXX=aarch64-linux-gnu-g++
- PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/pkgconfig - PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/pkgconfig
flags:
- -buildmode=pie
- -trimpath
- id: linux-armhf - id: linux-armhf
main: ./cmd/signer main: ./cmd/signer
binary: cacert-gosigner binary: cacert-gosigner
@ -42,6 +48,9 @@ builds:
- CC=arm-linux-gnueabihf-gcc - CC=arm-linux-gnueabihf-gcc
- CXX=arm-linux-gnueabihf-g++ - CXX=arm-linux-gnueabihf-g++
- PKG_CONFIG_PATH=/usr/arm-linux-gnueabihf/pkgconfig - PKG_CONFIG_PATH=/usr/arm-linux-gnueabihf/pkgconfig
flags:
- -buildmode=pie
- -trimpath
archives: archives:
- id: cacert-gosigner - id: cacert-gosigner
builds: builds:

View file

@ -15,12 +15,15 @@ test:
go test -race ./... go test -race ./...
clientsim: $(GOFILES) clientsim: $(GOFILES)
go build -race ./cmd/clientsim go build -race -trimpath ./cmd/clientsim
signer: $(GOFILES) signer: $(GOFILES)
go build -race -ldflags="-X 'main.date=$(BUILD_TIME)' -X 'main.commit=$(COMMIT)' -X 'main.version=$(VERSION)'" ./cmd/signer go build -race -trimpath -ldflags="-X 'main.date=$(BUILD_TIME)' -X 'main.commit=$(COMMIT)' -X 'main.version=$(VERSION)'" ./cmd/signer
clean: clean:
rm -f signer clientsim pkg/messages/resolver.msgpackgen.go rm -f signer clientsim pkg/messages/resolver.msgpackgen.go
.PHONY: test lint all clean snapshot:
goreleaser build --rm-dist --snapshot
.PHONY: test lint all clean snapshot