#!/usr/bin/make -f

export GOCACHE := /tmp/gocache
export GOPATH := /usr/share/gocode
export SECURITY_BUILD_OPTIONS = -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -z noexecstack -pie -fPIC -z now -ftrapv

SYSTYPE=$(shell grep Type= /etc/deepin-version|cut -d= -f 2)

depend_ostree = true

ifdef depend_ostree
	DistDepends += ostree,
endif

ifneq ($(DEB_BUILD_ARCH), mips64el)
    export GOBUILD_OPTIONS= -ldflags '-linkmode=external -extldflags "-Wl,-z,noexecstack,-z,relro,-z,now,-pie"'
    export GOBUILD_CGO_FLAGS= CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -ftrapv"
endif

%:
	dh $@

override_dh_install:
	dh_install --sourcedir=debian/tmp

ifeq ($(DEB_BUILD_ARCH), mipsel)
override_dh_auto_test:

endif

ifdef DistDepends
override_dh_gencontrol:
	dh_gencontrol -- -Vdist:Depends="$(DistDepends)"
endif

override_dh_installsystemd:
	dh_installsystemd -r --no-restart-after-upgrade --no-start
