chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / debian / rules.d / debhelper.mk
1 # This is so horribly wrong.  libc-pic does a whole pile of gratuitous
2 # renames.  There's very little we can do for now.  Maybe after
3 # Sarge releases we can consider breaking packages, but certainly not now.
4
5 $(stamp)binaryinst_$(libc)-pic:: debhelper
6         @echo Running special kludge for $(libc)-pic
7         dh_testroot
8         dh_installdirs -p$(curpass)
9         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libc_pic.a debian/$(libc)-pic/$(libdir)/.
10         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libc.map debian/$(libc)-pic/$(libdir)/libc_pic.map
11         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/elf/soinit.os debian/$(libc)-pic/$(libdir)/libc_pic/soinit.o
12         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/elf/sofini.os debian/$(libc)-pic/$(libdir)/libc_pic/sofini.o
13
14         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/math/libm_pic.a debian/$(libc)-pic/$(libdir)/.
15         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libm.map debian/$(libc)-pic/$(libdir)/libm_pic.map
16         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/resolv/libresolv_pic.a debian/$(libc)-pic/$(libdir)/.
17         install --mode=0644 build-tree/$(DEB_HOST_ARCH)-libc/libresolv.map debian/$(libc)-pic/$(libdir)/libresolv_pic.map
18
19 # Some per-package extra files to install.
20 define libc-bin_extra_debhelper_pkg_install
21         # dh_installmanpages thinks that .so is a language.
22         install --mode=0644 debian/local/manpages/ld.so.8 debian/libc-bin/usr/share/man/man8/ld.so.8
23 endef
24
25 # Should each of these have per-package options?
26
27 $(patsubst %,binaryinst_%,$(DEB_ARCH_REGULAR_PACKAGES) $(DEB_INDEP_REGULAR_PACKAGES)) :: binaryinst_% : $(stamp)binaryinst_%
28
29 # Make sure the debug packages are built last, since other packages may add
30 # files to them.
31 debug-packages = $(filter %-dbg,$(DEB_ARCH_REGULAR_PACKAGES))
32 non-debug-packages = $(filter-out %-dbg,$(DEB_ARCH_REGULAR_PACKAGES))
33 $(patsubst %,$(stamp)binaryinst_%,$(debug-packages)):: $(patsubst %,$(stamp)binaryinst_%,$(non-debug-packages))
34
35 $(patsubst %,$(stamp)binaryinst_%,$(DEB_ARCH_REGULAR_PACKAGES) $(DEB_INDEP_REGULAR_PACKAGES)):: $(patsubst %,$(stamp)install_%,$(EGLIBC_PASSES)) debhelper
36         @echo Running debhelper for $(curpass)
37         dh_testroot
38         dh_installdirs -p$(curpass)
39         dh_install -p$(curpass)
40         dh_installman -p$(curpass)
41         dh_installinfo -p$(curpass)
42         dh_installdebconf -p$(curpass)
43         if [ $(curpass) = glibc-doc ] ; then \
44                 dh_installchangelogs -p$(curpass) ; \
45         else \
46                 dh_installchangelogs -p$(curpass) debian/changelog.upstream ; \
47         fi
48         dh_installinit -p$(curpass)
49         dh_installdocs -p$(curpass) 
50         dh_lintian -p $(curpass)
51         dh_link -p$(curpass)
52         set -e; if test -d debian/bug/$(curpass); then                   \
53             dh_installdirs -p$(curpass) usr/share/bug;                   \
54             dh_install -p$(curpass) debian/bug/$(curpass) usr/share/bug; \
55         fi
56
57         # extra_debhelper_pkg_install is used for debhelper.mk only.
58         # when you want to install extra packages, use extra_pkg_install.
59         $(call xx,extra_debhelper_pkg_install)
60         $(call xx,extra_pkg_install)
61
62 ifeq ($(filter nostrip,$(DEB_BUILD_OPTIONS)),)
63         # libpthread must be stripped specially; GDB needs the
64         # non-dynamic symbol table in order to load the thread
65         # debugging library.  We keep a full copy of the symbol
66         # table in libc6-dbg but basic thread debugging should
67         # work even without that package installed.
68
69         # strip *.o files as dh_strip does not (yet?) do it.
70
71         if test "$(NOSTRIP_$(curpass))" != 1; then                      \
72           dh_strip -p$(curpass) -Xlibpthread --dbg-package=$(libc)-dbg; \
73                                                                         \
74           (cd debian/$(curpass);                                        \
75            find . -name libpthread-\*.so -exec objcopy                  \
76              --only-keep-debug '{}' ../$(libc)-dbg/usr/lib/debug/'{}'   \
77              ';' || true;                                               \
78            find . -name libpthread-\*.so -exec objcopy                  \
79              --add-gnu-debuglink=../$(libc)-dbg/usr/lib/debug/'{}'      \
80              '{}' ';' || true);                                         \
81           find debian/$(curpass) -name libpthread-\*.so -exec           \
82             strip --strip-debug --remove-section=.comment               \
83             --remove-section=.note '{}' ';' || true;                    \
84                                                                         \
85           (cd debian/$(curpass);                                        \
86            find . -name \*crt\*.o -exec objcopy                         \
87              --only-keep-debug '{}' ../$(libc)-dbg/usr/lib/debug/'{}'   \
88              ';' || true;                                               \
89            find . -name \*crt\*.o -exec objcopy                         \
90              --add-gnu-debuglink=../$(libc)-dbg/usr/lib/debug/'{}'      \
91              '{}' ';' || true);                                         \
92           find debian/$(curpass) -name \*crt\*.o -exec                  \
93             strip --strip-debug --remove-section=.comment               \
94             --remove-section=.note '{}' ';' || true;    \
95         fi
96 endif
97
98         dh_compress -p$(curpass)
99         dh_fixperms -p$(curpass) -Xpt_chown
100         # Use this instead of -X to dh_fixperms so that we can use
101         # an unescaped regular expression.  ld.so must be executable;
102         # libc.so and NPTL's libpthread.so print useful version
103         # information when executed.
104         find debian/$(curpass) -type f \( -regex '.*/ld.*so' \
105                 -o -regex '.*/libpthread-.*so' \
106                 -o -regex '.*/libc-.*so' \) \
107                 -exec chmod a+x '{}' ';'
108         dh_makeshlibs -X/usr/lib/debug -p$(curpass) -V "$(call xx,shlib_dep)"
109         # Add relevant udeb: lines in shlibs files
110         chmod a+x debian/shlibs-add-udebs
111         ./debian/shlibs-add-udebs $(curpass)
112
113         dh_installdeb -p$(curpass)
114         dh_shlibdeps -p$(curpass)
115         dh_gencontrol -p$(curpass)
116         if [ $(curpass) = nscd ] ; then \
117                 sed -i -e "s/\(Depends:.*libc[0-9.]\+\)-[a-z0-9]\+/\1/" debian/nscd/DEBIAN/control ; \
118         fi
119         dh_md5sums -p$(curpass)
120         dh_builddeb -p$(curpass)
121
122         touch $@
123
124 $(patsubst %,binaryinst_%,$(DEB_UDEB_PACKAGES)) :: binaryinst_% : $(stamp)binaryinst_%
125 $(patsubst %,$(stamp)binaryinst_%,$(DEB_UDEB_PACKAGES)): debhelper $(patsubst %,$(stamp)install_%,$(EGLIBC_PASSES))
126         @echo Running debhelper for $(curpass)
127         dh_testroot
128         dh_installdirs -p$(curpass)
129         dh_install -p$(curpass)
130         dh_strip -p$(curpass)
131         
132         # when you want to install extra packages, use extra_pkg_install.
133         $(call xx,extra_pkg_install)
134
135         dh_compress -p$(curpass)
136         dh_fixperms -p$(curpass)
137         find debian/$(curpass) -type f \( -regex '.*lib[0-9]*/ld.*so.*' \
138                 -o -regex '.*lib[0-9]*/.*libpthread.*so.*' \
139                 -o -regex '.*lib[0-9]*/libc[.-].*so.*' \) \
140                 -exec chmod a+x '{}' ';'
141         dh_installdeb -p$(curpass)
142         # dh_shlibdeps -p$(curpass)
143         dh_gencontrol -p$(curpass)
144         dh_builddeb -p$(curpass)
145
146         touch $@
147
148 debhelper: $(stamp)debhelper-common $(patsubst %,$(stamp)debhelper_%,$(EGLIBC_PASSES))
149 $(stamp)debhelper-common: 
150         for x in `find debian/debhelper.in -maxdepth 1 -type f`; do \
151           y=debian/`basename $$x`; \
152           cp $$x $$y; \
153           sed -e "s#BUILD-TREE#$(build-tree)#" -i $$y; \
154           sed -e "s#LIBC#$(libc)#" -i $$y; \
155           sed -e "s#EXIT_CHECK##" -i $$y; \
156           sed -e "s#DEB_HOST_ARCH#$(DEB_HOST_ARCH)#" -i $$y; \
157           sed -e "/NSS_CHECK/r debian/script.in/nsscheck.sh" -i $$y; \
158           sed -e "/NOHWCAP/r debian/script.in/nohwcap.sh" -i $$y; \
159           sed -e "s#CURRENT_VER#$(DEB_VERSION)#" -i $$y; \
160           case $$y in \
161             *.install) \
162               sed -e "s/^#.*//" -i $$y ; \
163               ;; \
164           esac; \
165         done
166
167         # Substitute __PROVIDED_LOCALES__.
168         perl -i -pe 'BEGIN {undef $$/; open(IN, "debian/tmp-libc/usr/share/i18n/SUPPORTED"); $$j=<IN>;} s/__PROVIDED_LOCALES__/$$j/g;' debian/locales.config debian/locales.postinst
169
170         # Generate common substvars files.
171         echo "locale:Depends=$(shell perl debian/debver2localesdep.pl $(LOCALES_DEP_VER))" > tmp.substvars
172         echo "locale-compat:Depends=$(shell perl debian/debver2localesdep.pl $(LOCALES_COMPAT_VER))" >> tmp.substvars
173
174         for pkg in $(DEB_ARCH_REGULAR_PACKAGES) $(DEB_INDEP_REGULAR_PACKAGES) $(DEB_UDEB_PACKAGES); do \
175           cp tmp.substvars debian/$$pkg.substvars; \
176         done
177         rm -f tmp.substvars
178
179         touch $@
180
181 $(patsubst %,debhelper_%,$(EGLIBC_PASSES)) :: debhelper_% : $(stamp)debhelper_%
182 $(stamp)debhelper_%: $(stamp)debhelper-common $(stamp)install_%
183         libdir=$(call xx,libdir) ; \
184         slibdir=$(call xx,slibdir) ; \
185         curpass=$(curpass) ; \
186         c_so=`ls debian/tmp-$$curpass/$$slibdir | grep "libc\.so\."` ; \
187         m_so=`ls debian/tmp-$$curpass/$$slibdir | grep "libm\.so\."` ; \
188         rt_so=`ls debian/tmp-$$curpass/$$slibdir | grep "librt\.so\."` ; \
189         dl_so=`ls debian/tmp-$$curpass/$$slibdir | grep "libdl\.so\."` ; \
190         rtld_so=`LANG=C LC_ALL=C readelf -l debian/tmp-$$curpass/usr/bin/iconv | grep "interpreter" | sed -e 's/.*interpreter: \(.*\)]/\1/g'`; \
191         pthread_so=`ls debian/tmp-$$curpass/$$slibdir | grep "libpthread\.so\."` || true; \
192         case "$$curpass:$$slibdir" in \
193           libc:*) \
194             templates="libc libc-dev libc-pic libc-prof libc-udeb libnss-dns-udeb libnss-files-udeb" \
195             pass="" \
196             suffix="" \
197             ;; \
198           *:/lib32 | *:/lib64) \
199             templates="libc libc-dev" \
200             pass="-alt" \
201             suffix="-$(curpass)" \
202             ;; \
203           *:*) \
204             templates="libc" \
205             pass="-otherbuild" \
206             suffix="-$(curpass)" \
207             ;; \
208         esac ; \
209         for t in $$templates ; do \
210           for s in debian/$$t$$pass.* ; do \
211             t=`echo $$s | sed -e "s#libc\(.*\)$$pass#$(libc)\1$$suffix#"` ; \
212             if [ "$$s" != "$$t" ] ; then \
213               cp $$s $$t ; \
214             fi ; \
215             sed -e "s#TMPDIR#debian/tmp-$$curpass#g" -i $$t; \
216             sed -e "s#SLIBDIR#$$slibdir#g" -i $$t; \
217             sed -e "s#LIBDIR#$$libdir#g" -i $$t; \
218             sed -e "s#FLAVOR#$$curpass#g" -i $$t; \
219             sed -e "s#C_SO#$$c_so#" -i $$t ; \
220             sed -e "s#M_SO#$$m_so#" -i $$t ; \
221             sed -e "s#RT_SO#$$rt_so#" -i $$t ; \
222             sed -e "s#DL_SO#$$dl_so#" -i $$t ; \
223             sed -e "s#RTLD_SO#$$rtld_so#" -i $$t ; \
224             sed -e "s#PTHREAD_SO#$$pthread_so#" -i $$t ; \
225           done ; \
226         done
227
228         touch $@
229
230 clean::
231         dh_clean 
232
233         rm -f debian/*.install*
234         rm -f debian/*.install.*
235         rm -f debian/*.manpages
236         rm -f debian/*.links
237         rm -f debian/*.postinst
238         rm -f debian/*.preinst
239         rm -f debian/*.postinst
240         rm -f debian/*.prerm
241         rm -f debian/*.postrm
242         rm -f debian/*.info
243         rm -f debian/*.init
244         rm -f debian/*.config
245         rm -f debian/*.templates
246         rm -f debian/*.dirs
247         rm -f debian/*.docs
248         rm -f debian/*.doc-base
249         rm -f debian/*.generated
250         rm -f debian/*.lintian-overrides
251         rm -f debian/*.NEWS
252         rm -f debian/*.README.Debian
253
254         rm -f $(stamp)binaryinst*