@@ -1,150 +0,0 @@
1−diff -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
4−@@ -1,4 +1,4 @@
5−-{-# LANGUAGE CPP #-}
6−+{-# LANGUAGE CPP, ViewPatterns #-}
7−
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
10−@@ -29,7 +29,7 @@
11− emptyBuildInfo, allBuildInfo,
12− Library(..),
13− libModules, hasLibs)
14−-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),
15−+import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(withPackageDB, buildDir, localPkgDescr, installedPkgs, withPrograms),
16− InstallDirs(..),
17− componentPackageDeps,
18− absoluteInstallDirs)
19−@@ -56,14 +56,26 @@
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
31−
32− import Control.Applicative ((<$>))
33−
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
38−+ [clbi] -> Just clbi
39−+ _ -> Nothing
40−+#else
41−+onDefaultSearchPath = id
42−+libraryConfig = LBI.libraryConfig
43−+#endif
44−+
45− -- the name of the c2hs pre-compiled header file
46− precompFile = "precompchs.bin"
47−
48−@@ -100,7 +112,7 @@
49−
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]
56− where
57−@@ -111,7 +123,12 @@
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)
61−-
62−+ isLib lib dll =
63−+ case stripPrefix ("lib"++lib) dll of
64−+ Just ('.':_) -> True
65−+ Just ('-':n:_) | isNumber n -> True
66−+ _ -> False
67−+
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.
70−
71−@@ -144,8 +161,8 @@
72− register :: PackageDescription -> LocalBuildInfo
73− -> RegisterFlags -- ^Install in the user's database?; verbose
74− -> IO ()
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
79− = do
80−
81− installedPkgInfoRaw <- generateRegistrationInfo
82−@@ -237,6 +254,7 @@
83− = nub $
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__]
87−
88− installCHI :: PackageDescription -- ^information from the .cabal file
89− -> LocalBuildInfo -- ^information from the configure step
90−@@ -426,7 +444,7 @@
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)
97− ) programs
98− let printError name = do
99−diff -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
102−@@ -29,6 +29,24 @@
103− import Control.Monad
104−
105−
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
118−+ if not exists
119−+ then return True
120−+ else do tb <- getModificationTime b
121−+ ta <- getModificationTime a
122−+ return (ta > tb)
123−+
124− setupWrapper :: FilePath -> IO ()
125− setupWrapper setupHsFile = do
126− args <- getArgs
127−@@ -91,8 +109,8 @@
128− -- Currently this is GHC only. It should really be generalised.
129− --
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
136− when outOfDate $ do
137− debug verbosity "Setup script is out of date, compiling..."
138−@@ -144,12 +162,3 @@
139− Nothing Nothing Nothing
140− exitCode <- waitForProcess process
141− unless (exitCode == ExitSuccess) $ exitWith exitCode
142−-
143−-moreRecentFile :: FilePath -> FilePath -> IO Bool
144−-moreRecentFile a b = do
145−- exists <- doesFileExist b
146−- if not exists
147−- then return True
148−- else do tb <- getModificationTime b
149−- ta <- getModificationTime a
150−- return (ta > tb)