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