File: rules

package info (click to toggle)
zlib 1%3A1.2.11.dfsg-2
  • links: PTS
  • area: main
  • in suites: bullseye, bullseye-backports
  • size: 1,856 kB
  • sloc: ansic: 17,063; sh: 983; makefile: 575; pascal: 115; perl: 104; xml: 95
file content (219 lines) | stat: -rwxr-xr-x 6,204 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
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

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

CFLAGS = `dpkg-buildflags --get CFLAGS` `dpkg-buildflags --get CPPFLAGS` -Wall -D_REENTRANT
LDFLAGS = `dpkg-buildflags --get LDFLAGS`

# binutils doesn't supply the prefixed version normally like GCC does so
# we can't just unconditionally use DEB_HOST_GNU_TYPE-ar
ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
	AR=ar
else
	AR=$(DEB_HOST_GNU_TYPE)-ar
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O3
endif

ifeq (,$(filter nobiarch,$(DEB_BUILD_PROFILES)))

32-ARCHS=amd64 ppc64 kfreebsd-amd64 s390x
64-ARCHS=s390 sparc i386 powerpc mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el x32

ifneq (,$(findstring $(DEB_HOST_ARCH), $(32-ARCHS)))
EXTRA_INSTALL=install32
EXTRA_BUILD=build32-stamp
# s390x fails at compatibility.
ifneq (,$(findstring $(DEB_HOST_ARCH), s390x))
m32=-m31
else
m32=-m32
endif
endif

ifneq (,$(findstring s390x, $(DEB_HOST_ARCH)))
else
ifneq (,$(findstring $(DEB_HOST_ARCH), $(64-ARCHS)))
EXTRA_INSTALL=install64
EXTRA_BUILD=build64-stamp
# MIPS doesn't use -m64
ifneq (,$(findstring $(DEB_HOST_ARCH), mips mipsel mipsn32 mipsn32el mipsr6 mipsr6el mipsn32r6 mipsn32r6el))
m64=-mabi=64
else
m64=-m64
endif
endif
endif

N32-ARCHS=mips mipsel
ifneq (,$(findstring $(DEB_HOST_ARCH), $(N32-ARCHS)))
EXTRA_INSTALL+=installn32
EXTRA_BUILD+=buildn32-stamp
mn32=-mabi=n32
endif

endif # !nobiarch

UNALIGNED_ARCHS=i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 lpia
ifneq (,$(findstring $(DEB_HOST_ARCH), $(UNALIGNED_ARCHS)))
CFLAGS+=-DUNALIGNED_OK
endif

COPYLIST=*.h *.c *.in zlib.map configure zlib.3 test

configure-stamp: configure
	dh_testdir

	if [ ! -f Makefile.stash ]; then cp Makefile Makefile.stash ; fi

	AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

	touch $@

configure64-stamp: configure
	dh_testdir

	mkdir -p debian/64
	cp -r $(COPYLIST) debian/64
	cd debian/64 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(m64)" \
	    CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
	    uname=GNU ./configure --shared --prefix=/usr  --libdir=\$${prefix}/usr/lib64
	touch $@

configure32-stamp: configure
	dh_testdir

	mkdir -p debian/32
	cp -r $(COPYLIST) debian/32
	cd debian/32 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(m32)" \
	    CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
	    uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/usr/lib32
	touch $@

configuren32-stamp: configure
	dh_testdir

	mkdir -p debian/n32
	cp -r $(COPYLIST) debian/n32
	cd debian/n32 && AR=$(AR) CC="$(DEB_HOST_GNU_TYPE)-gcc $(mn32)" \
	    CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
	    uname=GNU ./configure --shared --prefix=/usr --libdir=\$${prefix}/usr/lib32
	touch $@

build: build-stamp $(EXTRA_BUILD)
build-stamp: configure-stamp
	dh_testdir

	$(MAKE)
	-$(MAKE) test

	touch $@

build64-stamp: configure64-stamp
	dh_testdir
	make -C debian/64
	touch $@

build32-stamp: configure32-stamp
	dh_testdir
	make -C debian/32
	touch $@

buildn32-stamp: configuren32-stamp
	dh_testdir
	make -C debian/n32
	touch $@

clean:
	dh_testdir
	dh_testroot

	$(MAKE) distclean

	rm -f build-stamp configure-stamp foo.gz 
	rm -rf debian/64 build64-stamp configure64-stamp
	rm -rf debian/32 build32-stamp configure32-stamp
	rm -rf debian/n32 buildn32-stamp configuren32-stamp
	-mv Makefile.stash Makefile
	-mv zlibdefs.h.stash zlibdefs.h

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install

	install -d debian/tmp/lib/$(DEB_HOST_MULTIARCH)
	mv debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so.* debian/tmp/lib/$(DEB_HOST_MULTIARCH)
	ln -sf /lib/$(DEB_HOST_MULTIARCH)/$$(readlink debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libz.so

install64: install build64-stamp
	$(MAKE) -C debian/64 prefix=$(CURDIR)/debian/tmp install

install32: install build32-stamp
	$(MAKE) -C debian/32 prefix=$(CURDIR)/debian/tmp install

installn32: install buildn32-stamp
	$(MAKE) -C debian/n32 prefix=$(CURDIR)/debian/tmp install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install $(EXTRA_INSTALL)
	dh_testdir
	dh_testroot
	dh_installchangelogs -a ChangeLog
	dh_installdocs -a
	dh_installexamples -a
	dh_install -a --sourcedir=debian/tmp
	dh_installman -a
	dh_lintian -a
	dh_link -a
	dh_strip -a --dbgsym-migration="zlib1g-dbg (<< 1:1.2.11.dfsg-2~)"
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -pzlib1g -V"zlib1g (>= 1:1.2.3.3.dfsg-1)" --add-udeb=zlib1g-udeb
ifeq (,$(filter nobiarch,$(DEB_BUILD_PROFILES)))
ifneq (,$(findstring $(DEB_HOST_ARCH), $(32-ARCHS)))
	dh_makeshlibs -plib32z1 -V"lib32z1 (>= 1:1.2.3.3.dfsg-1)"
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), $(64-ARCHS)))
	dh_makeshlibs -plib64z1 -V"lib64z1 (>= 1:1.2.3.3.dfsg-1)"
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), $(N32-ARCHS)))
	dh_makeshlibs -plibn32z1 -V"libn32z1 (>= 1:1.2.3.3.dfsg-1)"
endif
endif
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install install64 install32