From ea7285569e0f8b38c99002f45889fff444cc628e Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 16 Sep 2008 10:10:42 -0500 Subject: [PATCH] Do not require user to have intltool installed --- .hgignore | 12 +- Makefile.ug | 6 +- autogen.sh | 20 +++- intltool/README | 2 + intltool/aclocal/intltool.m4 | 1 + intltool/intltool.patch | 152 ++++++++++++++++++++++++++ intltool/intltool/Makefile.in.in | 1 + intltool/intltool/intltool-extract.in | 1 + intltool/intltool/intltool-merge.in | 1 + intltool/intltool/intltool-update.in | 1 + m4/moo-i18n.m4 | 31 +----- po-gsv/maintain | 18 +-- po/maintain | 37 +++++-- 13 files changed, 213 insertions(+), 70 deletions(-) create mode 100644 intltool/README create mode 100644 intltool/aclocal/intltool.m4 create mode 100644 intltool/intltool.patch create mode 100644 intltool/intltool/Makefile.in.in create mode 100644 intltool/intltool/intltool-extract.in create mode 100644 intltool/intltool/intltool-merge.in create mode 100644 intltool/intltool/intltool-update.in diff --git a/.hgignore b/.hgignore index bcc1cff5..042261d5 100644 --- a/.hgignore +++ b/.hgignore @@ -28,19 +28,11 @@ intltool-update.in ltmain.sh missing mkinstalldirs -po-gsv/Makefile.in.in -po-gsv/dist -po-gsv/missing -po-gsv/notexist -po-gsv/pot -po/Makefile.in.in -po/dist -po/missing -po/notexist -po/pot syntax: regexp +^po(-gsv)?/(Makefile\.in\.in|dist|missing|notexist|pot|intltool-update)$ + ^Makefile\.am ^medit/Makefile\.am ^moo/Makefile\.am diff --git a/Makefile.ug b/Makefile.ug index 2aa1e161..11db2774 100644 --- a/Makefile.ug +++ b/Makefile.ug @@ -1,12 +1,14 @@ AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip EXTRA_DIST += \ - autogen.sh \ mingw-configure \ COPYING.GPL \ COPYING \ LICENSE \ - THANKS + THANKS \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in @MOO_PO_SUBDIRS_RULE@ @MOO_PO_SUBDIRS_RULE2@ diff --git a/autogen.sh b/autogen.sh index b9ef99e8..3d427ae7 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,7 +9,7 @@ srcdir=`cd $rel_srcdir && pwd` echo "srcdir="$srcdir aclocal_extra= -for d in m4 moo/m4 ugly/m4; do +for d in m4 moo/m4 ugly/m4 intltool/aclocal; do if [ -d $rel_srcdir/$d ]; then aclocal_extra="$aclocal_extra -I $d" fi @@ -39,10 +39,20 @@ fi if [ -d po ]; then echo glib-gettextize --force --copy glib-gettextize --force --copy || exit $? - echo intltoolize --automake --force --copy - intltoolize --automake --force --copy || exit $? - echo rm -f intltool-extract.in intltool-merge.in intltool-update.in - rm -f intltool-extract.in intltool-merge.in intltool-update.in + + if [ -d intltool ]; then + for f in intltool-extract.in intltool-merge.in intltool-update.in; do + echo "rm -f $f && ln -s intltool/intltool/$f $f" + rm -f $f || exit $? + ln -s intltool/intltool/$f $f || exit $? + done + echo "rm -f po/Makefile.in.in && cp intltool/intltool/Makefile.in.in po/Makefile.in.in" + rm -f po/Makefile.in.in || exit $? + cp intltool/intltool/Makefile.in.in po/Makefile.in.in || exit $? + else + echo intltoolize --automake --force --copy + intltoolize --automake --force --copy || exit $? + fi fi if [ -d po-gsv ] ; then diff --git a/intltool/README b/intltool/README new file mode 100644 index 00000000..511c8b29 --- /dev/null +++ b/intltool/README @@ -0,0 +1,2 @@ +This is stuff from intltool-0.40 (rev 758), fixed back so it doesn't +require user to have it installed. diff --git a/intltool/aclocal/intltool.m4 b/intltool/aclocal/intltool.m4 new file mode 100644 index 00000000..4cb7787e --- /dev/null +++ b/intltool/aclocal/intltool.m4 @@ -0,0 +1 @@ +/usr/local/src/intltool-svn/intltool.m4 \ No newline at end of file diff --git a/intltool/intltool.patch b/intltool/intltool.patch new file mode 100644 index 00000000..63075ffb --- /dev/null +++ b/intltool/intltool.patch @@ -0,0 +1,152 @@ +Index: intltool-extract.in +=================================================================== +--- intltool-extract.in (revision 758) ++++ intltool-extract.in (working copy) +@@ -31,8 +31,8 @@ + + ## Release information + my $PROGRAM = "intltool-extract"; +-my $PACKAGE = "@PACKAGE@"; +-my $VERSION = "@VERSION@"; ++my $PACKAGE = "intltool"; ++my $VERSION = "0.40.3"; + + ## Loaded modules + use strict; +Index: intltool.m4 +=================================================================== +--- intltool.m4 (revision 758) ++++ intltool.m4 (working copy) +@@ -1,3 +1,6 @@ ++# This is intltool.m4 from intltool-0.40, fixed back so that user doesn't ++# have to have it installed. ++ + ## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*- + ## Copyright (C) 2001 Eazel, Inc. + ## Author: Maciej Stachowiak +@@ -36,24 +39,7 @@ case "$am__api_version" in + ;; + esac + +-if test -n "$1"; then +- AC_MSG_CHECKING([for intltool >= $1]) +- +- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +- INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +- [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +- ] +- AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) +- test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || +- AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) +-fi +- +-AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) +-AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) +-AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) +-if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then +- AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) +-fi ++## Do not check version at all, since it's all kept in the repo + + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' +@@ -110,6 +96,11 @@ if test -z "$xgversion" -o -z "$mmversio + AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) + fi + ++# Use the tools built into the package, not the ones that are installed. ++AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract') ++AC_SUBST(INTLTOOL_MERGE, '$(top_builddir)/intltool-merge') ++AC_SUBST(INTLTOOL_UPDATE, '$(top_builddir)/intltool-update') ++ + AC_PATH_PROG(INTLTOOL_PERL, [perl]) + if test -z "$INTLTOOL_PERL"; then + AC_MSG_ERROR([perl not found; required for intltool]) +@@ -126,6 +117,42 @@ if test "x$2" != "xno-xml"; then + fi + fi + ++dnl The following is very similar to ++dnl ++dnl AC_CONFIG_FILES([intltool-extract intltool-merge intltool-update]) ++dnl ++dnl with the following slight differences: ++dnl - the *.in files are in ac_aux_dir, ++dnl - if the file haven't changed upon reconfigure, it's not touched, ++dnl - the evaluation of the third parameter enables a hack which computes ++dnl the actual value of $libdir, ++dnl - the user sees "executing intltool commands", instead of ++dnl "creating intltool-extract" and such. ++dnl ++dnl Nothing crucial here, and we could use AC_CONFIG_FILES, if there were ++dnl a reason for it. ++ ++AC_CONFIG_COMMANDS([intltool], [ ++ ++for file in intltool-extract intltool-merge intltool-update; do ++ sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \ ++ -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \ ++ -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \ ++ < ${ac_aux_dir}/${file}.in > ${file}.out ++ if cmp -s ${file} ${file}.out 2>/dev/null; then ++ rm -f ${file}.out ++ else ++ mv -f ${file}.out ${file} ++ fi ++ chmod ugo+x ${file} ++ chmod u+w ${file} ++done ++ ++], ++[INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}' ++prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir" ++INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}']) ++ + # Substitute ALL_LINGUAS so we can use it in po/Makefile + AC_SUBST(ALL_LINGUAS) + +Index: intltool-update.in +=================================================================== +--- intltool-update.in (revision 758) ++++ intltool-update.in (working copy) +@@ -1,4 +1,4 @@ +-#!@INTLTOOL_PERL@ -w ++#!@INTLTOOL_PERL@ + # -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + + # +@@ -30,8 +30,8 @@ + + ## Release information + my $PROGRAM = "intltool-update"; +-my $VERSION = "@VERSION@"; +-my $PACKAGE = "@PACKAGE@"; ++my $VERSION = "0.40.3"; ++my $PACKAGE = "intltool"; + + ## Loaded modules + use strict; +@@ -442,7 +442,7 @@ sub FindLeftoutFiles + { + if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) + { +- warn "mismatched quotes at line $. in $file\n"; ++ # warn "mismatched quotes at line $. in $file\n"; + s-$match.*--; + } + } +Index: intltool-merge.in +=================================================================== +--- intltool-merge.in (revision 758) ++++ intltool-merge.in (working copy) +@@ -34,8 +34,8 @@ + + ## Release information + my $PROGRAM = "intltool-merge"; +-my $PACKAGE = "@PACKAGE@"; +-my $VERSION = "@VERSION@"; ++my $PACKAGE = "intltool"; ++my $VERSION = "0.40.3"; + + ## Loaded modules + use strict; diff --git a/intltool/intltool/Makefile.in.in b/intltool/intltool/Makefile.in.in new file mode 100644 index 00000000..67031125 --- /dev/null +++ b/intltool/intltool/Makefile.in.in @@ -0,0 +1 @@ +/usr/local/src/intltool-svn/Makefile.in.in \ No newline at end of file diff --git a/intltool/intltool/intltool-extract.in b/intltool/intltool/intltool-extract.in new file mode 100644 index 00000000..1c1155d0 --- /dev/null +++ b/intltool/intltool/intltool-extract.in @@ -0,0 +1 @@ +/usr/local/src/intltool-svn/intltool-extract.in \ No newline at end of file diff --git a/intltool/intltool/intltool-merge.in b/intltool/intltool/intltool-merge.in new file mode 100644 index 00000000..60e1de5d --- /dev/null +++ b/intltool/intltool/intltool-merge.in @@ -0,0 +1 @@ +/usr/local/src/intltool-svn/intltool-merge.in \ No newline at end of file diff --git a/intltool/intltool/intltool-update.in b/intltool/intltool/intltool-update.in new file mode 100644 index 00000000..165dc4f6 --- /dev/null +++ b/intltool/intltool/intltool-update.in @@ -0,0 +1 @@ +/usr/local/src/intltool-svn/intltool-update.in \ No newline at end of file diff --git a/m4/moo-i18n.m4 b/m4/moo-i18n.m4 index a5e5c779..8c84ae66 100644 --- a/m4/moo-i18n.m4 +++ b/m4/moo-i18n.m4 @@ -7,26 +7,6 @@ AC_DEFUN_ONCE([MOO_AC_PO_GSV],[ IT_PO_SUBDIR([po-gsv]) ]) -# _MOO_AC_PROG_INTLTOOL(min-version,if-found,if-not-found) -AC_DEFUN([_MOO_AC_PROG_INTLTOOL],[ - INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - INTLTOOL_APPLIED_VERSION=`intltool-update --version 2>/dev/null | head -1 | cut -d" " -f3` - [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` - ] - if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT"; then - $2 - : - else - AC_MSG_CHECKING([for intltool >= $1]) - if test "x$INTLTOOL_APPLIED_VERSION" = "x"; then - AC_MSG_RESULT([not found]) - else - AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) - fi - $3 - fi -]) - AC_DEFUN_ONCE([MOO_AC_I18N],[ AC_REQUIRE([MOO_AC_CHECK_OS]) @@ -40,7 +20,7 @@ AC_DEFUN_ONCE([MOO_AC_I18N],[ _moo_enable_nls=no ],[ AC_ARG_ENABLE(nls, - AC_HELP_STRING(--disable-nls, [do not try to use gettext and friends]), + AC_HELP_STRING(--disable-nls, [do not try to use intltool and gettext]), [_moo_enable_nls=$enable_nls],[:]) ]) @@ -57,15 +37,8 @@ AC_DEFUN_ONCE([MOO_AC_I18N],[ MOO_PO_SUBDIRS_RULE='po-subdirs-stamp: ; echo dummy > po-subdirs-stamp' MOO_PO_SUBDIRS_RULE2='po-subdirs-stamp-2: ; echo dummy > po-subdirs-stamp-2' ],[ - if test "x$_moo_enable_nls" != xno; then - _MOO_AC_PROG_INTLTOOL([0.40],[],[ - _moo_enable_nls=no - AC_MSG_WARN([intltool version 0.40 or newer not found, native language support will be disabled]) - ]) - fi - if test "x$_moo_enable_nls" = xyes; then - AC_PROG_INTLTOOL([0.40]) + AC_PROG_INTLTOOL([0.37]) AM_GLIB_GNU_GETTEXT # these two are copied from intltool, need them under different name to use with --disable-nls diff --git a/po-gsv/maintain b/po-gsv/maintain index b4f2fc16..f6041277 100755 --- a/po-gsv/maintain +++ b/po-gsv/maintain @@ -1,17 +1 @@ -#!/bin/sh - -for f in pot dist; do if test ! -e $f; then ln -s maintain $f; fi; done - -case `basename $0` in - pot) - args="--gettext-package=moo-gsv -p" - ;; - dist) - args="--gettext-package=moo-gsv -d" - ;; - *) - args="--gettext-package=moo-gsv -m" - ;; -esac - -exec intltool-update $args $* +../po/maintain \ No newline at end of file diff --git a/po/maintain b/po/maintain index ddc2e7f5..da631c71 100755 --- a/po/maintain +++ b/po/maintain @@ -1,15 +1,37 @@ #!/bin/sh -for f in pot dist; do if test ! -e $f; then ln -s maintain $f; fi; done +INTLTOOL_UPDATE_IN=../intltool/intltool/intltool-update.in +INTLTOOL_UPDATE=./intltool-update +GETTEXT_PACKAGE=moo + +case `pwd` in + */po-gsv) + GETTEXT_PACKAGE=moo-gsv + ;; +esac + +do_or_die() { + echo "$*" + "$@" || exit 1 +} + +if [ ! -x $INTLTOOL_UPDATE -o $INTLTOOL_UPDATE_IN -nt $INTLTOOL_UPDATE ]; then + echo "sed -e 's,@INTLTOOL_PERL@,/usr/bin/env perl,g' $INTLTOOL_UPDATE_IN > $INTLTOOL_UPDATE.tmp" + sed -e 's,@INTLTOOL_PERL@,/usr/bin/env perl,g' $INTLTOOL_UPDATE_IN > $INTLTOOL_UPDATE.tmp || exit 1 + do_or_die mv $INTLTOOL_UPDATE.tmp $INTLTOOL_UPDATE + do_or_die chmod +x $INTLTOOL_UPDATE +fi + +for f in pot dist; do if [ ! -e $f ]; then ln -s maintain $f; fi; done dist () { if [ -n "$1" ]; then - exec intltool-update --gettext-package=moo -d "$@" + echo "$INTLTOOL_UPDATE --gettext-package=$GETTEXT_PACKAGE -d $*" + exec $INTLTOOL_UPDATE --gettext-package=$GETTEXT_PACKAGE -d "$@" fi for f in *.po; do - echo "intltool-update --gettext-package=moo -d `basename $f .po`" - intltool-update --gettext-package=moo -d `basename $f .po` || exit 1 + do_or_die $INTLTOOL_UPDATE --gettext-package=$GETTEXT_PACKAGE -d `basename $f .po` done exit 0 @@ -17,14 +39,15 @@ dist () { case `basename $0` in pot) - args="--gettext-package=moo -p" + args="--gettext-package=$GETTEXT_PACKAGE -p" ;; dist) dist "$@" ;; *) - args="--gettext-package=moo -m" + args="--gettext-package=$GETTEXT_PACKAGE -m" ;; esac -exec intltool-update $args "$@" +echo "$INTLTOOL_UPDATE $args $*" +exec $INTLTOOL_UPDATE $args "$@"