diff options
author | Lennart Kolmodin <kolmodin@gentoo.org> | 2009-05-06 20:55:17 +0000 |
---|---|---|
committer | Lennart Kolmodin <kolmodin@gentoo.org> | 2009-05-06 20:55:17 +0000 |
commit | e7f14c3c5bb09c60716ebcef91300fb8cd21377a (patch) | |
tree | 379622f80b95db13f779f1c3c19bea87c44d8305 | |
parent | amd64 stable, bug #264594 (diff) | |
download | gentoo-2-e7f14c3c5bb09c60716ebcef91300fb8cd21377a.tar.gz gentoo-2-e7f14c3c5bb09c60716ebcef91300fb8cd21377a.tar.bz2 gentoo-2-e7f14c3c5bb09c60716ebcef91300fb8cd21377a.zip |
Fixes for dev-haskell/haddock
(Portage version: 2.1.6.12/cvs/Linux x86_64)
-rw-r--r-- | dev-haskell/haddock/ChangeLog | 9 | ||||
-rw-r--r-- | dev-haskell/haddock/files/haddock-2.4.2-Setup.hs | 72 | ||||
-rw-r--r-- | dev-haskell/haddock/haddock-2.4.2.ebuild | 32 |
3 files changed, 107 insertions, 6 deletions
diff --git a/dev-haskell/haddock/ChangeLog b/dev-haskell/haddock/ChangeLog index 687151fd123f..f49f8127b768 100644 --- a/dev-haskell/haddock/ChangeLog +++ b/dev-haskell/haddock/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for dev-haskell/haddock # Copyright 2000-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-haskell/haddock/ChangeLog,v 1.58 2009/04/26 16:05:27 kolmodin Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-haskell/haddock/ChangeLog,v 1.59 2009/05/06 20:55:17 kolmodin Exp $ + + 06 May 2009; Lennart Kolmodin <kolmodin@gentoo.org> + +files/haddock-2.4.2-Setup.hs, haddock-2.4.2.ebuild: + Hide dependency on filepath and bundle dependency on ghc-paths. + This is to make it easier to install/upgrade haddock when you've just + upgraded/installed ghc-6.10. + Relevant bug #268248. 26 Apr 2009; Lennart Kolmodin <kolmodin@gentoo.org> haddock-0.8.ebuild, haddock-0.9.ebuild: diff --git a/dev-haskell/haddock/files/haddock-2.4.2-Setup.hs b/dev-haskell/haddock/files/haddock-2.4.2-Setup.hs new file mode 100644 index 000000000000..31ee04eb8168 --- /dev/null +++ b/dev-haskell/haddock/files/haddock-2.4.2-Setup.hs @@ -0,0 +1,72 @@ +{- +Setup.hs: based on code from ghc-paths of Simon Marlow +Fixed to not use the .buildinfo, and use -Dfoo flags for both libraries and executables +-} +import Distribution.Simple +import Distribution.Simple.Setup +import Distribution.PackageDescription +import Distribution.Simple.LocalBuildInfo +import Distribution.InstalledPackageInfo +import Distribution.Simple.Program +import Distribution.Simple.PackageIndex as Pkg + +import System.Exit +import System.IO +import Data.IORef +import Data.Char +import Data.Maybe + +main = defaultMainWithHooks simpleUserHooks { + confHook = myCustomConfHook + } + where + myCustomConfHook :: (Either GenericPackageDescription PackageDescription, HookedBuildInfo) + -> ConfigFlags + -> IO LocalBuildInfo + myCustomConfHook egpdpdhbi flags = do + -- get the default LBI + lbi <- confHook simpleUserHooks egpdpdhbi flags + let programs = withPrograms lbi + + libdir_ <- rawSystemProgramStdoutConf (fromFlag (configVerbosity flags)) + ghcProgram programs ["--print-libdir"] + let libdir = reverse $ dropWhile isSpace $ reverse libdir_ + + ghc_pkg = case lookupProgram ghcPkgProgram programs of + Just p -> programPath p + Nothing -> error "ghc-pkg was not found" + ghc = case lookupProgram ghcProgram programs of + Just p -> programPath p + Nothing -> error "ghc was not found" + + -- figure out docdir from base's haddock-html field + base_pkg = case searchByName (installedPkgs lbi) "base" of + None -> error "no base package" + Unambiguous (x:_) -> x + _ -> error "base ambiguous" + base_html = case haddockHTMLs base_pkg of + [] -> "" + (x:_) -> x + docdir = fromMaybe base_html $ + fmap reverse (stripPrefix (reverse "/libraries/base") + (reverse base_html)) + + let programs' = userSpecifyArgs "ghc" ["-DGHC_PATHS_GHC_PKG=" ++ show ghc_pkg, + "-DGHC_PATHS_GHC=" ++ show ghc, + "-DGHC_PATHS_LIBDIR=" ++ show libdir, + "-DGHC_PATHS_DOCDIR=" ++ show docdir + ] programs + -- returning our modified LBI that includes the -D definitions + return lbi { withPrograms = programs' } + +die :: String -> IO a +die msg = do + hFlush stdout + hPutStr stderr msg + exitWith (ExitFailure 1) + +stripPrefix :: Eq a => [a] -> [a] -> Maybe [a] +stripPrefix [] ys = Just ys +stripPrefix (x:xs) (y:ys) + | x == y = stripPrefix xs ys +stripPrefix _ _ = Nothing diff --git a/dev-haskell/haddock/haddock-2.4.2.ebuild b/dev-haskell/haddock/haddock-2.4.2.ebuild index 2b1ca28f7404..7d7a328616e2 100644 --- a/dev-haskell/haddock/haddock-2.4.2.ebuild +++ b/dev-haskell/haddock/haddock-2.4.2.ebuild @@ -1,23 +1,34 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-haskell/haddock/haddock-2.4.2.ebuild,v 1.2 2009/04/20 00:08:07 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-haskell/haddock/haddock-2.4.2.ebuild,v 1.3 2009/05/06 20:55:17 kolmodin Exp $ CABAL_FEATURES="bin lib" # don't enable profiling as the 'ghc' package is not built with profiling inherit haskell-cabal autotools +GHCPATHS_PN="ghc-paths" +GHCPATHS_PV="0.1.0.5" +GHCPATHS_P="${GHCPATHS_PN}-${GHCPATHS_PV}" + DESCRIPTION="A documentation-generation tool for Haskell libraries" HOMEPAGE="http://www.haskell.org/haddock/" -SRC_URI="http://hackage.haskell.org/packages/archive/${PN}/${PV}/${P}.tar.gz" +SRC_URI="http://hackage.haskell.org/packages/archive/${PN}/${PV}/${P}.tar.gz + http://hackage.haskell.org/packages/archive/${GHCPATHS_PN}/${GHCPATHS_PV}/${GHCPATHS_P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc" -RDEPEND="~dev-lang/ghc-6.10.2 - dev-haskell/filepath - dev-haskell/ghc-paths" +# haddock-2.4.2 also deps on the upgradeable package dev-haskell/filepath. +# however, it's included in >=ghc-6.10, so we use the core package without +# stating the dependency in DEPEND. + +# we bundle the dep on ghc-paths to reduce the dependencies on this critical +# package. ghc-paths would like to be compiled with USE=doc, which pulls in +# haddock, which requires ghc-paths, which pulls in haddock... + +RDEPEND="~dev-lang/ghc-6.10.2" DEPEND="${RDEPEND} >=dev-haskell/cabal-1.6 doc? ( ~app-text/docbook-xml-dtd-4.2 @@ -27,6 +38,17 @@ DEPEND="${RDEPEND} src_unpack() { unpack ${A} + # use ghc-paths directly, not as a library + sed -e "s|build-depends: ghc-paths|hs-source-dirs: ../${GHCPATHS_P}|" \ + -e "s|Simple|Custom|" \ + -i "${S}/${PN}.cabal" + + # ghc-paths has a custom Setup.hs, haddock has the default Setup.lhs. + # we use a somewhat modified ghc-paths Setup.hs that works better for our + # purposes. + rm "${S}/Setup.lhs" + cp "${FILESDIR}/${P}-Setup.hs" "${S}/Setup.hs" + if use doc; then cd "${S}/doc" eautoreconf |