File: rules

package info (click to toggle)
graphicsmagick 1.4%2Breally1.3.45%2Bhg17696-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 49,092 kB
  • sloc: ansic: 249,519; cpp: 18,805; sh: 8,000; perl: 3,634; makefile: 2,567; tcl: 2,209; python: 1,250
file content (251 lines) | stat: -rwxr-xr-x 7,862 bytes parent folder | download
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
#!/usr/bin/make -f
# -*- makefile -*-

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

export DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
export DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
        gm_confflags += --build $(DEB_HOST_GNU_TYPE)
else
	gm_confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

ARCHS_CHECK_NOFAIL:=hppa sparc
ifneq (,$(findstring $(DEB_BUILD_ARCH),$(ARCHS_CHECK_NOFAIL)))
CHECK_FAILED_ACTION:=echo "Ignoring testsuite failures on this architecture"
else
CHECK_FAILED_ACTION:= { \
		echo "Aborting build due to testsuite failures"; \
		if test -e test-suite.log; then \
			echo "==== test-suite.log ===="; \
			cat test-suite.log; \
			echo "==== end of test-suite.log ===="; \
		fi; \
		/bin/false; \
	}
endif

# on i386, with glibc-2.18, the linker hangs on i386
# $ cat test.c
# int main(){return(0);}
# $ gcc -fPIE -pie -static test.c
# *** Error in `/usr/bin/ld': corrupted double-linked list: 0x09da0260 ***
# <linker hangs>
ifneq (,$(filter $(DEB_HOST_ARCH),i386))
  DEB_BUILD_HARDENING_PIE:=0
endif

DEB_BUILD_MAINT_OPTIONS := hardening=+all
DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/buildflags.mk

PACKAGENAME=graphicsmagick

configure: configure-stamp
configure-stamp:
	dh_testdir
	dh_autoreconf
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
	MVDelegate=/bin/mv \
	    ./configure $(gm_confflags) \
		--enable-shared \
		--enable-static \
		--enable-libtool-verbose \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--docdir=\$${prefix}/share/doc/graphicsmagick \
		--with-gs-font-dir=/usr/share/fonts/type1/gsfonts \
		--with-x \
		--without-dps \
		--without-modules \
		--without-frozenpaths \
		--with-webp=yes \
		--with-zstd=yes \
		--with-perl \
		--with-perl-options="INSTALLDIRS=vendor" \
		--enable-quantum-library-names \
		--with-quantum-depth=16

	touch configure-stamp

build: build-arch build-indep

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

	# Teach Perl binding to build without an installed library.
	# Also, we need to prune several of the security options we
	# added above:
	# * The compiler chokes on Perl's standard macro MEM_WRAP_CHECK()
	#   if -Werror=format-security is set.
	# * The Perl Makefile generator ignores linker flags it doesn't
	#   grok (ie. -pie -z relro). Hence, we need to strip -fPIE from
	#   CCFLAGS as well, or the linker would barf about non-PIC symbols.
	test -e PerlMagick/Makefile.PL.debsave || sed -i -e \
	 "/LIBS/s|\(-L[[:space:]]*\)[^[:space:]]\+|\1$(CURDIR)/magick/.libs|" \
	 -e "s/-Werror=format-security/-Wformat-security/g" \
	 -e "s/-fPIE//g" \
	 -e "s/-pie//g" \
	 PerlMagick/Makefile.PL

	$(MAKE)
	# Perl is built separately. Make sure to override the stupid
	# rpath picked up from the LIBS hack above.
	$(MAKE) perl-build LD_RUN_PATH=

	touch build-arch-stamp

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

	pod2man debian/Magick.pm > 'debian/Image::Magick.3pm'

	touch build-indep-stamp

