emsg=$pwd/$T/emsgids.c
posr=$pwd/$T/po-sources
-# Extra files to scan
-extra_files=$pwd/options.c
-
# Locate files to scan, and generate the list. All .c, .h, and .def files
# in $srcdir are examined, likewise $srcdir/config and $srcdir/config/*
# (directories). Also, all subdirectories of $srcdir that contain a
do eval echo $dir$glob
done
done;
- echo $extra_files;
} | tr ' ' "$nl" | grep -v '\*' |
$AWK -v excl=po/EXCLUDES -v posr=$posr -v kopt=$kopt -v emsg=$emsg '
function keyword_option(line) {
}'
)
+echo "scanning option files..." >&2
+
+( cd $srcdir; find . -name '*.opt' -print |
+ $AWK '{
+ file = $1
+ lineno = 1
+ field = 0
+ while (getline < file) {
+ if (/^[ \t]*(;|$)/ || !/^[^ \t]/) {
+ field = 0
+ } else {
+ if (field == 2) {
+ line = $0
+ gsub(".*\t", "", line)
+ printf("#line %d \"%s\"\n", lineno, file)
+ printf("_(\"%s\")\n", line)
+ }
+ field++;
+ }
+ lineno++;
+ }
+ }') >> $emsg
+
# Run the xgettext command, with temporary added as a file to scan.
echo "running xgettext..." >&2
$xgettext --default-domain=$package --directory=$srcdir \
--add-comments `cat $kopt` --files-from=$posr \
--copyright-holder="Free Software Foundation, Inc." \
--msgid-bugs-address="http://gcc.gnu.org/bugs.html" \
- --language=c -o po/$package.pot
+ --language=c -o po/$package.pot.tmp
+# Remove local paths from .pot file.
+sed "s:$srcdir/::g;s:$pwd/::g;" <po/$package.pot.tmp >po/$package.pot
+rm po/$package.pot.tmp