fix: work around inability to build haskell main master
authorGreg Hurrell <greg@hurrell.net>
Tue, 8 Dec 2020 20:16:45 +0000 (21:16 +0100)
committerGreg Hurrell <greg@hurrell.net>
Tue, 8 Dec 2020 20:16:45 +0000 (21:16 +0100)
Seeing an issue like this:

    https://github.com/commercialhaskell/stack/issues/157

Fix from here:

    https://stackoverflow.com/a/39019781

With this, this (ie. building updated Ferret docs) works:

    git clone https://github.com/wincent/docvim.git
    cd docvim
    pacman -S stack happy
    bin/docvim \
        -c ~/.vim/pack/bundle/opt/ferret \
        ~/.vim/pack/bundle/opt/ferret/README.md \
        ~/.vim/pack/bundle/opt/ferret/doc/ferret.txt

Setup.hs

index 9a994af677b0dfd41b4e3b76b3e7e604003d64e1..4a1d95c542e3279ba487de6d3f8a6aa3951f891e 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,2 +1,17 @@
 import Distribution.Simple
-main = defaultMain
+import System.Environment
+
+-- Hacking this to work based on:
+--
+--    https://stackoverflow.com/a/39019781
+--
+-- Relies on `happy` existing at /usr/bin/happy; eg. on Arch Linux:
+--
+--    sudo pacman -S stack happy
+
+main = do
+  args <- getArgs
+  let args' = if elem "configure" args
+    then args ++ [ "--with-happy=/usr/bin/happy" ]
+    else args
+  defaultMainWithArgs args'