1diff -ru orig/Gtk2HsSetup.hs new/Gtk2HsSetup.hs
2--- orig/Gtk2HsSetup.hs 2013-10-28 08:36:50.283581635 +0100
3+++ new/Gtk2HsSetup.hs 2013-10-28 08:36:50.000000000 +0100
6+{-# LANGUAGE CPP, ViewPatterns #-}
8 #ifndef CABAL_VERSION_CHECK
9 #error This module has to be compiled via the Setup.hs program which generates the gtk2hs-macros.h file
11 emptyBuildInfo, allBuildInfo,
14-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),
15+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(withPackageDB, buildDir, localPkgDescr, installedPkgs, withPrograms),
20 import Distribution.Verbosity
21 import Control.Monad (when, unless, filterM, liftM, forM, forM_)
22 import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )
23-import Data.List (isPrefixOf, isSuffixOf, nub, minimumBy)
24+import Data.List (isPrefixOf, isSuffixOf, nub, minimumBy, stripPrefix)
25 import Data.Ord as Ord (comparing)
26-import Data.Char (isAlpha)
27+import Data.Char (isAlpha, isNumber)
28 import qualified Data.Map as M
29 import qualified Data.Set as S
30+import qualified Distribution.Simple.LocalBuildInfo as LBI
32 import Control.Applicative ((<$>))
34+#if CABAL_VERSION_CHECK(1,17,0)
35+import Distribution.Simple.Program.Find ( defaultProgramSearchPath )
36+onDefaultSearchPath f a b = f a b defaultProgramSearchPath
37+libraryConfig lbi = case [clbi | (LBI.CLibName, clbi, _) <- LBI.componentsConfigs lbi] of
41+onDefaultSearchPath = id
42+libraryConfig = LBI.libraryConfig
45 -- the name of the c2hs pre-compiled header file
46 precompFile = "precompchs.bin"
50 fixLibs :: [FilePath] -> [String] -> [String]
51 fixLibs dlls = concatMap $ \ lib ->
52- case filter (("lib" ++ lib) `isPrefixOf`) dlls of
53+ case filter (isLib lib) dlls of
54 dlls@(_:_) -> [dropExtension (pickDll dlls)]
55 _ -> if lib == "z" then [] else [lib]
58 -- Yes this is a hack but the proper solution is hard: we would need to
59 -- parse the .a file and see which .dll file(s) it needed to link to.
60 pickDll = minimumBy (Ord.comparing length)
63+ case stripPrefix ("lib"++lib) dll of
65+ Just ('-':n:_) | isNumber n -> True
68 -- The following code is a big copy-and-paste job from the sources of
69 -- Cabal 1.8 just to be able to fix a field in the package file. Yuck.
72 register :: PackageDescription -> LocalBuildInfo
73 -> RegisterFlags -- ^Install in the user's database?; verbose
75-register pkg@PackageDescription { library = Just lib }
76- lbi@LocalBuildInfo { libraryConfig = Just clbi } regFlags
77+register pkg@(library -> Just lib )
78+ lbi@(libraryConfig -> Just clbi) regFlags
81 installedPkgInfoRaw <- generateRegistrationInfo
84 ["-I" ++ dir | dir <- PD.includeDirs bi]
85 ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"]
86+ ++ ["-D__GLASGOW_HASKELL__="++show __GLASGOW_HASKELL__]
88 installCHI :: PackageDescription -- ^information from the .cabal file
89 -> LocalBuildInfo -- ^information from the configure step
91 checkGtk2hsBuildtools :: [Program] -> IO ()
92 checkGtk2hsBuildtools programs = do
93 programInfos <- mapM (\ prog -> do
94- location <- programFindLocation prog normal
95+ location <- onDefaultSearchPath programFindLocation prog normal
96 return (programName prog, location)
98 let printError name = do
99diff -ru orig/SetupWrapper.hs new/SetupWrapper.hs
100--- orig/SetupWrapper.hs 2013-10-28 08:36:50.283581635 +0100
101+++ new/SetupWrapper.hs 2013-10-28 08:36:50.000000000 +0100
106+-- moreRecentFile is implemented in Distribution.Simple.Utils, but only in
107+-- Cabal >= 1.18. For backwards-compatibility, we implement a copy with a new
108+-- name here. Some desirable alternate strategies don't work:
109+-- * We can't use CPP to check which version of Cabal we're up against because
110+-- this is the file that's generating the macros for doing that.
111+-- * We can't use the name moreRecentFiles and use
112+-- import D.S.U hiding (moreRecentFiles)
113+-- because on old GHC's (and according to the Report) hiding a name that
114+-- doesn't exist is an error.
115+moreRecentFile' :: FilePath -> FilePath -> IO Bool
116+moreRecentFile' a b = do
117+ exists <- doesFileExist b
120+ else do tb <- getModificationTime b
121+ ta <- getModificationTime a
124 setupWrapper :: FilePath -> IO ()
125 setupWrapper setupHsFile = do
128 -- Currently this is GHC only. It should really be generalised.
130 compileSetupExecutable = do
131- setupHsNewer <- setupHsFile `moreRecentFile` setupProgFile
132- cabalVersionNewer <- setupVersionFile `moreRecentFile` setupProgFile
133+ setupHsNewer <- setupHsFile `moreRecentFile'` setupProgFile
134+ cabalVersionNewer <- setupVersionFile `moreRecentFile'` setupProgFile
135 let outOfDate = setupHsNewer || cabalVersionNewer
137 debug verbosity "Setup script is out of date, compiling..."
139 Nothing Nothing Nothing
140 exitCode <- waitForProcess process
141 unless (exitCode == ExitSuccess) $ exitWith exitCode
143-moreRecentFile :: FilePath -> FilePath -> IO Bool
144-moreRecentFile a b = do
145- exists <- doesFileExist b
148- else do tb <- getModificationTime b
149- ta <- getModificationTime a
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list