annotate setup-gettext @ 3419:284a0ad6a7f0

[gaim-migrate @ 3441] We don't need that quoted variable anymore. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 24 Aug 2002 01:10:43 +0000
parents d7c90e6ecc23
children bd05f8566531
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3414
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 #!/bin/sh
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 VERSION=0.1.0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 parse_gettext_version() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'`
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'`
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 find_gettext() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 GETTEXT_TOOL=autopoint
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 GETTEXT_TOOL=gettextize
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 (gettextize --version) < /dev/null > /dev/null 2>&1 || {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 GETTEXT_TOOL=
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 backup_m4() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 [ -d m4 ] && mv m4 m4~
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 restore_m4() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 [ -d m4~ ] && {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 rm -rf m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 mv m4~ m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 restore_files() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 [ -e configure.in~ ] && mv -f configure.in~ configure.in
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 [ -e configure.ac~ ] && mv -f configure.ac~ configure.ac
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 [ -e Makefile.am~ ] && mv -f Makefile.am~ Makefile.am
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 abort() {
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 restore_files
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 restore_m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 exit 1
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 }
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 # Main code
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 find_gettext
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 # See if a version of gettext and its tools are installed.
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 if [ x$GETTEXT_TOOL == x ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 echo
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 echo "You do not have a version of gettext installed."
3415
d7c90e6ecc23 [gaim-migrate @ 3434]
Christian Hammond <chipx86@chipx86.com>
parents: 3414
diff changeset
56 echo "Please download one from your local package repository or"
3414
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 echo
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 exit 1
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 fi
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 parse_gettext_version
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 NUMVAR=$#
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 if [ $NUMVAR -gt 0 ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 if [ $NUMVAR -gt 1 ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 echo "Only one option at a time!"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 exit 1
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 elif [ $1 == "--gettext-tool" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 echo $GETTEXT_TOOL
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 elif [ $1 == "--help" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 echo "setup-gettext v$VERSION"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 echo "Usage:"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 echo " --gettext-tool Returns gettextize or autopoint, depending"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 echo " on the version of gettext installed."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 echo " --gettext-version Returns the version of gettext installed."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 echo " --gettext-major-version Returns the major version of gettext installed."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 echo " --gettext-minor-version Returns the minor version of gettext installed."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 echo " --gettext-micro-version Returns the micro version of gettext installed."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 echo " --help Displays this help screen."
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 echo
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 elif [ $1 == "--version" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 echo $VERSION
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 elif [ $1 == "--gettext-version" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 echo $GETTEXT_VERSION
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 elif [ $1 == "--gettext-major-version" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 echo $GETTEXT_MAJOR_VERSION
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 elif [ $1 == "--gettext-minor-version" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 echo $GETTEXT_MINOR_VERSION
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 elif [ $1 == "--gettext-micro-version" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 echo $GETTEXT_MICRO_VERSION
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 elif [ $1 == "--happy-url" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 echo http://gaim.sf.net/forkgettext.jpg
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 exit 0
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 else
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 echo "Invalid option '$1'"
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 exit 1
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 fi
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 fi
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 # Okay, run the main stuff
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 if [ "$GETTEXT_TOOL" == "autopoint" ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 backup_m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 echo n | autopoint --force || abort
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 restore_m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 else
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 backup_m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 # Gettext is pure evil. It DEMANDS that we press Return no matter
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 # what. This gets rid of their happy "feature" of doom.
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 chmod +x .temp-gettextize
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 rm .temp-gettextize
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 restore_files
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 restore_m4
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 [ -e po/Makevars.template ] && mv po/Makevars.template po/Makevars
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 else
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 echo n | gettextize --copy --force || exit;
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 fi
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 fi
4149e5e36eb9 [gaim-migrate @ 3433]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142