diff options
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | haddock.cabal | 3 | ||||
-rw-r--r-- | haddock.wrapper | 2 | ||||
-rw-r--r-- | src/Haddock/GHC.hs | 3 | ||||
-rw-r--r-- | src/Main.hs | 9 |
5 files changed, 34 insertions, 4 deletions
@@ -1,7 +1,28 @@ TOP=../.. ENABLE_SHELL_WRAPPERS = YES +EXTRA_INPLACE_CONFIGURE_FLAGS += --flags=-ghc-paths +EXTRA_STAGE2_CONFIGURE_FLAGS += --flags=-ghc-paths include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/cabal.mk +SRC_HC_OPTS += -w + +.PHONY: install-inplace + +INPLACE_PKG_CONF = $(FPTOOLS_TOP_ABS)/ghc/inplace-datadir/package.conf + +install-inplace: + $(INSTALL_PACKAGE) install '$(GHC_PKG_PROG)' '$(INPLACE_PKG_CONF)' '' \ + '$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace' \ + '$(FPTOOLS_TOP_ABS)/utils/haddock/install-inplace' \ + '$$prefix/bin' \ + '$$prefix/lib' \ + '$$prefix/libexec' \ + '$$prefix/dynlib' \ + '$$prefix/share' \ + '$$prefix/doc' \ + '$$prefix/html' \ + '$$prefix/haddock' \ + --distpref dist-install --enable-shell-wrappers diff --git a/haddock.cabal b/haddock.cabal index d626f3cd..5f486bd3 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -75,9 +75,10 @@ executable haddock if flag(ghc-paths) build-depends: ghc-paths + cpp-options: -DGHC_PATHS if impl(ghc >= 6.9) - build-depends: Cabal >= 1.5 + build-depends: Cabal >= 1.5, getopt main-is: Main.hs hs-source-dirs: src diff --git a/haddock.wrapper b/haddock.wrapper index e93dc7a7..bb16c310 100644 --- a/haddock.wrapper +++ b/haddock.wrapper @@ -1,2 +1,2 @@ -$executablename -B$datadir ${1+"$@"} +$executablename -B$datadir -l$datadir ${1+"$@"} diff --git a/src/Haddock/GHC.hs b/src/Haddock/GHC.hs index d5b59e0e..66bd3b1f 100644 --- a/src/Haddock/GHC.hs +++ b/src/Haddock/GHC.hs @@ -25,6 +25,7 @@ import GHC import DynFlags hiding (Option) import Packages hiding (package) import StaticFlags +import SrcLoc -- | Start a GHC session with the -haddock flag set. Also turn off @@ -33,7 +34,7 @@ startGhc :: String -> [String] -> IO (Session, DynFlags) startGhc libDir flags = do -- TODO: handle warnings? #if __GLASGOW_HASKELL__ >= 609 - (restFlags, _) <- parseStaticFlags flags + (restFlags, _) <- parseStaticFlags (map noLoc flags) #else restFlags <- parseStaticFlags flags #endif diff --git a/src/Main.hs b/src/Main.hs index f9820243..310214c6 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -38,7 +38,9 @@ import System.Exit import System.Environment import GHC +#ifdef GHC_PATHS import GHC.Paths +#endif import DynFlags import Bag import ErrUtils @@ -137,7 +139,12 @@ main = handleTopExceptions $ do let libDir | Just dir <- getGhcLibDir flags = dir - | otherwise = libdir -- from GHC.Paths + | otherwise = +#ifdef GHC_PATHS + libdir -- from GHC.Paths +#else + error "No GhcLibDir" +#endif -- initialize GHC (session, dynflags) <- startGhc libDir (ghcFlags flags) |