Skip to content

Commit

Permalink
Ticket #4619: (autogen.sh) - improve creation of POTFILES.in
Browse files Browse the repository at this point in the history
- current POTFILES.in file detection can output wrong filename
     xgettext output
     #: src/background.c:221 src/filemanager/file.c:858 src/filemanager/file.c:952
     result in
     src/background.csrc/filemanager/file.csrc/filemanager/file.c
- simplify POTFILES.in file detection by using grep only
- find command search files only
- find/grep option should be Solaris OS friendly
- move POTFILES.in creating to configure.ac (more BUILD friendly and future autogen.sh get rid possibility)
- autoconf AC_CONFIG_COMMANDS_POST support since <2.64
- comparing current vs simplify grep file detection result in additional files:
    lib/search/regex.c
    lib/widget/history.c
    lib/widget/quick.h
    src/diffviewer/internal.h
    src/diffviewer/search.c
    src/editor/editdraw.c
    src/editor/etags.c
    src/filemanager/command.c
    src/vfs/tar/tar.c
    src/viewer/lib.c
    tests/src/execute__common.c
    tests/src/execute__execute_with_vfs_arg.c

Signed-off-by: Andreas Mohr <[email protected]>
Signed-off-by: Yury V. Zaytsev <[email protected]>
  • Loading branch information
Andreas Mohr authored and zyv committed Dec 25, 2024
1 parent 17c2a65 commit fe9e468
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
11 changes: 0 additions & 11 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ ${AUTORECONF:-autoreconf} --verbose --install --force -I m4 ${AUTORECONF_FLAGS}
# Customize the INSTALL file
rm -f INSTALL && ln -s doc/INSTALL .

# Generate po/POTFILES.in
if ! xgettext -h 2>&1 | grep -- '--keyword' >/dev/null ; then
echo "gettext is unable to extract translations, set XGETTEXT to GNU gettext!" >&2
touch po/POTFILES.in
else
${XGETTEXT:-xgettext} --keyword=_ --keyword=N_ --keyword=Q_ --output=- \
`find . -name '*.[ch]'` | ${SED-sed} -ne '/^#:/{s/#://;s/:[0-9]*/\
/g;s/ //g;p;}' | \
grep -v '^$' | sort | uniq >po/POTFILES.in
fi

"$srcdir/version.sh" "$srcdir"

if test -x "$srcdir/configure.mc"; then
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ tests/src/vfs/extfs/helpers-list/misc/Makefile
tests/src/vfs/ftpfs/Makefile
])

AC_CONFIG_COMMANDS_POST([
"${srcdir}"/po/create-potfiles_in.sh "${srcdir}"
])

AC_OUTPUT

AC_MSG_NOTICE([
Expand Down
12 changes: 12 additions & 0 deletions po/create-potfiles_in.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

if [ -z "$1" ] ;then
echo "usage: $0 <toplevel-source-dir>"
exit 1
fi

cd "$1" && \
"${FIND:-find}" . -type f -name '*.[ch]' -exec \
"${GREP:-grep}" -l '_\s*(\s*"' {} + | \
"${SORT:-sort}" | "${UNIQ:-uniq}" > po/POTFILES.in

0 comments on commit fe9e468

Please sign in to comment.