Add support for response files in wrapper script
[hsc2hs.git] / hsc2hs.wrapper
1 #!/bin/sh
2
3 tflag="--template=$topdir/template-hsc.h"
4 Iflag="-I$topdir/include/"
5
6 read_response() {
7     response_file=$1
8     if [ -f "$response_file" ]; then
9         while read -r arg; do
10             case "$arg" in
11                 -t*)          tflag=;;
12                 --template=*) tflag=;;
13                 @*)           read_response "${arg#"@"}" ;;
14                 --)           break;;
15             esac
16         done < "$response_file"
17     fi
18 }
19
20 for arg do
21     case "$arg" in
22         -t*)          tflag=;;
23         --template=*) tflag=;;
24         @*)           read_response "${arg#"@"}" ;;
25         --)           break;;
26     esac
27 done
28
29 exec "$executablename" ${tflag:+"$tflag"} $HSC2HS_EXTRA ${1+"$@"} "$Iflag"