-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
env -u
e.g. unsetting vars under OSX
- Loading branch information
Showing
1 changed file
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ GO_BUILD_INSTALL_DEPS=-i | |
GO_BUILD_TAGS='netgo unsafe' | ||
GO_BUILD_FLAGS=$(GO_BUILD_INSTALL_DEPS) -ldflags "-extldflags \"-static\" -X main.version=$(SCOPE_VERSION)" -tags $(GO_BUILD_TAGS) | ||
|
||
|
||
This comment has been minimized.
Sorry, something went wrong. |
||
all: $(SCOPE_EXPORT) | ||
|
||
$(DOCKER_DISTRIB): | ||
|
@@ -67,6 +68,15 @@ $(SCOPE_EXE) $(RUNSVINIT) lint tests shell prog/static.go: $(SCOPE_BACKEND_BUILD | |
|
||
else | ||
|
||
UNAME := $(shell uname) | ||
ifeq ($(UNAME), Darwin) | ||
UNSET_GOARCH_GOOS=unset GOARCH GOOS; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
UNSET_GOGC=unset GOGC; | ||
else | ||
UNSET_GOARCH_GOOS=env -u GOGC -u GOOS | ||
This comment has been minimized.
Sorry, something went wrong. |
||
UNSET_GOGC=env -u GOGC | ||
endif | ||
|
||
$(SCOPE_EXE): $(SCOPE_BACKEND_BUILD_UPTODATE) | ||
time $(GO) build $(GO_BUILD_FLAGS) -o $@ ./$(@D) | ||
@strings $@ | grep cgo_stub\\\.go >/dev/null || { \ | ||
|
@@ -79,12 +89,12 @@ $(SCOPE_EXE): $(SCOPE_BACKEND_BUILD_UPTODATE) | |
} | ||
|
||
%.codecgen.go: $(CODECGEN_EXE) | ||
rm -f $@ && env -u GOARCH -u GOOS $(GO) build -i -tags $(GO_BUILD_TAGS) ./$(@D) # workaround for https://github.com/ugorji/go/issues/145 | ||
cd $(@D) && env -u GOARCH -u GOOS $(GO_ENVS) $(shell pwd)/$(CODECGEN_EXE) -rt $(GO_BUILD_TAGS) -u -o $(@F) $(notdir $(call GET_CODECGEN_DEPS,$(@D))) | ||
rm -f $@ && $(UNSET_GOARCH_GOOS) $(GO) build -i -tags $(GO_BUILD_TAGS) ./$(@D) # workaround for https://github.com/ugorji/go/issues/145 | ||
cd $(@D) && $(UNSET_GOARCH_GOOS) $(GO_ENVS) $(shell pwd)/$(CODECGEN_EXE) -rt $(GO_BUILD_TAGS) -u -o $(@F) $(notdir $(call GET_CODECGEN_DEPS,$(@D))) | ||
|
||
$(CODECGEN_EXE): $(CODECGEN_DIR)/*.go | ||
mkdir -p $(@D) | ||
env -u GOARCH -u GOOS $(GO) build -i -tags $(GO_BUILD_TAGS) -o $@ ./$(CODECGEN_DIR) | ||
$(UNSET_GOARCH_GOOS) $(GO) build -i -tags $(GO_BUILD_TAGS) -o $@ ./$(CODECGEN_DIR) | ||
|
||
$(RUNSVINIT): $(SCOPE_BACKEND_BUILD_UPTODATE) | ||
time $(GO) build $(GO_BUILD_FLAGS) -o $@ ./$(@D) | ||
|
@@ -93,7 +103,7 @@ shell: $(SCOPE_BACKEND_BUILD_UPTODATE) | |
/bin/bash | ||
|
||
tests: $(SCOPE_BACKEND_BUILD_UPTODATE) | ||
env -u GOGC $(GO_ENVS) ./tools/test -no-go-get | ||
$(UNSET_GOGC) $(GO_ENVS) ./tools/test -no-go-get | ||
This comment has been minimized.
Sorry, something went wrong.
2opremio
Contributor
|
||
|
||
lint: $(SCOPE_BACKEND_BUILD_UPTODATE) | ||
./tools/lint . | ||
|
Extra space