Browse files

HDBC-postgres patch: Strip whitespace the result of pg_config

Sorry bombardment of email. Here is another patch that fixed a build
problem I was getting.

pg_config returns "/usr/lib\n" when it means "/usr/lib", and this patch
strips that whitespace.

Cheers,

Phil

Fixed newline bug: pg_config includes a newline at the end of its output

From: Phil Wise <p@beta16.co.uk>
  • Loading branch information...
1 parent 012be65 commit 5931c69a74732c9a908e51948a6ef311f0aac0c0 @cajun-rat cajun-rat committed with jgoerzen Jan 14, 2009
Showing with 6 additions and 2 deletions.
  1. +6 −2 Setup.lhs
View
8 Setup.lhs
@@ -9,6 +9,9 @@ import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program
import Distribution.Verbosity
+import Data.Char (isSpace)
+import Data.List (dropWhile,reverse)
+
import Control.Monad
main = defaultMainWithHooks simpleUserHooks {
@@ -40,9 +43,10 @@ psqlBuildInfo lbi = do
libDir <- pgconfig ["--libdir"]
return emptyBuildInfo {
- extraLibDirs = [libDir],
- includeDirs = [incDir]
+ extraLibDirs = [strip libDir],
+ includeDirs = [strip incDir]
}
where
verbosity = normal -- honestly, this is a hack
+ strip x = dropWhile isSpace $ reverse $ dropWhile isSpace $ reverse x
\end{code}

0 comments on commit 5931c69

Please sign in to comment.