diff --git a/.travis.yml b/.travis.yml index b3b89f1..1cfed4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ sudo: required go: - 1.16.x # Latest go version env: - - azure-linux - GO111MODULE=on addons: apt: @@ -12,8 +11,7 @@ addons: - gcc-multilib before_install: - # gox simplifies building for multiple architectures - - go get github.com/necrose99/gox + - # skip install: - # skip @@ -23,7 +21,8 @@ script: - diff -u <(echo -n) <(gofmt -d .) - go vet $(go list ./... | grep -v /vendor/) - sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross - - GOX_linux_arm_LDFLAGS="-linkmode external -extldflags -static" GOX_linux_arm_CC=arm-linux-gnueabi-gcc GOX_linux_arm64_LDFLAGS="-linkmode external -extldflags -static" GOX_linux_arm64_CC=aarch64-linux-gnu-gcc gox -rebuild -parallel=1 -verbose -cgo -os="linux" -arch="amd64 arm arm64" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.Version=`git rev-parse --short HEAD`" -verbose ./... + - make build + - make build-cross-plat deploy: provider: releases diff --git a/Makefile b/Makefile index aca8bab..789b1d3 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,15 @@ IMAGE=h44z/wg-portal all: dep build -build: dep - mkdir -p $(BUILDDIR) +build: dep $(addsuffix -amd64,$(addprefix $(BUILDDIR)/,$(BINARIES))) + cp scripts/wg-portal.service $(BUILDDIR) + cp scripts/wg-portal.env $(BUILDDIR) + +build-cross-plat: dep build $(addsuffix -arm,$(addprefix $(BUILDDIR)/,$(BINARIES))) $(addsuffix -arm64,$(addprefix $(BUILDDIR)/,$(BINARIES))) cp scripts/wg-portal.service $(BUILDDIR) cp scripts/wg-portal.env $(BUILDDIR) - GOX_linux_arm_LDFLAGS="-linkmode external -extldflags -static" GOX_linux_arm_CC=arm-linux-gnueabihf-gcc GOX_linux_arm64_LDFLAGS="-linkmode external -extldflags -static" GOX_linux_arm64_CC=aarch64-linux-gnu-gcc gox -rebuild -parallel=1 -verbose -cgo -os="linux" -arch="amd64 arm arm64" -output="dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.Version=`git rev-parse --short HEAD`" -verbose ./... dep: - $(GOCMD) get github.com/necrose99/gox $(GOCMD) mod download validate: dep @@ -56,4 +57,4 @@ $(BUILDDIR)/%-arm64: cmd/%/main.go dep phony # On arch-linux install arm-linux-gnueabihf-gcc to crosscompile for arm $(BUILDDIR)/%-arm: cmd/%/main.go dep phony - CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@ $< \ No newline at end of file + CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@ $< \ No newline at end of file