Merge branch 'pr-914'

Closes #914
This commit is contained in:
Aleksa Sarai 2016-09-10 17:24:16 +10:00
commit 37f1747aec
No known key found for this signature in database
GPG Key ID: 9E18AA267DDB8DB4
2 changed files with 32 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ vendor/pkg
/runc
Godeps/_workspace/src/github.com/opencontainers/runc
man/man8
release

View File

@ -22,14 +22,44 @@ MAN_PAGES = $(shell ls $(MAN_DIR)/*.8)
MAN_PAGES_BASE = $(notdir $(MAN_PAGES))
MAN_INSTALL_PATH := ${PREFIX}/share/man/man8/
RELEASE_DIR := $(CURDIR)/release
VERSION := ${shell cat ./VERSION}
SHELL ?= $(shell command -v bash 2>/dev/null)
all: $(RUNC_LINK)
go build -i -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o runc .
static: $(RUNC_LINK)
CGO_ENABLED=1 go build -i -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -o runc .
release: $(RUNC_LINK)
@flag_list=(seccomp selinux apparmor static); \
unset expression; \
for flag in "$${flag_list[@]}"; do \
expression+="' '{'',$${flag}}"; \
done; \
eval profile_list=("$$expression"); \
for profile in "$${profile_list[@]}"; do \
output=${RELEASE_DIR}/runc; \
for flag in $$profile; do \
output+=."$$flag"; \
done; \
tags="$$profile"; \
ldflags="-X main.gitCommit=${COMMIT} -X main.version=${VERSION}"; \
CGO_ENABLED=; \
[[ "$$profile" =~ static ]] && { \
tags="$${tags/static/static_build}"; \
tags+=" cgo"; \
ldflags+=" -w -extldflags -static"; \
CGO_ENABLED=1; \
}; \
echo "Building target: $$output"; \
rm -rf "${GOPATH}/pkg"; \
go build -i -ldflags "$$ldflags" -tags "$$tags" -o "$$output" .; \
done
$(RUNC_LINK):
ln -sfn $(CURDIR) $(RUNC_LINK)
@ -89,6 +119,7 @@ clean:
rm -f runc
rm -f $(RUNC_LINK)
rm -rf $(GOPATH)/pkg
rm -rf $(RELEASE_DIR)
validate:
script/validate-gofmt