| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
include /usr/share/dpkg/default.mk |
| 4 |
|
| 5 |
PKG := github.com/etix/mirrorbits |
| 6 |
GO_LDFLAGS += -X $(PKG)/core.VERSION=v$(DEB_VERSION_UPSTREAM) |
| 7 |
GO_LDFLAGS += -X $(PKG)/core.BUILD=$(DEB_VERSION) |
| 8 |
GO_LDFLAGS += -X $(PKG)/config.TEMPLATES_PATH=/usr/share/mirrorbits/templates/ |
| 9 |
ifeq (,$(filter $(DEB_BUILD_ARCH), mipsel mips64el)) |
| 10 |
GO_BUILDFLAGS += -buildmode=pie |
| 11 |
endif |
| 12 |
|
| 13 |
%: |
| 14 |
dh $@ --builddirectory=_build --buildsystem=golang --with=bash-completion |
| 15 |
|
| 16 |
execute_after_dh_auto_configure: |
| 17 |
cd _build/src/$(PKG) && \ |
| 18 |
find -name "*.pb.go" -delete -printf "removed %p\n" && \ |
| 19 |
protoc -I rpc --go_opt=paths=source_relative --go_out=plugins=grpc:rpc rpc.proto |
| 20 |
|
| 21 |
override_dh_auto_build: |
| 22 |
dh_auto_build -- $(GO_BUILDFLAGS) -ldflags '$(GO_LDFLAGS)' |
| 23 |
|
| 24 |
override_dh_auto_test: |
| 25 |
dh_auto_test -- -ldflags '$(GO_LDFLAGS)' |
| 26 |
|
| 27 |
override_dh_auto_install: |
| 28 |
dh_auto_install -- --no-source |
| 29 |
# the below step is automatic with debhelper >= 14 |
| 30 |
dh_installsysusers |
| 31 |
|
| 32 |
override_dh_installsystemd: |
| 33 |
dh_installsystemd --no-enable --no-start |