File: rules

package info (click to toggle)
hplip 1.6.10-3etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 35,140 kB
  • ctags: 10,985
  • sloc: ansic: 48,004; cpp: 40,938; python: 29,973; xml: 14,675; sh: 9,841; perl: 4,257; makefile: 786
file content (348 lines) | stat: -rwxr-xr-x 11,028 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#!/usr/bin/make -f
# debian/rules for hplip
# GNU copyright 1997 to 1999 by Joey Hess.
# Copyright (c) 2003 Torsten Landschoff <torsten@debian.org>
# Copyright (c) 2004-2006 Henrique de Moraes Holschuh <hmh@debian.org>

PACKAGE=hplip
BASEPKG=hplip

# DPatch
DEB_SOURCE_PACKAGE:=$(PACKAGE)
include /usr/share/dpatch/dpatch.make

# DebHelper control
export DH_ALWAYS_EXCLUDE=CVS:.cvsignore
#export DH_VERBOSE=1

DBGPKG:=$(BASEPKG)-dbg
PKGTMP:=$(CURDIR)/debian/tmp
PPDDIR:=$(PKGTMP)/usr/share/ppd
CHANGELOG:=doc/release_notes.html

# Version information
# We cannot get the hpijs version like this because we could be generating
# it at runtime when we run autogen.sh
HPLIP_BINARY_VERSION?=$(shell dpkg-parsechangelog | grep -E "^Version:" | \
	tr -d ' \t' | cut -d ':' -f 2-)
ifeq	(,$(HPLIP_BINARY_VERSION))
	$(error Could not get debian package version from debian/changelog)
endif

HPLIP_VERSION:=$(shell echo "$(HPLIP_BINARY_VERSION)" | \
			sed -e 's/+b[0-9]\+$$//')
HPLIP_UPSTREAM_VERSION:=$(shell echo "$(HPLIP_VERSION)" | \
			  sed -e 's/-[^-]\+$$//')

# Autoconf
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CONFFLAGS =
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
else
  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

DEBUGFLAGS=-g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	DEBUGFLAGS += -O0
else
	DEBUGFLAGS += -O2
endif

CFLAGS:=-Wall -pipe $(DEBUGFLAGS)
CXXFLAGS:=$(CFLAGS)

##
##  Build-tree preparation
##

configure:
	dh_testdir
	chmod +x debian/autogen.sh
	debian/autogen.sh

debian/hpijs.version: configure
	@if test -r $@ ; then \
		touch $@ ; \
	else \
		echo "Cannot create debian/hpijs.version, please try running debian/autogen.sh manually" ; \
		exit 1 ; \
	fi

# Clean everything up, including everything auto-generated
# at build time that needs not to be kept around in the Debian diff
clean: clean-patched unpatch
clean-patched: configure debian/hpijs.version
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	rm -f install-stamp install-arch-stamp install-indep-stamp

	-$(MAKE) clean
	-$(MAKE) distclean
	find -type d -name autom4te.cache -print0 | xargs -0 -r rm -rf \;
	-rm -f prnt/hpijs/platform.h prnt/hpijs/auto-include.h
	find -type d -name build -print0 | xargs -0 -r rm -rf \;
	find \( -name config.sub -o -name config.guess \
			-o -name config.cache -o -name config.log \) -print0 \
		| xargs -0 -r rm -f \;

	# We prefer to regenerate these using pyuic
	(cd ui && for i in *.ui ; do rm -f $${i%.ui}.py ; done)

	dh_clean

##
##  Package build
##

configure-stamp: patch-stamp configure debian/hpijs.version
	dh_testdir

	ln -sf /usr/share/misc/config.sub .
	ln -sf /usr/share/misc/config.guess .
	rm -f config.cache

	./configure CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
		HPLIP_PPD_PATH=/usr/share/ppd \
		$(CONFFLAGS) \
	 	--config-cache \
		--disable-dependency-tracking \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--datadir=\$${prefix}/share \
		--libexecdir=\$${prefix}/lib \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--enable-debug \
		--without-icon \
		--disable-foomatic-install \
		--disable-cups-install \
		--enable-network-build \
		--enable-pp-build \
		--enable-scan-build \
		--enable-gui-build \
		--enable-fax-build

	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp
	dh_testdir

	$(MAKE)

	touch build-stamp

##
## Debian packaging
##

