#!/usr/bin/make -f

export DH_VERBOSE = 1
export GOCACHE=$(CURDIR)/_build
export GOPATH=$(CURDIR)/_build
export GOPROXY=off


%:
	dh $@ --builddirectory=_build --buildsystem=golang --with=bash-completion

override_dh_auto_install:
	dh_auto_install -- --no-source

	#generate completion files
	$(CURDIR)/debian/hubble/usr/bin/hubble completion bash >$(CURDIR)/debian/hubble.bash
	$(CURDIR)/debian/hubble/usr/bin/hubble completion zsh >$(CURDIR)/debian/_hubble

override_dh_dwz:

execute_before_dh_auto_test:
	cp cmd/observe_help.txt _build/src/github.com/cilium/hubble/cmd/observe_help.txt

override_dh_installdocs:
	dh_installdocs
	mkdir -p debian/hubble/usr/share/doc/hubble/grpc
	cp vendor/google.golang.org/grpc/NOTICE.txt debian/hubble/usr/share/doc/hubble/grpc
	mkdir -p debian/hubble/usr/share/doc/hubble/yaml.v2
	cp vendor/gopkg.in/yaml.v2/NOTICE debian/hubble/usr/share/doc/hubble/yaml.v2
	mkdir -p debian/hubble/usr/share/doc/hubble/yaml.v3
	cp vendor/gopkg.in/yaml.v3/NOTICE debian/hubble/usr/share/doc/hubble/yaml.v3
