Skip to content

Commit

Permalink
wescamp.py: Initialize build-system
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed Oct 13, 2012
1 parent e1c905e commit 6982c5a
Show file tree
Hide file tree
Showing 66 changed files with 42,346 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Makefile
@@ -0,0 +1,55 @@
include campaign.def

LANGS=$(shell cat po/LINGUAS)
POFILES=${LANGS:=.po}
DUMMYPOFILES=${LANGS:=.nop}
UPDATEPOFILES=${LANGS:=.po-update}
GMOFILES=${LANGS:=.gmo}
CATALOGS=${LANGS:=.gmo}

all: setup
cd po && (make update-po || (make clean && false))
for locale in `cat po/LINGUAS`; do \
if test -f po/$${locale}.gmo; then \
mkdir -p ${CAMPAIGN}/translations/$${locale}/LC_MESSAGES ;\
cp po/$${locale}.gmo ${CAMPAIGN}/translations/$${locale}/LC_MESSAGES/${DOMAIN}.mo ;\
else \
rm -f ${CAMPAIGN}/translations/$${locale}/LC_MESSAGES/${DOMAIN}.mo; \
if test -d ${CAMPAIGN}/translations/$${locale}; then \
rmdir ${CAMPAIGN}/translations/$${locale}/LC_MESSAGES; \
rmdir ${CAMPAIGN}/translations/$${locale}; \
fi; \
fi; \
done
cd po && make clean

# The comment-remove command is seperate from the Makevars insertion line.
# This arrangement allows for comments from Makevars to be stripped too.
setup:
sed < po/Makefile.in.in > po/Makefile \
-e "s/@CAMPAIGN@/${CAMPAIGN}/" \
-e "s/@PACKAGE@/${DOMAIN}/" \
-e "s/@BRANCH@/${BRANCH}/" \
-e "s/@srcdir@/./" \
-e "s/@top_srcdir@/../" \
-e "s,@MSGFMT@,msgfmt," \
-e "s,@MSGMERGE@,msgmerge," \
-e "s/@POFILES@/${POFILES}/" \
-e "s/@DUMMYPOFILES@/${DUMMYPOFILES}/" \
-e "s/@UPDATEPOFILES@/${UPDATEPOFILES}/" \
-e "s/@GMOFILES@/${GMOFILES}/" \
-e "s/@CATALOGS@/${CATALOGS}/" \
-e "/Makevars gets inserted here/ r po/Makevars"
sed -i po/Makefile -e "/^[ \t]*#/d"

mostlyclean:
-cd po && make mostlyclean

clean:
-cd po && make clean

distclean:
-cd po && make distclean

realclean: distclean
rm -rf ${CAMPAIGN}/translations
1 change: 1 addition & 0 deletions build-system.version
@@ -0,0 +1 @@
7c0fe253b224965bd73d4fd6d8b6fb104dfc5007
3 changes: 3 additions & 0 deletions campaign.def
@@ -0,0 +1,3 @@
CAMPAIGN=Troubled_Times
DOMAIN=wesnoth-Troubled_Times
BRANCH=1.12
7 changes: 7 additions & 0 deletions po/FINDCFG
@@ -0,0 +1,7 @@
find . \( -name '* *' \) -exec echo Filename with spaces found: '{}' \; >&2
if test 0 -ne `find . -name '* *.cfg' -or -name '* *.lua'|wc -l`; then
echo filename-with-spaces-found
exit 1
fi
find . -name '*.cfg' -print
find . -name '*.lua' -print
1 change: 1 addition & 0 deletions po/LINGUAS
@@ -0,0 +1 @@
af ang ang@latin ar bg ca ca_ES@valencia cs da de el en_GB en@shaw es eo et eu fi fr fur_IT ga gd gl he hr hu id is it ja ko la lt lv mk mr nl nb_NO pl pt pt_BR racv ro ru sk sl sr sr@ijekavian sr@ijekavianlatin sr@latin sv tl tr uk vi zh_CN zh_TW
173 changes: 173 additions & 0 deletions po/Makefile.in.in
@@ -0,0 +1,173 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License but which still want to provide support for the GNU gettext
# functionality.
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.14.1-5
# Modified by Yann Dirson for Battle for Wesnoth, for:
# - WML files support
# - proper behaviour when msgfmt is missing
# - support for relative localedir

