WIP: dont use gox

This commit is contained in:
Christoph Haas 2021-02-24 22:52:19 +01:00
parent 6d4fcba00c
commit 14339e72d4
2 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,6 @@ sudo: required
go: go:
- 1.16.x # Latest go version - 1.16.x # Latest go version
env: env:
- azure-linux
- GO111MODULE=on - GO111MODULE=on
addons: addons:
apt: apt:
@ -12,8 +11,7 @@ addons:
- gcc-multilib - gcc-multilib
before_install: before_install:
# gox simplifies building for multiple architectures - # skip
- go get github.com/necrose99/gox
install: install:
- # skip - # skip
@ -23,7 +21,8 @@ script:
- diff -u <(echo -n) <(gofmt -d .) - diff -u <(echo -n) <(gofmt -d .)
- go vet $(go list ./... | grep -v /vendor/) - 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 - 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: deploy:
provider: releases provider: releases

View File

@ -10,14 +10,15 @@ IMAGE=h44z/wg-portal
all: dep build all: dep build
build: dep build: dep $(addsuffix -amd64,$(addprefix $(BUILDDIR)/,$(BINARIES)))
mkdir -p $(BUILDDIR) 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.service $(BUILDDIR)
cp scripts/wg-portal.env $(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: dep:
$(GOCMD) get github.com/necrose99/gox
$(GOCMD) mod download $(GOCMD) mod download
validate: dep 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 # On arch-linux install arm-linux-gnueabihf-gcc to crosscompile for arm
$(BUILDDIR)/%-arm: cmd/%/main.go dep phony $(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 $@ $< CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@ $<