more idiomatic go build time variable setting
avoiding the use of 'sed'
This commit is contained in:
1 parent
7c8586b576
commit
d31a4ea331
2 files changed
+3
-4
No files matched your search
@@ -4,6 +4,7 @@
|
||||
# If you can use docker without being root, you can do "make SUDO="
|
||||
SUDO=sudo
|
||||
|
||||
WEAVE_VERSION=git-$(shell git rev-parse --short=12 HEAD)
|
||||
WEAVER_EXE=weaver/weaver
|
||||
WEAVEDNS_EXE=weavedns/weavedns
|
||||
WEAVER_IMAGE=zettio/weave
|
||||
@@ -15,7 +16,7 @@ all: $(WEAVER_EXPORT) $(WEAVEDNS_EXPORT)
|
||||
|
||||
$(WEAVER_EXE) $(WEAVEDNS_EXE):
|
||||
go get -tags netgo ./$(shell dirname $@)
|
||||
go build -ldflags '-extldflags "-static"' -tags netgo -o $@ ./$(shell dirname $@)
|
||||
go build -ldflags '-extldflags "-static"' -ldflags "-X main.version $(WEAVE_VERSION)" -tags netgo -o $@ ./$(shell dirname $@)
|
||||
@strings $@ | grep cgo_stub\\\.go >/dev/null || { \
|
||||
rm $@; \
|
||||
echo "\nYour go standard library was built without the 'netgo' build tag."; \
|
||||
|
||||
+1
-3
@@ -47,11 +47,9 @@ build() {
|
||||
|
||||
## Inject the version numbers and build the distributables
|
||||
## (library versions?)
|
||||
|
||||
sed -i "/var version = / c\var version = \"$VERSION\"" weaver/main.go
|
||||
sed -i "/var version = / c\var version = \"$VERSION\"" weavedns/main.go
|
||||
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
|
||||
make \
|
||||
WEAVE_VERSION=$VERSION \
|
||||
WEAVER_IMAGE=$DOCKERHUB_USER/weave \
|
||||
WEAVEDNS_IMAGE=$DOCKERHUB_USER/weavedns
|
||||
|
||||
|
||||
Reference in new issue
Block a user