Skip to content

Commit

Permalink
build: Disable CGO when building
Browse files Browse the repository at this point in the history
Statically linking libc to avoid `version `GLIBC_2.32' not found` issue.
  • Loading branch information
boris1993 committed Jun 4, 2023
1 parent ee2193c commit 38aacc8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ROOT_DIR:=$(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))../)
GO_ENV=CGO_ENABLED=0
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
Expand All @@ -20,19 +21,19 @@ test:
$(GOTEST) $(GOTEST_ARGS) $(ROOT_DIR)/internal/...

windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-windows-amd64/$(APP_NAME).exe $(ROOT_DIR)/cmd/dnsupdater/main.go
GOARCH=amd64 GOOS=windows $(GO_ENV) $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-windows-amd64/$(APP_NAME).exe $(ROOT_DIR)/cmd/dnsupdater/main.go
cp $(ROOT_DIR)/configs/config.yaml.template $(ROOT_DIR)/bin/$(APP_NAME)-windows-amd64/

darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-darwin-amd64/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
GOARCH=amd64 GOOS=darwin $(GO_ENV) $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-darwin-amd64/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
cp $(ROOT_DIR)/configs/config.yaml.template $(ROOT_DIR)/bin/$(APP_NAME)-darwin-amd64/

linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-linux-amd64/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
GOARCH=amd64 GOOS=linux $(GO_ENV) $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-linux-amd64/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
cp $(ROOT_DIR)/configs/config.yaml.template $(ROOT_DIR)/bin/$(APP_NAME)-linux-amd64/

mips-softfloat:
GOARCH=mips GOOS=linux GOMIPS=softfloat $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-linux-mips-softfloat/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
GOARCH=mips GOOS=linux GOMIPS=softfloat $(GO_ENV) $(GOBUILD) $(BUILD_ARGS) -o $(ROOT_DIR)/bin/$(APP_NAME)-linux-mips-softfloat/$(APP_NAME) $(ROOT_DIR)/cmd/dnsupdater/main.go
cp $(ROOT_DIR)/configs/config.yaml.template $(ROOT_DIR)/bin/$(APP_NAME)-linux-mips-softfloat/

.PHONY: clean
Expand Down

0 comments on commit 38aacc8

Please sign in to comment.