Commits

Andy Gocke  committed 9770f1f

New setup

  • Participants
  • Parent commits 9006dba

Comments (0)

Files changed (1)

+import Distribution.PackageDescription (BuildInfo)
 import Distribution.Simple
+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo)
+import Distribution.Simple.PreProcess 
 import Distribution.Simple.Program.Types
+import Distribution.Simple.Utils (findProgramVersion, notice)
+import System.Cmd (rawSystem)
+import System.FilePath ((</>))
 
-main = defaultMainWithHooks simpleUserHooks { hookedPrograms = [hprotoc] }
+main = defaultMainWithHooks simpleUserHooks { 
+  hookedPrograms = [hprotocProgram]
+}
 
 hprotocProgram :: Program
 hprotocProgram = (simpleProgram "hprotoc") {
 ppHprotoc :: BuildInfo -> LocalBuildInfo -> PreProcessor
 ppHprotoc _ lbi = PreProcessor {
   platformIndependent = True,
-
+  runPreProcessor = \(inPath, inFile) (outPath, outFile) verbosity -> do
+    notice verbosity (inPath </> inFile ++ " compiled to " ++ 
+                      outPath </> outFile)
+    rawSystem "hprotoc" ["--haskell-out=" ++ outPath, inPath </> inFile]
+    return ()
+}