summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-04-13 16:35:57 +0000
committerjlam <jlam@pkgsrc.org>2006-04-13 16:35:57 +0000
commit0f4967eb59854511c3cbd3d80e3a886dd7fb7fc7 (patch)
tree05edb3a0d35814dcd46fc6d587c479a7a041b561
parent56e51ad6bcbe62feec59ad6d8300df92c2e40784 (diff)
downloadpkgsrc-0f4967eb59854511c3cbd3d80e3a886dd7fb7fc7.tar.gz
Overhaul the way packages can ask for "msgfmt". If a package needs
msgfmt, then it should set the following in the package Makefile: USE_TOOLS+= msgfmt To deal with message files that use the "msgid_plural" statement, which isn't supported in NetBSD<=3.x and also in gettext<=0.10.35, we determine if the built-in "msgfmt" is sufficiently new enough to understand "msgid_plural". If it isn't, then we use the msgfmt.sh script to transform the msgid_plural statements to an equivalent construct that's understood by older msgfmt tools. The msgfmt.sh script is a straightforward translation of the original perl script msgfmt.pl script by Julio M. Merino Vidal into shell and awk, which are more lightweight dependencies than perl. We remove the USE_MSGFMT_PLURALS bits in gettext-lib/builtin.mk as they are made obsolete by the new code in mk/tools/msgfmt.mk. BUILD_USE_MSGFMT is still supported but will be removed in a separate commit.
-rw-r--r--devel/gettext-lib/builtin.mk36
-rw-r--r--devel/gettext/files/msgfmt.pl170
-rw-r--r--mk/bsd.pkg.use.mk7
-rw-r--r--mk/tools/bsd.tools.mk3
-rw-r--r--mk/tools/msgfmt.mk86
-rwxr-xr-xmk/tools/msgfmt.sh189
-rw-r--r--mk/tools/replace.mk18
-rw-r--r--mk/tools/tools.Linux.mk5
-rw-r--r--mk/tools/tools.NetBSD.mk5
9 files changed, 295 insertions, 224 deletions
diff --git a/devel/gettext-lib/builtin.mk b/devel/gettext-lib/builtin.mk
index 8503d268d27..781b69613be 100644
--- a/devel/gettext-lib/builtin.mk
+++ b/devel/gettext-lib/builtin.mk
@@ -1,4 +1,4 @@
-# $NetBSD: builtin.mk,v 1.31 2006/04/06 06:21:49 reed Exp $
+# $NetBSD: builtin.mk,v 1.32 2006/04/13 16:35:58 jlam Exp $
BUILTIN_PKG:= gettext
@@ -206,38 +206,4 @@ CONFIGURE_ARGS+= --without-libintl-prefix
. endif
. endif
-. if defined(USE_MSGFMT_PLURALS) && !empty(USE_MSGFMT_PLURALS:M[Yy][Ee][Ss])
-USE_TOOLS+= perl
-CONFIGURE_ENV+= MSGFMT=${BUILDLINK_DIR}/bin/msgfmt
-
-# XXX _USE_NEW_TOOLS=yes should make "msgfmt" and "msgfmt-plural" into
-# XXX tools that can be specified via USE_TOOLS. They would replace
-# XXX BUILD_USES_MSGFMT and USE_MSGFMT_PLURALS.
-# XXX
-BUILDLINK_TARGETS+= buildlink-msgfmt
-
-buildlink-msgfmt: ${BUILDLINK_DIR}/bin/msgfmt
-
-${BUILDLINK_DIR}/bin/msgfmt: ${.CURDIR}/../../devel/gettext/files/msgfmt.pl
- @ver=`${BUILDLINK_PREFIX.gettext:Q}/bin/msgfmt --version | \
- ${HEAD} -n 1 | ${CUT} -d ' ' -f 4`; \
- ${MKDIR} ${.TARGET:H}; \
- case $${ver} in \
- 0.10.[1-3][0-5]|0.[0-9].*) \
- ${ECHO} "=> Creating msgfmt wrapper to work-around" \
- "plurals"; \
- ${CAT} ${.ALLSRC} | \
- ${SED} -e "s|@PERL@|"${PERL5:Q}"|g" \
- -e "s|@MSGFMT@|"${BUILDLINK_PREFIX.gettext:Q}/bin/msgfmt"|g" \
- > ${.TARGET}; \
- ;; \
- *) \
- ${ECHO} "#! ${SH}" >${.TARGET}; \
- ${ECHO} "${BUILDLINK_PREFIX.gettext:Q}/bin/msgfmt" \
- '"$$@"' >>${.TARGET}; \
- ;; \
- esac; \
- ${CHMOD} +x ${.TARGET}
-. endif
-
.endif # CHECK_BUILTIN.gettext
diff --git a/devel/gettext/files/msgfmt.pl b/devel/gettext/files/msgfmt.pl
deleted file mode 100644
index 332f851d2cd..00000000000
--- a/devel/gettext/files/msgfmt.pl
+++ /dev/null
@@ -1,170 +0,0 @@
-#!@PERL@
-#
-# $NetBSD: msgfmt.pl,v 1.3 2006/04/06 21:42:23 jmmv Exp $
-#
-# msgfmt.pl - Workaround uses of msgid_plural to work with implementations
-# that don't support it.
-#
-# Copyright (c) 2004, 2005, 2006 Julio M. Merino Vidal <jmmv@NetBSD.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name of author nor the names of its contributors may
-# be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Parse command line. We copy almost everything as is in the @args array,
-# which will be used later when calling the real "msgfmt" utility. As an
-# exception, the file name is transformed to the temporary file we will
-# use, and the original one is stored in the $file variable.
-@args = ();
-$file = "";
-$skip = 0;
-foreach (@ARGV) {
- if ($skip) {
- $skip = 0;
- } elsif (/^-(a|D|o)$/) {
- $skip = 1;
- } elsif (/^--(alignment|directory|output-file)$/) {
- $skip = 1;
- } elsif (/^[^-]/) {
- $file = $_;
- $_ = "$file.tmp";
- }
-
- push @args, $_;
-}
-
-# Parse the catalog file to convert msgid_plural entries to the "old"
-# format, which handles each of the translations independantly.
-open INFILE, $file;
-open OUTFILE, ">$file.tmp";
-
-printf "Working-around plural forms in $file\n";
-while (<INFILE>) {
- @msgid_singular = ();
- @msgid_plural = ();
-
- s/^#~//;
-
- if (/^msgid[ \t]+(.*)$/) {
- push @msgid_singular, "$1\n";
- while (<INFILE>) {
- next if /^$/;
-
- if (/^[ \t]*"/) {
- push @msgid_singular, $_;
- } else {
- last;
- }
- }
- }
-
- if (/^msgid_plural[ \t]+(.*)$/) {
- push @msgid_plural, "$1\n";
- while (<INFILE>) {
- if (/^[ \t]*"/) {
- push @msgid_plural, $_;
- } else {
- last;
- }
- }
- }
-
- if (/^msgstr[ \t]+(.*)$/) {
- print OUTFILE "msgid ";
- foreach $line (@msgid_singular) { print OUTFILE $line; }
- print OUTFILE "msgstr $1\n";
- while (<INFILE>) {
- if (/^[ \t]*"/) {
- print OUTFILE;
- } else {
- last;
- }
- }
- }
-
- if (/^msgstr\[0\][ \t]+(.*)$/) {
- print OUTFILE "msgid ";
- foreach $line (@msgid_singular) { print OUTFILE $line; }
- print OUTFILE "msgstr $1\n";
- while (<INFILE>) {
- if (/^[ \t]*"/) {
- print OUTFILE;
- } else {
- last;
- }
- }
- }
-
- if (/^msgstr\[1\][ \t]+(.*)$/) {
- $equal = (@msgid_singular == @msgid_plural);
- if ($equal) {
- for ($i = 0; $i < @msgid_singular; $i++) {
- if (@msgid_singular[$i] ne @msgid_plural[$i]) {
- $equal = 0;
- last;
- }
- }
- }
-
- if (! $equal) {
- print OUTFILE "msgid ";
- foreach $line (@msgid_plural) { print OUTFILE $line; }
- print OUTFILE "msgstr $1\n";
- while (<INFILE>) {
- if (/^[ \t]*"/) {
- print OUTFILE;
- } else {
- last;
- }
- }
- } else {
- while (<INFILE>) {
- last if (! /^[ \t]*"/);
- }
- }
- }
-
- if (/^msgstr\[2\][ \t]+(.*)$/) {
- }
-
- if (/^#/ || /^[ \t]*$/) {
- print OUTFILE;
- next;
- }
-}
-
-close OUTFILE;
-close INFILE;
-
-# Call the real msgfmt utility, using the temporary file as the source
-# catalog.
-printf "Running `@MSGFMT@ @args'\n";
-$ret = system("@MSGFMT@ @args") >> 8;
-
-if ($ret == 0) {
- unlink "$file.tmp";
-}
-
-exit $ret;
diff --git a/mk/bsd.pkg.use.mk b/mk/bsd.pkg.use.mk
index 3dcc7d234ee..e7d531eec40 100644
--- a/mk/bsd.pkg.use.mk
+++ b/mk/bsd.pkg.use.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.use.mk,v 1.30 2006/03/11 04:01:27 reed Exp $
+# $NetBSD: bsd.pkg.use.mk,v 1.31 2006/04/13 16:35:58 jlam Exp $
#
# Turn USE_* macros into proper depedency logic. Included near the top of
# bsd.pkg.mk, after bsd.prefs.mk.
@@ -61,9 +61,8 @@ PKG_SKIP_REASON= "INSTALLATION_PREFIX can't be used in a pkgviews package"
### BUILD_USES_MSGFMT
-.if defined(BUILD_USES_MSGFMT) && \
- (!exists(/usr/bin/msgfmt) || ${_USE_GNU_GETTEXT} == "yes")
-BUILD_DEPENDS+= gettext-tools>=0.14.5:../../devel/gettext-tools
+.if defined(BUILD_USES_MSGFMT)
+USE_TOOLS+= msgfmt
.endif
### PKG_USE_KERBEROS
diff --git a/mk/tools/bsd.tools.mk b/mk/tools/bsd.tools.mk
index f12695bcb9a..ef4c5b2dbda 100644
--- a/mk/tools/bsd.tools.mk
+++ b/mk/tools/bsd.tools.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.tools.mk,v 1.32 2005/08/10 20:56:20 jlam Exp $
+# $NetBSD: bsd.tools.mk,v 1.33 2006/04/13 16:35:58 jlam Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -111,6 +111,7 @@ USE_TOOLS?= # empty
.include "../../mk/tools/automake.mk"
.include "../../mk/tools/autoconf.mk"
.include "../../mk/tools/texinfo.mk"
+.include "../../mk/tools/msgfmt.mk"
.include "../../mk/tools/ldconfig.mk"
.include "../../mk/tools/rpcgen.mk"
.include "../../mk/tools/strip.mk"
diff --git a/mk/tools/msgfmt.mk b/mk/tools/msgfmt.mk
new file mode 100644
index 00000000000..36a973aec6f
--- /dev/null
+++ b/mk/tools/msgfmt.mk
@@ -0,0 +1,86 @@
+# $NetBSD: msgfmt.mk,v 1.1 2006/04/13 16:35:58 jlam Exp $
+#
+# Copyright (c) 2006 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+.if !defined(TOOLS_IGNORE.msgfmt) && !empty(USE_TOOLS:C/:.*//:Mmsgfmt)
+. if !empty(PKGPATH:Mdevel/gettext-tools)
+MAKEFLAGS+= TOOLS_IGNORE.msgfmt=
+. else
+. if defined(TOOLS_PLATFORM.msgfmt) && !empty(TOOLS_PLATFORM.msgfmt)
+. if !defined(_TOOLS_USE_PKGSRC.msgfmt)
+#
+# Discover if the version on the builtin msgfmt is new enough to handle
+# msgid_plural (at least 0.10.35).
+#
+_TOOLS_VERSION.msgfmt!= ${TOOLS_PLATFORM.msgfmt} --version | \
+ ${AWK} '{ print $$4; exit }'
+_TOOLS_USE_PKGSRC.msgfmt!= \
+ if ${PKG_ADMIN} pmatch "gettext>=0.10.35" \
+ gettext-${_TOOLS_VERSION.msgfmt:Q}; then \
+ ${ECHO} no; \
+ else \
+ ${ECHO} yes; \
+ fi
+. endif
+MAKEVARS+= _TOOLS_USE_PKGSRC.msgfmt
+. else
+_TOOLS_USE_PKGSRC.msgfmt= yes
+. endif
+
+# If we're not using the builtin gettext implementation, then we should
+# definitely be using the pkgsrc version of msgfmt (gettext-tools).
+#
+CHECK_BUILTIN.gettext:= yes
+. include "../../devel/gettext-lib/builtin.mk"
+CHECK_BUILTIN.gettext:= no
+. if !empty(USE_BUILTIN.gettext:M[nN][oO])
+_TOOLS_USE_PKGSRC.msgfmt= yes
+. endif
+
+. if !empty(_TOOLS_USE_PKGSRC.msgfmt:M[yY][eE][sS])
+TOOLS_CREATE+= msgfmt
+TOOLS_DEPENDS.msgfmt?= {gettext>=0.10.36,gettext-tools>=0.14.5}:../../devel/gettext-tools
+TOOLS_FIND_PREFIX+= TOOLS_PREFIX.msgfmt=${TOOLS_DEPENDS.msgfmt:C/:.*//}
+TOOLS_PATH.msgfmt= ${TOOLS_PREFIX.msgfmt}/bin/msgfmt
+. else
+USE_TOOLS+= awk sh
+TOOLS_PATH.msgfmt= ${PKGSRCDIR}/mk/tools/msgfmt.sh
+TOOLS_SCRIPT.msgfmt= AWK=${TOOLS_AWK:Q} \
+ MSGFMT=${TOOLS_PLATFORM.msgfmt:Q} \
+ ${TOOLS_SH} ${TOOLS_PATH.msgfmt} "$$@"
+. endif
+. endif
+.endif
diff --git a/mk/tools/msgfmt.sh b/mk/tools/msgfmt.sh
new file mode 100755
index 00000000000..cb09303168c
--- /dev/null
+++ b/mk/tools/msgfmt.sh
@@ -0,0 +1,189 @@
+#!/bin/sh
+#
+# $NetBSD: msgfmt.sh,v 1.1 2006/04/13 16:35:58 jlam Exp $
+#
+# Copyright (c) 2004, 2005, 2006 Julio M. Merino Vidal <jmmv@NetBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name of author nor the names of its contributors may
+# be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+: ${AWK=awk}
+: ${MSGFMT=/usr/bin/msgfmt}
+
+case "${MSGFMT}" in
+/*) ;;
+*) echo 1>&2 "$0: \`\`${MSGFMT}'' must be an absolute pathname."
+ exit 1
+ ;;
+esac
+if test ! -x "${MSGFMT}"; then
+ echo 1>&2 "$0: \`\`${MSGFMT}'' does not exist."
+ exit 1
+fi
+
+# Parse the command line options.
+version=
+cmd="${MSGFMT}"
+while test $# -gt 0; do
+ case "$1" in
+ --version)
+ version="$1"
+ cmd="$cmd $1"; shift
+ ;;
+ -[aDo]|--alignment|--directory|--output-file)
+ cmd="$cmd $1 $2"; shift; shift;
+ ;;
+ [!-]*)
+ pofile="$1"
+ cmd="$cmd -"; shift
+ ;;
+ *)
+ cmd="$cmd $1"; shift
+ ;;
+ esac
+done
+
+# If we are asked for just the version, then avoid spawning awk.
+test -z "$version" || exec $cmd
+
+cat $pofile | ${AWK} '
+{
+ s = 0
+ p = 0
+
+ sub("^#~", "")
+
+ # Buffer any "msgid" statements into the singular array.
+ if ($0 ~ /^msgid[ ]+/) {
+ sub("^msgid[ ]+", "");
+ singular[s++] = $0
+ while (getline) {
+ if ($0 ~ /^$/) continue
+ if ($0 ~ /^[ ]*"/)
+ singular[s++] = $0
+ else
+ break
+ }
+ }
+
+ # Buffer any "msgid_plural" statements into the plural array.
+ if ($0 ~ /^msgid_plural[ ]+/) {
+ sub("^msgid_plural[ ]+", "");
+ plural[p++] = $0
+ while (getline) {
+ if ($0 ~ /^[ ]*"/)
+ plural[p++] = $0
+ else
+ break
+ }
+ }
+
+ # If we see "msgstr", then we are outputting the translation
+ # of a singular form of a message, so dump the contents of the
+ # singular array and output the "msgstr" translation.
+ #
+ if ($0 ~ /^msgstr[ ]+/) {
+ sub("^msgstr[ ]+", "");
+ if (s > 0) {
+ print "msgid " singular[0]
+ for (i = 1; i < s; i++) print singular[i]
+ }
+ print "msgstr " $0
+ while (getline) {
+ if ($0 ~ /^[ ]*"/)
+ print $0
+ else
+ break
+ }
+ }
+
+ # If we see "msgstr[0]", then we are outputting the translation
+ # of a singular form of a message, so dump the contents of the
+ # singular array and output the "msgstr[0]" translation.
+ #
+ if ($0 ~ /^msgstr\[0\][ ]+/) {
+ sub("^msgstr...[ ]+", "");
+ if (s > 0) {
+ print "msgid " singular[0]
+ for (i = 1; i < s; i++) print singular[i]
+ }
+ print "msgstr " $0
+ while (getline) {
+ if ($0 ~ /^[ ]*"/)
+ print $0
+ else
+ break
+ }
+ }
+
+ # If we see "msgstr[1]", then we are outputting the translation
+ # of a plural form of a message, so dump the contents of the
+ # plural array and output the "msgstr[1]" translation.
+ #
+ if ($0 ~ /^msgstr\[1\][ ]+/) {
+ #
+ # Check if the singular and plural arrays are equal.
+ # If they are, then we do not need to output an
+ # additional plural translation at all since the
+ # "singular" form is already correct.
+ #
+ equal = 0
+ if (s == p) {
+ equal = 1;
+ for (i = 0; i < s; i++) {
+ if (singular[i] != plural[i]) {
+ equal = 0; break
+ }
+ }
+ }
+ if (equal == 1) {
+ while (getline) {
+ if ($0 !~ /^[ ]*"/) break
+ }
+ s = 0; p = 0
+ next
+ }
+
+ sub("^msgstr...[ ]+", "");
+ if (p > 0) {
+ print "msgid " plural[0]
+ for (i = 1; i < p; i++) print plural[i]
+ }
+ print "msgstr " $0
+ while (getline) {
+ if ($0 ~ /^[ ]*"/)
+ print $0
+ else
+ break
+ }
+ }
+
+ # Skip comments and blank lines.
+ if ($0 ~ /^#/ || $0 ~ /^[ ]*$/) {
+ print $0
+ next
+ }
+}
+' | $cmd
diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk
index 5a8d897923a..b0191e26b84 100644
--- a/mk/tools/replace.mk
+++ b/mk/tools/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.164 2006/04/06 06:23:06 reed Exp $
+# $NetBSD: replace.mk,v 1.165 2006/04/13 16:35:58 jlam Exp $
#
# Copyright (c) 2005 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -79,13 +79,6 @@
# USE_TOOLS+= perl:run
#
-# XXX Keep this hack here until the day that msgfmt and msgfmt-plurals
-# XXX is handled directly by the tools framework.
-# XXX
-.if defined(USE_MSGFMT_PLURALS) && !empty(USE_MSGFMT_PLURALS:M[yY][eE][sS])
-USE_TOOLS+= perl
-.endif
-
# bison implies "bison-yacc"
.if !empty(USE_TOOLS:Mbison) || !empty(USE_TOOLS:Mbison\:*)
USE_TOOLS+= bison-yacc
@@ -885,17 +878,18 @@ TOOLS_PATH.${_t_}= ${TOOLS_PREFIX.${_t_}}/bin/${GNU_PROGRAM_PREFIX}${_t_}
######################################################################
# These tools are all supplied by the devel/gettext-tools package if there
-# is no native tool available.
+# is no native tool available. Don't add "msgfmt" to this list since it
+# needs special handling -- see mk/tools/msgfmt.mk.
#
-_TOOLS.gettext-tools= gettext msgfmt xgettext
-_TOOLS_DEP.gettext-tools= gettext<0.14.5,gettext-tools>=0.14.5
+_TOOLS.gettext-tools= gettext xgettext
+_TOOLS_DEP.gettext-tools= {gettext>0.10.35,gettext-tools>=0.14.5}
.for _t_ in ${_TOOLS.gettext-tools}
. if !defined(TOOLS_IGNORE.${_t_}) && !empty(_USE_TOOLS:M${_t_})
. if !empty(PKGPATH:Mdevel/gettext-tools)
MAKEFLAGS+= TOOLS_IGNORE.${_t_}=
. elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
-TOOLS_DEPENDS.${_t_}?= {${_TOOLS_DEP.gettext-tools}}:../../devel/gettext-tools
+TOOLS_DEPENDS.${_t_}?= ${_TOOLS_DEP.gettext-tools}:../../devel/gettext-tools
TOOLS_CREATE+= ${_t_}
TOOLS_FIND_PREFIX+= TOOLS_PREFIX.${_t_}=${TOOLS_DEPENDS.${_t_}:C/:.*//}
TOOLS_PATH.${_t_}= ${TOOLS_PREFIX.${_t_}}/bin/${_t_}
diff --git a/mk/tools/tools.Linux.mk b/mk/tools/tools.Linux.mk
index cc1c8ce8d9c..791c336fa96 100644
--- a/mk/tools/tools.Linux.mk
+++ b/mk/tools/tools.Linux.mk
@@ -1,4 +1,4 @@
-# $NetBSD: tools.Linux.mk,v 1.30 2006/03/06 05:25:45 jlam Exp $
+# $NetBSD: tools.Linux.mk,v 1.31 2006/04/13 16:35:59 jlam Exp $
#
# System-supplied tools for the Linux operating system.
@@ -123,6 +123,9 @@ TOOLS_PLATFORM.mkdir?= /bin/mkdir -p
.if exists(/usr/bin/mktemp)
TOOLS_PLATFORM.mktemp?= /usr/bin/mktemp
.endif
+.if exists(/usr/bin/msgfmt)
+TOOLS_PLATFORM.msgfmt?= /usr/bin/msgfmt
+.endif
TOOLS_PLATFORM.mv?= /bin/mv
.if exists(/bin/nice)
TOOLS_PLATFORM.nice?= /bin/nice
diff --git a/mk/tools/tools.NetBSD.mk b/mk/tools/tools.NetBSD.mk
index aab10c426af..ecfaf01d89e 100644
--- a/mk/tools/tools.NetBSD.mk
+++ b/mk/tools/tools.NetBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: tools.NetBSD.mk,v 1.26 2006/03/06 05:25:45 jlam Exp $
+# $NetBSD: tools.NetBSD.mk,v 1.27 2006/04/13 16:35:59 jlam Exp $
#
# System-supplied tools for the NetBSD operating system.
@@ -59,6 +59,9 @@ TOOLS_PLATFORM.makeinfo?= /usr/bin/makeinfo
.endif
TOOLS_PLATFORM.mkdir?= /bin/mkdir -p
TOOLS_PLATFORM.mktemp?= /usr/bin/mktemp
+.if exists(/usr/bin/msgfmt)
+TOOLS_PLATFORM.msgfmt?= /usr/bin/msgfmt
+.endif
TOOLS_PLATFORM.mtree?= /usr/sbin/mtree
TOOLS_PLATFORM.mv?= /bin/mv
TOOLS_PLATFORM.nice?= /usr/bin/nice