aboutsummaryrefslogtreecommitdiffstats
path: root/po-mageia/Makefile
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2020-07-30 22:10:35 +0200
committerOlav Vitters <olav@vitters.nl>2020-07-30 22:10:35 +0200
commita5c52c00c16be69e14360222520129d30f76e042 (patch)
treed44ff9f87b2985ead827c72c55b5aaee23c5dd10 /po-mageia/Makefile
parent817ca842f086f7290f183720539834263c2f1afe (diff)
downloadinitscripts-a5c52c00c16be69e14360222520129d30f76e042.tar
initscripts-a5c52c00c16be69e14360222520129d30f76e042.tar.gz
initscripts-a5c52c00c16be69e14360222520129d30f76e042.tar.bz2
initscripts-a5c52c00c16be69e14360222520129d30f76e042.tar.xz
initscripts-a5c52c00c16be69e14360222520129d30f76e042.zip
Align Makefile and tree structure with upstream tree structure
Instead of placing the custom files with the upstream files it seems clearer to have them mostly separated. This makes it easier to see which parts are custom and which parts are more or less upstream. As a result the upstream Makefile only needed minor changes to accomodate this. The Makefile is NOT bug free, unfortunately it doesn't always do the right thing, this due to inexperience.
Diffstat (limited to 'po-mageia/Makefile')
-rw-r--r--po-mageia/Makefile108
1 files changed, 108 insertions, 0 deletions
diff --git a/po-mageia/Makefile b/po-mageia/Makefile
new file mode 100644
index 00000000..01f6540f
--- /dev/null
+++ b/po-mageia/Makefile
@@ -0,0 +1,108 @@
+# Basic Makefile for compiling & installing the files.
+#
+# Supports standard GNU Makefile variables for specifying the paths:
+# * prefix
+# * exec_prefix
+# * bindir
+# * sbindir
+# * libdir
+# * datarootdir
+# * datadir
+# * mandir
+# * sysconfdir
+# * localstatedir
+# * DESTDIR
+#
+
+SHELL = /bin/bash
+
+# Normally /usr/local is used. However, it does not make sense for us to use it
+# here, as it just complicates things even further.
+prefix = /usr
+exec_prefix = $(prefix)
+bindir = $(prefix)/bin
+sbindir = $(prefix)/sbin
+libdir = $(prefix)/lib
+libexecdir = $(exec_prefix)/libexec
+datarootdir = $(prefix)/share
+datadir = $(datarootdir)
+mandir = $(datadir)/man
+sysconfdir = /etc
+localstatedir = /var
+sharedstatedir = $(localstatedir)/lib
+INSTALLNLSDIR = $(prefix)/share/locale
+
+INSTALL= /usr/bin/install -c
+INSTALL_PROGRAM= ${INSTALL}
+INSTALL_DATA= ${INSTALL} -m 644
+RPMROOT=/mnt/BIG/dis/cooker/i586/media
+
+MSGMERGE = msgmerge
+
+NLSPACKAGE = initscripts
+
+CATALOGS = $(shell ls *.po)
+FMTCATALOGS = $(patsubst %.po,%.mo,$(CATALOGS))
+
+all: $(FMTCATALOGS)
+
+POTFILES:
+ rm -f etc/init.d/* etc/rc.d/init.d/*
+ for i in `find $(RPMROOT)/*/release -name '*.rpm' \! -path '$(RPMROOT)/debug*'`; do \
+ rpm2cpio $$i | cpio --quiet -id './etc/rc.d/init.d/*' './etc/init.d/*'; \
+ done
+ mv etc/init.d/* etc/rc.d/init.d/
+
+pot $(NLSPACKAGE).pot: POTFILES
+ rm -rf etc/sysconfig etc/rc.d/rc*
+ mkdir -p etc/rc.d etc/sysconfig/network-scripts
+ cp ../../sysconfig/network-scripts/* etc/sysconfig/network-scripts/
+ cp ../../rc.d/rc* etc/rc.d/
+ ./gprintify.py etc/rc.d/rc* etc/sysconfig/network-scripts/* etc/rc.d/init.d/*
+ ./xgettext_sh.py `find etc -type f` > $(NLSPACKAGE).po
+ sed -i -e '/^#:/s|etc/|/etc/|g' -e "s/=CHARSET/=utf-8/" $(NLSPACKAGE).po
+ msgattrib -F $(NLSPACKAGE).po -o $(NLSPACKAGE).po
+ msgcat EXTRA_STRINGS $(NLSPACKAGE).po --use-first > $(NLSPACKAGE).tmp.po
+ if cmp -s $(NLSPACKAGE).tmp.po $(NLSPACKAGE).pot; then \
+ rm -f $(NLSPACKAGE).tmp.po; \
+ else \
+ mv $(NLSPACKAGE).tmp.po $(NLSPACKAGE).pot; \
+ fi
+ rm -rf $(NLSPACKAGE).po etc/sysconfig etc/rc.d/rc*
+
+update-po: $(NLSPACKAGE).pot refresh-po
+
+refresh-po:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ lang=`basename $$cat .po`; \
+ if $(MSGMERGE) $$lang.po $(NLSPACKAGE).pot > $$lang.pot ; then \
+ mv -f $$lang.pot $$lang.po ; \
+ echo "$(MSGMERGE) of $$lang succeeded" ; \
+ else \
+ echo "$(MSGMERGE) of $$lang failed" ; \
+ rm -f $$lang.pot ; \
+ fi \
+ done
+
+clean:
+ rm -f *mo *.pyc
+
+distclean: clean
+ rm -f .depend Makefile
+
+depend:
+
+install: all
+ mkdir -p $(DESTDIR)$(INSTALLNLSDIR)
+ for n in $(CATALOGS); do \
+ l=`basename $$n .po`; \
+ mo=$$l.mo; \
+ $(INSTALL) -m 755 -d $(DESTDIR)$(INSTALLNLSDIR)/$$l; \
+ $(INSTALL) -m 755 -d $(DESTDIR)$(INSTALLNLSDIR)/$$l/LC_MESSAGES; \
+ $(INSTALL) -m 644 $$mo \
+ $(DESTDIR)$(INSTALLNLSDIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
+ done
+
+%.mo: %.po
+ sed 's/$[a-zA-Z0-9_{}]*/%s/g' < $< | msgfmt -o $@ -