# common part of the install: Upstream makefiles, general stuff
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install "DESTDIR=$(PKGTMP)" docdir=/usr/share/doc

	# Remove files we are not to ship from the install tree
	@echo Removing non-shipped files, see debian/non-shipped-files.txt
	@cat debian/non-shipped-files.txt | \
		( cd "$(PKGTMP)" && xargs -d '\n' -t -r rm -fv )

	# Edit the generated hp.conf
	( cd "$(PKGTMP)/etc/hp" && \
	  sed -e 's#^doc=.*#doc=/usr/share/doc/hplip-doc/HTML#' \
	    < hplip.conf > hplip.conf.1 && \
	    mv -f hplip.conf.1 hplip.conf )

	# Lintian and linda overrides
	cd debian ; \
	for i in *.linda ; do \
	    [ -r "$$i" ] && { \
		mkdir -p "$${i%%.linda}/usr/share/linda/overrides" ;\
		install  -m 644 "$$i" "$${i%%.linda}/usr/share/linda/overrides/$${i%%.linda}" ;\
	    } ;\
	done ;\
	for i in *.lintian ; do \
	    [ -r "$$i" ] && { \
		mkdir -p "$${i%%.lintian}/usr/share/lintian/overrides" ;\
		install  -m 644 "$$i" "$${i%%.lintian}/usr/share/lintian/overrides/$${i%%.lintian}" ;\
	    } ;\
	done

	touch install-stamp

# install arch-dependent packages specific files
install-arch: install-arch-stamp
install-arch-stamp: install-stamp
	# Remove stray #! lines on python libraries, and fix permissions
	find "$(PKGTMP)/usr/lib/hplip" -maxdepth 1 -mindepth 1 -type d -print0 | \
		xargs -0 -r -i@ find @ -type f -name '*.py' | \
		while read -r i ; do \
			chmod a-x "$$i" && \
			sed < "$$i" > "$$i.tmp" -e '/^#!/ {1 d}' && \
			mv -f "$$i.tmp" "$$i" ; \
		done

	mkdir -p "$(PKGTMP)/usr/share/pixmaps"
	install -m 644 debian/*.xpm "$(PKGTMP)/usr/share/pixmaps"
	mkdir -p "$(PKGTMP)/usr/share/applications"
	install -m 644 debian/*.desktop "$(PKGTMP)/usr/share/applications"

	mkdir -p "$(PKGTMP)/etc/sane.d/dll.d"
	install -m 644 debian/$(BASEPKG).sane "$(PKGTMP)/etc/sane.d/dll.d/$(PACKAGE)"

	# Fax support: HPLIP upstream is changing their minds too fast to
	# trust their makefiles on this.
	[ -e "$(PKGTMP)/usr/lib/hplip/fax/hpfax" ] && \
	  mv -f "$(PKGTMP)/usr/lib/hplip/fax/hpfax" "$(PKGTMP)/usr/lib/cups/backend/"

	# Fax PPD, install to destdir directly
	mkdir -p "$(CURDIR)/debian/hpijs/usr/share/ppd/hpijs/HP"
	sed < "fax/ppd/HP-Fax-hplip.ppd" \
		-e '/^[*]NickName:/ s/" *$$/ - HPLIP $(HPLIP_UPSTREAM_VERSION)"/' \
		| gzip -9 \
		> "$(CURDIR)/debian/hpijs/usr/share/ppd/hpijs/HP/HP-Fax-hplip.ppd.gz"

	# Python update helper
	mkdir -p "$(PKGTMP)/usr/share/python/runtime.d/"
	install -m 755 debian/hplip.rtupdate "$(PKGTMP)/usr/share/python/runtime.d/"

	dh_install -a "--sourcedir=$(PKGTMP)" --list-missing >install-arch-stamp 2>&1 || \
		( echo "Last five lines of error log:" ; tail -n 5 install-arch-stamp ; exit 1 )

# install arch-independent packages specific files
install-indep: install-indep-stamp
install-indep-stamp: install-stamp
	# PPDs
	# 1. Append hplip identifier to the long nickname
	# 2. Install to basedir/<Manufacturer>/
	# 3. Normalize case of PPD file names
	# 4. Compress all PPDs
	# 
	# Fax PPD: shipped by arch-dep hpijs package
	find prnt/hpijs/ppd -type f -name '*-hpijs.ppd' | \
	while read -r i ; do \
		PPDSUITE="hpijs" ;\
		PPDVENDOR=$$(sed -r -n \
			-e '/^[*]Manufacturer/ { s/[^:]+:[[:blank:]]+"([^"]*)".*/\1/;s/[[:blank:]]//g;p }' \
			< "$$i" ) ;\
		mkdir -p "$(PPDDIR)/$${PPDSUITE}/$${PPDVENDOR}" ;\
		PPDFILE=$$(echo "$$i" | sed -r -e 's#.*/([^/]+)$$#\1#' \
			-e 's#(^|/)hp[-_]#HP-#i' \
			-e s/series/Series/i -e s/color/Color/i \
			-e s/office/Office/i -e s/business/Business/i \
			-e s/jet/Jet/i -e s/ink/Ink/i -e s/desk/Desk/i \
			-e s/smart/Smart/i -e s/photo/Photo/i -e s/psc/PSC/i \
			-e s/laser/Laser/i -e s/design/Design/i \
			-e s/mfp/MFP/i -e 's/[-_]hpijs/-hpijs/i' ) ;\
		sed < "$$i" -e '/^[*]NickName:/ s/" *$$/ - HPLIP $(HPLIP_UPSTREAM_VERSION)"/' \
			| gzip -9 \
			> "$(PPDDIR)/$${PPDSUITE}/$${PPDVENDOR}/$${PPDFILE}.gz" ;\
		chmod 644 "$(PPDDIR)/$${PPDSUITE}/$${PPDVENDOR}/$${PPDFILE}.gz" ;\
	done

	dh_install -i "--sourcedir=$(PKGTMP)" --list-missing >install-indep-stamp 2>&1 || \
		( echo "Last five lines of error log:" ; tail -n 5 install-indep-stamp ; exit 1 )

