mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
pass linkmode=external only for Linux
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
ef5e3fe3fe
commit
d091f90f81
8
Makefile
8
Makefile
@ -1,7 +1,7 @@
|
|||||||
VERSION="v0.8+"
|
VERSION="v0.8+"
|
||||||
GIT_COMMIT=$(shell git rev-list -1 HEAD)
|
GIT_COMMIT=$(shell git rev-list -1 HEAD)
|
||||||
|
|
||||||
GO_COMPILE=linuxkit/go-compile:ceff1817e4c670d253c7bd38da05daecaa513f5f
|
GO_COMPILE=linuxkit/go-compile:9f76f29606aec51f2f568984c4c6fe55da2dde10
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
LINUXKIT?=bin/linuxkit.exe
|
LINUXKIT?=bin/linuxkit.exe
|
||||||
@ -37,7 +37,7 @@ $(RTF): tmp_rtf_bin.tar | bin
|
|||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
tmp_rtf_bin.tar: Makefile
|
tmp_rtf_bin.tar: Makefile
|
||||||
docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION) -linkmode=external" -o $(RTF) > $@
|
docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION)" -o $(RTF) > $@
|
||||||
|
|
||||||
# Manifest tool for multi-arch images
|
# Manifest tool for multi-arch images
|
||||||
MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90
|
MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90
|
||||||
@ -48,7 +48,7 @@ bin/manifest-tool: tmp_mt_bin.tar | bin
|
|||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
tmp_mt_bin.tar: Makefile
|
tmp_mt_bin.tar: Makefile
|
||||||
docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/estesp/manifest-tool --clone $(MT_REPO) --commit $(MT_COMMIT) --package github.com/estesp/manifest-tool --ldflags "-X main.gitCommit=$(MT_COMMIT) -linkmode=external" -o bin/manifest-tool > $@
|
docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/estesp/manifest-tool --clone $(MT_REPO) --commit $(MT_COMMIT) --package github.com/estesp/manifest-tool --ldflags "-X main.gitCommit=$(MT_COMMIT)" -o bin/manifest-tool > $@
|
||||||
|
|
||||||
LINUXKIT_DEPS=$(wildcard src/cmd/linuxkit/*.go) $(wildcard src/cmd/linuxkit/*/*.go) Makefile
|
LINUXKIT_DEPS=$(wildcard src/cmd/linuxkit/*.go) $(wildcard src/cmd/linuxkit/*/*.go) Makefile
|
||||||
$(LINUXKIT): tmp_linuxkit_bin.tar
|
$(LINUXKIT): tmp_linuxkit_bin.tar
|
||||||
@ -57,7 +57,7 @@ $(LINUXKIT): tmp_linuxkit_bin.tar
|
|||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS)
|
tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS)
|
||||||
tar cf - -C src/cmd/linuxkit . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION) -linkmode=external" -o $(LINUXKIT) > $@
|
tar cf - -C src/cmd/linuxkit . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o $(LINUXKIT) > $@
|
||||||
|
|
||||||
.PHONY: test-cross
|
.PHONY: test-cross
|
||||||
test-cross:
|
test-cross:
|
||||||
|
@ -30,6 +30,6 @@ docker run -it --rm \
|
|||||||
-v $(pwd):/go/src/github.com/linuxkit/linuxkit \
|
-v $(pwd):/go/src/github.com/linuxkit/linuxkit \
|
||||||
-w /go/src/github.com/linuxkit/linuxkit/src/cmd/linuxkit \
|
-w /go/src/github.com/linuxkit/linuxkit/src/cmd/linuxkit \
|
||||||
--entrypoint=go
|
--entrypoint=go
|
||||||
linuxkit/go-compile:ceff1817e4c670d253c7bd38da05daecaa513f5f
|
linuxkit/go-compile:9f76f29606aec51f2f568984c4c6fe55da2dde10
|
||||||
mod vendor
|
mod vendor
|
||||||
```
|
```
|
||||||
|
@ -87,7 +87,7 @@ test -z $(GOOS=linux go vet $MOD_ARG -printf=false . 2>&1 | grep -v "^#" | grep
|
|||||||
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
|
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr)
|
||||||
|
|
||||||
>&2 echo "ineffassign..."
|
>&2 echo "ineffassign..."
|
||||||
test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec ineffassign {} \; | tee /dev/stderr)
|
test -z $(ineffassign ./... | tee /dev/stderr)
|
||||||
|
|
||||||
>&2 echo "go build..."
|
>&2 echo "go build..."
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ then
|
|||||||
go build $MOD_ARG -o $out -ldflags "${ldflags}" "$package"
|
go build $MOD_ARG -o $out -ldflags "${ldflags}" "$package"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
go build $MOD_ARG -o $out -buildmode pie -ldflags "-s -w ${ldflags} -extldflags \"-static\"" "$package"
|
go build $MOD_ARG -o $out -buildmode pie -ldflags "-linkmode=external -s -w ${ldflags} -extldflags \"-static-pie\"" "$package"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar cf - $out
|
tar cf - $out
|
||||||
|
Loading…
Reference in New Issue
Block a user