poppler 0.14.1 → 0.14.2
raw patch · 6 files changed
+201/−23 lines, 6 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Graphics/UI/Gtk/Poppler/Structs.hsc +3/−2
- Graphics/UI/Gtk/Poppler/Types.chs +5/−2
- Setup.hs +3/−3
- SetupWrapper.hs +166/−0
- hspoppler.h +1/−0
- poppler.cabal +23/−16
Graphics/UI/Gtk/Poppler/Structs.hsc view
@@ -21,8 +21,9 @@ -- -- #hide -#include <glib-2.0/glib.h>-#include <poppler.h>+-- #include <glib-2.0/glib.h>+#include "poppler.h"+#include <glib.h> #include "template-hsc-gtk2hs.h" -- |
Graphics/UI/Gtk/Poppler/Types.chs view
@@ -36,6 +36,7 @@ -- module Graphics.UI.Gtk.Poppler.Types ( + module System.Glib.GObject, Document(Document), DocumentClass, toDocument, mkDocument, unDocument,@@ -71,14 +72,16 @@ ) where import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)-#if __GLASGOW_HASKELL__ >= 707+-- TODO work around cpphs https://ghc.haskell.org/trac/ghc/ticket/13553+#if __GLASGOW_HASKELL__ >= 707 || __GLASGOW_HASKELL__ == 0 import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr) #else import Foreign.ForeignPtr (unsafeForeignPtrToPtr) #endif+ import Foreign.C.Types (CULong(..), CUInt(..), CULLong(..)) import System.Glib.GType (GType, typeInstanceIsA)-import System.Glib.GObject+{#import System.Glib.GObject#} {# context lib="poppler" prefix="poppler" #}
Setup.hs view
@@ -2,11 +2,11 @@ -- all Gtk2Hs-specific boilerplate is kept in -- gtk2hs-buildtools:Gtk2HsSetup ---import Gtk2HsSetup ( gtk2hsUserHooks) -- , checkGtk2hsBuildtools,- -- typeGenProgram, signalGenProgram, c2hsLocal)+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools,+ typeGenProgram, signalGenProgram, c2hsLocal) import Distribution.Simple ( defaultMainWithHooks ) main = do- -- checkGtk2hsBuildtools [typeGenProgram, signalGenProgram, c2hsLocal]+ checkGtk2hsBuildtools [typeGenProgram, signalGenProgram, c2hsLocal] defaultMainWithHooks gtk2hsUserHooks
+ SetupWrapper.hs view
@@ -0,0 +1,166 @@+{-# LANGUAGE CPP #-}++-- 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 as B (exeExtension)+import Distribution.Simple.Configure (configCompilerEx)+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 (ExitCode(..), exitWith)+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" <.> B.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+ (compiler,_,_) <- configCompilerEx defaultCompilerFlavor Nothing Nothing conf verbosity+ index <- getInstalledPackages verbosity compiler 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) <- configCompilerEx (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
+ hspoppler.h view
@@ -0,0 +1,1 @@+#include <poppler.h>
poppler.cabal view
@@ -1,28 +1,33 @@+-- Note that poppler is packaged after pango. if we have any issue in build (gtk2hs packages are+-- pretty entangled), please refer to pango and adjust this following the change made in pango. Name: poppler-Version: 0.14.1+Version: 0.14.2 License: GPL-2 License-file: COPYING Copyright: (c) 2001-2012, 2014-2016 The Gtk2Hs Team Author: Andy Stewart Maintainer: Ian-Woo Kim <ianwookim@gmail.com> Build-Type: Custom-Cabal-Version:>= 1.24+Cabal-Version: >= 1.24 Stability: stable homepage: http://projects.haskell.org/gtk2hs bug-reports: http://github.com/wavewave/poppler/issues Synopsis: Binding to the Poppler. Description: Poppler is a fork of the xpdf PDF viewer, to provide PDF rendering functionality as a shared library, to centralize the maintenance effort.- And move to forward in a number of areas that don't fit within the goals of xpdf.+ And move to forward in a number of areas that don't fit within the goals of xpdf. Category: Graphics-Tested-With: GHC == 8.0-Extra-Source-Files:+Tested-With: GHC == 7.10, GHC == 8.0+Extra-Source-Files: SetupWrapper.hs+ -- SetupMain.hs+ -- Gtk2HsSetup.hs hierarchy.list template-hsc-gtk2hs.h+ hspoppler.h x-Types-File: Graphics/UI/Gtk/Poppler/Types.chs x-Types-ModName: Graphics.UI.Gtk.Poppler.Types-x-Types-Import: System.Glib.GObject+x-Types-Forward: *System.Glib.GObject x-Types-Lib: poppler x-Types-Prefix: poppler x-Types-Tag: poppler@@ -40,15 +45,13 @@ description: compile with gtk3 default: False - custom-setup setup-depends: base >= 4.6,- Cabal >= 1.24 && < 1.25,+ Cabal >= 1.24 && < 2.1, gtk2hs-buildtools >= 0.13.1.0 && < 0.14 - Library- build-depends: base >= 4 && < 5, array, containers, + build-depends: base >= 4 && < 5, array, containers, mtl, bytestring, glib >= 0.13 && < 0.15, cairo >= 0.13 && < 0.15@@ -58,8 +61,12 @@ build-depends: gtk >= 0.14.3 && < 0.15 build-tools: gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen - cpp-options: -U__BLOCKS__ -D__attribute__(A)=- + cpp-options: -U__BLOCKS__+ if os(darwin) || os(freebsd)+ cpp-options: -D__attribute__(A)= -D_Nullable= -D_Nonnull=+ if os(windows)+ cpp-options: -D__USE_MINGW_ANSI_STDIO=1+ exposed-modules: Graphics.UI.Gtk.Poppler.Action Graphics.UI.Gtk.Poppler.Attachment@@ -73,12 +80,12 @@ Graphics.UI.Gtk.Poppler.Structs Graphics.UI.Gtk.Poppler.Types - default-language: Haskell2010+ default-language: Haskell98 default-extensions: ForeignFunctionInterface- + x-c2hs-Header: hspoppler.h include-dirs: .- x-c2hs-Header: poppler.h- if flag(gtk3) + includes: hspoppler.h+ 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