packages feed

svgcairo 0.12.5.2 → 0.13.0.0

raw patch · 5 files changed

+73/−40 lines, 5 filesdep +textdep ~cairodep ~glibPVP ok

version bump matches the API change (PVP)

Dependencies added: text

Dependency ranges changed: cairo, glib

API changes (from Hackage documentation)

Files

Graphics/Rendering/Cairo/SVG.chs view
@@ -1,8 +1,9 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} ----------------------------------------------------------------------------- -- | -- Module      :  Graphics.Rendering.Cairo.SVG--- Copyright   :  (c) 2005 Duncan Coutts, Paolo Martini +-- Copyright   :  (c) 2005 Duncan Coutts, Paolo Martini -- License     :  BSD-style (see cairo/COPYRIGHT) -- -- Maintainer  :  gtk2hs-devel@lists.sourceforge.net@@ -77,6 +78,8 @@   ) where  import Control.Monad (when)+import Data.Monoid ((<>))+import qualified Data.Text as T (unpack) import Foreign import Foreign.C import Control.Monad.Reader (ask, liftIO)@@ -95,7 +98,7 @@  --------------------- -- Types--- +--  {# pointer *RsvgHandle as SVG foreign newtype #} @@ -108,19 +111,19 @@  --------------------- -- Basic API--- +--  -- block scoped versions  withSvgFromFile :: FilePath -> (SVG -> Render a) -> Render a withSvgFromFile file action =-  withSVG $ \svg -> do   +  withSVG $ \svg -> do     liftIO $ svgParseFromFile file svg     action svg  withSvgFromHandle :: Handle -> (SVG -> Render a) -> Render a withSvgFromHandle hnd action =-  withSVG $ \svg -> do   +  withSVG $ \svg -> do     liftIO $ svgParseFromHandle hnd svg     action svg @@ -136,7 +139,7 @@              {# call g_type_init #}              svgPtr <- {# call unsafe new #}              svgPtr' <- newForeignPtr_ svgPtr-             return (SVG svgPtr'))             +             return (SVG svgPtr'))           (\(SVG fptr) -> withForeignPtr fptr $ \ptr ->                             {# call unsafe g_object_unref #} (castPtr ptr)) @@ -216,7 +219,7 @@  -- | Get the width and height of the SVG image. ---svgGetSize :: +svgGetSize ::     SVG  -> (Int, Int) -- ^ @(width, height)@ svgGetSize svg = Unsafe.unsafePerformIO $@@ -228,7 +231,7 @@  --------------------- -- Convenience API--- +--  svgRenderFromFile :: FilePath -> Render Bool svgRenderFromFile file = withSvgFromFile file svgRender@@ -241,9 +244,9 @@  --------------------- -- Utils--- +--  checkStatus :: (Ptr (Ptr ()) -> IO CInt) -> IO () checkStatus action =   checkGError (\ptr -> action ptr >> return ())-    (\(GError domain code msg) -> fail ("svg cairo error: " ++ msg))+    (\(GError domain code msg) -> fail (T.unpack $ "svg cairo error: " <> msg))
Gtk2HsSetup.hs view
@@ -6,9 +6,9 @@  -- | Build a Gtk2hs package. ---module Gtk2HsSetup ( -  gtk2hsUserHooks, -  getPkgConfigPackages, +module Gtk2HsSetup (+  gtk2hsUserHooks,+  getPkgConfigPackages,   checkGtk2hsBuildtools,   typeGenProgram,   signalGenProgram,@@ -55,8 +55,9 @@ import Distribution.Version (Version(..)) import Distribution.Verbosity import Control.Monad (when, unless, filterM, liftM, forM, forM_)-import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )-import Data.List (isPrefixOf, isSuffixOf, stripPrefix, nub)+import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList, catMaybes )+import Data.List (isPrefixOf, isSuffixOf, nub, minimumBy, stripPrefix, tails )+import Data.Ord as Ord (comparing) import Data.Char (isAlpha, isNumber) import qualified Data.Map as M import qualified Data.Set as S@@ -113,9 +114,16 @@ fixLibs :: [FilePath] -> [String] -> [String] fixLibs dlls = concatMap $ \ lib ->     case filter (isLib lib) dlls of-                dll:_ -> [dropExtension dll]-                _     -> if lib == "z" then [] else [lib]+                dlls@(_:_) -> [dropExtension (pickDll dlls)]+                _          -> if lib == "z" then [] else [lib]   where+    -- If there are several .dll files matching the one we're after then we+    -- just have to guess. For example for recent Windows cairo builds we get+    -- libcairo-2.dll libcairo-gobject-2.dll libcairo-script-interpreter-2.dll+    -- Our heuristic is to pick the one with the shortest name.+    -- Yes this is a hack but the proper solution is hard: we would need to+    -- parse the .a file and see which .dll file(s) it needed to link to.+    pickDll = minimumBy (Ord.comparing length)     isLib lib dll =         case stripPrefix ("lib"++lib) dll of             Just ('.':_)                -> True@@ -154,9 +162,9 @@ register :: PackageDescription -> LocalBuildInfo          -> RegisterFlags -- ^Install in the user's database?; verbose          -> IO ()-register pkg@(library       -> Just lib )-         lbi@(libraryConfig -> Just clbi) regFlags+register pkg@PackageDescription { library       = Just lib  } lbi regFlags   = do+    let clbi = LBI.getComponentLocalBuildInfo lbi LBI.CLibName      installedPkgInfoRaw <- generateRegistrationInfo                            verbosity pkg lib lbi clbi inplace distPref@@ -168,7 +176,7 @@       -- Three different modes:     case () of-     _ | modeGenerateRegFile   -> die "Generate Reg File not supported"+     _ | modeGenerateRegFile   -> writeRegistrationFile installedPkgInfo        | modeGenerateRegScript -> die "Generate Reg Script not supported"        | otherwise             -> registerPackage verbosity                                     installedPkgInfo pkg lbi inplace@@ -180,6 +188,8 @@    where     modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))+    regFile             = fromMaybe (display (packageId pkg) <.> "conf")+                                    (fromFlag (regGenPkgConf regFlags))     modeGenerateRegScript = fromFlag (regGenScript regFlags)     inplace   = fromFlag (regInPlace regFlags)     packageDbs = nub $ withPackageDB lbi@@ -188,6 +198,10 @@     distPref  = fromFlag (regDistPref regFlags)     verbosity = fromFlag (regVerbosity regFlags) +    writeRegistrationFile installedPkgInfo = do+      notice verbosity ("Creating package registration file: " ++ regFile)+      writeUTF8File regFile (showInstalledPackageInfo installedPkgInfo)+ register _ _ regFlags = notice verbosity "No package to register"   where     verbosity = fromFlag (regVerbosity regFlags)@@ -247,11 +261,24 @@     = 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)]+   ++ ["-D__GLASGOW_HASKELL__="++show (ghcDefine . ghcVersion . compilerId $ LBI.compiler lbi)]  where   ghcDefine (v1:v2:_) = v1 * 100 + v2   ghcDefine _ = __GLASGOW_HASKELL__ +  ghcVersion :: CompilerId -> [Int]+-- This version is nicer, but we need to know the Cabal version that includes the new CompilerId+-- #if CABAL_VERSION_CHECK(1,19,2)+--   ghcVersion (CompilerId GHC v _) = versionBranch v+--   ghcVersion (CompilerId _ _ (Just c)) = ghcVersion c+-- #else+--   ghcVersion (CompilerId GHC v) = versionBranch v+-- #endif+--   ghcVersion _ = []+-- This version should work fine for now+  ghcVersion = concat . take 1 . map (read . (++"]") . takeWhile (/=']')) . catMaybes+               . map (stripPrefix "CompilerId GHC (Version {versionBranch = ") . tails . show+ installCHI :: PackageDescription -- ^information from the .cabal file         -> LocalBuildInfo -- ^information from the configure step         -> Verbosity -> CopyDest -- ^flags sent to copy or install@@ -262,11 +289,11 @@   -- a modules that does not have a .chi file   mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath)                    (PD.libModules lib)-                 +   let files = [ f | Just f <- mFiles ]   installOrdinaryFiles verbosity libPref files -  + installCHI _ _ _ _ = return ()  ------------------------------------------------------------------------------@@ -292,13 +319,12 @@  genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () genSynthezisedFiles verb pd lbi = do-   cPkgs <- getPkgConfigPackages verb lbi pd    let xList = maybe [] (customFieldsBI . libBuildInfo) (library pd)               ++customFieldsPD pd       typeOpts :: String -> [ProgArg]-      typeOpts tag = concat [ map (\val -> '-':'-':drop (length tag) field++'=':val) (words content)+      typeOpts tag = concat [ map (\val -> '-':'-':drop (length tag) field ++ '=':val) (words content)                             | (field,content) <- xList,                               tag `isPrefixOf` field,                               field /= (tag++"file")]@@ -306,8 +332,9 @@                  | PackageIdentifier name (Version (major:minor:_) _) <- cPkgs                  , let name' = filter isAlpha (display name)                  , tag <- name'-                        : [ name' ++ "-" ++ show major ++ "." ++ show digit-                          | digit <- [0,2..minor] ]+                        :[ name' ++ "-" ++ show maj ++ "." ++ show d2+                          | (maj, d2) <- [(maj,   d2) | maj <- [0..(major-1)], d2 <- [0,2..20]]+                                      ++ [(major, d2) | d2 <- [0,2..minor]] ]                  ]        signalsOpts :: [ProgArg]@@ -426,14 +453,14 @@  -- Extract the dependencies of this file. This is intentionally rather naive as it -- ignores CPP conditionals. We just require everything which means that the--- existance of a .chs module may not depend on some CPP condition.  +-- existance of a .chs module may not depend on some CPP condition. extractDeps :: ModDep -> IO ModDep extractDeps md@ModDep { mdLocation = Nothing } = return md extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do   let findImports acc (('{':'#':xs):xxs) = case (dropWhile (' ' ==) xs) of         ('i':'m':'p':'o':'r':'t':' ':ys) ->           case simpleParse (takeWhile ('#' /=) ys) of-            Just m -> findImports (m:acc) xxs +            Just m -> findImports (m:acc) xxs             Nothing -> die ("cannot parse chs import in "++f++":\n"++                             "offending line is {#"++xs)          -- no more imports after the first non-import hook@@ -467,8 +494,8 @@                          return (programName prog, location)                       ) programs   let printError name = do-        putStrLn $ "Cannot find " ++ name ++ "\n" +        putStrLn $ "Cannot find " ++ name ++ "\n"                  ++ "Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin)."         exitFailure   forM_ programInfos $ \ (name, location) ->-    when (isNothing location) (printError name) +    when (isNothing location) (printError name)
SetupWrapper.hs view
@@ -9,7 +9,7 @@ import Distribution.Simple.Program import Distribution.Simple.Compiler import Distribution.Simple.BuildPaths (exeExtension)-import Distribution.Simple.Configure (configCompiler)+import Distribution.Simple.Configure (configCompilerEx) import Distribution.Simple.GHC (getInstalledPackages) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Version@@ -115,7 +115,7 @@       when outOfDate $ do         debug verbosity "Setup script is out of date, compiling..." -        (comp, conf)    <- configCompiler (Just GHC) Nothing Nothing+        (comp, _, conf) <- configCompilerEx (Just GHC) Nothing Nothing                              defaultProgramConfiguration verbosity         cabalLibVersion <- cabalLibVersionToUse comp conf         let cabalPkgid = PackageIdentifier (PackageName "Cabal") cabalLibVersion
svgcairo.cabal view
@@ -1,5 +1,5 @@ Name:           svgcairo-Version:        0.12.5.2+Version:        0.13.0.0 License:        BSD3 License-file:   COPYING Copyright:      (c) 2001-2010 The Gtk2Hs Team@@ -9,7 +9,7 @@ Cabal-Version:  >= 1.8 Stability:      provisional homepage:       http://projects.haskell.org/gtk2hs/-bug-reports:    http://hackage.haskell.org/trac/gtk2hs/+bug-reports:    https://github.com/gtk2hs/svgcairo/issues Synopsis:       Binding to the libsvg-cairo library. Description:    Svgcairo is used to render SVG with cairo. @@ -30,16 +30,16 @@   location:     https://github.com/gtk2hs/svgcairo  Library-        build-depends:  base  == 4.*, mtl,-                        glib  >=0.12.5.0 && <0.13, -                        cairo >=0.12.5.0 && <0.13+        build-depends:  base  == 4.*, mtl, text,+                        glib  >=0.13.0.0 && <0.14,+                        cairo >=0.13.0.0 && <0.14 						-        build-tools:    gtk2hsC2hs >= 0.13.9,+        build-tools:    gtk2hsC2hs >= 0.13.11,                         gtk2hsTypeGen 		         exposed-modules:           Graphics.Rendering.Cairo.SVG-		  +		         extensions:     ForeignFunctionInterface 		         Include-dirs: .
svgcairo.h view
@@ -1,3 +1,6 @@+#ifdef __BLOCKS__+#undef __BLOCKS__+#endif #include <librsvg/rsvg.h> #include <librsvg/rsvg-cairo.h> #include <librsvg/librsvg-features.h>