From dc8368815efaf639e61332299dc40acdce7a0bd9 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 1 Nov 2003 20:42:16 +0000 Subject: [PATCH] Added po translations to autoconf/automake process --- Makefile.am | 2 +- autogen.sh | 51 +++++++++++++++++++++++++++++++++++++++++++- configure.in | 16 ++++++++++++-- po/Makefile | 48 ----------------------------------------- po/fr.po | 1 - weechat/Makefile.am | 2 +- weechat/autogen.sh | 51 +++++++++++++++++++++++++++++++++++++++++++- weechat/configure.in | 16 ++++++++++++-- weechat/po/Makefile | 48 ----------------------------------------- weechat/po/fr.po | 1 - 10 files changed, 130 insertions(+), 106 deletions(-) delete mode 100644 po/Makefile delete mode 100644 weechat/po/Makefile diff --git a/Makefile.am b/Makefile.am index c7db0395b..ee98a47fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -SUBDIRS = src +SUBDIRS = po intl src EXTRA_DIST = weechat.1 diff --git a/autogen.sh b/autogen.sh index 5a53b7243..ba54bb85f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,55 @@ #!/bin/sh rm -f config.cache -aclocal + +### GETTEXT ### + +echo searching for GNU gettext intl directory... + +dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share" +found=0 +for try in $dirs; do + echo -n " -> $try/gettext/intl... " + if test -d $try/gettext/intl; then + echo found it + found=1 + break + fi + echo no +done +if test "$found" != 1; then + echo ERROR: Cannot find gettext/intl directory. + echo ERROR: Install GNU gettext in /usr or /usr/local prefix. + exit 7 +fi; + +echo copying gettext intl files... +intldir="$try/gettext/intl" +if test ! -d intl; then + mkdir intl +fi +olddir=`pwd` +cd $intldir +for file in *; do + if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then + rm -f $olddir/intl/$file + cp $intldir/$file $olddir/intl/ + fi +done +cp -f $try/gettext/po/Makefile.in.in $olddir/po/ +cd $olddir +if test -f intl/plural.c; then + sleep 2 + touch intl/plural.c +fi + +### END GETTEXT ### + +echo "running aclocal..." +aclocal -I /usr/share/aclocal +echo "running autoconf..." autoconf +echo "running autoheader..." autoheader +echo "running automake..." automake -a +echo "autogen.sh ok, now run ./configure script" diff --git a/configure.in b/configure.in index 5e8fe6a5f..85c546ff9 100644 --- a/configure.in +++ b/configure.in @@ -29,8 +29,12 @@ AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_RANLIB +# Gettext +ALL_LINGUAS="fr" +AM_GNU_GETTEXT + # Checks for libraries. -# AC_CHECK_LIB([curses], [initscr]) +AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0) # Checks for header files. AC_HEADER_STDC @@ -66,11 +70,17 @@ AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes") AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes") if test "x$enable_curses" = "xyes" ; then + if test "$LIBCURSES_FOUND" = "0" ; then + AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.]) + fi CURSES_LIBS=-lcurses AC_SUBST(CURSES_LIBS) fi if test "x$enable_gtk" = "xyes" ; then + #if test "$LIBGTK_FOUND" = "0" ; then + # AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.]) + #fi GTK_CFLAGS=`pkg-config --cflags gtk+-2.0` GTK_LIBS=`pkg-config --libs gtk+-2.0` AC_SUBST(GTK_CFLAGS) @@ -86,7 +96,9 @@ AC_OUTPUT([Makefile src/gui/Makefile src/gui/curses/Makefile src/gui/gtk/Makefile - src/gui/qt/Makefile]) + src/gui/qt/Makefile + intl/Makefile + po/Makefile.in]) echo echo $PACKAGE $VERSION diff --git a/po/Makefile b/po/Makefile deleted file mode 100644 index e97659f27..000000000 --- a/po/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2003 FlashCode -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -all: - @echo "Usage: make init => create new template (weechat.pot)" - @echo " make update => update translations with new messages from sources" - @echo " make install => compile and install all translations" - @echo " make clean => delete all binary and backup files" - -init: - @cd ../src; \ - xgettext -o ../po/weechat.pot --keyword=_ --keyword=N_ --msgid-bugs-address=flashcode@flashtux.org --msgstr-prefix `find -name "*.h"` `find -name "*.c"` - -update: - cd ../src; \ - xgettext -o /tmp/temp1.po --keyword=_ --keyword=N_ --msgid-bugs-address=flashcode@flashtux.org `find -name "*.h"` `find -name "*.c"`; \ - sed s/charset=CHARSET/charset=iso-8859-1/ /tmp/temp1.po >/tmp/temp2.po; \ - cd ../po; \ - for fichier in *.po; do \ - msgmerge -U $$fichier /tmp/temp2.po; \ - done - -install: - @for fichier in *.po; do \ - echo "Creating binary: $$fichier => weechat.mo..."; \ - msgfmt -o weechat.mo $$fichier; \ - REP=$${fichier%%.po}; \ - echo "Copying weechat.mo (from $$fichier) to /usr/share/locale/$$REP/LC_MESSAGES"; \ - cp -f weechat.mo /usr/share/locale/$$REP/LC_MESSAGES/ ; \ - done - rm -f ./weechat.mo - -clean: - rm -f ./*.mo ./*.po~ diff --git a/po/fr.po b/po/fr.po index 9f335e7c1..5afbe2d9d 100644 --- a/po/fr.po +++ b/po/fr.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the WeeChat package. # FlashCode , 2003. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: 0.0.2\n" diff --git a/weechat/Makefile.am b/weechat/Makefile.am index c7db0395b..ee98a47fb 100644 --- a/weechat/Makefile.am +++ b/weechat/Makefile.am @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -SUBDIRS = src +SUBDIRS = po intl src EXTRA_DIST = weechat.1 diff --git a/weechat/autogen.sh b/weechat/autogen.sh index 5a53b7243..ba54bb85f 100755 --- a/weechat/autogen.sh +++ b/weechat/autogen.sh @@ -1,6 +1,55 @@ #!/bin/sh rm -f config.cache -aclocal + +### GETTEXT ### + +echo searching for GNU gettext intl directory... + +dirs="/usr/share /usr/local/share /opt/share /usr /usr/local /opt /usr/gnu/share" +found=0 +for try in $dirs; do + echo -n " -> $try/gettext/intl... " + if test -d $try/gettext/intl; then + echo found it + found=1 + break + fi + echo no +done +if test "$found" != 1; then + echo ERROR: Cannot find gettext/intl directory. + echo ERROR: Install GNU gettext in /usr or /usr/local prefix. + exit 7 +fi; + +echo copying gettext intl files... +intldir="$try/gettext/intl" +if test ! -d intl; then + mkdir intl +fi +olddir=`pwd` +cd $intldir +for file in *; do + if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then + rm -f $olddir/intl/$file + cp $intldir/$file $olddir/intl/ + fi +done +cp -f $try/gettext/po/Makefile.in.in $olddir/po/ +cd $olddir +if test -f intl/plural.c; then + sleep 2 + touch intl/plural.c +fi + +### END GETTEXT ### + +echo "running aclocal..." +aclocal -I /usr/share/aclocal +echo "running autoconf..." autoconf +echo "running autoheader..." autoheader +echo "running automake..." automake -a +echo "autogen.sh ok, now run ./configure script" diff --git a/weechat/configure.in b/weechat/configure.in index 5e8fe6a5f..85c546ff9 100644 --- a/weechat/configure.in +++ b/weechat/configure.in @@ -29,8 +29,12 @@ AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_RANLIB +# Gettext +ALL_LINGUAS="fr" +AM_GNU_GETTEXT + # Checks for libraries. -# AC_CHECK_LIB([curses], [initscr]) +AC_CHECK_LIB([curses], [initscr], LIBCURSES_FOUND=1, LIBCURSES_FOUND=0) # Checks for header files. AC_HEADER_STDC @@ -66,11 +70,17 @@ AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes") AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes") if test "x$enable_curses" = "xyes" ; then + if test "$LIBCURSES_FOUND" = "0" ; then + AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.]) + fi CURSES_LIBS=-lcurses AC_SUBST(CURSES_LIBS) fi if test "x$enable_gtk" = "xyes" ; then + #if test "$LIBGTK_FOUND" = "0" ; then + # AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.]) + #fi GTK_CFLAGS=`pkg-config --cflags gtk+-2.0` GTK_LIBS=`pkg-config --libs gtk+-2.0` AC_SUBST(GTK_CFLAGS) @@ -86,7 +96,9 @@ AC_OUTPUT([Makefile src/gui/Makefile src/gui/curses/Makefile src/gui/gtk/Makefile - src/gui/qt/Makefile]) + src/gui/qt/Makefile + intl/Makefile + po/Makefile.in]) echo echo $PACKAGE $VERSION diff --git a/weechat/po/Makefile b/weechat/po/Makefile deleted file mode 100644 index e97659f27..000000000 --- a/weechat/po/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2003 FlashCode -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -all: - @echo "Usage: make init => create new template (weechat.pot)" - @echo " make update => update translations with new messages from sources" - @echo " make install => compile and install all translations" - @echo " make clean => delete all binary and backup files" - -init: - @cd ../src; \ - xgettext -o ../po/weechat.pot --keyword=_ --keyword=N_ --msgid-bugs-address=flashcode@flashtux.org --msgstr-prefix `find -name "*.h"` `find -name "*.c"` - -update: - cd ../src; \ - xgettext -o /tmp/temp1.po --keyword=_ --keyword=N_ --msgid-bugs-address=flashcode@flashtux.org `find -name "*.h"` `find -name "*.c"`; \ - sed s/charset=CHARSET/charset=iso-8859-1/ /tmp/temp1.po >/tmp/temp2.po; \ - cd ../po; \ - for fichier in *.po; do \ - msgmerge -U $$fichier /tmp/temp2.po; \ - done - -install: - @for fichier in *.po; do \ - echo "Creating binary: $$fichier => weechat.mo..."; \ - msgfmt -o weechat.mo $$fichier; \ - REP=$${fichier%%.po}; \ - echo "Copying weechat.mo (from $$fichier) to /usr/share/locale/$$REP/LC_MESSAGES"; \ - cp -f weechat.mo /usr/share/locale/$$REP/LC_MESSAGES/ ; \ - done - rm -f ./weechat.mo - -clean: - rm -f ./*.mo ./*.po~ diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 9f335e7c1..5afbe2d9d 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -3,7 +3,6 @@ # This file is distributed under the same license as the WeeChat package. # FlashCode , 2003. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: 0.0.2\n"