Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 52 lines (40 sloc) 1.478 kb
37762d9 @proglang IConnection-intro
proglang authored
1 #!/usr/bin/env runhaskell
ed73ff4 @jgoerzen UNDO: Removed most files irrelevant for testsuite
jgoerzen authored
2
57c7238 Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches over to u...
Brian Bloniarz authored
3 import Distribution.Simple
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
4 import Distribution.PackageDescription
5 import Distribution.Version
6
ddb5974 @jgoerzen Revert "Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches o...
jgoerzen authored
7 import Distribution.Simple.LocalBuildInfo
8 import Distribution.Simple.Program
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
9 import Distribution.Verbosity
10
5931c69 @cajun-rat HDBC-postgres patch: Strip whitespace the result of pg_config
cajun-rat authored
11 import Data.Char (isSpace)
12 import Data.List (dropWhile,reverse)
13
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
14 import Control.Monad
15
16 main = defaultMainWithHooks simpleUserHooks {
17 hookedPrograms = [pgconfigProgram],
18
19 confHook = \pkg flags -> do
8c3dba3 @zenzike Fix deprecation warnings in Setup.
zenzike authored
20 lbi <- confHook simpleUserHooks pkg flags
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
21 bi <- psqlBuildInfo lbi
f0a529f @jgoerzen Starting tweaks
jgoerzen authored
22
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
23 return lbi {
24 localPkgDescr = updatePackageDescription
e2ea943 @jgoerzen typo fix
jgoerzen authored
25 (Just bi, [("runtests", bi)]) (localPkgDescr lbi)
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
26 }
ddb5974 @jgoerzen Revert "Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches o...
jgoerzen authored
27 }
8a13170 @dcoutts As an alternative to hard-coding, use pg_config to find the includedir
dcoutts authored
28
4a361cc @zenzike Add pg_config as a required program in setup.
zenzike authored
29 pgconfigProgram = (simpleProgram "pgconfig or pg_config") {
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
30 programFindLocation = \verbosity -> do
8c3dba3 @zenzike Fix deprecation warnings in Setup.
zenzike authored
31 pgconfig <- findProgramLocation verbosity "pgconfig"
32 pg_config <- findProgramLocation verbosity "pg_config"
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
33 return (pgconfig `mplus` pg_config)
34 }
ddb5974 @jgoerzen Revert "Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches o...
jgoerzen authored
35
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
36 psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
37 psqlBuildInfo lbi = do
38 (pgconfigProg, _) <- requireProgram verbosity
c86e3ab @jgoerzen GHC 6.12 compatibility fix
jgoerzen authored
39 pgconfigProgram (withPrograms lbi)
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
40 let pgconfig = rawSystemProgramStdout verbosity pgconfigProg
41
42 incDir <- pgconfig ["--includedir"]
43 libDir <- pgconfig ["--libdir"]
44
45 return emptyBuildInfo {
5931c69 @cajun-rat HDBC-postgres patch: Strip whitespace the result of pg_config
cajun-rat authored
46 extraLibDirs = [strip libDir],
47 includeDirs = [strip incDir]
ddb5974 @jgoerzen Revert "Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches o...
jgoerzen authored
48 }
0754d58 @jgoerzen Patch to support GHC 6.8 and GHC 6.10 simultaneously
jgoerzen authored
49 where
50 verbosity = normal -- honestly, this is a hack
5931c69 @cajun-rat HDBC-postgres patch: Strip whitespace the result of pg_config
cajun-rat authored
51 strip x = dropWhile isSpace $ reverse $ dropWhile isSpace $ reverse x
Something went wrong with that request. Please try again.