Add support for response files in wrapper script
authorBen Gamari <ben@smart-cactus.org>
Tue, 23 Oct 2018 19:19:43 +0000 (15:19 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 23 Oct 2018 20:09:03 +0000 (16:09 -0400)
Reviewers: O25 HSC2HS, hvr

Subscribers: ckoparkar

Differential Revision: https://phabricator.haskell.org/D5238

hsc2hs.wrapper

index e4479dd..ee1ad9d 100644 (file)
@@ -2,10 +2,26 @@
 
 tflag="--template=$topdir/template-hsc.h"
 Iflag="-I$topdir/include/"
+
+read_response() {
+    response_file=$1
+    if [ -f "$response_file" ]; then
+        while read -r arg; do
+            case "$arg" in
+                -t*)          tflag=;;
+                --template=*) tflag=;;
+                @*)           read_response "${arg#"@"}" ;;
+                --)           break;;
+            esac
+        done < "$response_file"
+    fi
+}
+
 for arg do
     case "$arg" in
         -t*)          tflag=;;
         --template=*) tflag=;;
+        @*)           read_response "${arg#"@"}" ;;
         --)           break;;
     esac
 done