summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 42627c27b1989c7a6d230385f4507cd3e3d03d5e (plain)
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
#!/usr/bin/make -f
# rules to package gutenprint
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Use dpatch.
include /usr/share/quilt/quilt.make

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

update-patch-series:
	mkdir -p $(CURDIR)/debian/patches
	rm -f $(CURDIR)/debian/patches/*.patch
	git format-patch -o $(CURDIR)/debian/patches patches ^upstream | \
	  xargs -n 1 basename > $(CURDIR)/debian/patches/series
	for patch in $$(ls $(CURDIR)/debian/patches/*.patch); do \
	  lines=$$(cat $$patch | wc -l); \
	  head -n $$(($$lines - 3)) $$patch > $${patch}.chomped; \
	  mv $${patch}.chomped $$patch; \
	done

autoconfigure: autoconfigure-stamp
autoconfigure-stamp: debian/control
	[ -r scripts/config.sub.orig ] || \
	  cp -f scripts/config.sub scripts/config.sub.orig
	[ -r scripts/config.guess.orig ] || \
	  cp -f scripts/config.guess scripts/config.guess.orig

	[ ! -r /usr/share/misc/config.sub ] || \
	  cp -f /usr/share/misc/config.sub scripts/config.sub
	[ ! -r /usr/share/misc/config.guess ] || \
	  cp -f /usr/share/misc/config.guess scripts/config.guess

	dh_testdir
	mkdir debian/build; \
	cd debian/build; \
	../../configure --host=$(DEB_HOST_GNU_TYPE) \
	  --build=$(DEB_BUILD_GNU_TYPE) \
	  --prefix=/usr --mandir=\$${prefix}/share/man \
	  --disable-static --enable-shared --disable-rpath --disable-static-genppd \
	  --with-modules=dlopen \
	  --enable-libgutenprintui2 --with-gimp2 \
	  --with-cups --enable-cups-level3-ppds --enable-globalized-cups-ppds \
	  --with-ijs --with-foomatic --with-foomatic3 \
	  --disable-test
	touch autoconfigure-stamp


build: build-stamp debian/control
build-stamp: patch autoconfigure-stamp
	dh_testdir

	cd debian/build; \
	$(MAKE)

	touch build-stamp

clean: realclean unpatch
realclean: debian/control
	dh_testdir

	rm -rf debian/build debian/install

	[ ! -f Makefile ] || $(MAKE) distclean

	[ ! -r scripts/config.guess.orig ] || \
	  mv -f scripts/config.guess.orig scripts/config.guess || :
	[ ! -r scripts/config.sub.orig ] || \
	  mv -f scripts/config.sub.orig scripts/config.sub || :

	dh_clean

install: DH_OPTIONS=
install: build debian/control
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	cd debian/build; \
	$(MAKE) DESTDIR=$(CURDIR)/debian/install install

	dh_install


# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installchangelogs -i NEWS
	dh_link -i
	dh_compress -i -X.pdf -X.odt
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	  cp src/cups/README debian/cups-driver-gutenprint/usr/share/doc/cups-driver-gutenprint/README.cups
	  mv debian/ijsgutenprint/usr/share/man/man1/ijsgutenprint.1 debian/ijsgutenprint/usr/share/man/man1/ijsgutenprint.5.2.1
	  ln -s ijsgutenprint.5.2.1.gz debian/ijsgutenprint/usr/share/man/man1/ijsgutenprint.1.gz
	  ln -s ijsgutenprint.5.2 debian/ijsgutenprint/usr/bin/ijsgutenprint
	dh_installexamples -a
	dh_installchangelogs -a NEWS
	dh_strip -a
	dh_link -a
	dh_compress -a -X.pdf -X.odt
	dh_fixperms -a
# Strip DT_RPATH from CUPS binaries.
	find debian/cups-driver-gutenprint/usr/lib -type f -perm +0111 -print0 | xargs -0 chrpath --delete
	dh_makeshlibs -a -V -X usr/lib/gutenprint
	dh_installdeb -a
	dh_shlibdeps -a -X usr/lib/gutenprint -l$(CURDIR)/debian/libgutenprint2/usr/lib:$(CURDIR)/debian/libgutenprintui2-1/usr/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install autoconfigure patch unpatch update-patch-series