Mercurial > pidgin
annotate setup-gettext @ 8715:4d15f11024bd
[gaim-migrate @ 9470]
leave me alone. marv suggested this.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 19 Apr 2004 21:47:36 +0000 |
parents | afd6b3185274 |
children | 904d03bfccce |
rev | line source |
---|---|
3414 | 1 #!/bin/sh |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
2 # |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
3 # setup-gettext - Provides compatibility with versions of gettext |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
4 # from the 0.10.x, 0.11.x, and 0.12.x series. |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
5 # |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
6 # Copyright (C) 2002 Christian Hammond. |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
7 # |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
8 # This program is free software; you can redistribute it and/or |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
9 # modify it under the terms of the GNU General Public License as |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
10 # published by the Free Software Foundation; either version 2 of |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
11 # the License, or (at your option) any later version. |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
12 # |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
13 # This program is distributed in the hope that it will be useful, |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
16 # GNU General Public License for more details. |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
17 # |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
18 # You should have received a copy of the GNU General Public |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
19 # License along with this program; if not, write to the Free |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
20 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
21 # MA 02111-1307 USA |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
22 # |
3414 | 23 |
8065
afd6b3185274
[gaim-migrate @ 8761]
Christian Hammond <chipx86@chipx86.com>
parents:
6749
diff
changeset
|
24 VERSION=0.1.6 |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
25 |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
26 VERBOSE=0 |
3414 | 27 |
28 parse_gettext_version() { | |
29 GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'` | |
30 GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'` | |
31 GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'` | |
32 GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'` | |
33 } | |
34 | |
35 find_gettext() { | |
36 GETTEXT_TOOL=autopoint | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
37 |
3414 | 38 (autopoint --version) < /dev/null > /dev/null 2>&1 || { |
39 GETTEXT_TOOL=gettextize | |
40 | |
41 (gettextize --version) < /dev/null > /dev/null 2>&1 || { | |
42 GETTEXT_TOOL= | |
43 } | |
44 } | |
45 } | |
46 | |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
47 install() { |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
48 [ -f configure.in ] && { |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
49 cp configure.in .tmp-configure.in |
3421
3efe967c8524
[gaim-migrate @ 3443]
Christian Hammond <chipx86@chipx86.com>
parents:
3420
diff
changeset
|
50 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
51 AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
52 rm .tmp-configure.in |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
53 } |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
54 |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
55 [ -f configure.ac ] && { |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
56 cp configure.ac .tmp-configure.ac |
3421
3efe967c8524
[gaim-migrate @ 3443]
Christian Hammond <chipx86@chipx86.com>
parents:
3420
diff
changeset
|
57 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
58 AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
59 rm .tmp-configure.ac |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
60 } |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
61 |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
62 [ -f autogen.sh ] && { |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
63 cp autogen.sh .tmp-autogen.sh |
3422
cd42bf49e2bb
[gaim-migrate @ 3444]
Christian Hammond <chipx86@chipx86.com>
parents:
3421
diff
changeset
|
64 sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -e 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
65 rm .tmp-autogen.sh |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
66 } |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
67 |
4563
d6491dc2b7b2
[gaim-migrate @ 4844]
Christian Hammond <chipx86@chipx86.com>
parents:
3422
diff
changeset
|
68 echo 'dnl Added by setup-gettext. Do not remove this' >> acinclude.m4 |
d6491dc2b7b2
[gaim-migrate @ 4844]
Christian Hammond <chipx86@chipx86.com>
parents:
3422
diff
changeset
|
69 echo 'dnl unless you know what you are doing.' >> acinclude.m4 |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
70 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4 |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
71 } |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
72 |
3414 | 73 backup_m4() { |
74 [ -d m4 ] && mv m4 m4~ | |
75 } | |
76 | |
77 restore_m4() { | |
78 [ -d m4~ ] && { | |
79 rm -rf m4 | |
80 mv m4~ m4 | |
81 } | |
82 } | |
83 | |
84 restore_files() { | |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
85 [ -f configure.in~ ] && mv -f configure.in~ configure.in |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
86 [ -f configure.ac~ ] && mv -f configure.ac~ configure.ac |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
87 [ -f Makefile.am~ ] && mv -f Makefile.am~ Makefile.am |
3414 | 88 } |
89 | |
90 abort() { | |
91 restore_files | |
92 restore_m4 | |
93 | |
94 exit 1 | |
95 } | |
96 | |
97 # Main code | |
98 | |
99 find_gettext | |
100 | |
101 # See if a version of gettext and its tools are installed. | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
102 if test x$GETTEXT_TOOL = x; then |
3414 | 103 echo |
104 echo "You do not have a version of gettext installed." | |
3415
d7c90e6ecc23
[gaim-migrate @ 3434]
Christian Hammond <chipx86@chipx86.com>
parents:
3414
diff
changeset
|
105 echo "Please download one from your local package repository or" |
3414 | 106 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/" |
107 echo | |
108 exit 1 | |
109 fi | |
110 | |
111 parse_gettext_version | |
112 | |
113 NUMVAR=$# | |
114 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
115 if test $NUMVAR -gt 0; then |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
116 if test $NUMVAR -gt 1; then |
3414 | 117 echo "Only one option at a time!" |
118 exit 1 | |
119 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
120 elif test $1 = "--gettext-tool"; then |
3414 | 121 echo $GETTEXT_TOOL |
122 exit 0 | |
123 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
124 elif test $1 = "--help"; then |
3414 | 125 echo "setup-gettext v$VERSION" |
126 echo "Usage:" | |
127 echo " --gettext-tool Returns gettextize or autopoint, depending" | |
128 echo " on the version of gettext installed." | |
129 echo " --gettext-version Returns the version of gettext installed." | |
130 echo " --gettext-major-version Returns the major version of gettext installed." | |
131 echo " --gettext-minor-version Returns the minor version of gettext installed." | |
132 echo " --gettext-micro-version Returns the micro version of gettext installed." | |
133 echo " --help Displays this help screen." | |
134 echo | |
135 exit 0 | |
136 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
137 elif test $1 = "--version"; then |
3414 | 138 echo $VERSION |
139 exit 0 | |
140 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
141 elif test $1 = "--gettext-version"; then |
3414 | 142 echo $GETTEXT_VERSION |
143 exit 0 | |
144 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
145 elif test $1 = "--gettext-major-version"; then |
3414 | 146 echo $GETTEXT_MAJOR_VERSION |
147 exit 0 | |
148 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
149 elif test $1 = "--gettext-minor-version"; then |
3414 | 150 echo $GETTEXT_MINOR_VERSION |
151 exit 0 | |
152 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
153 elif test $1 = "--gettext-micro-version"; then |
3414 | 154 echo $GETTEXT_MICRO_VERSION |
155 exit 0 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
156 |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
157 elif test $1 = "--install"; then |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
158 install |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
159 echo "setup-gettext installed." |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
160 exit 0 |
3414 | 161 |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
162 elif test $1 = "--happy-url"; then |
3414 | 163 echo http://gaim.sf.net/forkgettext.jpg |
164 exit 0 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
165 |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
166 elif test $1 = "--verbose"; then |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
167 VERBOSE=1 |
3414 | 168 |
169 else | |
170 echo "Invalid option '$1'" | |
171 exit 1 | |
172 fi | |
173 fi | |
174 | |
175 # Okay, run the main stuff | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
176 if test "$GETTEXT_TOOL" = "autopoint"; then |
3414 | 177 backup_m4 |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
178 [ $VERBOSE -eq 1 ] && echo " autopoint --force" |
3414 | 179 echo n | autopoint --force || abort |
180 restore_m4 | |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
181 |
8065
afd6b3185274
[gaim-migrate @ 8761]
Christian Hammond <chipx86@chipx86.com>
parents:
6749
diff
changeset
|
182 if test $GETTEXT_MINOR_VERSION -ge 12; then |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
183 cp po/Makefile.in.in po/.tmp-Makefile.in.in |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
184 sed -e 's#echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
185 rm po/.tmp-Makefile.in.in |
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
186 fi |
3414 | 187 else |
6749
c92584ee753d
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
188 if test $GETTEXT_MINOR_VERSION -eq 11; then |
3414 | 189 backup_m4 |
190 | |
191 # Gettext is pure evil. It DEMANDS that we press Return no matter | |
192 # what. This gets rid of their happy "feature" of doom. | |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
193 [ $VERBOSE -eq 1 ] && \ |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
194 echo " gettextize --copy --force --intl --no-changelog" |
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
195 |
3414 | 196 sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize |
197 chmod +x .temp-gettextize | |
198 echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort | |
199 rm .temp-gettextize | |
200 | |
201 restore_files | |
202 restore_m4 | |
203 | |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
204 [ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars |
3414 | 205 else |
3420
bd05f8566531
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
206 [ $VERBOSE -eq 1 ] && echo " gettextize --copy --force" |
3414 | 207 echo n | gettextize --copy --force || exit; |
208 fi | |
209 fi | |
210 |