3 #DISABLE_UPDATE_UPLOADERS := 1
4 #include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
5 #-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk
9 STAMP_DIR := debian/stampdir
11 PATCH_DIR := debian/patches
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
18 DEB_BUILD_OPTIONS_PARALLEL ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19 MAKEFLAGS += $(if $(DEB_BUILD_OPTIONS_PARALLEL),-j$(DEB_BUILD_OPTIONS_PARALLEL))
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)
23 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
24 DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
25 #DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
27 # Debian architectures
28 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
29 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
32 CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
34 # Ensure the build aborts when there are still references to undefined
36 LDFLAGS += -Wl,-z,defs
38 # NB: do NOT use -Wl,--as-needed to build glib; for instance the link to
39 # pthread is carefully crafted to allow dlopen()ing pthread-using libs; see
40 # http://mid.gmane.org/1257999019.21780.15.camel@marzipan
42 # Make the linker work a bit harder so dynamic loading can be done faster
50 SHARED_PKG := libglib$(APIVER)-$(SONAME)
51 DATA_PKG := libglib$(APIVER)-data
52 DEV_PKG := libglib$(APIVER)-dev
53 UDEB_PKG := libglib$(APIVER)-udeb
54 DOC_PKG := libglib$(APIVER)-doc
55 DEBUG_PKG := $(SHARED_PKG)-dbg
56 REFDBG_PKG := libglib$(APIVER)-$(SONAME)-refdbg
58 # list of flavors we build; each gets a builddir, a configure pass (configure
59 # args are defined below), a build pass, and an install pass (in two steps)
60 # Note: the "deb" flavor is required
61 FLAVORS := deb udeb refdbg
63 # list of flavors to run the test suite on
64 CHECK_FLAVORS := $(filter deb, $(FLAVORS))
66 # list of arches on which testsuite failures are fatal
67 # XXX testsuite failures currently disabled as testsuite fails everywhere when
68 # $HOME isn't writable
69 CHECK_SUPPORTED_ARCHES :=
70 # CHECK_SUPPORTED_ARCHES := alpha amd64 i386 ia64 lpia m68k s390
71 # testsuite is known to fail on hppa, hurd, kfreebsd-amd64, kfreebsd-i386; see
73 # testsuite is known to fail on arm, mips, mipsel, powerpc, sparc; see GNOME #481573
75 # build dir for the current flavor; this is only expanded in flavor specific
77 # Note: dh_clean will rm -rf debian/tmp, hence all builds
78 builddir = $(buildbasedir)/$*
79 buildbasedir = $(CURDIR)/debian/build
81 # install dir for the current flavor; this is only expanded in flavor specific
83 installdir = $(installbasedir)/$*
84 installbasedir = $(CURDIR)/debian/install
87 common_configure_flags := \
89 --mandir=\$${prefix}/share/man \
90 --infodir=\$${prefix}/share/info \
91 --with-html-dir=\$${prefix}/share/doc/$(DOC_PKG)
92 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
93 common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE)
95 common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
97 deb_configure_flags := $(common_configure_flags) \
99 udeb_configure_flags := $(common_configure_flags) \
101 refdbg_configure_flags := $(common_configure_flags) \
102 --disable-visibility \
105 $(STAMP_DIR)/patch-stamp:
107 # backup the original files to restore them in the clean target
108 -test -r config.sub && cp config.sub config.sub.orig
109 -test -r config.guess && cp config.guess config.guess.orig
111 QUILT_PATCHES=$(PATCH_DIR) \
112 quilt --quiltrc /dev/null push -a || test $$? = 2
113 -test -r /usr/share/misc/config.sub && \
114 cp -f /usr/share/misc/config.sub config.sub
115 -test -r /usr/share/misc/config.guess && \
116 cp -f /usr/share/misc/config.guess config.guess
117 -mkdir -p $(STAMP_DIR)
120 patch: $(STAMP_DIR)/patch-stamp
122 $(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp
126 CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
127 $(CURDIR)/configure $($*_configure_flags)
129 mv /usr/lib/libdl.so /usr/lib/libdl.so.tmp
130 ln -sf /lib/libdl.so.2 /usr/lib/libdl.so
132 configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS))
134 $(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
136 LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
137 $(MAKE) -C $(builddir)
140 build: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
142 maybe_ignore_check_failure = $(if $(filter ,$(CHECK_SUPPORTED_ARCHES)),-)
144 $(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-%
146 ifeq ($(filter $(DEB_BUILD_ARCH),$(CHECK_SUPPORTED_ARCHES)),$(DEB_BUILD_ARCH))
147 # testsuite failures are fatal
148 LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
149 $(MAKE) -k -C $(builddir) check
151 # testsuite failures are ignored
152 -LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
153 $(MAKE) -k -C $(builddir) check
157 check: $(addprefix $(STAMP_DIR)/check-stamp-, $(CHECK_FLAVORS))
159 $(STAMP_DIR)/install-stamp-%: $(STAMP_DIR)/build-stamp-%
160 mkdir -p $(installdir)
161 $(MAKE) -C $(builddir) install DESTDIR=$(installdir)
164 install: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS))
169 -e "s#@SONAME@#$(SONAME)#g" \
170 -e "s#@APIVER@#$(APIVER)#g" \
171 -e "s#@VERSION@#$(VERSION)#g" \
172 -e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
173 -e "s#@DATA_PKG@#$(DATA_PKG)#g" \
174 -e "s#@DEV_PKG@#$(DEV_PKG)#g" \
175 -e "s#@UDEB_PKG@#$(UDEB_PKG)#g" \
176 -e "s#@DOC_PKG@#$(DOC_PKG)#g" \
177 -e "s#@DEBUG_PKG@#$(DEBUG_PKG)#g" \
178 -e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \
179 -e "s#@REFDBG_PKG@#$(REFDBG_PKG)#g" \
182 clean: debian/control
185 # remove install and build dirs
186 rm -rf $(installbasedir)
187 rm -rf $(buildbasedir)
188 # restore files from backup (before unpatching)
189 -test -r config.sub.orig && mv -f config.sub.orig config.sub
190 -test -r config.guess.orig && mv -f config.guess.orig config.guess
191 # unapply patches, if any
192 QUILT_PATCHES=$(PATCH_DIR) \
193 quilt --quiltrc /dev/null pop -a -R || test $$? = 2
198 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
199 maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)
201 # can't run the testsuite when cross-compiling
207 binary-indep: build $(maybe_check) install
211 dh_installchangelogs -i -N$(DATA_PKG) ChangeLog
212 dh_installdocs -N$(DATA_PKG) -i NEWS README
214 dh_compress -i -X.sgml -X.devhelp
221 binary-arch: build $(maybe_check) install
225 # empty the dependency_libs in the *.la files
226 sed -i -e "/dependency_libs/ s/'.*'/''/" debian/$(DEV_PKG)/usr/lib/*.la
227 dh_installchangelogs -s -N$(DEV_PKG) -N$(DEBUG_PKG) \
229 dh_installdocs -s -N$(DEV_PKG) -N$(DEBUG_PKG) NEWS README
231 dh_strip -s --dbg-package=$(DEBUG_PKG) -N$(UDEB_PKG) -N$(REFDBG_PKG)
232 dh_strip -p$(UDEB_PKG)
233 dh_compress -s -X.sgml -X.devhelp
235 dh_makeshlibs -p$(SHARED_PKG) \
236 -V "$(SHARED_PKG) (>= $(SHVER))" \
237 --add-udeb="$(UDEB_PKG)" -- -c4
239 # override shlibs for libraries from this source before computing
240 # dependencies of packages generated from this source; we already have
241 # inter-dependencies expressed manually in the control file, we do not
242 # need the shlibs to add duplicates
243 sed -nr -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \
244 debian/*/DEBIAN/shlibs \
246 dh_shlibdeps -s -ldebian/$(SHARED_PKG)/usr/lib
247 -rm -f debian/shlibs.local
252 binary: binary-indep binary-arch
253 .PHONY: patch configure build check install clean binary-indep binary-arch binary debian/control