Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / examples / po / xsmallpot.sh
1 #!/bin/sh
2 # Usage: xsmallpot.sh srcdir hello-foo [hello-foobar.pot]
3
4 set -e
5
6 # Nuisances.
7 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
8
9 test $# = 2 || test $# = 3 || { echo "Usage: xsmallpot.sh srcdir hello-foo [hello-foobar.pot]" 1>&2; exit 1; }
10 srcdir=$1
11 directory=$2
12 potfile=${3-$directory.pot}
13
14 abs_srcdir=`cd "$srcdir" && pwd`
15
16 cd ..
17 rm -rf tmp-$directory
18 cp -p -r "$abs_srcdir"/../$directory tmp-$directory
19 chmod -R u+w tmp-$directory
20 cd tmp-$directory
21 case $directory in
22   hello-c++-kde)
23     cat > configure.ac <<EOF
24 AC_INIT
25 AC_CONFIG_AUX_DIR(admin)
26 AM_INIT_AUTOMAKE([$directory], 0)
27 AC_PROG_CXX
28 AM_GNU_GETTEXT([external])
29 AM_GNU_GETTEXT_VERSION(0.15)
30 AC_CONFIG_FILES([po/Makefile.in])
31 AC_CONFIG_FILES([Makefile])
32 AC_CONFIG_FILES([m4/Makefile])
33 AC_OUTPUT
34 EOF
35     aclocal -I m4
36     autopoint -f
37     autoconf
38     automake -a -c
39     ./configure
40     ;;
41   hello-objc-gnustep)
42     ./autogen.sh
43     ;;
44   *)
45     grep '^\(AC_INIT\|AC_CONFIG\|AC_PROG_\|AC_SUBST(.*OBJC\|AM_INIT\|AM_CONDITIONAL\|AM_GNU_GETTEXT\|AM_PO_SUBDIRS\|AC_OUTPUT\)' configure.ac > tmp-configure.ac
46     mv -f tmp-configure.ac configure.ac
47     ./autogen.sh
48     ./configure
49     ;;
50 esac
51 cd po
52 make $potfile
53 sed -e "/^#:/ {
54 s, \\([^ ]\\), $directory/\\1,g
55 }" < $potfile > ../../po/$potfile
56 cd ..
57 cd ..
58 rm -rf tmp-$directory