File: rules

package info (click to toggle)
kpcli 3.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 296 kB
  • sloc: perl: 4,102; makefile: 32
file content (48 lines) | stat: -rwxr-xr-x 1,635 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This makes no difference for usual debian/rules invokations, but the
# get-orig-source target might be called from any directory by policy.
PACKAGE_ROOT := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
PACKAGE_ROOT := $(realpath $(PACKAGE_ROOT)/..)
VERSION := $(shell cd $(PACKAGE_ROOT) && dpkg-parsechangelog | perl -ne 'print $$1 if m/Version:\s*([\d\.]+)-\d+/')

%:
	dh $@


override_dh_install:
	@echo "Detected upstream package version $(VERSION)"
	install -m 0755 --owner root --group root -T kpcli-$(VERSION).pl debian/kpcli/usr/bin/kpcli

override_dh_installman:
	pod2man --name KPCLI kpcli-$(VERSION).pl debian/kpcli.1
	dh_installman

override_dh_installchangelogs:
	# changelog is in upstream README
	# README itself is the same as the manpage
	dh_installchangelogs README

get-orig-source:
	[ -n "$(VERSION)" ] || exit 1
	set -e && (									\
		CURDIR=`pwd` ;								\
		TEMPDIR=`mktemp -d` ;							\
		BUILDDIR="build/" ;							\
		mkdir "$${TEMPDIR}/$${BUILDDIR}" ;					\
		cd $${TEMPDIR}/$${BUILDDIR} ;						\
		wget http://qa.debian.org/watch/sf.php/kpcli/README ;			\
		wget http://qa.debian.org/watch/sf.php/kpcli/kpcli-$(VERSION).pl ;	\
		echo "Generating kpcli_$(VERSION).orig.tar.gz" ;			\
		tar zcfv ../kpcli_$(VERSION).orig.tar.gz . ;				\
		if [ -f "$${CURDIR}/kpcli_$(VERSION).orig.tar.gz" ] ; then		\
		echo "Not overwriting $(VERSION).orig.tar.gz: already exists in ." ; 	\
		else									\
		mv $${TEMPDIR}/kpcli_$(VERSION).orig.tar.gz $${CURDIR} ;		\
		fi ;									\
		rm -rf $$TEMPDIR							\
		)