github.com/git-lfs/git-lfs@v2.5.2+incompatible/debian/rules (about)

     1  #!/usr/bin/make -f
     2  
     3  export DH_OPTIONS
     4  export GO15VENDOREXPERIMENT=1
     5  
     6  #dh_golang doesn't do this for you
     7  ifeq ($(DEB_HOST_ARCH), i386)
     8  	export GOARCH := 386
     9  else ifeq ($(DEB_HOST_ARCH), amd64)
    10  	export GOARCH := amd64
    11  else ifeq ($(DEB_HOST_ARCH), armhf)
    12  	export GOARCH := arm
    13  else ifeq ($(DEB_HOST_ARCH), arm64)
    14  	export GOARCH := arm64
    15  endif
    16  
    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
    20  export DH_GOLANG_EXCLUDES := test github.com/olekukonko/ts/* github.com/xeipuuv/* github.com/spf13/cobra/* github.com/kr/* github.com/pkg/errors github.com/alexbrainman/sspi/*
    21  export PATH := $(CURDIR)/$(BUILD_DIR)/bin:$(PATH)
    22  
    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
    25  
    26  %:
    27  	dh $@ --buildsystem=golang --with=golang
    28  
    29  override_dh_clean:
    30  	rm -f debian/debhelper.log
    31  	rm -rf man
    32  	dh_clean
    33  
    34  override_dh_auto_build:
    35  	cd ${BUILD_DIR}/src/github.com/git-lfs/git-lfs && go generate ./commands
    36  	dh_auto_build
    37  	#dh_golang doesn't do anything here in deb 8, and it's needed in both
    38  	if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_BUILD_GNU_TYPE)" ]; then\
    39  		cp -rf $(BUILD_DIR)/bin/*/* $(BUILD_DIR)/bin/; \
    40  		cp -rf $(BUILD_DIR)/pkg/*/* $(BUILD_DIR)/pkg/; \
    41  	fi
    42  	rm $(BUILD_DIR)/bin/script
    43  	rm $(BUILD_DIR)/bin/man
    44  	make man
    45  
    46  override_dh_strip:
    47  	# strip disabled as golang upstream doesn't support it and it makes go
    48  	# crash. See https://launchpad.net/bugs/1200255.
    49  
    50  override_dh_golang:
    51  	# The dh_golang is used to add the Built-using field to the deb.  This is only for reference.
    52  	# As of https://anonscm.debian.org/cgit/collab-maint/dh-golang.git/commit/script/dh_golang?id=7c3fbec6ea92294477fa8910264fe9bd823f21c3
    53  	# dh_golang errors out because the go compiler used was not installed via a package.  Therefore the step is skipped
    54  
    55  override_dh_auto_install:
    56  	mkdir -p debian/git-lfs/usr/bin
    57  	cp $(BUILD_DIR)/bin/git-lfs debian/git-lfs/usr/bin/
    58  
    59  override_dh_auto_test:
    60  	ln -s ../../../../../../commands/repos $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/commands/repos
    61  	ln -s ../../../../bin $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/bin
    62  	#dh_golang uses the wrong dir to test on. This tricks everything into being happy
    63  	DEB_BUILD_GNU_TYPE=$(DEB_HOST_GNU_TYPE) dh_auto_test
    64  	rm $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/commands/repos $(BUILD_DIR)/src/github.com/git-lfs/git-lfs/bin