mirror of
https://github.com/opencontainers/runc.git
synced 2026-06-30 19:58:25 +00:00
Because runc-dmz is not checked into Git, go get will end up creating a copy of libcontainer/dmz with no runc-dmz binary, which causes external libcontainer users to have compilation errors. Unfortunately, we cannot get go:embed to just ignore that there are no files matching the provided pattern, so instead we need to create a dummy file that matches the go:embed (which we check into Git and so go get _will_ copy) and switch to embed.FS. This is a little bit uglier, but at least it will fix external libcontainer users. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
20 lines
643 B
Makefile
20 lines
643 B
Makefile
# Get GO, GOARCH and CC values for cross-compilation.
|
|
include ../../cc_platform.mk
|
|
|
|
# List of GOARCH that nolibc supports, from:
|
|
# https://go.dev/doc/install/source#environment (with GOOS=linux)
|
|
#
|
|
# See nolibc supported arches in ./nolibc/arch-*.h
|
|
NOLIBC_GOARCHES := 386 amd64 arm arm64 loong64 ppc64le riscv64 s390x
|
|
|
|
ifneq (,$(filter $(GOARCH), $(NOLIBC_GOARCHES)))
|
|
# We use the flags suggested in nolibc/nolibc.h, it makes the binary very small.
|
|
CFLAGS += -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib -lgcc
|
|
else
|
|
CFLAGS += -DRUNC_USE_STDLIB
|
|
endif
|
|
|
|
binary/runc-dmz: _dmz.c
|
|
$(CC) $(CFLAGS) -static -o $@ $^
|
|
$(STRIP) -gs $@
|