| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
include /usr/share/dpkg/default.mk |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
|
| 6 |
# Uncomment this to turn on verbose mode. |
| 7 |
# export DH_VERBOSE=1 |
| 8 |
|
| 9 |
ifeq (,$(filter $(DEB_HOST_ARCH), mips mipsel mips64el)) |
| 10 |
HARDENING := -buildmode=pie -ldflags="-extldflags -Wl,-z,now,-z,relro" |
| 11 |
endif |
| 12 |
|
| 13 |
%: |
| 14 |
dh $@ --builddirectory=_build --buildsystem=golang |
| 15 |
|
| 16 |
# Override dh_auto_configure to use installed source files (as opposed to the |
| 17 |
# ones in the source directory). |
| 18 |
# https://salsa.debian.org/go-team/packages/dh-golang/-/blob/ae5fd9e2937153ca1fff1b455a392b0b570d6a96/script/dh_golang_autopkgtest#L83 |
| 19 |
override_dh_auto_configure: |
| 20 |
dh_auto_configure |
| 21 |
# This step is necessary because the upstream distributes the library with |
| 22 |
# a folder structure that differs from the expected Go module path. |
| 23 |
# The Go module for this library is sigs.k8s.io/kustomize/kustomize/v5. |
| 24 |
# To align the folder structure with the expected module path, this step |
| 25 |
# renames the 'kustomize' folder to 'v5'. |
| 26 |
mv $(CURDIR)/_build/src/sigs.k8s.io/kustomize/kustomize/kustomize $(CURDIR)/_build/src/sigs.k8s.io/kustomize/kustomize/v5 |
| 27 |
|
| 28 |
override_dh_auto_build: |
| 29 |
dh_auto_build -O --buildsystem=golang -- $(HARDENING) |
| 30 |
|
| 31 |
execute_before_dh_auto_install: |
| 32 |
mv _build/bin/v5 _build/bin/kustomize |
| 33 |
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 34 |
mkdir -v -p $(CURDIR)/debian/completion |
| 35 |
_build/bin/kustomize completion bash > $(CURDIR)/debian/completion/kustomize.bash |
| 36 |
_build/bin/kustomize completion fish > $(CURDIR)/debian/completion/kustomize.fish |
| 37 |
_build/bin/kustomize completion zsh > $(CURDIR)/debian/completion/kustomize.zsh |
| 38 |
endif |
| 39 |
|
| 40 |
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES))) |
| 41 |
execute_before_dh_installman-arch: |
| 42 |
help2man debian/kustomize/usr/bin/kustomize \ |
| 43 |
--no-info --no-discard-stderr \ |
| 44 |
--version-string="$(DEB_VERSION_UPSTREAM)" \ |
| 45 |
-n "Customization of Kubernetes YAML configurations" > debian/kustomize.1 |
| 46 |
endif |