#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 ## We add later the locale name to each TARGETDIR DEBIAN_DIR = $(CURDIR)/debian SRC_DIR = $(CURDIR)/src TARGETDIR_LC=$(DEBIAN_DIR)/language-pack-extra- LOCALE_DIR=/usr/share/locale/ PKG_ES=$(shell pwd)/debian/language-pack-extra-es FIREFOX_ADDON_DIR=$(PKG_ES)/usr/lib/firefox-addons/extensions # Only oficially released ZIP ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. #-$(MAKE) clean @set -e ; echo "Clean-up" ; \ RM_DIRS="`find $(DEBIAN_DIR) -mindepth 1 -maxdepth 1 -type d -name "language-pack-extra-*"`" ; \ for dir in $${RM_DIRS} ; do \ rm -rf $${dir} ; \ done @set -e; if ! diff $(DEBIAN_DIR)/locales.supported $(DEBIAN_DIR)/locales.list > /dev/null ; then \ echo "--------------------------------------------------------------" ; \ echo "Supported locales and generated packages locales do not match" ; \ echo "You have to execute fakeroot debian/rules update maybe" ; \ echo "--------------------------------------------------------------" ; \ exit 1 ; \ fi dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs @set -e; LANGUAGES="`cat $(DEBIAN_DIR)/locales.supported`" ; \ for locale in $${LANGUAGES} ; do \ SRC_FILES="`find $(SRC_DIR)/$${locale} -mindepth 1 -maxdepth 1 -name "*.po"`" ; \ lang="`echo $${locale} | cut -d"_" -f1`" ; \ dest_dir="$(TARGETDIR_LC)$${lang}/usr/share/lintian/overrides/" ; \ mkdir -p $${dest_dir} ; \ sed "s/LANG/$${lang}/g;s/LOCALE/$${locale}/g" $(DEBIAN_DIR)/templates/override.template >> \ $(DEBIAN_DIR)/language-pack-extra-$${lang}/usr/share/lintian/overrides/language-pack-extra-$${lang} ; \ mkdir -p "$(TARGETDIR_LC)$${lang}$(LOCALE_DIR)$${locale}.UTF-8" ; \ ln -sf $${locale}.UTF-8 $(TARGETDIR_LC)$${lang}$(LOCALE_DIR)$${locale}.UTF8 ; \ ln -sf $${locale}.UTF-8 $(TARGETDIR_LC)$${lang}$(LOCALE_DIR)$${locale}.utf-8 ; \ ln -sf $${locale}.UTF-8 $(TARGETDIR_LC)$${lang}$(LOCALE_DIR)$${locale}.utf8 ; \ dest_dir="$(TARGETDIR_LC)$${lang}$(LOCALE_DIR)$${locale}.UTF-8/LC_MESSAGES/" ; \ mkdir -p $${dest_dir} ; \ for file in $${SRC_FILES} ; do \ out_file=`basename $${file} | sed -e "s/\.po/\.mo/"` ; \ echo "Processing file `basename $${file}` for locale $${locale}" ; \ msgfmt $${file} -o $${dest_dir}/$${out_file} ; \ done ; \ done ln -sf "${LOCALE_DIR}qcv_ES.UTF-8" "debian/language-pack-extra-qcv${LOCALE_DIR}qcv_ES" # Install Firefox 4 spanish translations # cd data; \ # find -type f -name '*firefox*.xpi' -exec install -D -m 644 "{}" "$(FIREFOX_ADDON_DIR)/`basename {}`" \; # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs dh_installdocs dh_link dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb # Build architecture-dependent files here. binary-arch: build install # We have nothing to do because architecture is all. clean-zips: dh_testdir rm -f $(CURDIR)/zips/* update: create-source-dirs update-debian-files update-changelog create-source-dirs: @set -e; for dir in `cat $(DEBIAN_DIR)/locales.supported` ; \ do \ mkdir -p $(SRC_DIR)/$${dir} ; \ done update-debian-files: cp -f $(CURDIR)/debian/templates/control.template $(CURDIR)/debian/control -mv -f $(CURDIR)/debian/locales.list $(CURDIR)/debian/locales.list.old @set -e; LOCALES="`cat $(DEBIAN_DIR)/locales.supported`" ; \ for locale in $${LOCALES} ; do \ if [ ! -d "$(SRC_DIR)/$${locale}" ] ; then \ echo "Some source directory missing. Execute fakeroot debian/rules create-source-dirs after" ; \ exit 1 ; \ else \ CURLOCALE="$${locale}" ; \ CURLANG=`echo $${CURLOCALE} | cut -d"_" -f1` ; \ CURLOCALESMALL=`echo $${CURLANG} | tr '[:upper:]' '[:lower:]'` ; \ CURLANGXPATH=`xpath -q -e "//*[@iso_639_1_code=\"$$CURLANG\"]/@name" /usr/share/xml/iso-codes/iso_639.xml` ; \ [ "$${CURLANG}" = "qcv" ] && CURLANGXPATH=" name=\"Valencian\"" ; \ [ "$${CURLANG}" = "ca" ] && CURLANGXPATH=" name=\"Catalan\"" ; \ CURLANGNAME="`echo $${CURLANGXPATH} | sed 's/name=//;s/"//g'`" ; \ if [ -e $(CURDIR)/debian/templates/$${CURLOCALESMALL}/control ] ; \ then cat $(CURDIR)/debian/templates/$${CURLOCALESMALL}/control >> $(CURDIR)/debian/control ; \ else \ sed "s/CURLOCALESMALL/$${CURLOCALESMALL}/g;s/CURLOCALE/$${CURLOCALE}/g;s/CURLANGNAME/$${CURLANGNAME}/g;s/CURLANG/$${CURLANG}/g" \ $(CURDIR)/debian/templates/package.template >> $(CURDIR)/debian/control; \ fi; \ echo $${CURLOCALE} >> $(CURDIR)/debian/locales.list ; \ if [ -e $(CURDIR)/debian/templates/$${CURLOCALESMALL}/README.Debian ] ;\ then cp -f $(CURDIR)/debian/templates/$${CURLOCALESMALL}/README.Debian $(CURDIR)/debian/language-pack-extra-$${CURLOCALESMALL}.README.Debian ; \ fi ; \ fi ; \ done update-changelog: @set -e; ADDED="`diff $(DEBIAN_DIR)/locales.list.old $(DEBIAN_DIR)/locales.list | sed -n "/^>/ s%> %%p" | tr "\n" " " `" ; \ CONTENT_ADDED="" ; \ for d in $${ADDED} ; do \ CONTENT_ADDED="Extra translations for locale $${d} added @ $${CONTENT_ADDED}" ; \ done ; \ REMOVED="`diff $(DEBIAN_DIR)/locales.list.old $(DEBIAN_DIR)/locales.list | sed -n "/^