| 1 | #!/usr/bin/make -f |
|---|
| 2 | |
|---|
| 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/check-dist.mk |
|---|
| 6 | -include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk |
|---|
| 7 | |
|---|
| 8 | GNOME_MODULE := pango |
|---|
| 9 | |
|---|
| 10 | STAMP_DIR := debian/stampdir |
|---|
| 11 | |
|---|
| 12 | PATCH_DIR := debian/patches |
|---|
| 13 | |
|---|
| 14 | # rules in this debian/rules Makefile can be built concurrently as well as |
|---|
| 15 | # upstream rules in Makefile; all $(MAKE) invocations will inherit this flag, |
|---|
| 16 | # if you recurse into debian/rules ($(MAKE) |
|---|
| 17 | # -f debian/rules in rules), you need to pass a flag to avoid adding "-jX" when |
|---|
| 18 | # the childs encounters this line |
|---|
| 19 | DEB_BUILD_OPTIONS_PARALLEL ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
|---|
| 20 | MAKEFLAGS += $(if $(DEB_BUILD_OPTIONS_PARALLEL),-j$(DEB_BUILD_OPTIONS_PARALLEL)) |
|---|
| 21 | |
|---|
| 22 | CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2) |
|---|
| 23 | |
|---|
| 24 | # Ensure the build aborts when there are still references to undefined |
|---|
| 25 | # symbols |
|---|
| 26 | LDFLAGS += -Wl,-z,defs |
|---|
| 27 | |
|---|
| 28 | # Make the linker work a bit harder so dynamic loading can be done faster |
|---|
| 29 | LDFLAGS += -Wl,-O1 |
|---|
| 30 | |
|---|
| 31 | DEBVERSION := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p') |
|---|
| 32 | VERSION := $(shell echo $(DEBVERSION) | sed -e 's/-[^-]*$$//') |
|---|
| 33 | APIVER := 1.0 |
|---|
| 34 | SONAME := 0 |
|---|
| 35 | MODVER := 1.6.0 |
|---|
| 36 | SHVERSION := 1.22.0 |
|---|
| 37 | |
|---|
| 38 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
|---|
| 39 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
|---|
| 40 | |
|---|
| 41 | # relative libdir |
|---|
| 42 | ifneq (,$(findstring multiarch,$(DEB_BUILD_OPTIONS))) |
|---|
| 43 | LIBDIR := usr/lib/$(DEB_HOST_GNU_TYPE) |
|---|
| 44 | else |
|---|
| 45 | LIBDIR := usr/lib |
|---|
| 46 | endif |
|---|
| 47 | |
|---|
| 48 | # relative Pango Modules Path (separated by ":") |
|---|
| 49 | MODULES_PATH := $(LIBDIR)/pango/$(MODVER)/modules |
|---|
| 50 | |
|---|
| 51 | # relative directory to store the generated Pango Module File |
|---|
| 52 | MODULE_FILES_D := $(LIBDIR)/pango/$(MODVER)/module-files.d |
|---|
| 53 | |
|---|
| 54 | # Pango Module API version virtual Provide |
|---|
| 55 | ifneq (,$(findstring multiarch,$(DEB_BUILD_OPTIONS))) |
|---|
| 56 | PANGO_MODVER_DEP := pango$(APIVER)-multiarch-modver-$(MODVER) |
|---|
| 57 | else |
|---|
| 58 | PANGO_MODVER_DEP := pango$(APIVER)-modver-$(MODVER) |
|---|
| 59 | endif |
|---|
| 60 | |
|---|
| 61 | # package names |
|---|
| 62 | SHARED_PKG := libpango$(APIVER)-$(SONAME) |
|---|
| 63 | UDEB_PKG := libpango$(APIVER)-udeb |
|---|
| 64 | COMMON_PKG := libpango$(APIVER)-common |
|---|
| 65 | DEV_PKG := libpango$(APIVER)-dev |
|---|
| 66 | DEBUG_PKG := libpango$(APIVER)-$(SONAME)-dbg |
|---|
| 67 | DOC_PKG := libpango$(APIVER)-doc |
|---|
| 68 | |
|---|
| 69 | # package groups, used in rule dependencies and in cleanup |
|---|
| 70 | BINARY_INDEP_PKGS := $(DOC_PKG) $(COMMON_PKG) |
|---|
| 71 | BINARY_ARCH_PKGS := $(SHARED_PKG) $(UDEB_PKG) $(DEV_PKG) $(DEBUG_PKG) |
|---|
| 72 | ALL_PKGS := $(BINARY_INDEP_PKGS) $(BINARY_ARCH_PKGS) |
|---|
| 73 | |
|---|
| 74 | # list of flavors we build; each gets a builddir, a configure pass (configure |
|---|
| 75 | # args are defined below), a build pass, and an install pass (in two steps) |
|---|
| 76 | # Note: the shared flavor is required |
|---|
| 77 | FLAVORS := shared static udeb |
|---|
| 78 | |
|---|
| 79 | # list of flavors to run the test suite on |
|---|
| 80 | CHECK_FLAVORS := $(filter shared, $(FLAVORS)) |
|---|
| 81 | |
|---|
| 82 | # build dir for the current flavor; this is only expanded in flavor specific |
|---|
| 83 | # targets |
|---|
| 84 | builddir = $(buildbasedir)/$* |
|---|
| 85 | buildbasedir = $(CURDIR)/debian/build |
|---|
| 86 | |
|---|
| 87 | # install dir for the current flavor; this is only expanded in flavor specific |
|---|
| 88 | # targets |
|---|
| 89 | installdir = $(installbasedir)/$* |
|---|
| 90 | installbasedir = $(CURDIR)/debian/install |
|---|
| 91 | |
|---|
| 92 | # configure flags |
|---|
| 93 | common_configure_flags := \ |
|---|
| 94 | --prefix=/usr \ |
|---|
| 95 | --libdir=/$(LIBDIR) \ |
|---|
| 96 | --mandir=\$${prefix}/share/man \ |
|---|
| 97 | --infodir=\$${prefix}/share/info \ |
|---|
| 98 | --with-html-dir=\$${prefix}/share/doc/$(DOC_PKG) \ |
|---|
| 99 | --sysconfdir=/etc \ |
|---|
| 100 | --build=$(DEB_BUILD_GNU_TYPE) |
|---|
| 101 | |
|---|
| 102 | ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
|---|
| 103 | common_configure_flags += --host=$(DEB_HOST_GNU_TYPE) |
|---|
| 104 | endif |
|---|
| 105 | |
|---|
| 106 | shared_configure_flags := $(common_configure_flags) \ |
|---|
| 107 | --enable-shared \ |
|---|
| 108 | --disable-static |
|---|
| 109 | static_configure_flags := $(common_configure_flags) \ |
|---|
| 110 | --disable-shared \ |
|---|
| 111 | --with-included-modules \ |
|---|
| 112 | --enable-static |
|---|
| 113 | udeb_configure_flags := $(common_configure_flags) \ |
|---|
| 114 | --without-x \ |
|---|
| 115 | --enable-shared \ |
|---|
| 116 | --disable-debug |
|---|
| 117 | |
|---|
| 118 | # macro computing the list of 'debian/<pkg>.*" files which have a corresponding |
|---|
| 119 | # ".in" file; pass the list of packages in $(1) |
|---|
| 120 | dh_subst_files = $(patsubst %.in,%,$(wildcard $(addprefix debian/, $(addsuffix *.in, $(1))))) |
|---|
| 121 | |
|---|
| 122 | debian/dh_pangomodules.1: debian/dh_pangomodules |
|---|
| 123 | cd debian && pod2man -c "Pango" -r "$(DEBVERSION)" dh_pangomodules dh_pangomodules.1 |
|---|
| 124 | |
|---|
| 125 | patch: $(STAMP_DIR)/patch-stamp |
|---|
| 126 | |
|---|
| 127 | $(STAMP_DIR)/patch-stamp: |
|---|
| 128 | dh_testdir |
|---|
| 129 | # apply patches |
|---|
| 130 | QUILT_PATCHES=$(PATCH_DIR) quilt --quiltrc /dev/null push -a || test $$? = 2 |
|---|
| 131 | # backup the original (potentially patched) files to restore them in |
|---|
| 132 | # the clean target |
|---|
| 133 | -test -r config.sub && cp config.sub config.sub.orig |
|---|
| 134 | -test -r config.guess && cp config.guess config.guess.orig |
|---|
| 135 | -test -r /usr/share/misc/config.sub && \ |
|---|
| 136 | cp -f /usr/share/misc/config.sub config.sub |
|---|
| 137 | -test -r /usr/share/misc/config.guess && \ |
|---|
| 138 | cp -f /usr/share/misc/config.guess config.guess |
|---|
| 139 | -mkdir -p $(STAMP_DIR) |
|---|
| 140 | touch $@ |
|---|
| 141 | |
|---|
| 142 | $(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp |
|---|
| 143 | dh_testdir |
|---|
| 144 | mkdir -p $(builddir) |
|---|
| 145 | cd $(builddir) && \ |
|---|
| 146 | CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ |
|---|
| 147 | $(CURDIR)/configure $($*_configure_flags) |
|---|
| 148 | touch $@ |
|---|
| 149 | |
|---|
| 150 | configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS)) |
|---|
| 151 | |
|---|
| 152 | $(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-% |
|---|
| 153 | dh_testdir |
|---|
| 154 | LD_LIBRARY_PATH=$(builddir)/pango/.libs:$(LD_LIBRARY_PATH) \ |
|---|
| 155 | $(MAKE) -C $(builddir) |
|---|
| 156 | touch $@ |
|---|
| 157 | |
|---|
| 158 | build: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS)) |
|---|
| 159 | |
|---|
| 160 | $(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-% |
|---|
| 161 | dh_testdir |
|---|
| 162 | # setting LD_LIBRARY_PATH for "make check" might be needed in the |
|---|
| 163 | # future, but doesn't seem necessary right now |
|---|
| 164 | #LD_LIBRARY_PATH=$(builddir)/pango/.libs:$(LD_LIBRARY_PATH) |
|---|
| 165 | # testsuite failures are ignored |
|---|
| 166 | -$(MAKE) -C $(builddir) check |
|---|
| 167 | touch $@ |
|---|
| 168 | |
|---|
| 169 | check: $(addprefix $(STAMP_DIR)/check-stamp-, $(CHECK_FLAVORS)) |
|---|
| 170 | |
|---|
| 171 | $(STAMP_DIR)/install-stamp-%: $(STAMP_DIR)/build-stamp-% |
|---|
| 172 | mkdir -p $(installdir) |
|---|
| 173 | $(MAKE) -C $(builddir) install \ |
|---|
| 174 | DESTDIR=$(installdir) |
|---|
| 175 | touch $@ |
|---|
| 176 | |
|---|
| 177 | install: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS)) |
|---|
| 178 | |
|---|
| 179 | # gross kludge to force control generation with the %.in target |
|---|
| 180 | clean:: |
|---|
| 181 | touch debian/control.in |
|---|
| 182 | |
|---|
| 183 | # always update debian/foo (do not rely on the timestamp of debian/control |
|---|
| 184 | # versus debian/control.in which might break with svn, svn-buildpackage, or |
|---|
| 185 | # dpkg-source) |
|---|
| 186 | debian/%: debian/%.in |
|---|
| 187 | dh_testdir |
|---|
| 188 | sed -e "s#@SONAME@#$(SONAME)#g" \ |
|---|
| 189 | -e "s#@APIVER@#$(APIVER)#g" \ |
|---|
| 190 | -e "s#@VERSION@#$(VERSION)#g" \ |
|---|
| 191 | -e "s#@PANGO_MODVER_DEP@#$(PANGO_MODVER_DEP)#g" \ |
|---|
| 192 | -e "s#@LIBDIR@#$(LIBDIR)#g" \ |
|---|
| 193 | -e "s#@MODULES_PATH@#$(MODULES_PATH)#g" \ |
|---|
| 194 | -e "s#@MODULE_FILES_D@#$(MODULE_FILES_D)#g" \ |
|---|
| 195 | -e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \ |
|---|
| 196 | $@.in >$@ |
|---|
| 197 | |
|---|
| 198 | clean:: debian/control |
|---|
| 199 | dh_testdir |
|---|
| 200 | dh_testroot |
|---|
| 201 | # remove install and build dirs |
|---|
| 202 | rm -rf $(installbasedir) |
|---|
| 203 | rm -rf $(buildbasedir) |
|---|
| 204 | # restore files from backup (before unpatching) |
|---|
| 205 | -test -r config.sub.orig && mv -f config.sub.orig config.sub |
|---|
| 206 | -test -r config.guess.orig && mv -f config.guess.orig config.guess |
|---|
| 207 | # unapply patches, if any |
|---|
| 208 | QUILT_PATCHES=$(PATCH_DIR) quilt --quiltrc /dev/null pop -a -R || test $$? = 2 |
|---|
| 209 | -rm -rf .pc |
|---|
| 210 | -rm -rf $(STAMP_DIR) |
|---|
| 211 | -rm -f $(call dh_subst_files,$(ALL_PKGS)) |
|---|
| 212 | -rm -f debian/dh_pangomodules debian/dh_pangomodules.1 |
|---|
| 213 | dh_clean |
|---|
| 214 | |
|---|
| 215 | maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check) |
|---|
| 216 | |
|---|
| 217 | binary-indep: build $(maybe_check) install $(call dh_subst_files,$(BINARY_INDEP_PKGS)) |
|---|
| 218 | dh_testdir |
|---|
| 219 | dh_testroot |
|---|
| 220 | dh_installdirs -i |
|---|
| 221 | dh_install -i |
|---|
| 222 | dh_installchangelogs -i ChangeLog ChangeLog.* |
|---|
| 223 | dh_installdocs -i NEWS README |
|---|
| 224 | dh_installman -i |
|---|
| 225 | dh_link -i |
|---|
| 226 | dh_compress -i -X.sgml -X.devhelp |
|---|
| 227 | dh_fixperms -i |
|---|
| 228 | dh_installdeb -i |
|---|
| 229 | dh_gencontrol -i |
|---|
| 230 | dh_md5sums -i |
|---|
| 231 | dh_builddeb -i |
|---|
| 232 | |
|---|
| 233 | binary-arch: build $(maybe_check) install $(call dh_subst_files,$(BINARY_ARCH_PKGS)) debian/dh_pangomodules debian/dh_pangomodules.1 |
|---|
| 234 | dh_testdir |
|---|
| 235 | dh_testroot |
|---|
| 236 | dh_install -s |
|---|
| 237 | # remove the rpath in libs and modules since a spurious /usr/lib RPATH |
|---|
| 238 | # appears on 64-bits arches which confuses dh_shlibdeps; the RPATH |
|---|
| 239 | # isn't needed in the udeb anyway as libcairo's udeb ships libs in |
|---|
| 240 | # /usr/lib; see #432258 |
|---|
| 241 | chrpath -d debian/$(UDEB_PKG)/$(LIBDIR)/*.so.* \ |
|---|
| 242 | debian/$(UDEB_PKG)/$(MODULES_PATH)/*.so |
|---|
| 243 | # Remove the thai module to avoid extraneous dependencies |
|---|
| 244 | rm -f debian/$(UDEB_PKG)/$(MODULES_PATH)/pango-thai-lang.so |
|---|
| 245 | # empty the dependency_libs in the *.la files |
|---|
| 246 | sed -i "/dependency_libs/ s/'.*'/''/" \ |
|---|
| 247 | debian/$(DEV_PKG)/$(LIBDIR)/*.la |
|---|
| 248 | dh_installchangelogs -s -N$(SHARED_PKG) -N$(DEV_PKG) ChangeLog ChangeLog.* |
|---|
| 249 | dh_installdocs -s -N$(SHARED_PKG) -N$(DEV_PKG) NEWS README |
|---|
| 250 | dh_installdefoma -s |
|---|
| 251 | # fix the permissions of the development package because it ships |
|---|
| 252 | # dh_pangomodules which we need to invoke in this build |
|---|
| 253 | dh_fixperms -p$(DEV_PKG) |
|---|
| 254 | # generate $(SHARED_PKG).modules for the shared lib |
|---|
| 255 | LD_LIBRARY_PATH=$(CURDIR)/debian/$(SHARED_PKG)/$(LIBDIR):$(LD_LIBRARY_PATH) \ |
|---|
| 256 | PANGO_QUERYMODULES=$(buildbasedir)/shared/pango/pango-querymodules \ |
|---|
| 257 | debian/$(DEV_PKG)/usr/bin/dh_pangomodules \ |
|---|
| 258 | -p$(SHARED_PKG) -k |
|---|
| 259 | # generate $(UDEB_PKG).modules for the udeb |
|---|
| 260 | LD_LIBRARY_PATH=$(CURDIR)/debian/$(UDEB_PKG)/$(LIBDIR):$(LD_LIBRARY_PATH) \ |
|---|
| 261 | PANGO_QUERYMODULES=$(buildbasedir)/udeb/pango/pango-querymodules \ |
|---|
| 262 | debian/$(DEV_PKG)/usr/bin/dh_pangomodules \ |
|---|
| 263 | -p$(UDEB_PKG) -k |
|---|
| 264 | dh_installinfo -s |
|---|
| 265 | dh_installman -s |
|---|
| 266 | dh_link -s |
|---|
| 267 | dh_strip -s --dbg-package=$(DEBUG_PKG) -N$(UDEB_PKG) |
|---|
| 268 | dh_strip -p$(UDEB_PKG) |
|---|
| 269 | dh_compress -s -X.sgml -X.devhelp |
|---|
| 270 | dh_fixperms -s |
|---|
| 271 | dh_makeshlibs -p$(SHARED_PKG) \ |
|---|
| 272 | -X$(MODULES_PATH) \ |
|---|
| 273 | -V '$(SHARED_PKG) (>= $(SHVERSION))' \ |
|---|
| 274 | --add-udeb=$(UDEB_PKG) |
|---|
| 275 | dh_installdeb -s |
|---|
| 276 | # override shlibs for libraries from this source before computing |
|---|
| 277 | # dependencies of packages generated from this source; we already have |
|---|
| 278 | # inter-dependencies expressed manually in the control file, we do not |
|---|
| 279 | # need the shlibs to add duplicates |
|---|
| 280 | sed -nr -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \ |
|---|
| 281 | debian/*/DEBIAN/shlibs \ |
|---|
| 282 | >debian/shlibs.local |
|---|
| 283 | dh_shlibdeps -s -N$(UDEB_PKG) |
|---|
| 284 | dh_shlibdeps -p$(UDEB_PKG) |
|---|
| 285 | -rm -f debian/shlibs.local |
|---|
| 286 | dh_gencontrol -s |
|---|
| 287 | dh_md5sums -s |
|---|
| 288 | dh_builddeb -s |
|---|
| 289 | |
|---|
| 290 | binary: binary-indep binary-arch |
|---|
| 291 | .PHONY: patch configure build check install clean binary-indep binary-arch binary |
|---|