1- #!/usr/bin/env runhaskell
1+ {-# LANGUAGE CPP #-}
2+
3+ #ifndef MIN_VERSION_Cabal
4+ #define MIN_VERSION_Cabal(x,y,z) 0
5+ #endif
26
37import Distribution.Simple
48import Distribution.Simple.Setup
@@ -12,9 +16,28 @@ import Distribution.Verbosity
1216import Data.Char (isSpace )
1317import Data.List (dropWhile ,reverse )
1418
19+ #if MIN_VERSION_Cabal(2,0,0)
20+ import Distribution.Types.UnqualComponentName
21+ #endif
22+
23+ flag :: String -> FlagName
24+ #if MIN_VERSION_Cabal(2,0,0)
25+ flag = mkFlagName
26+ #else
27+ flag = FlagName
28+ #endif
29+
30+ #if MIN_VERSION_Cabal(2,0,0)
31+ unqualComponentName :: String -> UnqualComponentName
32+ unqualComponentName = mkUnqualComponentName
33+ #else
34+ unqualComponentName :: String -> String
35+ unqualComponentName = id
36+ #endif
37+
1538main = defaultMainWithHooks simpleUserHooks {
1639 confHook = \ pkg flags -> do
17- if lookup (FlagName " use-pkg-config" )
40+ if lookup (flag " use-pkg-config" )
1841 (configConfigurationsFlags flags) == Just True
1942 then do
2043 confHook simpleUserHooks pkg flags
@@ -24,15 +47,15 @@ main = defaultMainWithHooks simpleUserHooks {
2447
2548 return lbi {
2649 localPkgDescr = updatePackageDescription
27- (Just bi, [(" runtests" , bi)]) (localPkgDescr lbi)
50+ (Just bi, [(unqualComponentName " runtests" , bi)]) (localPkgDescr lbi)
2851 }
2952}
3053
3154psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
3255psqlBuildInfo lbi = do
3356 (pgconfigProg, _) <- requireProgram verbosity
3457 (simpleProgram " pg_config" ) (withPrograms lbi)
35- let pgconfig = rawSystemProgramStdout verbosity pgconfigProg
58+ let pgconfig = getProgramOutput verbosity pgconfigProg
3659
3760 incDir <- pgconfig [" --includedir" ]
3861 libDir <- pgconfig [" --libdir" ]
0 commit comments