#!/usr/bin/make -f # ICU debian/rules that uses debhelper. # The Debian packages for ICU are created and maintained by # Yves Arrouye . They are part of Debian GNU/Linux # since the Debian woody release. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatability version to use. export DH_COMPAT=2 #firstdir := $(shell sed -n 's/Package: \(.*\)/\1/p' debian/control | head -1) # Where the source for ICU is, where to build srcdir = source builddir = build # How to get to $(srcdir) from $(builddir) builddir_relative_topdir = .. builddir_relative_srcdir = $(builddir_relative_topdir)/$(srcdir) # Getting the ICU version numbers, stolen from configure.in (that's okay, I # wrote the configure.in part anyway) version := $(shell sed -n 's/^[ ]*\#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' $(srcdir)/common/unicode/utypes.h) lib_version := $(shell echo $(version) | sed -e 's/\.//' -e 's/^\([^.]*\)$$/\1.0/') lib_version_major := $(shell echo $(lib_version) | sed 's/\..*//') # ICU installation directories, w/o the initial slash pkgdatadir = usr/share/icu icudatadir = $(pkgdatadir)/$(version) pkglibdir = usr/lib/icu iculibdir = $(pkglibdir)/$(version) datasrcdir = usr/share/icu/$(version)/data # shared library versions, option 1 version:=$(shell sed -n 's/^[ ]*\#[ ]*define[ ]*U_ICU_VERSION[ ]*"\([^"]*\)".*/\1/p' $(srcdir)/common/unicode/utypes.h) major:=$(shell echo $(version) | sed -e 's/\.//' -e 's/\..*//') # option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so #version=`ls src/.libs/lib*.so.* | \ # awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` #major=`ls src/.libs/lib*.so.* | \ # awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` # Build flags CFLAGS = -O2 # -Wall CXXFLAGS = -O2 # -Wall INSTALL_PROGRAM = /usr/bin/install ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g CXXFLAGS += -g endif ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif all: build configure: $(builddir)/configure-stamp $(builddir)/configure-stamp: # Add here commands to configure the package. test -d $(builddir) || mkdir $(builddir) cd $(builddir); CFLAGS='$(CFLAGS)' CXXFLAGS='$(CFLAGS)' INSTALL_PROGRAM='$(INSTALL_PROGRAM)' $(builddir_relative_srcdir)/configure --srcdir=$(builddir_relative_srcdir) --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --with-data-packaging=files --disable-rpath --enable-shared --enable-static --disable-samples touch $@ build: $(builddir)/configure-stamp debian-files $(builddir)/build-stamp # Build some Debian files DEBIAN_FILES=control icu.conffiles postinst prerm icu.postinst icu.prerm libicu$(lib_version_major).postinst debian/%: debian/%.in cd $(builddir) \ && CONFIG_FILES=$(builddir_relative_topdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status debian/libicu$(lib_version_major).%: debian/libicu.% cp $< $@ debian-files: $(addprefix debian/,$(DEBIAN_FILES)) $(builddir)/build-stamp: dh_testdir # Add here commands to compile the package. $(MAKE) -C $(builddir) touch $@ clean: dh_testdir dh_testroot $(RM) $(builddir)/build-stamp $(builddir)/configure-stamp # Add here commands to clean up after the build process. -$(MAKE) -C $(builddir) distclean #-$(RM) `find $(builddir)/samples $(builddir)/test -name Makefile -print` -$(RM) `find $(builddir) -name Makefile -print` dh_clean $(RM) $(addprefix debian/,$(DEBIAN_FILES)) $(RM) debian/*docs if test -d $(builddir) -a $(builddir) != $(srcdir); then rmdir `find $(builddir) -type d -print | sort -r`; fi install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/tmp $(MAKE) -C $(builddir) install DESTDIR=`pwd`/debian/tmp # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install # dh_testversion dh_testdir dh_testroot rm debian/tmp/usr/sbin/gentest # # build libicu${major} package by moving files from icu-dev # dh_movefiles -plibicu$(major) \ usr/lib/libicuuc.so.* \ usr/lib/libicui18n.so.* \ usr/lib/libicutoolutil.so.* \ usr/lib/libustdio.so.* # # build icu package by moving files from icu-dev # dh_movefiles -picu \ etc \ usr/sbin \ $(icudatadir)/README \ $(iculibdir)/*.cnv \ $(iculibdir)/u*.dat \ $(iculibdir)/tz.dat \ usr/share/man rm debian/tmp/$(pkglibdir)/current rm debian/tmp/$(iculibdir)/cnvalias.dat # # build icu-locales package by moving files from icu-dev # dh_movefiles -picu-locales \ $(iculibdir)/*.res \ $(iculibdir)/*.brk # # build icu-data from the source data # test -d debian/icu-data/$(datasrcdir) || \ mkdir -p debian/icu-data/$(datasrcdir) install -m 644 $(srcdir)/../data/ucname.txt \ $(srcdir)/../data/*.ucm \ debian/icu-data/$(datasrcdir) test -d debian/icu-data/$(datasrcdir)/unidata || \ mkdir -p debian/icu-data/$(datasrcdir)/unidata install -m 644 $(srcdir)/../data/unidata/*.* \ debian/icu-data/$(datasrcdir)/unidata unidatafile=`(cd $(srcdir)/../data; ls UnicodeData*.txt)`; cd debian/icu-data/$(datasrcdir) && ln -s unidata/UnicodeData.txt $$unidatafile # # build icu-i18ndata from the source data # test -d debian/icu-i18ndata/$(datasrcdir) || \ mkdir -p debian/icu-i18ndata/$(datasrcdir) install -m 644 $(srcdir)/../data/*.txt \ $(srcdir)/../data/*.brk \ debian/icu-i18ndata/$(datasrcdir) cd debian/icu-i18ndata/$(datasrcdir) && \ $(RM) convrtrs.txt UnicodeData*.txt ucname.txt # # move the rest of the development files # in their package # dh_movefiles usr # # do a bit of cleanup # rm -rf debian/tmp/etc debian/tmp/usr/sbin \ debian/tmp/usr/share/man # # continue to prepare packages # # dh_installdebconf dh_installdocs docs dh_installexamples $(srcdir)/samples/* dh_installmenu # dh_installemacsen # dh_installpam # dh_installinit dh_installcron dh_installmanpages -picu dh_installinfo dh_undocumented -picu genccode.8 gencmn.8 gennames.8 \ genprops.8 gentz.8 pkgdata.8 dh_installchangelogs dh_link dh_strip dh_compress dh_fixperms # You may want to make some executables suid here. dh_suidregister dh_makeshlibs dh_installdeb # dh_perl dh_shlibdeps && \ sed 's/ libicu$(lib_version_major)[^,]*,//' debian/libicu$(major).substvars >debian/libicu$(major).substvars.new && mv debian/libicu$(major).substvars.new debian/libicu$(major).substvars dh_gencontrol -- -Vversion=$(version) -Vmajor=$(major) dh_md5sums dh_builddeb # Automatically update changelog update-changelog: cvers=`sed -n 's/^icu (\([^)]*\)).*/\1/p' debian/changelog | head -1`; if dpkg --compare-versions $$cvers lt $(version)-1; then \ dch -v $(version)-1 "Update to ICU version $(version)."; \ fi binary: update-changelog binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian-files update-changelog