Commit d65ad0b0 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Updated build setup to run build-parser.sh automatically

parent 0ac0c84a
...@@ -39,7 +39,7 @@ maintainer: andrew.gibiansky@gmail.com ...@@ -39,7 +39,7 @@ maintainer: andrew.gibiansky@gmail.com
category: Development category: Development
build-type: Simple build-type: Custom
-- Constraint on the version of Cabal needed to build this package. -- Constraint on the version of Cabal needed to build this package.
cabal-version: >=1.8 cabal-version: >=1.8
...@@ -75,6 +75,8 @@ library ...@@ -75,6 +75,8 @@ library
executable IHaskell executable IHaskell
-- .hs or .lhs file containing the Main module. -- .hs or .lhs file containing the Main module.
main-is: Main.hs main-is: Main.hs
build-tools: happy, cpphs
-- Modules included in this executable, other than Main. -- Modules included in this executable, other than Main.
other-modules: other-modules:
......
import Distribution.Simple import Distribution.Simple
import System.Cmd
import Control.Monad
main :: IO () main :: IO ()
main = defaultMain main = defaultMainWithHooks simpleUserHooks{
preConf = \args confFlags -> do
buildParser
preConf simpleUserHooks args confFlags
}
buildParser = system "./build-parser.sh"
#!/bin/sh #!/bin/sh
# Called from Setup.hs.
# Preprocess the GHC parser we're using to CPP subs.
cpphs --linepragma --text HaskellParser.y.pp -OParser.y cpphs --linepragma --text HaskellParser.y.pp -OParser.y
# Compile the parser and remove intermediate file.
happy Parser.y happy Parser.y
rm Parser.y rm Parser.y
# Move output Haskell to source directory.
mkdir -p IHaskell/GHC mkdir -p IHaskell/GHC
mv Parser.hs IHaskell/GHC/HaskellParser.hs mv Parser.hs IHaskell/GHC/HaskellParser.hs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment