1#!/bin/bash
2#
3#  Florence - Florence is a simple virtual keyboard for Gnome.
4#
5#  Copyright (C) 2008 François Agrech
6#
7#  This program is free software; you can redistribute it and/or modify
8#  it under the terms of the GNU General Public License as published by
9#  the Free Software Foundation; either version 2, or (at your option)
10#  any later version.
11#
12#  This program is distributed in the hope that it will be useful,
13#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15#  GNU General Public License for more details.
16#
17#  You should have received a copy of the GNU General Public License
18#  along with this program; if not, write to the Free Software Foundation,
19#  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20#
21
22export COMMAND="$0"
23
24# exit on missing command
25function fatal {
26	echo "You need the $1 command to execute $COMMAND. Please install $1 and rerun $COMMAND" >&2
27	exit 1
28}
29
30# check for the presence of a command
31function check {
32	hash $1 2>&- >/dev/null || fatal $1
33}
34
35# execute action and print a message
36function run {
37	check $1
38	echo "executing \"$*\""
39	eval $* >/dev/null
40}
41
42# go to project directory
43OLD_PWD=$PWD
44cd ${0%%/*}
45
46run aclocal
47CURR_PWD=$PWD
48run gnome-doc-prepare --force
49run glib-gettextize --force --copy
50run intltoolize --copy --force --automake
51run libtoolize
52run autoheader
53run automake --foreign --add-missing
54run autoconf
55
56cd data
57hash trang 2>&- >/dev/null
58if [ $? -eq 0 ]; then
59	run trang -I rnc -O rng florence.rnc relaxng/florence.rng
60	run trang -I rnc -O rng style.rnc relaxng/style.rng
61else
62	test "x$TRANGPATH" = "x" && echo "Please set the TRANGPATH environment variable." >&2 && exit 1
63	[ ! -e $TRANGPATH/trang.jar ] &&
64		echo "You need trang to execute $COMMAND. please install trand and rerun $COMMAND." &&
65		exit 1
66	run java -jar $TRANGPATH/trang.jar -I rnc -O rng florence.rnc relaxng/florence.rng
67	run java -jar $TRANGPATH/trang.jar -I rnc -O rng style.rnc relaxng/style.rng
68fi
69
70cd ../po
71run intltool-update -r
72run intltool-update -p
73
74cd ../docs
75LINGUAS="fr ru"
76for lang in $LINGUAS
77do
78	run xml2po -u $lang/$lang.po C/florence.xml
79done
80run xml2po -o userdoc.pot C/florence.xml
81
82# go back
83cd $OLD_PWD
84
85