| #! /bin/sh |
| # Copyright (C) 2010 Free Software Foundation, Inc. |
| # |
| # 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, 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, see <http://www.gnu.org/licenses/>. |
| |
| # Check that the value of the 'Report-Msgid-Bugs-To' field in the POT file's |
| # header comes from the _MSGID_BUGS_ADDRESS variable if it is specified, or |
| # from the third argument of AC_INIT otherwise. |
| |
| . ./defs || Exit 1 |
| |
| set -e |
| |
| cat > Makefile.am << 'END' |
| locale_POTS = posub/foo-bar.pot |
| posub_foo_bar_pot_SOURCES = src/main.c |
| EXTRA_DIST = src/main.c |
| END |
| |
| # Insert an email address as third argument of the AC_INIT invocation. |
| mv configure.in configure.in.bak |
| sed -e '/AC_INIT/{s/)$/, [info@yoyodyne.example.com])/}' < configure.in.bak > configure.in |
| |
| cat >> configure.in << 'END' |
| AM_POT_TOOLS |
| AC_OUTPUT |
| END |
| |
| mkdir src |
| cat > src/main.c << 'END' |
| #include <stdio.h> |
| int main () |
| { |
| printf (gettext ("Hello, world.\n")); |
| return 0; |
| } |
| END |
| |
| $ACLOCAL |
| $AUTOMAKE -a |
| $AUTOCONF |
| |
| cat > expected << 'END' |
| # SOME DESCRIPTIVE TITLE. |
| # This file is put in the public domain. |
| # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| # |
| #, fuzzy |
| msgid "" |
| msgstr "" |
| "Project-Id-Version: pot-msgidbugs 1.0\n" |
| "Report-Msgid-Bugs-To: info@yoyodyne.example.com\n" |
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| "Language-Team: LANGUAGE <LL@li.org>\n" |
| "Language: \n" |
| "MIME-Version: 1.0\n" |
| "Content-Type: text/plain; charset=CHARSET\n" |
| "Content-Transfer-Encoding: 8bit\n" |
| |
| #: src/main.c:4 |
| #, c-format |
| msgid "Hello, world.\n" |
| msgstr "" |
| END |
| |
| for builddir in . sub1; do |
| if test $builddir = '.'; then |
| sourcedir='.' |
| else |
| sourcedir='..' |
| mkdir $builddir |
| fi |
| instdir="`pwd`/instdir" |
| cd $builddir |
| $sourcedir/configure --prefix="$instdir" |
| $MAKE |
| |
| # Check that "make distdir" creates the expected .pot file. |
| # (It is created under $sourcedir, because the .pot file is distributed. |
| # Cf. the GNU standards, node "Makefile Basics".) |
| |
| $MAKE distdir |
| |
| test -f $sourcedir/posub/foo-bar.pot |
| test $builddir = '.' || test ! -r posub/foo-bar.pot |
| cat $sourcedir/posub/foo-bar.pot | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > actual |
| diff actual $sourcedir/expected |
| rm -f actual |
| |
| # Sanity check. |
| $MAKE distcheck |
| |
| # Clean up. |
| $MAKE distclean |
| rm -rf "$instdir" |
| cd $sourcedir |
| done |
| |
| cat >> Makefile.am << 'END' |
| posub_foo_bar_pot_MSGID_BUGS_ADDRESS = bug-maude@yoyodyne.example.com |
| END |
| |
| cat > expected << 'END' |
| # SOME DESCRIPTIVE TITLE. |
| # This file is put in the public domain. |
| # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| # |
| #, fuzzy |
| msgid "" |
| msgstr "" |
| "Project-Id-Version: pot-msgidbugs 1.0\n" |
| "Report-Msgid-Bugs-To: bug-maude@yoyodyne.example.com\n" |
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| "Language-Team: LANGUAGE <LL@li.org>\n" |
| "Language: \n" |
| "MIME-Version: 1.0\n" |
| "Content-Type: text/plain; charset=CHARSET\n" |
| "Content-Transfer-Encoding: 8bit\n" |
| |
| #: src/main.c:4 |
| #, c-format |
| msgid "Hello, world.\n" |
| msgstr "" |
| END |
| |
| $AUTOMAKE -a |
| |
| for builddir in . sub2; do |
| if test $builddir = '.'; then |
| sourcedir='.' |
| else |
| sourcedir='..' |
| mkdir $builddir |
| fi |
| instdir="`pwd`/instdir" |
| cd $builddir |
| $sourcedir/configure --prefix="$instdir" |
| $MAKE |
| |
| # Check that "make distdir" creates the expected .pot file. |
| # (It is created under $sourcedir, because the .pot file is distributed. |
| # Cf. the GNU standards, node "Makefile Basics".) |
| |
| $MAKE distdir |
| |
| test -f $sourcedir/posub/foo-bar.pot |
| test $builddir = '.' || test ! -r posub/foo-bar.pot |
| grep -v 'POT-Creation-Date' $sourcedir/posub/foo-bar.pot | LC_ALL=C tr -d '\r' > actual |
| diff actual $sourcedir/expected |
| rm -f actual |
| |
| # Sanity check. |
| $MAKE distcheck |
| |
| # Clean up. |
| $MAKE distclean |
| rm -rf "$instdir" |
| cd $sourcedir |
| done |
| |
| : |