# Build architecture-independent packages
binary-indep: install-indep debian/hpijs.version
	dh_testdir -i
	dh_testroot
#	dh_installdebconf -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installmenu -i
#	dh_installlogrotate -i
#	dh_installemacsen -i
#	dh_installpam -i
#	dh_installmime -i
#	dh_installinit -i
#	dh_installcron -i
	dh_installman -i
#	dh_installinfo -i
	dh_installchangelogs -i $(CHANGELOG)
	dh_link -i
	dh_strip -i --dbg-package=$(DBGPKG)
	dh_compress -i
	dh_fixperms -i
#	dh_perl -i
#	dh_pysupport -i
#	dh_python -i /usr/lib/hplip
#	dh_makeshlibs -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -phpijs-ppds -- \
		-v"$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)" \
		-V"hplip:source:Version=$(HPLIP_VERSION)" \
		-V"hpijs:source:Version=$$(cat debian/hpijs.version)+$(HPLIP_VERSION)" \
		-V"hplip:Upstream-Version=$(HPLIP_UPSTREAM_VERSION)" \
		-V"hpijs:Upstream-Version=$$(cat debian/hpijs.version)" \
		-V"hplip:binary:Version=$(HPLIP_BINARY_VERSION)" \
		-V"hpijs:binary:Version=$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)"
	dh_gencontrol -i -Nhpijs-ppds -- \
		-V"hplip:source:Version=$(HPLIP_VERSION)" \
		-V"hpijs:source:Version=$$(cat debian/hpijs.version)+$(HPLIP_VERSION)" \
		-V"hplip:Upstream-Version=$(HPLIP_UPSTREAM_VERSION)" \
		-V"hpijs:Upstream-Version=$$(cat debian/hpijs.version)" \
		-V"hplip:binary:Version=$(HPLIP_BINARY_VERSION)" \
		-V"hpijs:binary:Version=$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)"
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent packages
binary-arch: install-arch debian/hpijs.version
	dh_testdir -a
	dh_testroot
#	dh_installdebconf -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
	dh_desktop -a
#	dh_installlogrotate -a
#	dh_installemacsen -a
#	dh_installpam -a
#	dh_installmime -a
#	dh_installcron -a
	dh_installman -a
#	dh_installinfo -a
	dh_installchangelogs -a $(CHANGELOG)
	dh_pysupport -a /usr/lib/hplip
	dh_python -a /usr/lib/hplip
	# must come after dh_pysupport and dh_python, or the postinst
	# ordering will be screwed up and break.
	dh_installinit -phplip --init-script=hplip -- defaults 19
#	dh_perl -a
	dh_link -a
	dh_strip -a --dbg-package=$(DBGPKG)
	dh_compress -a
	dh_fixperms -a
#	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -phpijs -- \
		-v"$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)" \
		-V"hplip:source:Version=$(HPLIP_VERSION)" \
		-V"hpijs:source:Version=$$(cat debian/hpijs.version)+$(HPLIP_VERSION)" \
		-V"hplip:Upstream-Version=$(HPLIP_UPSTREAM_VERSION)" \
		-V"hpijs:Upstream-Version=$$(cat debian/hpijs.version)" \
		-V"hplip:binary:Version=$(HPLIP_BINARY_VERSION)" \
		-V"hpijs:binary:Version=$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)"
	dh_gencontrol -a -Nhpijs -- \
		-V"hplip:source:Version=$(HPLIP_VERSION)" \
		-V"hpijs:source:Version=$$(cat debian/hpijs.version)+$(HPLIP_VERSION)" \
		-V"hplip:Upstream-Version=$(HPLIP_UPSTREAM_VERSION)" \
		-V"hpijs:Upstream-Version=$$(cat debian/hpijs.version)" \
		-V"hplip:binary:Version=$(HPLIP_BINARY_VERSION)" \
		-V"hpijs:binary:Version=$$(cat debian/hpijs.version)+$(HPLIP_BINARY_VERSION)"
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean clean-patched binary-indep binary-arch binary install install-arch install-indep