check: check-stamp
check-stamp: build-arch-stamp
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_testdir

	# Cannot patch a binary file, so do take a detour via uudecode...
	for i in `cd "$(CURDIR)/debian/reference-new"; find -name "*.uu"`; do \
		new="$(CURDIR)/debian/reference-new/$$i"; \
		orig="$${i%.uu}"; \
		save="$(CURDIR)/debian/reference-orig/$${orig}"; \
		test -f "$${orig}" || continue; \
		test ! -f "$${save}" || continue; \
		mkdir -p "`dirname $${save}`" && \
		mv "$${orig}" "$${save}" && \
		uudecode -o "$${orig}" "$${new}"; \
	done

	# FIXME Something's confusing libtool, so its wrappers don't do the
	#       library path magic they are supposed to do. I haven't found
	#       out what's wrong yet, so let's work around the problem here
	#       with a manual override to LD_LIBRARY_PATH.
	# XXX make check insists on rebuilding the Perl plugin, so we have
	#     to override LD_RUN_PATH once more. (NB: We cannot just build
	#     the plugin once here because make check is not called when
	#     cross-compiling.)
	# XXX Unset DISPLAY to make sure the PerlMagick X regression test
	#     does not pick up a stray and possibly unauthenticated entry.
	@if test "$(DEB_HOST_GNU_TYPE)" = "$(DEB_BUILD_GNU_TYPE)"; then \
		unset DISPLAY; \
		LD_LIBRARY_PATH="$(CURDIR)/magick/.libs:$(CURDIR)/wand/.libs:$(CURDIR)/Magick++/lib/.libs:$$LD_LIBRARY_PATH" \
		$(MAKE) check check-perl LD_RUN_PATH= || \
		        $(CHECK_FAILED_ACTION); \
	else \
		echo "Skipping regression tests because we appear to be cross-compiling"; \
	fi
endif
	touch check-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-arch-stamp build-indep-stamp check-stamp

	test ! -f Makefile || $(MAKE) distclean distclean-perl
	rm -f $(CURDIR)/PerlMagick/Makefile.PL

	rm -f 'debian/Image::Magick.3pm'

	# Clean up after 'patching' miff binaries.
	test ! -d "$(CURDIR)/debian/reference-orig" || \
	for i in `cd "$(CURDIR)/debian/reference-orig"; find -type f`; do \
		orig="$${i}"; \
		save="$(CURDIR)/debian/reference-orig/$$i"; \
		mv "$${save}" "$${orig}"; \
	done && rm -rf "$(CURDIR)/debian/reference-orig"
	rm -f config.log

	dh_autoreconf_clean
	dh_clean

install: build install-indep install-arch
install-indep:
	dh_testdir
	dh_testroot
	
	dh_prep -i

	dh_install -i

install-arch:
	dh_testdir
	dh_testroot
	
	dh_prep -a

	# pkgdocdir is hardwired in configure.ac and can only be overridden
	# here.
	$(DEB_GAIN_ROOT_CMD) $(MAKE) install install-exec-perl \
		DESTDIR=$(CURDIR)/debian/tmp \
		pkgdocdir=/usr/share/doc/$(PACKAGENAME)

	# Push dependency libs to new .private entry.
	grep -q '^Libs.private:' \
		debian/tmp/usr/lib/pkgconfig/GraphicsMagick.pc || \
	  sed -e '/^Libs:/s|-L/usr/lib\(/X11\)\? ||g' \
	      -e '/^Libs:/s|\(-lGraphicsMagick\) \(.*\)|\1\nLibs.private: -L/usr/lib/X11 \2|' \
	      -i debian/tmp/usr/lib/pkgconfig/GraphicsMagick.pc

binary-indep: build-indep install-indep
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -i
	dh_installman -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build-arch check install-arch
	dh_testdir
	dh_testroot
	dh_installdirs -a
	mv debian/tmp/usr/share/doc/graphicsmagick/www/api* \
	   debian/libgraphicsmagick1-dev/usr/share/doc/libgraphicsmagick1-dev/www
	mv debian/tmp/usr/share/doc/graphicsmagick/www/Magick++/ \
	   debian/libgraphicsmagick++1-dev/usr/share/doc/libgraphicsmagick++1-dev/www
	sed -e 's|\(HREF="\)\(Magick++/\)|\1../../libgraphicsmagick++1-dev/www/\2|' \
	    -e 's|\(HREF="\)\(api.html\)|\1../../libgraphicsmagick1-dev/www/\2|' \
	    -i debian/tmp/usr/share/doc/graphicsmagick/www/programming.html
	dh_install -a --sourcedir=debian/tmp
	dh_missing -a --list-missing
	dh_installchangelogs -a ChangeLog
	dh_installdocs -a
	dh_installman -a
	dh_installexamples -a
	dh_installmenu -p graphicsmagick
	dh_installmime -p graphicsmagick
	dh_link -a
	dh_strip -a --dbg-package=graphicsmagick-dbg
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -Nlibgraphicsmagick++-q16-12t64
	dh_makeshlibs -plibgraphicsmagick++-q16-12t64 \
		-V'libgraphicsmagick++-q16-12t64 (>= 1.3.26-5~)'
	dh_installdeb -a
	dh_perl -p libgraphics-magick-perl
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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