packages feed

poppler 0.12.2.2 → 0.12.3

raw patch · 6 files changed

+321/−157 lines, 6 filesdep +gtk3setup-changed

Dependencies added: gtk3

Files

Graphics/UI/Gtk/Poppler/Types.chs view
@@ -1,5 +1,5 @@-{-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE CPP #-}+{-# OPTIONS_HADDOCK hide #-} -- -*-haskell-*- -- -------------------- automatically generated file - do not edit ---------- --  Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell@@ -69,13 +69,14 @@   castToLayer, gTypeLayer   ) where -import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr)-#if __GLASGOW_HASKELL__>=704-import Foreign.C.Types    (CULong(..), CUInt(..))+import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)+#if __GLASGOW_HASKELL__ >= 707+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) #else-import Foreign.C.Types    (CULong, CUInt)+import Foreign.ForeignPtr (unsafeForeignPtrToPtr) #endif-import System.Glib.GType	(GType, typeInstanceIsA)+import Foreign.C.Types    (CULong(..), CUInt(..))+import System.Glib.GType  (GType, typeInstanceIsA) import System.Glib.GObject  {# context lib="poppler" prefix="poppler" #}@@ -95,7 +96,7 @@  -- ******************************************************************* Document -{#pointer *Document foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerDocument as Document foreign newtype #} deriving (Eq,Ord)  mkDocument = (Document, objectUnref) unDocument (Document o) = o@@ -118,7 +119,7 @@  -- ****************************************************************** FontsIter -{#pointer *FontsIter foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerFontsIter as FontsIter foreign newtype #} deriving (Eq,Ord)  mkFontsIter = (FontsIter, objectUnref) unFontsIter (FontsIter o) = o@@ -141,7 +142,7 @@  -- *********************************************************************** Page -{#pointer *Page foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerPage as Page foreign newtype #} deriving (Eq,Ord)  mkPage = (Page, objectUnref) unPage (Page o) = o@@ -164,7 +165,7 @@  -- ****************************************************************** FormField -{#pointer *FormField foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerFormField as FormField foreign newtype #} deriving (Eq,Ord)  mkFormField = (FormField, objectUnref) unFormField (FormField o) = o@@ -187,7 +188,7 @@  -- ********************************************************************* PSFile -{#pointer *PSFile foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerPSFile as PSFile foreign newtype #} deriving (Eq,Ord)  mkPSFile = (PSFile, objectUnref) unPSFile (PSFile o) = o@@ -210,7 +211,7 @@  -- ******************************************************************* FontInfo -{#pointer *FontInfo foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerFontInfo as FontInfo foreign newtype #} deriving (Eq,Ord)  mkFontInfo = (FontInfo, objectUnref) unFontInfo (FontInfo o) = o@@ -233,7 +234,7 @@  -- ***************************************************************** Attachment -{#pointer *Attachment foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerAttachment as Attachment foreign newtype #} deriving (Eq,Ord)  mkAttachment = (Attachment, objectUnref) unAttachment (Attachment o) = o@@ -256,7 +257,7 @@  -- ********************************************************************** Layer -{#pointer *Layer foreign newtype #} deriving (Eq,Ord)+{#pointer *PopplerLayer as Layer foreign newtype #} deriving (Eq,Ord)  mkLayer = (Layer, objectUnref) unLayer (Layer o) = o
Gtk2HsSetup.hs view
@@ -1,37 +1,7 @@-{-# LANGUAGE CPP #-}--#define CABAL_VERSION_ENCODE(major, minor, micro) (     \-          ((major) * 10000)                             \-        + ((minor) *   100)                             \-        + ((micro) *     1))--#define CABAL_VERSION_CHECK(major,minor,micro)    \-        (CABAL_VERSION >= CABAL_VERSION_ENCODE(major,minor,micro))+{-# LANGUAGE CPP, ViewPatterns #-} --- now, this is bad, but Cabal doesn't seem to actually pass any information about--- its version to CPP, so guess the version depending on the version of GHC-#ifdef CABAL_VERSION_MINOR-#ifndef CABAL_VERSION_MAJOR-#define CABAL_VERSION_MAJOR 1-#endif-#ifndef CABAL_VERSION_MICRO-#define CABAL_VERSION_MICRO 0-#endif-#define CABAL_VERSION CABAL_VERSION_ENCODE(     \-        CABAL_VERSION_MAJOR,                    \-        CABAL_VERSION_MINOR,                    \-        CABAL_VERSION_MICRO)-#else-#warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)-#if (__GLASGOW_HASKELL__ >= 700)-#define CABAL_VERSION CABAL_VERSION_ENCODE(1,10,0)-#else-#if (__GLASGOW_HASKELL__ >= 612)-#define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0)-#else-#define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0)-#endif-#endif+#ifndef CABAL_VERSION_CHECK+#error This module has to be compiled via the Setup.hs program which generates the gtk2hs-macros.h file #endif  -- | Build a Gtk2hs package.@@ -39,7 +9,10 @@ module Gtk2HsSetup (    gtk2hsUserHooks,    getPkgConfigPackages, -  checkGtk2hsBuildtools+  checkGtk2hsBuildtools,+  typeGenProgram,+  signalGenProgram,+  c2hsLocal   ) where  import Distribution.Simple@@ -49,32 +22,22 @@                                            libraryDirs,                                            extraLibraries,                                            extraGHCiLibraries )-import Distribution.Simple.PackageIndex (-#if CABAL_VERSION_CHECK(1,8,0)-  lookupInstalledPackageId-#else-  lookupPackageId-#endif-  )+import Distribution.Simple.PackageIndex ( lookupInstalledPackageId ) import Distribution.PackageDescription as PD ( PackageDescription(..),                                                updatePackageDescription,                                                BuildInfo(..),                                                emptyBuildInfo, allBuildInfo,                                                Library(..),                                                libModules, hasLibs)-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(withPackageDB, buildDir, localPkgDescr, installedPkgs, withPrograms),                                            InstallDirs(..),-#if CABAL_VERSION_CHECK(1,8,0)                                            componentPackageDeps,-#else-                                           packageDeps,-#endif                                            absoluteInstallDirs) import Distribution.Simple.Compiler  ( Compiler(..) ) import Distribution.Simple.Program (   Program(..), ConfiguredProgram(..),-  rawSystemProgramConf, rawSystemProgramStdoutConf, programName,-  c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram,+  rawSystemProgramConf, rawSystemProgramStdoutConf, programName, programPath,+  c2hsProgram, pkgConfigProgram, gccProgram, requireProgram, ghcPkgProgram,   simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg) import Distribution.ModuleName ( ModuleName, components, toFilePath ) import Distribution.Simple.Utils@@ -84,11 +47,7 @@                                   fromFlagOrDefault, defaultRegisterFlags) import Distribution.Simple.BuildPaths ( autogenModulesDir ) import Distribution.Simple.Install ( install )-#if CABAL_VERSION_CHECK(1,8,0) import Distribution.Simple.Register ( generateRegistrationInfo, registerPackage )-#else-import qualified Distribution.Simple.Register as Register ( register )-#endif import Distribution.Text ( simpleParse, display ) import System.FilePath import System.Exit (exitFailure)@@ -97,13 +56,26 @@ import Distribution.Verbosity import Control.Monad (when, unless, filterM, liftM, forM, forM_) import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )-import Data.List (isPrefixOf, isSuffixOf, nub)-import Data.Char (isAlpha)+import Data.List (isPrefixOf, isSuffixOf, stripPrefix, nub)+import Data.Char (isAlpha, isNumber) import qualified Data.Map as M import qualified Data.Set as S+import qualified Distribution.Simple.LocalBuildInfo as LBI+import Distribution.Simple.Compiler (compilerVersion)  import Control.Applicative ((<$>)) +#if CABAL_VERSION_CHECK(1,17,0)+import Distribution.Simple.Program.Find ( defaultProgramSearchPath )+onDefaultSearchPath f a b = f a b defaultProgramSearchPath+libraryConfig lbi = case [clbi | (LBI.CLibName, clbi, _) <- LBI.componentsConfigs lbi] of+  [clbi] -> Just clbi+  _ -> Nothing+#else+onDefaultSearchPath = id+libraryConfig = LBI.libraryConfig+#endif+ -- the name of the c2hs pre-compiled header file precompFile = "precompchs.bin" @@ -140,15 +112,19 @@  fixLibs :: [FilePath] -> [String] -> [String] fixLibs dlls = concatMap $ \ lib ->-    case filter (("lib" ++ lib) `isPrefixOf`) dlls of+    case filter (isLib lib) dlls of                 dll:_ -> [dropExtension dll]                 _     -> if lib == "z" then [] else [lib]-+  where+    isLib lib dll =+        case stripPrefix ("lib"++lib) dll of+            Just ('.':_)                -> True+            Just ('-':n:_) | isNumber n -> True+            _                           -> False+         -- The following code is a big copy-and-paste job from the sources of -- Cabal 1.8 just to be able to fix a field in the package file. Yuck. -#if CABAL_VERSION_CHECK(1,8,0)-         installHook :: PackageDescription -> LocalBuildInfo                    -> UserHooks -> InstallFlags -> IO () installHook pkg_descr localbuildinfo _ flags = do@@ -178,8 +154,8 @@ register :: PackageDescription -> LocalBuildInfo          -> RegisterFlags -- ^Install in the user's database?; verbose          -> IO ()-register pkg@PackageDescription { library       = Just lib  }-         lbi@LocalBuildInfo     { libraryConfig = Just clbi } regFlags+register pkg@(library       -> Just lib )+         lbi@(libraryConfig -> Just clbi) regFlags   = do      installedPkgInfoRaw <- generateRegistrationInfo@@ -195,19 +171,20 @@      _ | modeGenerateRegFile   -> die "Generate Reg File not supported"        | modeGenerateRegScript -> die "Generate Reg Script not supported"        | otherwise             -> registerPackage verbosity+                                    installedPkgInfo pkg lbi inplace #if CABAL_VERSION_CHECK(1,10,0)-                                    installedPkgInfo pkg lbi inplace [packageDb]+                                    packageDbs #else-                                    installedPkgInfo pkg lbi inplace packageDb+                                    packageDb #endif    where     modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))     modeGenerateRegScript = fromFlag (regGenScript regFlags)     inplace   = fromFlag (regInPlace regFlags)-    packageDb = case flagToMaybe (regPackageDB regFlags) of-                    Just db -> db-                    Nothing -> registrationPackageDB (withPackageDB lbi)+    packageDbs = nub $ withPackageDB lbi+                    ++ maybeToList (flagToMaybe  (regPackageDB regFlags))+    packageDb = registrationPackageDB packageDbs     distPref  = fromFlag (regDistPref regFlags)     verbosity = fromFlag (regVerbosity regFlags) @@ -215,45 +192,7 @@   where     verbosity = fromFlag (regVerbosity regFlags) -#else-installHook :: PackageDescription -> LocalBuildInfo-                   -> UserHooks -> InstallFlags -> IO ()-installHook pkg_descr localbuildinfo _ flags = do-  let copyFlags = defaultCopyFlags {-                      copyDistPref   = installDistPref flags,-                      copyInPlace    = installInPlace flags,-                      copyUseWrapper = installUseWrapper flags,-                      copyDest       = toFlag NoCopyDest,-                      copyVerbosity  = installVerbosity flags-                  }-  install pkg_descr localbuildinfo copyFlags-  let registerFlags = defaultRegisterFlags {-                          regDistPref  = installDistPref flags,-                          regInPlace   = installInPlace flags,-                          regPackageDB = installPackageDB flags,-                          regVerbosity = installVerbosity flags-                      }-  when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags -registerHook :: PackageDescription -> LocalBuildInfo-        -> UserHooks -> RegisterFlags -> IO ()-registerHook pkg_descr localbuildinfo _ flags =-    if hasLibs pkg_descr-    then register pkg_descr localbuildinfo flags-    else setupMessage verbosity-           "Package contains no library to register:" (packageId pkg_descr)-  where verbosity = fromFlag (regVerbosity flags)--register :: PackageDescription -> LocalBuildInfo-         -> RegisterFlags -- ^Install in the user's database?; verbose-         -> IO ()-register pkg_descr lbi regFlags = do-  let verbosity = fromFlag (regVerbosity regFlags)-  warn verbosity "Cannot register ghci libraries with Cabal 1.6 (need 1.8)."-  Register.register pkg_descr lbi regFlags-  -#endif- ------------------------------------------------------------------------------ -- This is a hack for Cabal-1.8, It is not needed in Cabal-1.9.1 or later ------------------------------------------------------------------------------@@ -291,15 +230,12 @@   -- additional .chi files might be needed that other packages have installed;   -- we assume that these are installed in the same place as .hi files   let chiDirs = [ dir |-#if CABAL_VERSION_CHECK(1,8,0)                   ipi <- maybe [] (map fst . componentPackageDeps) (libraryConfig lbi),                   dir <- maybe [] importDirs (lookupInstalledPackageId (installedPkgs lbi) ipi) ]-#else-                  ipi <- packageDeps lbi,-                  dir <- maybe [] importDirs (lookupPackageId (installedPkgs lbi) ipi) ]-#endif+  (gccProg, _) <- requireProgram verbosity gccProgram (withPrograms lbi)   rawSystemProgramConf verbosity c2hsLocal (withPrograms lbi) $        map ("--include=" ++) (outDir:chiDirs)+    ++ [ "--cpp=" ++ programPath gccProg, "--cppopts=-E" ]     ++ ["--cppopts=" ++ opt | opt <- getCppOptions bi lbi]     ++ ["--output-dir=" ++ newOutDir,         "--output=" ++ newOutFile,@@ -311,6 +247,10 @@     = nub $       ["-I" ++ dir | dir <- PD.includeDirs bi]    ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"]+   ++ ["-D__GLASGOW_HASKELL__="++show (ghcDefine . versionBranch . compilerVersion $ LBI.compiler lbi)]+ where+  ghcDefine (v1:v2:_) = v1 * 100 + v2+  ghcDefine _ = __GLASGOW_HASKELL__  installCHI :: PackageDescription -- ^information from the .cabal file         -> LocalBuildInfo -- ^information from the configure step@@ -321,18 +261,10 @@   -- cannot use the recommended 'findModuleFiles' since it fails if there exists   -- a modules that does not have a .chi file   mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath)-#if CABAL_VERSION_CHECK(1,8,0)                    (PD.libModules lib)-#else-                   (PD.libModules pkg)-#endif                     let files = [ f | Just f <- mFiles ]-#if CABAL_VERSION_CHECK(1,8,0)   installOrdinaryFiles verbosity libPref files-#else-  copyFiles verbosity libPref files-#endif     installCHI _ _ _ _ = return ()@@ -348,8 +280,16 @@ signalGenProgram = simpleProgram "gtk2hsHookGenerator"  c2hsLocal :: Program-c2hsLocal = simpleProgram "gtk2hsC2hs"+c2hsLocal = (simpleProgram "gtk2hsC2hs") {+    programFindVersion = findProgramVersion "--version" $ \str ->+      -- Invoking "gtk2hsC2hs --version" gives a string like:+      -- C->Haskell Compiler, version 0.13.4 (gtk2hs branch) "Bin IO", 13 Nov 2004+      case words str of+        (_:_:_:ver:_) -> ver+        _             -> ""+  } + genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () genSynthezisedFiles verb pd lbi = do @@ -497,11 +437,11 @@             (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)  -- Check user whether install gtk2hs-buildtools correctly.-checkGtk2hsBuildtools :: [String] -> IO ()+checkGtk2hsBuildtools :: [Program] -> IO () checkGtk2hsBuildtools programs = do-  programInfos <- mapM (\ name -> do-                         location <- programFindLocation (simpleProgram name) normal-                         return (name, location)+  programInfos <- mapM (\ prog -> do+                         location <- onDefaultSearchPath programFindLocation prog normal+                         return (programName prog, location)                       ) programs   let printError name = do         putStrLn $ "Cannot find " ++ name ++ "\n" 
Setup.hs view
@@ -1,10 +1,10 @@--- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module,--- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept--- identical across all modules.-import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools )-import Distribution.Simple ( defaultMainWithHooks )+-- Standard setup file for a Gtk2Hs module.+--+-- See also:+--  * SetupMain.hs    : the real Setup script for this package+--  * Gtk2HsSetup.hs  : Gtk2Hs-specific boilerplate+--  * SetupWrapper.hs : wrapper for compat with various ghc/cabal versions -main = do-  checkGtk2hsBuildtools ["gtk2hsC2hs", "gtk2hsTypeGen", "gtk2hsHookGenerator"]-  defaultMainWithHooks gtk2hsUserHooks-  +import SetupWrapper ( setupWrapper )++main = setupWrapper "SetupMain.hs"
+ SetupMain.hs view
@@ -0,0 +1,48 @@+-- The real Setup file for a Gtk2Hs package (invoked via the SetupWrapper).+-- It contains only adjustments specific to this package,+-- all Gtk2Hs-specific boilerplate is kept in Gtk2HsSetup.hs+-- which should be kept identical across all packages.+--+import Distribution.Simple ( defaultMainWithHooks, UserHooks(postConf),+                             PackageIdentifier(..), PackageName(..) )+import Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages, checkGtk2hsBuildtools,+                     typeGenProgram, signalGenProgram, c2hsLocal)+import Distribution.Simple.Setup ( ConfigFlags(configVerbosity), fromFlag)+import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) )+import Distribution.Simple.BuildPaths ( autogenModulesDir )+import Distribution.Text ( display )+import Distribution.Version ( Version(..) )+import Distribution.Verbosity+import Distribution.Simple.Utils+import System.FilePath++main = do+  checkGtk2hsBuildtools [c2hsLocal, typeGenProgram]+  defaultMainWithHooks gtk2hsUserHooks {++    postConf = \args cf pd lbi -> do+      let verb = (fromFlag (configVerbosity cf))+      cPkgs <- getPkgConfigPackages verb lbi pd+      let [pangoVersion] = [ v | PackageIdentifier (PackageName "pango") v <- cPkgs ]+      writePangoVersionHeaderFile verb lbi pangoVersion+      postConf gtk2hsUserHooks args cf pd lbi+  }++------------------------------------------------------------------------------+-- Generate CPP defines for version of C libs.+------------------------------------------------------------------------------++writePangoVersionHeaderFile :: Verbosity -> LocalBuildInfo -> Version -> IO ()+writePangoVersionHeaderFile verbosity lbi (Version (major:minor:micro:_) []) = do+  createDirectoryIfMissingVerbose verbosity True targetDir+  rewriteFile targetFile $ unlines+    [ "#define PANGO_VERSION_MAJOR " ++ show major+    , "#define PANGO_VERSION_MINOR " ++ show minor+    , "#define PANGO_VERSION_MICRO " ++ show micro+    ]+  where+    targetDir  = autogenModulesDir lbi+    targetFile = targetDir </> "hspangoversion.h"++writeVersionHeaderFile _ _ version =+  die $ "unexpected pango version number: " ++ display version
+ SetupWrapper.hs view
@@ -0,0 +1,164 @@+-- A wrapper script for Cabal Setup.hs scripts. Allows compiling the real Setup+-- conditionally depending on the Cabal version.++module SetupWrapper (setupWrapper) where++import Distribution.Package+import Distribution.Compiler+import Distribution.Simple.Utils+import Distribution.Simple.Program+import Distribution.Simple.Compiler+import Distribution.Simple.BuildPaths (exeExtension)+import Distribution.Simple.Configure (configCompiler)+import Distribution.Simple.GHC (getInstalledPackages)+import qualified Distribution.Simple.PackageIndex as PackageIndex+import Distribution.Version+import Distribution.Verbosity+import Distribution.Text++import System.Environment+import System.Process+import System.Exit+import System.FilePath+import System.Directory+import qualified Control.Exception as Exception+import System.IO.Error (isDoesNotExistError)++import Data.List+import Data.Char+import Control.Monad+++-- moreRecentFile is implemented in Distribution.Simple.Utils, but only in+-- Cabal >= 1.18. For backwards-compatibility, we implement a copy with a new+-- name here. Some desirable alternate strategies don't work:+-- * We can't use CPP to check which version of Cabal we're up against because+--   this is the file that's generating the macros for doing that.+-- * We can't use the name moreRecentFiles and use+--   import D.S.U hiding (moreRecentFiles)+--   because on old GHC's (and according to the Report) hiding a name that+--   doesn't exist is an error.+moreRecentFile' :: FilePath -> FilePath -> IO Bool+moreRecentFile' a b = do+  exists <- doesFileExist b+  if not exists+    then return True+    else do tb <- getModificationTime b+            ta <- getModificationTime a+            return (ta > tb)++setupWrapper :: FilePath -> IO ()+setupWrapper setupHsFile = do+  args <- getArgs+  createDirectoryIfMissingVerbose verbosity True setupDir+  compileSetupExecutable+  invokeSetupScript args++  where+    setupDir         = "dist/setup-wrapper"+    setupVersionFile = setupDir </> "setup" <.> "version"+    setupProgFile    = setupDir </> "setup" <.> exeExtension+    setupMacroFile   = setupDir </> "wrapper-macros.h"++    useCabalVersion  = Version [1,8] []+    usePackageDB     = [GlobalPackageDB, UserPackageDB]+    verbosity        = normal++    cabalLibVersionToUse comp conf = do+      savedVersion <- savedCabalVersion+      case savedVersion of+        Just version+          -> return version+        _ -> do version <- installedCabalVersion comp conf+                writeFile setupVersionFile (show version ++ "\n")+                return version++    savedCabalVersion = do+      versionString <- readFile setupVersionFile+                         `Exception.catch` \e -> if isDoesNotExistError e+                                                   then return ""+                                                   else Exception.throwIO e+      case reads versionString of+        [(version,s)] | all isSpace s -> return (Just version)+        _                             -> return Nothing++    installedCabalVersion comp conf = do+      index <- getInstalledPackages verbosity usePackageDB conf++      let cabalDep = Dependency (PackageName "Cabal")+                                (orLaterVersion useCabalVersion)+      case PackageIndex.lookupDependency index cabalDep of+        []   -> die $ "The package requires Cabal library version "+                   ++ display useCabalVersion+                   ++ " but no suitable version is installed."+        pkgs -> return $ bestVersion (map fst pkgs)+      where+        bestVersion          = maximumBy (comparing preference)+        preference version   = (sameVersion, sameMajorVersion+                               ,stableVersion, latestVersion)+          where+            sameVersion      = version == cabalVersion+            sameMajorVersion = majorVersion version == majorVersion cabalVersion+            majorVersion     = take 2 . versionBranch+            stableVersion    = case versionBranch version of+                                 (_:x:_) -> even x+                                 _       -> False+            latestVersion    = version++    -- | If the Setup.hs is out of date wrt the executable then recompile it.+    -- Currently this is GHC only. It should really be generalised.+    --+    compileSetupExecutable = do+      setupHsNewer      <- setupHsFile      `moreRecentFile'` setupProgFile+      cabalVersionNewer <- setupVersionFile `moreRecentFile'` setupProgFile+      let outOfDate = setupHsNewer || cabalVersionNewer+      when outOfDate $ do+        debug verbosity "Setup script is out of date, compiling..."++        (comp, conf)    <- configCompiler (Just GHC) Nothing Nothing+                             defaultProgramConfiguration verbosity+        cabalLibVersion <- cabalLibVersionToUse comp conf+        let cabalPkgid = PackageIdentifier (PackageName "Cabal") cabalLibVersion+        debug verbosity $ "Using Cabal library version " ++ display cabalLibVersion++        writeFile setupMacroFile (generateVersionMacro cabalLibVersion)++        rawSystemProgramConf verbosity ghcProgram conf $+            ["--make", setupHsFile, "-o", setupProgFile]+         ++ ghcPackageDbOptions usePackageDB+         ++ ["-package", display cabalPkgid+            ,"-cpp", "-optP-include", "-optP" ++ setupMacroFile+            ,"-odir", setupDir, "-hidir", setupDir]+      where++        ghcPackageDbOptions dbstack = case dbstack of+          (GlobalPackageDB:UserPackageDB:dbs) -> concatMap specific dbs+          (GlobalPackageDB:dbs)               -> "-no-user-package-conf"+                                               : concatMap specific dbs+          _                                   -> ierror+          where+            specific (SpecificPackageDB db) = [ "-package-conf", db ]+            specific _ = ierror+            ierror     = error "internal error: unexpected package db stack"++        generateVersionMacro :: Version -> String+        generateVersionMacro version =+          concat+            ["/* DO NOT EDIT: This file is automatically generated by Cabal */\n\n"+            ,"#define CABAL_VERSION_CHECK(major1,major2,minor) (\\\n"+            ,"  (major1) <  ",major1," || \\\n"+            ,"  (major1) == ",major1," && (major2) <  ",major2," || \\\n"+            ,"  (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor,")"+            ,"\n\n"+            ]+          where+            (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)++    invokeSetupScript :: [String] -> IO ()+    invokeSetupScript args = do+      info verbosity $ unwords (setupProgFile : args)+      process <- runProcess (currentDir </> setupProgFile) args+                   Nothing Nothing+                   Nothing Nothing Nothing+      exitCode <- waitForProcess process+      unless (exitCode == ExitSuccess) $ exitWith exitCode
poppler.cabal view
@@ -1,12 +1,12 @@ Name:           poppler-Version:        0.12.2.2+Version:        0.12.3 License:        GPL-2 License-file:   COPYING-Copyright:      (c) 2001-2010 The Gtk2Hs Team+Copyright:      (c) 2001-2012, 2014 The Gtk2Hs Team Author:         Andy Stewart Maintainer:     Ian-Woo Kim <ianwookim@gmail.com> Build-Type:     Custom-Cabal-Version:  >= 1.6+Cabal-Version:  >= 1.8 Stability:      stable homepage:       http://www.haskell.org/gtk2hs/ bug-reports:    http://hackage.haskell.org/trac/gtk2hs/@@ -15,10 +15,12 @@                 library, to centralize the maintenance effort. 				And move to forward in a number of areas that don't fit within the goals of xpdf. Category:       Graphics-Tested-With:    GHC == 7.4-Extra-Source-Files: Gtk2HsSetup.hs-					hierarchy.list-					template-hsc-gtk2hs.h+Tested-With:    GHC == 7.4, GHC == 7.6+Extra-Source-Files: SetupWrapper.hs+                    SetupMain.hs+                    Gtk2HsSetup.hs+		    hierarchy.list+		    template-hsc-gtk2hs.h  x-Types-File:      Graphics/UI/Gtk/Poppler/Types.chs x-Types-ModName:   Graphics.UI.Gtk.Poppler.Types@@ -33,16 +35,22 @@                 Makefile  Source-Repository head-  type:         darcs-  location:     http://patch-tag.com/r/AndyStewart/poppler+  type:         git+  location:     git://github.com/wavewave/poppler.git +flag gtk3+  description: compile with gtk3+  default: False+ Library         build-depends:  base >= 4 && < 5, array, containers,                          mtl, bytestring,                         glib >= 0.12 && < 0.13,-                        cairo >= 0.12 && < 0.13,-                        gtk >= 0.12 && < 0.13---						haskell98, +                        cairo >= 0.12 && < 0.13+        if flag(gtk3)+          build-depends: gtk3 >= 0.12 && < 0.13+        else+          build-depends: gtk >= 0.12 && < 0.13         build-tools:    gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen 						         exposed-modules:@@ -62,4 +70,7 @@ 		         include-dirs:   .         x-c2hs-Header:  glib/poppler.h-        pkgconfig-depends: poppler-glib >= 0.12.4, gobject-2.0, glib-2.0, cairo >= 1.2.0, gdk-2.0, gdk-pixbuf-2.0, pango+        if flag(gtk3) +          pkgconfig-depends: poppler-glib >= 0.12.4, cairo >= 1.2.0, gdk-3.0, pango+        else+          pkgconfig-depends: poppler-glib >= 0.12.4, gobject-2.0, glib-2.0, cairo >= 1.2.0, gdk-2.0, gdk-pixbuf-2.0, pango