CAMPAIGN = @CAMPAIGN@
PACKAGE = @PACKAGE@
BRANCH = @BRANCH@

SHELL = /bin/sh

srcdir = @srcdir@
top_srcdir = @top_srcdir@

MSGFMT = @MSGFMT@
WMLXGETTEXT := $(top_srcdir)/utils/wmlxgettext
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update

POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@

CATALOGS = @CATALOGS@

# Makevars gets inserted here. (Don't remove this line!)

.SUFFIXES: .po .gmo .sed .sin .nop .po-update

all:
@echo "Run make in the directory below instead"

.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(MSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po 2>&1 | tee $${lang}.stats && if test -e t-$${lang}.gmo; then mv t-$${lang}.gmo $${lang}.gmo; fi; \
if grep '^0 translated' $${lang}.stats; then \
rm $${lang}.gmo; \
fi; \
rm -f $${lang}.stats

# Strips comments from .sin and generates .sed
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@

# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
$(DOMAIN).pot-update: $(srcdir)/remove-potcdate.sed
if ! test -r $(srcdir)/FINDCFG; then \
echo "FINDCFG is missing" 1>&2; \
exit 1; \
fi;
if ! ${WMLXGETTEXT} --directory=$(top_srcdir) --domain=$(DOMAIN) \
`cd $(top_srcdir) && sh $(subdir)/FINDCFG` > $(DOMAIN).wml.po ; then \
echo "${WMLXGETTEXT} failed" 1>&2; \
exit 1; \
fi
if test -f $(DOMAIN).wml.po ; then \
mv $(DOMAIN).wml.po $(DOMAIN).po ;\
fi
rm -f $(DOMAIN).wml.po
# Fill in Project-Id-Version
sed -i 's/PACKAGE VERSION/$(CAMPAIGN)-$(BRANCH)/g' $(DOMAIN).po;
# Remove Report-To target
sed -i 's/http:\/\/bugs.wesnoth.org\//$(MSGID_BUGS_ADDRESS)/g' $(DOMAIN).po;
# Strip the timestamp and see if the result differs from the old file.
# If it does, replace the old file.
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
else \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
}
if test 1 -ge `grep msgid $(srcdir)/$(DOMAIN).pot | wc -l`; then \
echo "Translation catalog empty" >&2; \
exit 1; \
fi;

# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
$(srcdir)/$(DOMAIN).pot:
$(MAKE) $(DOMAIN).pot-update

# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot 2>&1; \
else \
echo "$${lang}.po is missing. You should probably update the build system" >&2; \
fi

info dvi ps pdf html tags TAGS ctags CTAGS ID:

mostlyclean:
rm -f remove-potcdate.sed
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -f *.gmo
rm -f *.po~
rm -f *.wml.po

clean: mostlyclean
rm -f Makefile

distclean: clean

update-po:
$(MAKE) $(DOMAIN).pot-update
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
$(MAKE) update-gmo

# General rule for updating PO files.

.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po 2>&1; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi

$(DUMMYPOFILES):

update-gmo: $(GMOFILES)
@:

force:

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
32 changes: 32 additions & 0 deletions po/Makevars
@@ -0,0 +1,32 @@
# Makefile variables for PO directory in any package using GNU gettext.

# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
WMLXGETTEXT := wmlxgettext

# This variable depends on the location of this directory.
subdir = po

# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright.
COPYRIGHT_HOLDER =

# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =

0 comments on commit 6982c5a

Please sign in to comment.