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