File: rules

package info (click to toggle)
golang-gvisor-gvisor 0.0~20221219.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-proposed-updates
  • size: 17,136 kB
  • sloc: asm: 2,860; cpp: 348; python: 89; sh: 40; makefile: 34; ansic: 21
file content (50 lines) | stat: -rwxr-xr-x 1,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

# shim code is not compatible with containerd/1.15
# https://github.com/google/gvisor/issues/6449
export DH_GOLANG_EXCLUDES := tools webhook shim

GO_PKG     = gvisor.dev/gvisor
GO_LDFLAGS = -X main.version=$(DEB_VERSION_UPSTREAM)
VDSO       = _build/src/$(GO_PKG)/pkg/sentry/loader/vdsodata/vdso.so
BPF_OBJ    = _build/src/$(GO_PKG)/runsc/sandbox/bpf/af_xdp_ebpf.o

%:
	dh $@ --builddirectory=_build --buildsystem=golang

$(VDSO): vdso/*.cc vdso/*.h vdso/*.lds vdso/*.py
	# sync with vdso/BUILD bazel rules
	$(CC) $(CC_FLAGS) \
		-I. \
		-O2 \
		-std=c++11 \
		-fPIC \
		-fno-sanitize=all \
		-fno-stack-protector \
		-shared \
		-nostdlib \
		-Wl,-soname=linux-vdso.so.1 \
		-Wl,--hash-style=sysv \
		-Wl,--no-undefined -Wl,-Bsymbolic \
		-Wl,-z,max-page-size=4096 \
		-Wl,-z,common-page-size=4096 \
		-Wl,-Tvdso/vdso_$(DEB_HOST_ARCH).lds \
		-o $@ \
		vdso/vdso.cc vdso/vdso_time.cc
	python3 ./vdso/check_vdso.py --check-data --vdso=$@

$(BPF_OBJ): runsc/sandbox/bpf/af_xdp.ebpf.c
	# sync with tools/bazeldefs/defs.bzl bpf_program
	clang -O2 -Wall -Werror -target bpf -c $< -o $@ -I/usr/include/$(DEB_HOST_GNU_TYPE)

override_dh_auto_build: $(VDSO) $(BPF_OBJ)
	# runsc needs to be static linked
	CGO_ENABLED=0 dh_auto_build -- -ldflags "$(GO_LDFLAGS)"

execute_before_dh_auto_install:
	# replace it with dummy file, so -dev package doesn't have arch dependent file.
	# no other packages will import pkg/sentry/loader.
	echo > $(VDSO)
	echo > $(BPF_OBJ)