Mercurial > pidgin
changeset 3414:4149e5e36eb9
[gaim-migrate @ 3433]
This is easier to maintain, cleaner, and you can take the script with you.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 20 Aug 2002 08:54:56 +0000 |
parents | ccf479022081 |
children | d7c90e6ecc23 |
files | autogen.sh setup-gettext |
diffstat | 2 files changed, 149 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/autogen.sh Mon Aug 19 05:25:16 2002 +0000 +++ b/autogen.sh Tue Aug 20 08:54:56 2002 +0000 @@ -1,27 +1,12 @@ #!/bin/sh -abort() { - # Don't break the tree if something goes wrong. - if [ -e m4~ ]; then - rm -rf m4 - mv m4~ m4 - fi - - exit 1 -} +SETUP_GETTEXT=./setup-gettext -USE_AUTOPOINT=1 - -(autopoint --version) < /dev/null > /dev/null 2>&1 || { - - USE_AUTOPOINT=0 - - (gettextize --version) < /dev/null > /dev/null 2>&1 || { - echo; - echo "You must have gettext installed to compile Gaim"; - echo; - exit; - } +($SETUP_GETTEXT --gettext-tool) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have gettext installed to compile Gaim"; + echo; + exit; } (libtoolize --version) < /dev/null > /dev/null 2>&1 || { @@ -59,38 +44,7 @@ echo; echo "Running gettextize, please ignore non-fatal messages...." - -if [ $USE_AUTOPOINT -eq 1 ]; then - mv -f m4 m4~ - echo n | autopoint --force || abort; - rm -rf m4 - mv -f m4~ m4 -else - # They could have at least done us a favor and used autopoint all - # throughout 0.11.x. - GETTEXT_VER=`gettextize --version | sed -n 's/^.*[0-9]\+\.\([0-9]\+\)\..*$/\1/p'` - if [ $GETTEXT_VER -eq 11 ]; then - mv -f m4 m4~ - - # Gettext is pure evil. It DEMANDS that we press Return no matter - # what. This gets rid of their happy "feature" of doom. - sed 's:read .*< /dev/tty::' `which gettextize` > gaim-gettextize - chmod +x gaim-gettextize - echo n | ./gaim-gettextize --copy --force --intl --no-changelog || abort - rm gaim-gettextize - - # Now restore the things that brain-dead gettext modified. - [ -e configure.in~ ] && mv -f configure.in~ configure.in - [ -e configure.ac~ ] && mv -f configure.ac~ configure.ac - [ -e Makefile.am~ ] && mv -f Makefile.am~ Makefile.am - rm -rf m4 - mv -f m4~ m4 - - mv -f po/Makevars.template po/Makevars - else - echo n | gettextize --copy --force || exit; - fi -fi +$SETUP_GETTEXT echo "Running libtoolize, please ignore non-fatal messages...." echo n | libtoolize --copy --force || exit;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup-gettext Tue Aug 20 08:54:56 2002 +0000 @@ -0,0 +1,142 @@ +#!/bin/sh + +VERSION=0.1.0 + +parse_gettext_version() { + GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'` + GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'` + GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'` + GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'` +} + +find_gettext() { + GETTEXT_TOOL=autopoint + + (autopoint --version) < /dev/null > /dev/null 2>&1 || { + GETTEXT_TOOL=gettextize + + (gettextize --version) < /dev/null > /dev/null 2>&1 || { + GETTEXT_TOOL= + } + } +} + +backup_m4() { + [ -d m4 ] && mv m4 m4~ +} + +restore_m4() { + [ -d m4~ ] && { + rm -rf m4 + mv m4~ m4 + } +} + +restore_files() { + [ -e configure.in~ ] && mv -f configure.in~ configure.in + [ -e configure.ac~ ] && mv -f configure.ac~ configure.ac + [ -e Makefile.am~ ] && mv -f Makefile.am~ Makefile.am +} + +abort() { + restore_files + restore_m4 + + exit 1 +} + +# Main code + +find_gettext + +# See if a version of gettext and its tools are installed. +if [ x$GETTEXT_TOOL == x ]; then + echo + echo "You do not have a version of gettext installed." + echo "Please download one from your locak package repository or" + echo "from ftp://ftp.gnu.org/pub/gnu/gettext/" + echo + exit 1 +fi + +parse_gettext_version + +NUMVAR=$# + +if [ $NUMVAR -gt 0 ]; then + if [ $NUMVAR -gt 1 ]; then + echo "Only one option at a time!" + exit 1 + + elif [ $1 == "--gettext-tool" ]; then + echo $GETTEXT_TOOL + exit 0 + + elif [ $1 == "--help" ]; then + echo "setup-gettext v$VERSION" + echo "Usage:" + echo " --gettext-tool Returns gettextize or autopoint, depending" + echo " on the version of gettext installed." + echo " --gettext-version Returns the version of gettext installed." + echo " --gettext-major-version Returns the major version of gettext installed." + echo " --gettext-minor-version Returns the minor version of gettext installed." + echo " --gettext-micro-version Returns the micro version of gettext installed." + echo " --help Displays this help screen." + echo + exit 0 + + elif [ $1 == "--version" ]; then + echo $VERSION + exit 0 + + elif [ $1 == "--gettext-version" ]; then + echo $GETTEXT_VERSION + exit 0 + + elif [ $1 == "--gettext-major-version" ]; then + echo $GETTEXT_MAJOR_VERSION + exit 0 + + elif [ $1 == "--gettext-minor-version" ]; then + echo $GETTEXT_MINOR_VERSION + exit 0 + + elif [ $1 == "--gettext-micro-version" ]; then + echo $GETTEXT_MICRO_VERSION + exit 0 + + elif [ $1 == "--happy-url" ]; then + echo http://gaim.sf.net/forkgettext.jpg + exit 0 + + else + echo "Invalid option '$1'" + exit 1 + fi +fi + +# Okay, run the main stuff +if [ "$GETTEXT_TOOL" == "autopoint" ]; then + backup_m4 + echo n | autopoint --force || abort + restore_m4 +else + if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then + backup_m4 + + # Gettext is pure evil. It DEMANDS that we press Return no matter + # what. This gets rid of their happy "feature" of doom. + sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize + chmod +x .temp-gettextize + echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort + rm .temp-gettextize + + restore_files + restore_m4 + + [ -e po/Makevars.template ] && mv po/Makevars.template po/Makevars + else + echo n | gettextize --copy --force || exit; + fi +fi +