Debian Codegraph @

mkpot

raw
1 #!/bin/sh
2 ###############################################################################
3 # BRLTTY - A background process providing access to the console screen (when in
4 # text mode) for a blind person using a refreshable braille display.
5 #
6 # Copyright (C) 1995-2026 by The BRLTTY Developers.
7 #
8 # BRLTTY comes with ABSOLUTELY NO WARRANTY.
9 #
10 # This is free software, placed under the terms of the
11 # GNU Lesser General Public License, as published by the Free Software
12 # Foundation; either version 2.1 of the License, or (at your option) any
13 # later version. Please see the file LICENSE-LGPL for details.
14 #
15 # Web Page: http://brltty.app/
16 #
17 # This software is maintained by Dave Mielke <[email protected]>.
18 ###############################################################################
19
20 . "`dirname "${0}"`/brltty-prologue.sh"
21 addProgramOption p string.name packageName "specify the package name" "the name of the top-level directory of the source tree"
22 addProgramOption n string.version packageVersion "specify the package version" "no version"
23 addProgramOption o string.file outputFile "specify the output file" "<package-name>.pot in the current directory"
24 addProgramOption b string.email bugsAddress "specify the email address for bug reports" "no address"
25 addProgramOption c string.name copyrightHolder "specify the name of the copyright holder" "no copyright holder"
26 addProgramParameter source sourceRoot "top-level directory of source tree"
27 optionalProgramParameters
28 addProgramParameter build buildRoot "top-level directory of build tree" "the source tree"
29 parseProgramArguments "${@}"
30
31 [ -n "${sourceRoot}" ] || sourceRoot="."
32 sourceRoot="$(resolveDirectory "${sourceRoot}")" || semanticError
33
34 if [ -n "${buildRoot}" ]
35 then
36 buildRoot="$(resolveDirectory "${buildRoot}")" || semanticError
37 else
38 buildRoot="${sourceRoot}"
39 fi
40 [ "${buildRoot}" != "${sourceRoot}" ] || buildRoot=""
41
42 [ -n "${packageName}" ] || packageName=`basename "${sourceRoot}"`
43 [ -n "${outputFile}" ] || outputFile="${packageName}.pot"
44 [ "${outputFile#/}" != "${outputFile}" ] || outputFile="${initialDirectory}/${outputFile}"
45
46 xgettext --output - --force-po --no-wrap --from-code utf-8 \
47 ${packageName:+--package-name "${packageName}"} \
48 ${packageVersion:+--package-version "${packageVersion}"} \
49 ${bugsAddress:+--msgid-bugs-address "${bugsAddress}"} \
50 ${copyrightHolder:+--copyright-holder "${copyrightHolder}"} \
51 --keyword=strtext:1 --flag=logMessage:2:c-format \
52 --add-comments \
53 -- `find -H ${sourceRoot} ${buildRoot} -name '*.c' -o -name '*.h' | sort` |
54 sed >"${outputFile}" -e "
55 s/PACKAGE/${packageName}/
56
57 /^#: /{
58 s% ${sourceRoot}/*% %g
59 s% ${buildRoot}/*% %g
60 }
61 "
62 exit "${?}"