| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
export DH_GOLANG_INSTALL_EXTRA := \ |
| 4 |
common/buf/data \ |
| 5 |
|
| 6 |
include /usr/share/dpkg/default.mk |
| 7 |
|
| 8 |
# Build parameters are from upstream script: |
| 9 |
# - release/user-package.sh |
| 10 |
BUILDNAME = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +%Y%m%d-%H%M%S) |
| 11 |
LDFLAGS = -s -w -buildid= \ |
| 12 |
-X v2ray.com/core.codename=user \ |
| 13 |
-X v2ray.com/core.build=$(BUILDNAME) \ |
| 14 |
-X v2ray.com/core.version=$(shell echo $(DEB_VERSION_UPSTREAM)|sed -e 's/+[^+]*$$//') |
| 15 |
|
| 16 |
%: |
| 17 |
dh $@ --buildsystem=golang --with=golang |
| 18 |
|
| 19 |
# Regenerate protobuf (*.pb.go) files from *.proto |
| 20 |
override_dh_auto_configure: |
| 21 |
dh_auto_configure |
| 22 |
find obj-$(DEB_HOST_GNU_TYPE)/src/v2ray.com/core -type f -name '*.pb.go' \ |
| 23 |
-delete -printf 'Remove %p\n' |
| 24 |
cd obj-$(DEB_HOST_GNU_TYPE)/src; \ |
| 25 |
find v2ray.com/core -name '*.proto' -printf 'Regenerate %p\n' \ |
| 26 |
-exec protoc -I./v2ray.com/core --go_out=plugins=grpc:. {} \; |
| 27 |
|
| 28 |
override_dh_auto_build: |
| 29 |
DH_GOPKG="v2ray.com/core/main" dh_auto_build -- -ldflags "$(LDFLAGS)" |
| 30 |
cd obj-$(DEB_HOST_GNU_TYPE); mv bin/main bin/v2ray |
| 31 |
DH_GOPKG="v2ray.com/core/infra/control/main" dh_auto_build -- -ldflags "$(LDFLAGS)" -tags confonly |
| 32 |
cd obj-$(DEB_HOST_GNU_TYPE); mv bin/main bin/v2ctl |
| 33 |
|
| 34 |
override_dh_install: |
| 35 |
dh_install -X.pem |
| 36 |
|
| 37 |
ifeq ($(filter nocheck, $(DEB_BUILD_OPTIONS)),) |
| 38 |
override_dh_auto_test: |
| 39 |
ifneq ($(filter $(DEB_TARGET_ARCH), mips64el mipsel riscv64),) |
| 40 |
# Ignore failure on some slow systems |
| 41 |
-dh_auto_test -- -timeout 30m |
| 42 |
else |
| 43 |
dh_auto_test -- -timeout 30m |
| 44 |
endif |
| 45 |
endif |