Skip to content

Commit 37f1747

Browse files
committed
Merge branch 'pr-914'
Closes #914
2 parents 99c683a + 54390f8 commit 37f1747

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ vendor/pkg
22
/runc
33
Godeps/_workspace/src/github.com/opencontainers/runc
44
man/man8
5+
release

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,44 @@ MAN_PAGES = $(shell ls $(MAN_DIR)/*.8)
2222
MAN_PAGES_BASE = $(notdir $(MAN_PAGES))
2323
MAN_INSTALL_PATH := ${PREFIX}/share/man/man8/
2424

25+
RELEASE_DIR := $(CURDIR)/release
26+
2527
VERSION := ${shell cat ./VERSION}
2628

29+
SHELL ?= $(shell command -v bash 2>/dev/null)
30+
2731
all: $(RUNC_LINK)
2832
go build -i -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o runc .
2933

3034
static: $(RUNC_LINK)
3135
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 .
3236

37+
release: $(RUNC_LINK)
38+
@flag_list=(seccomp selinux apparmor static); \
39+
unset expression; \
40+
for flag in "$${flag_list[@]}"; do \
41+
expression+="' '{'',$${flag}}"; \
42+
done; \
43+
eval profile_list=("$$expression"); \
44+
for profile in "$${profile_list[@]}"; do \
45+
output=${RELEASE_DIR}/runc; \
46+
for flag in $$profile; do \
47+
output+=."$$flag"; \
48+
done; \
49+
tags="$$profile"; \
50+
ldflags="-X main.gitCommit=${COMMIT} -X main.version=${VERSION}"; \
51+
CGO_ENABLED=; \
52+
[[ "$$profile" =~ static ]] && { \
53+
tags="$${tags/static/static_build}"; \
54+
tags+=" cgo"; \
55+
ldflags+=" -w -extldflags -static"; \
56+
CGO_ENABLED=1; \
57+
}; \
58+
echo "Building target: $$output"; \
59+
rm -rf "${GOPATH}/pkg"; \
60+
go build -i -ldflags "$$ldflags" -tags "$$tags" -o "$$output" .; \
61+
done
62+
3363
$(RUNC_LINK):
3464
ln -sfn $(CURDIR) $(RUNC_LINK)
3565

@@ -89,6 +119,7 @@ clean:
89119
rm -f runc
90120
rm -f $(RUNC_LINK)
91121
rm -rf $(GOPATH)/pkg
122+
rm -rf $(RELEASE_DIR)
92123

93124
validate:
94125
script/validate-gofmt

0 commit comments

Comments
 (0)