source: pkg/raul/main/glib2.0/trunk/debian/rules @ 6999

Revision 6603, 8.1 KB checked in by alanbach-guest, 4 years ago (diff)
  • Sync'd with Debian 2.24.1-1
  • Property svn:executable set to *
Line 
1#!/usr/bin/make -f
2
3DISABLE_UPDATE_UPLOADERS := 1
4include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
5-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
6
7GNOME_MODULE := glib
8
9STAMP_DIR := debian/stampdir
10
11PATCH_DIR := debian/patches
12
13# rules in this debian/rules Makefile can be built concurrently as well as
14# upstream rules in Makefile; all $(MAKE) invocations will inherit this flag,
15# if you recurse into debian/rules ($(MAKE)
16# -f debian/rules in rules), you need to pass a flag to avoid adding "-jX" when
17# the childs encounters this line
18DEB_BUILD_OPTIONS_PARALLEL ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19MAKEFLAGS += $(if $(DEB_BUILD_OPTIONS_PARALLEL),-j$(DEB_BUILD_OPTIONS_PARALLEL))
20
21# These are used for cross-compiling and for saving the configure script
22# from having to guess our platform (since we know it already)
23DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
24DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
25
26# Debian architectures
27DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
28DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
29
30CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
31
32# Ensure the build aborts when there are still references to undefined
33# symbols
34LDFLAGS += -Wl,-z,defs
35
36# NB: do NOT use -Wl,--as-needed to build glib; for instance the link to
37# pthread is carefully crafted to allow dlopen()ing pthread-using libs; see
38# http://mid.gmane.org/1257999019.21780.15.camel@marzipan
39
40# Make the linker work a bit harder so dynamic loading can be done faster
41LDFLAGS += -Wl,-O1
42
43APIVER := 2.0
44SONAME := 0
45SHVER := 2.24.0
46
47# package names
48SHARED_PKG := libglib$(APIVER)-$(SONAME)
49DATA_PKG := libglib$(APIVER)-data
50DEV_PKG := libglib$(APIVER)-dev
51UDEB_PKG := libglib$(APIVER)-udeb
52DOC_PKG := libglib$(APIVER)-doc
53DEBUG_PKG := $(SHARED_PKG)-dbg
54REFDBG_PKG := libglib$(APIVER)-$(SONAME)-refdbg
55
56# list of flavors we build; each gets a builddir, a configure pass (configure
57# args are defined below), a build pass, and an install pass (in two steps)
58# Note: the "deb" flavor is required
59FLAVORS := deb udeb refdbg
60
61# list of flavors to run the test suite on
62CHECK_FLAVORS := $(filter deb, $(FLAVORS))
63
64CHECK_SUPPORTED_ARCHES :=
65#CHECK_SUPPORTED_ARCHES := amd64 i386 s390
66# CHECK_SUPPORTED_ARCHES := alpha ia64 lpia m68k
67# testsuite is known to fail on hppa, hurd, kfreebsd-amd64, kfreebsd-i386; see
68# Debian #428674
69# testsuite is known to fail on arm, mips, mipsel, powerpc, sparc; see GNOME #481573
70
71# build dir for the current flavor; this is only expanded in flavor specific
72# targets
73# Note: dh_clean will rm -rf debian/tmp, hence all builds
74builddir = $(buildbasedir)/$*
75buildbasedir = $(CURDIR)/debian/build
76
77# install dir for the current flavor; this is only expanded in flavor specific
78# targets
79installdir = $(installbasedir)/$*
80installbasedir = $(CURDIR)/debian/install
81
82# configure flags
83common_configure_flags := \
84                        --prefix=/usr \
85                        --mandir=\$${prefix}/share/man \
86                        --infodir=\$${prefix}/share/info \
87                        --with-html-dir=\$${prefix}/share/doc/$(DOC_PKG) \
88                        --with-pcre=system
89ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
90        common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE)
91else
92        common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
93endif
94deb_configure_flags := $(common_configure_flags) \
95                        --enable-static
96udeb_configure_flags := $(common_configure_flags) \
97                        --disable-selinux
98refdbg_configure_flags := $(common_configure_flags) \
99                        --disable-visibility \
100                        --enable-debug=yes
101
102$(STAMP_DIR)/patch-stamp:
103        dh_testdir
104        # backup the original files to restore them in the clean target
105        -test -r config.sub && cp config.sub config.sub.orig
106        -test -r config.guess && cp config.guess config.guess.orig
107        # apply patches
108        QUILT_PATCHES=$(PATCH_DIR) \
109                quilt --quiltrc /dev/null push -a || test $$? = 2
110        -test -r /usr/share/misc/config.sub && \
111                cp -f /usr/share/misc/config.sub config.sub
112        -test -r /usr/share/misc/config.guess && \
113                cp -f /usr/share/misc/config.guess config.guess
114        -mkdir -p $(STAMP_DIR)
115        touch $@
116
117patch: $(STAMP_DIR)/patch-stamp
118
119$(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp
120        dh_testdir
121        mkdir -p $(builddir)
122        cd $(builddir) && \
123                CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
124                        $(CURDIR)/configure $($*_configure_flags)
125        touch $@
126
127configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS))
128
129$(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
130        dh_testdir
131        LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
132                $(MAKE) -C $(builddir)
133        touch $@
134
135build: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
136
137maybe_ignore_check_failure = $(if $(filter ,$(CHECK_SUPPORTED_ARCHES)),-)
138
139$(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-%
140        dh_testdir
141ifeq ($(filter $(DEB_BUILD_ARCH),$(CHECK_SUPPORTED_ARCHES)),$(DEB_BUILD_ARCH))
142        # testsuite failures are fatal
143        LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
144                $(MAKE) -k -C $(builddir) check
145else
146        # testsuite failures are ignored
147        -LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
148                $(MAKE) -k -C $(builddir) check
149endif
150        touch $@
151
152check: $(addprefix $(STAMP_DIR)/check-stamp-, $(CHECK_FLAVORS))
153
154$(STAMP_DIR)/install-stamp-%: $(STAMP_DIR)/build-stamp-%
155        mkdir -p $(installdir)
156        $(MAKE) -C $(builddir) install DESTDIR=$(installdir)
157        touch $@
158
159install: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS))
160
161debian/control:
162        dh_testdir
163        sed \
164                -e "s#@SONAME@#$(SONAME)#g" \
165                -e "s#@APIVER@#$(APIVER)#g" \
166                -e "s#@VERSION@#$(VERSION)#g" \
167                -e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
168                -e "s#@DATA_PKG@#$(DATA_PKG)#g" \
169                -e "s#@DEV_PKG@#$(DEV_PKG)#g" \
170                -e "s#@UDEB_PKG@#$(UDEB_PKG)#g" \
171                -e "s#@DOC_PKG@#$(DOC_PKG)#g" \
172                -e "s#@DEBUG_PKG@#$(DEBUG_PKG)#g" \
173                -e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \
174                -e "s#@REFDBG_PKG@#$(REFDBG_PKG)#g" \
175                $@.in >$@
176
177clean: debian/control
178        dh_testdir
179        dh_testroot
180        # remove install and build dirs
181        rm -rf $(installbasedir)
182        rm -rf $(buildbasedir)
183        # restore files from backup (before unpatching)
184        -test -r config.sub.orig && mv -f config.sub.orig config.sub
185        -test -r config.guess.orig && mv -f config.guess.orig config.guess
186        # unapply patches, if any
187        QUILT_PATCHES=$(PATCH_DIR) \
188                quilt --quiltrc /dev/null pop -a -R || test $$? = 2
189        -rm -rf .pc
190        -rm -rf $(STAMP_DIR)
191        dh_clean
192
193ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
194maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)
195else
196# can't run the testsuite when cross-compiling
197maybe_check =
198endif
199
200binary-indep: build $(maybe_check) install
201        dh_testdir
202        dh_testroot
203        dh_install -i
204        dh_installchangelogs -i -N$(DATA_PKG) ChangeLog
205        dh_installdocs -N$(DATA_PKG) -i NEWS README
206        dh_link -i
207        dh_compress -i -X.sgml -X.devhelp
208        dh_fixperms -i
209        dh_installdeb -i
210        dh_gencontrol -i
211        dh_md5sums -i
212        dh_builddeb -i
213
214binary-arch: build $(maybe_check) install
215        dh_testdir
216        dh_testroot
217        dh_install -s
218        # empty the dependency_libs in the *.la files
219        sed -i -e "/dependency_libs/ s/'.*'/''/" debian/$(DEV_PKG)/usr/lib/*.la
220        dh_installchangelogs -s -N$(DEV_PKG) -N$(DEBUG_PKG) \
221                ChangeLog
222        dh_installdocs -s -N$(DEV_PKG) -N$(DEBUG_PKG) NEWS README
223        dh_link -s
224        dh_strip -s --dbg-package=$(DEBUG_PKG) -N$(UDEB_PKG) -N$(REFDBG_PKG)
225        dh_strip -p$(UDEB_PKG)
226        dh_compress -s -X.sgml -X.devhelp
227        dh_fixperms -s
228        dh_makeshlibs   -p$(SHARED_PKG) \
229                        -V "$(SHARED_PKG) (>= $(SHVER))" \
230                        --add-udeb="$(UDEB_PKG)" -- -c4
231        dh_installdeb -s
232        # override shlibs for libraries from this source before computing
233        # dependencies of packages generated from this source; we already have
234        # inter-dependencies expressed manually in the control file, we do not
235        # need the shlibs to add duplicates
236        sed -nr -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \
237                debian/*/DEBIAN/shlibs \
238                >debian/shlibs.local
239        dh_shlibdeps -s -ldebian/$(SHARED_PKG)/usr/lib
240        -rm -f debian/shlibs.local
241        dh_gencontrol -s
242        dh_md5sums -s
243        dh_builddeb -s
244
245binary: binary-indep binary-arch
246.PHONY: patch configure build check install clean binary-indep binary-arch binary debian/control
Note: See TracBrowser for help on using the repository browser.