| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
export DH_GOLANG_EXCLUDES := \ |
| 8 |
$(addprefix /,$(addsuffix (/|$$),\ |
| 9 |
$(filter-out debian gopls,\ |
| 10 |
$(sort $(shell find * -name '*.go' | cut -d'/' -f1))\ |
| 11 |
))) \ |
| 12 |
gopls/api-diff \ |
| 13 |
gopls/doc \ |
| 14 |
gopls/integration/govim \ |
| 15 |
gopls/internal/coverage \ |
| 16 |
gopls/internal/analysis/unusedparams/cmd \ |
| 17 |
gopls/internal/protocol/generate \ |
| 18 |
gopls/internal/telemetry/cmd/stacks \ |
| 19 |
gopls/release \ |
| 20 |
|
| 21 |
|
| 22 |
export DH_GOLANG_EXCLUDES += \ |
| 23 |
gopls/internal/regtest |
| 24 |
|
| 25 |
|
| 26 |
export DH_GOLANG_INSTALL_EXTRA := \ |
| 27 |
gopls/go.sum \ |
| 28 |
gopls/internal/cmd/usage \ |
| 29 |
gopls/internal/doc/api.json \ |
| 30 |
gopls/internal/server/assets \ |
| 31 |
gopls/internal/golang/splitpkg/splitpkg.html.tmpl \ |
| 32 |
gopls/internal/mcp/instructions.md |
| 33 |
|
| 34 |
VERSION := $(shell dpkg-parsechangelog --show-field Version | sed -E 's/([0-9]+:)?([0-9.~pre]+).*/\2/') |
| 35 |
LDFLAGS := -ldflags '-X "main.version=v$(VERSION)"' |
| 36 |
|
| 37 |
execute_before_dh_auto_configure: |
| 38 |
|
| 39 |
|
| 40 |
mkdir -p _build |
| 41 |
cp -a debian/go/src _build/ |
| 42 |
|
| 43 |
ifdef AUTOPKGTEST_TMP |
| 44 |
ifeq ($(wildcard "$(AUTOPKGTEST_TMP)/_build/src/golang.org/x/tools/gopls),) |
| 45 |
execute_after_dh_auto_configure: |
| 46 |
@echo "[info] _build/src/golang.org/x/tools/gopls not found" |
| 47 |
@echo "[info] dh_golang_autopkgtest replaced gopls source with golang-golang-x-tools-dev" |
| 48 |
@echo "[info] Undoing dh_golang_autopkgtest's mistake" |
| 49 |
rm -rf _build |
| 50 |
mkdir _build |
| 51 |
cp -a debian/go/src _build/ |
| 52 |
dh_auto_configure -O--builddirectory=_build -O--buildsystem=golang |
| 53 |
endif |
| 54 |
endif |
| 55 |
|
| 56 |
override_dh_auto_build: |
| 57 |
dh_auto_build -- $(LDFLAGS) |
| 58 |
|
| 59 |
override_dh_auto_install: |
| 60 |
dh_auto_install -- --no-source |
| 61 |
|
| 62 |
override_dh_auto_test: |
| 63 |
ifeq (,$(findstring gccgo, $(shell go version))) |
| 64 |
|
| 65 |
|
| 66 |
dh_auto_test -- -short -timeout=30m |
| 67 |
endif |
| 68 |
|
| 69 |
%: |
| 70 |
dh $@ --builddirectory=_build --buildsystem=golang |