/usr/bin/apertium-gen-modes is in apertium-dev 3.4.2~r68466-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | #!/bin/bash
APERTIUMDIR=/usr/share/apertium
XMLLINT=/usr/bin/xmllint
XSLTPROC=/usr/bin/xsltproc
#!/bin/bash
# Makefile.am prepends APERTIUMDIR, XMLLINT, XSLTPROC and the right shebang
show_help () {
cat <<EOF
USAGE: $(basename "$0") modes.xml
$(basename "$0") modes.xml BASENAME
$(basename "$0") -f modes.xml INSTALLDIR
Creates all modes under the 'modes/' subdirectory of the directory of
modes.xml, and further creates copies of installable modes in the same
directory as modes.xml.
If only modes.xml is given, all files refer only to datafiles under
the same directory as modes.xml.
If only modes.xml and BASENAME are given, installable modes will refer
to datafiles in ${APERTIUMDIR}/\${BASENAME}.
If -f is given, the second non-option argument INSTALLDIR is the full
path to where installed data files for installable modes are.
If a mode has attribute gendebug="yes", the script will also
auto-generate debug modes (e.g. -morph, -tagger, -chunker).
Use option -v to show the actual commands this script runs.
EOF
exit 1
}
verbose=false
fullpath=false
OPTIND=1
while getopts "hHfv" opt; do
case "$opt" in
h|H)
echo show_help
exit 0
;;
v) verbose=true
;;
f) fullpath=true
;;
'?')
show_help >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
xmlfile="$1"
if [[ ! -e "${xmlfile}" ]]; then
echo "ERROR: '${xmlfile}' file not found"
exit 1
fi
xmldir=$(cd "$(dirname "${xmlfile}")"; pwd)
case $# in
1) installdir="${xmldir}";;
2) if ${fullpath}; then
installdir="$2"
else
installdir="${APERTIUMDIR}/$2"
fi
;;
*) show_help >&2
exit 1
;;
esac
$verbose && set -x
set -o pipefail # introduced in bash 3; available in OSX>=10.5; should be safe
[[ -d "${xmldir}"/modes ]] || mkdir "${xmldir}"/modes
"${XMLLINT}" --dtdvalid "${APERTIUMDIR}"/modes.dtd --noout "${xmlfile}" || exit $?
"${XSLTPROC}" "${APERTIUMDIR}"/modes2debugmodes.xsl "${xmlfile}" \
| "${XSLTPROC}" --stringparam devdir "${xmldir}" \
--stringparam installdir "${installdir}" \
"${APERTIUMDIR}"/modes2bash.xsl \
- \
| awk -f "${APERTIUMDIR}"/apertium-createmodes.awk
|