4 export GO15VENDOREXPERIMENT=1
6 #dh_golang doesn't do this for you
7 ifeq ($(DEB_HOST_ARCH), i386)
9 else ifeq ($(DEB_HOST_ARCH), amd64)
10 export GOARCH := amd64
11 else ifeq ($(DEB_HOST_ARCH), armhf)
13 else ifeq ($(DEB_HOST_ARCH), arm64)
14 export GOARCH := arm64
17 BUILD_DIR := obj-$(DEB_HOST_GNU_TYPE)
18 export DH_GOPKG := github.com/git-lfs/git-lfs
19 # DH_GOLANG_EXCLUDES typically incorporates vendor exclusions from script/test
20 export DH_GOLANG_EXCLUDES := test github.com/olekukonko/ts/* github.com/xeipuuv/* github.com/spf13/cobra/* github.com/kr/* github.com/pkg/errors
21 export PATH := $(CURDIR)/$(BUILD_DIR)/bin:$(PATH)
23 # by-default, dh_golang only copies *.go and other source - this upsets a bunch of vendor test routines
24 export DH_GOLANG_INSTALL_ALL := 1
27 dh $@ --buildsystem=golang --with=golang
30 rm -f debian/debhelper.log
34 override_dh_auto_build:
36 #dh_golang doesn't do anything here in deb 8, and it's needed in both
37 if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_BUILD_GNU_TYPE)" ]; then\
38 cp -rf $(BUILD_DIR)/bin/*/* $(BUILD_DIR)/bin/; \
39 cp -rf $(BUILD_DIR)/pkg/*/* $(BUILD_DIR)/pkg/; \
41 rm $(BUILD_DIR)/bin/script
42 rm $(BUILD_DIR)/bin/man
46 # strip disabled as golang upstream doesn't support it and it makes go
47 # crash. See https://launchpad.net/bugs/1200255.
50 # The dh_golang is used to add the Built-using field to the deb. This is only for reference.
51 # As of https://anonscm.debian.org/cgit/collab-maint/dh-golang.git/commit/script/dh_golang?id=7c3fbec6ea92294477fa8910264fe9bd823f21c3
52 # dh_golang errors out because the go compiler used was not installed via a package. Therefore the step is skipped
54 override_dh_auto_install:
55 mkdir -p debian/git-lfs/usr/bin
56 cp $(BUILD_DIR)/bin/git-lfs debian/git-lfs/usr/bin/
58 override_dh_auto_test:
59 ln -s ../../../../../../commands/repos $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/commands/repos
60 ln -s ../../../../bin $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/bin
61 #dh_golang uses the wrong dir to test on. This tricks everything into being happy
62 DEB_BUILD_GNU_TYPE=$(DEB_HOST_GNU_TYPE) dh_auto_test
63 rm $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/commands/repos $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/bin