More helpful error message when trying to build using library-profiling
authordennis <dennis@felsin9.de>
Thu, 13 Sep 2012 10:53:23 +0000 (10:53 +0000)
committerdennis <dennis@felsin9.de>
Thu, 13 Sep 2012 10:53:23 +0000 (10:53 +0000)
Setup.hs
ghc-heap-view.cabal

index 9a994af..d7dc6ae 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,2 +1,12 @@
 import Distribution.Simple
-main = defaultMain
+import Distribution.Simple.Setup
+import Distribution.Simple.LocalBuildInfo
+import Distribution.PackageDescription (PackageDescription)
+
+main = defaultMainWithHooks $
+       simpleUserHooks { postConf = postConfHook (postConf simpleUserHooks) }
+
+postConfHook oldHook args flags descr buildInfo = case profFlag of
+  Flag True -> error "This library cannot be built using profiling. Try invoking cabal with the --disable-library-profiling flag."
+  _ -> oldHook args flags descr buildInfo
+  where profFlag = configProfLib $ configFlags buildInfo
index 3a5fa34..e401cb0 100644 (file)
@@ -16,7 +16,7 @@ Author:              Joachim Breitner, Dennis Felsing
 Maintainer:          Joachim Breitner <mail@joachim-breitner.de>
 Copyright:           2012 Joachim Breitner
 Category:            Debug, GHC
-Build-type:          Simple
+Build-type:          Custom
 Cabal-version:       >=1.14
 Extra-source-files:  Demo.hs