Permalink
Browse files

In Setup, tell haddock about GHC.Prim

  • Loading branch information...
1 parent b0f3bc3 commit 4e29a99dfdccb860972db69da3b570eb81b69bb8 @igfoo igfoo committed Sep 5, 2008
Showing with 13 additions and 3 deletions.
  1. +11 −2 Setup.hs
  2. +2 −1 ghc-prim.cabal
View
@@ -9,6 +9,7 @@ import Data.Maybe
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
+import Distribution.Simple.Program
import Distribution.Simple.Utils
import Distribution.Text
import System.Cmd
@@ -25,8 +26,9 @@ main = do let hooks = simpleUserHooks {
$ buildHook simpleUserHooks,
makefileHook = build_primitive_sources
$ makefileHook simpleUserHooks,
- haddockHook = build_primitive_sources
- $ haddockHook simpleUserHooks }
+ haddockHook = addPrimModuleForHaddock
+ $ build_primitive_sources
+ $ haddockHook simpleUserHooks }
defaultMainWithHooks hooks
type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO ()
@@ -40,6 +42,13 @@ addPrimModule f pd lbi uhs x =
lbi' = lbi { localPkgDescr = lpd }
f pd' lbi' uhs x
+addPrimModuleForHaddock :: Hook a -> Hook a
+addPrimModuleForHaddock f pd lbi uhs x =
+ do let pc = withPrograms lbi
+ pc' = userSpecifyArgs "haddock" ["GHC/Prim.hs"] pc
+ lbi' = lbi { withPrograms = pc' }
+ f pd lbi' uhs x
+
addPrimModuleToPD :: PackageDescription -> PackageDescription
addPrimModuleToPD pd =
case library pd of
View
@@ -22,7 +22,8 @@ Library {
GHC.Unit
c-sources:
cbits/longlong.c
- extensions: CPP, MagicHash, ForeignFunctionInterface, UnliftedFFITypes
+ extensions: CPP, MagicHash, ForeignFunctionInterface, UnliftedFFITypes,
+ UnboxedTuples, EmptyDataDecls, NoImplicitPrelude
-- We need to set the package name to ghc-prim (without a version number)
-- as it's magic.
ghc-options: -package-name ghc-prim

0 comments on commit 4e29a99

Please sign in to comment.