root / autotools / docbook-wrapper @ 936f3c59
History | View | Annotate | Download (630 Bytes)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
set -e |
4 |
|
5 |
if test "$#" != 4 |
6 |
then |
7 |
echo "Wrong number of arguments." >&2 |
8 |
exit 1 |
9 |
fi |
10 |
|
11 |
cmd="${1}" |
12 |
input="${2}" |
13 |
cmdoutputfile="${3}" |
14 |
output="${4}" |
15 |
|
16 |
# docbook2man inserts a date formatted using the current locale into its |
17 |
# output. Using the "C" locale makes sure it's always in the default format. |
18 |
export LC_ALL=C |
19 |
|
20 |
tmpdir=`mktemp -d` |
21 |
trap "rm -rf ${tmpdir}" EXIT |
22 |
|
23 |
if ! ( cd `dirname ${input}` && |
24 |
${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; ) |
25 |
then |
26 |
echo "Building ${output} failed." >&2 |
27 |
exit 1 |
28 |
fi |
29 |
|
30 |
mv "${tmpdir}/${cmdoutputfile}" "${output}" |
31 |
|
32 |
# Needed for make to recognize output file |
33 |
touch "${output}" |