File: rules

package info (click to toggle)
golang-v2ray-core 4.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,044 kB
  • sloc: sh: 404; makefile: 52; asm: 38
file content (47 lines) | stat: -rwxr-xr-x 1,524 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
#!/usr/bin/make -f

export DH_GOLANG_INSTALL_EXTRA := \
	common/buf/data \
	release/config/geoip.dat \
	release/config/geosite.dat

include /usr/share/dpkg/default.mk

# Build parameters are from upstream script:
# - release/user-package.sh
BUILDNAME = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +%Y%m%d-%H%M%S)
LDFLAGS = -s -w -buildid= \
	-X v2ray.com/core.codename=user \
	-X v2ray.com/core.build=$(BUILDNAME) \
	-X v2ray.com/core.version=$(shell echo $(DEB_VERSION_UPSTREAM)|sed -e 's/+[^+]*$$//')

%:
	dh $@ --buildsystem=golang --with=golang

# Regenerate protobuf (*.pb.go) files from *.proto
override_dh_auto_configure:
	dh_auto_configure
	find obj-$(DEB_HOST_GNU_TYPE)/src/v2ray.com/core -type f -name '*.pb.go' \
		-delete -printf 'Remove %p\n'
	cd obj-$(DEB_HOST_GNU_TYPE)/src; \
	find v2ray.com/core -name '*.proto' -printf 'Regenerate %p\n' \
		-exec protoc -I./v2ray.com/core --go_out=plugins=grpc:. {} \;

override_dh_auto_build:
	DH_GOPKG="v2ray.com/core/main" dh_auto_build -- -ldflags "$(LDFLAGS)"
	cd obj-$(DEB_HOST_GNU_TYPE); mv bin/main bin/v2ray
	DH_GOPKG="v2ray.com/core/infra/control/main" dh_auto_build -- -ldflags "$(LDFLAGS)" -tags confonly
	cd obj-$(DEB_HOST_GNU_TYPE); mv bin/main bin/v2ctl

override_dh_install:
	dh_install -X.pem

ifeq ($(filter nocheck, $(DEB_BUILD_OPTIONS)),)
override_dh_auto_test:
ifneq ($(filter $(DEB_TARGET_ARCH), armel armhf mips64el mipsel riscv64),)
# Ignore failure on some slow systems
	-dh_auto_test -- -timeout 30m
else
	dh_auto_test -- -timeout 30m
endif
endif