From e3ab4d5c51136329c4d6db1ed7252004a9363f4c Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 30 Aug 2023 11:16:41 +0200 Subject: [PATCH] Build: disable CGO --- Makefile | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 347b9fbc1..85c06e18c 100644 --- a/Makefile +++ b/Makefile @@ -14,19 +14,11 @@ deps-go: build: build-frontend build-backend build-frontend: yarn build + build-backend: mage -v build:backend build-debug: - env GOOS=linux go build -gcflags="all=-N -l" -o ./dist/gpx_zabbix-plugin_linux_amd64 ./pkg - -# Build for specific platform -build-backend-windows: extension = .exe -build-backend-%-arm64: - $(eval filename = gpx_zabbix-plugin_$*_arm64$(extension)) - env GOOS=$* GOARCH=arm64 go build -o ./dist/$(filename) ./pkg -build-backend-%: - $(eval filename = gpx_zabbix-plugin_$*_amd64$(extension)) - env GOOS=$* GOARCH=amd64 go build -o ./dist/$(filename) ./pkg + mage -v build:debug run-frontend: yarn install --pure-lockfile @@ -42,21 +34,23 @@ dist: dist-frontend dist-backend dist-frontend: yarn build -dist-backend: dist-backend-linux dist-backend-darwin dist-backend-freebsd dist-backend-windows dist-arm +dist-backend: dist-backend-mage dist-backend-freebsd dist-arm-freebsd-arm64 +dist-backend-mage: + mage -v buildAll dist-backend-windows: extension = .exe dist-backend-%: $(eval filename = gpx_zabbix-plugin_$*_amd64$(extension)) - env GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg + env CGO_ENABLED=0 GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg # ARM dist-arm: dist-arm-linux-arm-v6 dist-arm-linux-arm64 dist-arm-darwin-arm64 dist-arm-freebsd-arm64 dist-arm-linux-arm-v6: - env GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg + env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg dist-arm-linux-arm-v7: - env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg + env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg dist-arm-%-arm64: $(eval filename = gpx_zabbix-plugin_$*_arm64$(extension)) - env GOOS=$* GOARCH=arm64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg + env CGO_ENABLED=0 GOOS=$* GOARCH=arm64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg .PHONY: test test: test-frontend test-backend