| 1 |
#!/bin/bash |
| 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 |
. "${0%/*}/prologue.sh" |
| 21 |
|
| 22 |
executeCommand() { |
| 23 |
"${@}" |
| 24 |
} |
| 25 |
|
| 26 |
updateFiles() { |
| 27 |
fromRoot="${1}" |
| 28 |
fromDirectory="${2}" |
| 29 |
toDirectory="${3}" |
| 30 |
shift 3 |
| 31 |
|
| 32 |
executeCommand mkdir -p -- "${outputRoot}/${toDirectory}" |
| 33 |
set -- `cd "${fromRoot}/${fromDirectory}" && echo ${*}` |
| 34 |
|
| 35 |
for fromFile |
| 36 |
do |
| 37 |
fromPath="${fromRoot}/${fromDirectory}/${fromFile}" |
| 38 |
[ -e "${fromPath}" ] && executeCommand cp -a -- "${fromPath}" "${outputRoot}/${toDirectory}/" |
| 39 |
done |
| 40 |
} |
| 41 |
|
| 42 |
outputRoot="" |
| 43 |
sourceRoot="" |
| 44 |
buildRoot="" |
| 45 |
|
| 46 |
while getopts ":o:s:b:" option |
| 47 |
do |
| 48 |
case "${option}" |
| 49 |
in |
| 50 |
o) outputRoot="${OPTARG}";; |
| 51 |
s) sourceRoot="${OPTARG}";; |
| 52 |
b) buildRoot="${OPTARG}";; |
| 53 |
|
| 54 |
:) syntaxError "missing value: -${OPTARG}";; |
| 55 |
\?) syntaxError "unknown option: -${OPTARG}";; |
| 56 |
*) syntaxError "unimplemented option: -${option}";; |
| 57 |
esac |
| 58 |
done |
| 59 |
|
| 60 |
shift `expr "${OPTIND}" - 1` |
| 61 |
[ "${#}" -eq 0 ] || syntaxError "too many parameters" |
| 62 |
|
| 63 |
[ -n "${outputRoot}" ] || outputRoot="doc" |
| 64 |
verifyOutputDirectory "${outputRoot}" |
| 65 |
|
| 66 |
[ -n "${sourceRoot}" ] || sourceRoot=`dirname "${0}"` |
| 67 |
verifyInputDirectory "${sourceRoot}" |
| 68 |
sourceRoot=`resolveDirectory "${sourceRoot}"` |
| 69 |
|
| 70 |
if [ -n "${buildRoot}" ] |
| 71 |
then |
| 72 |
verifyInputDirectory "${buildRoot}" |
| 73 |
buildRoot=`resolveDirectory "${buildRoot}"` |
| 74 |
else |
| 75 |
buildRoot="${sourceRoot}" |
| 76 |
fi |
| 77 |
|
| 78 |
updateFiles "${sourceRoot}" "." "." "README" "LICENSE-*" |
| 79 |
|
| 80 |
sourceDocuments="${sourceRoot}/${documentsSubdirectory}" |
| 81 |
buildDocuments="${buildRoot}/${documentsSubdirectory}" |
| 82 |
|
| 83 |
for document in `cd "${sourceDocuments}" && echo README.*` |
| 84 |
do |
| 85 |
make -s -C "${buildDocuments}" "${document#README.}.html" |
| 86 |
done |
| 87 |
|
| 88 |
updateFiles "${sourceRoot}" "${documentsSubdirectory}" "." "BUGS" "ChangeLog" "CONTRIBUTORS" "HISTORY" "TODO" "*.csv" |
| 89 |
updateFiles "${buildRoot}" "${documentsSubdirectory}" "." "brltty.conf" "*.html" |
| 90 |
|
| 91 |
for manual in `cd "${sourceDocuments}" && echo Manual-*/*` |
| 92 |
do |
| 93 |
for documentExtension in doc htm html pdf sgml txt |
| 94 |
do |
| 95 |
updateFiles "${sourceRoot}" "${documentsSubdirectory}/${manual}" "${manual}" "*.${documentExtension}" |
| 96 |
done |
| 97 |
done |
| 98 |
|
| 99 |
for manual in BrlAPIref |
| 100 |
do |
| 101 |
updateFiles "${buildRoot}" "${documentsSubdirectory}/${manual}/html" "${manual}" "*.html" |
| 102 |
done |
| 103 |
|
| 104 |
executeCommand "${sourceRoot}/mkdocktb" -o "${outputRoot}/KeyTables" -s "${sourceRoot}" -b "${buildRoot}" |
| 105 |
|
| 106 |
exit 0 |