source: pkg/kev/main/glib2.0/trunk/debian/rules @ 5827

Revision 5827, 8.0 KB checked in by alanbach-guest, 4 years ago (diff)
  • Sync'd with Debian 2.22.0-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# Make the linker work a bit harder so dynamic loading can be done faster
37LDFLAGS += -Wl,-O1
38
39APIVER := 2.0
40SONAME := 0
41SHVER := 2.22.0
42
43# package names
44SHARED_PKG := libglib$(APIVER)-$(SONAME)
45DATA_PKG := libglib$(APIVER)-data
46DEV_PKG := libglib$(APIVER)-dev
47UDEB_PKG := libglib$(APIVER)-udeb
48DOC_PKG := libglib$(APIVER)-doc
49DEBUG_PKG := $(SHARED_PKG)-dbg
50REFDBG_PKG := libglib$(APIVER)-$(SONAME)-refdbg
51
52# list of flavors we build; each gets a builddir, a configure pass (configure
53# args are defined below), a build pass, and an install pass (in two steps)
54# Note: the "deb" flavor is required
55FLAVORS := deb udeb refdbg
56
57# list of flavors to run the test suite on
58CHECK_FLAVORS := $(filter deb, $(FLAVORS))
59
60# list of arches on which testsuite failures are fatal
61# XXX testsuite failures currently disabled as testsuite fails everywhere when
62# $HOME isn't writable
63CHECK_SUPPORTED_ARCHES :=
64# CHECK_SUPPORTED_ARCHES := alpha amd64 i386 ia64 lpia m68k s390
65# testsuite is known to fail on hppa, hurd, kfreebsd-amd64, kfreebsd-i386; see
66# Debian #428674
67# testsuite is known to fail on arm, mips, mipsel, powerpc, sparc; see GNOME #481573
68
69# build dir for the current flavor; this is only expanded in flavor specific
70# targets
71# Note: dh_clean will rm -rf debian/tmp, hence all builds
72builddir = $(buildbasedir)/$*
73buildbasedir = $(CURDIR)/debian/build
74
75# install dir for the current flavor; this is only expanded in flavor specific
76# targets
77installdir = $(installbasedir)/$*
78installbasedir = $(CURDIR)/debian/install
79
80# configure flags
81common_configure_flags := \
82                        --prefix=/usr \
83                        --mandir=\$${prefix}/share/man \
84                        --infodir=\$${prefix}/share/info \
85                        --with-html-dir=\$${prefix}/share/doc/$(DOC_PKG) \
86                        --with-pcre=system
87ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
88        common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE)
89else
90        common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
91endif
92deb_configure_flags := $(common_configure_flags) \
93                        --enable-static
94udeb_configure_flags := $(common_configure_flags) \
95                        --disable-selinux
96refdbg_configure_flags := $(common_configure_flags) \
97                        --disable-visibility \
98                        --enable-debug=yes
99
100$(STAMP_DIR)/patch-stamp:
101        dh_testdir
102        # backup the original files to restore them in the clean target
103        -test -r config.sub && cp config.sub config.sub.orig
104        -test -r config.guess && cp config.guess config.guess.orig
105        # apply patches
106        QUILT_PATCHES=$(PATCH_DIR) \
107                quilt --quiltrc /dev/null push -a || test $$? = 2
108        -test -r /usr/share/misc/config.sub && \
109                cp -f /usr/share/misc/config.sub config.sub
110        -test -r /usr/share/misc/config.guess && \
111                cp -f /usr/share/misc/config.guess config.guess
112        -mkdir -p $(STAMP_DIR)
113        touch $@
114
115patch: $(STAMP_DIR)/patch-stamp
116
117$(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp
118        dh_testdir
119        mkdir -p $(builddir)
120        cd $(builddir) && \
121                CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
122                        $(CURDIR)/configure $($*_configure_flags)
123        touch $@
124
125configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS))
126
127$(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
128        dh_testdir
129        LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
130                $(MAKE) -C $(builddir)
131        touch $@
132
133build: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
134
135maybe_ignore_check_failure = $(if $(filter ,$(CHECK_SUPPORTED_ARCHES)),-)
136
137$(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-%
138        dh_testdir
139ifeq ($(filter $(DEB_BUILD_ARCH),$(CHECK_SUPPORTED_ARCHES)),$(DEB_BUILD_ARCH))
140        # testsuite failures are fatal
141        LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
142                $(MAKE) -k -C $(builddir) check
143else
144        # testsuite failures are ignored
145        -LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
146                $(MAKE) -k -C $(builddir) check
147endif
148        touch $@
149
150check: $(addprefix $(STAMP_DIR)/check-stamp-, $(CHECK_FLAVORS))
151
152$(STAMP_DIR)/install-stamp-%: $(STAMP_DIR)/build-stamp-%
153        mkdir -p $(installdir)
154        $(MAKE) -C $(builddir) install DESTDIR=$(installdir)
155        touch $@
156
157install: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS))
158
159debian/control:
160        dh_testdir
161        sed \
162                -e "s#@SONAME@#$(SONAME)#g" \
163                -e "s#@APIVER@#$(APIVER)#g" \
164                -e "s#@VERSION@#$(VERSION)#g" \
165                -e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
166                -e "s#@DATA_PKG@#$(DATA_PKG)#g" \
167                -e "s#@DEV_PKG@#$(DEV_PKG)#g" \
168                -e "s#@UDEB_PKG@#$(UDEB_PKG)#g" \
169                -e "s#@DOC_PKG@#$(DOC_PKG)#g" \
170                -e "s#@DEBUG_PKG@#$(DEBUG_PKG)#g" \
171                -e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \
172                -e "s#@REFDBG_PKG@#$(REFDBG_PKG)#g" \
173                $@.in >$@
174
175clean: debian/control
176        dh_testdir
177        dh_testroot
178        # remove install and build dirs
179        rm -rf $(installbasedir)
180        rm -rf $(buildbasedir)
181        # restore files from backup (before unpatching)
182        -test -r config.sub.orig && mv -f config.sub.orig config.sub
183        -test -r config.guess.orig && mv -f config.guess.orig config.guess
184        # unapply patches, if any
185        QUILT_PATCHES=$(PATCH_DIR) \
186                quilt --quiltrc /dev/null pop -a -R || test $$? = 2
187        -rm -rf .pc
188        -rm -rf $(STAMP_DIR)
189        dh_clean
190
191ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
192maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)
193else
194# can't run the testsuite when cross-compiling
195maybe_check =
196endif
197
198binary-indep: build $(maybe_check) install
199        dh_testdir
200        dh_testroot
201        dh_install -i
202        dh_installchangelogs -i -N$(DATA_PKG) ChangeLog
203        dh_installdocs -N$(DATA_PKG) -i NEWS README
204        dh_link -i
205        dh_compress -i -X.sgml -X.devhelp
206        dh_fixperms -i
207        dh_installdeb -i
208        dh_gencontrol -i
209        dh_md5sums -i
210        dh_builddeb -i
211
212binary-arch: build $(maybe_check) install
213        dh_testdir
214        dh_testroot
215        dh_install -s
216        # empty the dependency_libs in the *.la files
217        sed -i -e "/dependency_libs/ s/'.*'/''/" debian/$(DEV_PKG)/usr/lib/*.la
218        dh_installchangelogs -s -N$(DEV_PKG) -N$(DEBUG_PKG) \
219                ChangeLog
220        dh_installdocs -s -N$(DEV_PKG) -N$(DEBUG_PKG) NEWS README
221        dh_link -s
222        dh_strip -s --dbg-package=$(DEBUG_PKG) -N$(UDEB_PKG) -N$(REFDBG_PKG)
223        dh_strip -p$(UDEB_PKG)
224        dh_compress -s -X.sgml -X.devhelp
225        dh_fixperms -s
226        dh_makeshlibs   -p$(SHARED_PKG) \
227                        -V "$(SHARED_PKG) (>= $(SHVER))" \
228                        --add-udeb="$(UDEB_PKG)" -- -c4
229        dh_installdeb -s
230        # override shlibs for libraries from this source before computing
231        # dependencies of packages generated from this source; we already have
232        # inter-dependencies expressed manually in the control file, we do not
233        # need the shlibs to add duplicates
234        sed -nr -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \
235                debian/*/DEBIAN/shlibs \
236                >debian/shlibs.local
237        dh_shlibdeps -s -ldebian/$(SHARED_PKG)/usr/lib
238        -rm -f debian/shlibs.local
239        dh_gencontrol -s
240        dh_md5sums -s
241        dh_builddeb -s
242
243binary: binary-indep binary-arch
244.PHONY: patch configure build check install clean binary-indep binary-arch binary debian/control
Note: See TracBrowser for help on using the repository browser.