HookedBuildInfo and Cabal
Hi Brian & everyone, Got this bug report, which appears to be related to your autoconf patch. Did you test it on Windows? As a more general question, how can one use Cabal to detect PostgreSQL paths in a way that works with both GHC 6.8 and 6.10? The commit here was: commit 57c723873b020643b9062941a2ece130cd0f36c6 Author: Brian Bloniarz <phunge0@hotmail.com> Date: Fri Dec 26 14:33:43 2008 -0500 Update hdbc-postgresql for GHC 6.10 & Cabal 1.6. This switches over to use autoconf rathe r than Cabal hooks to detect postgres paths; there's no backwards-compatible way to use write HookedBuildInfo with Cabal 1.2 and Cabal 1.6 (see http://www.haskell.org/pipermail/glasgow-ha skell-users/2008-October/015707.html) -- John ----- Forwarded message from software-noreply@complete.org ----- From: software-noreply@complete.org Date: Thu, 08 Jan 2009 12:37:12 -0600 Subject: [HDBC PostgreSQL driver - Bug #131] Throw exception when use data type "timpstamp without time zone" Issue #131 has been updated by Benjamin Cao. by the way, I cannot configure 1.1.6.0.0 successfully on my windows OS because of the Expr command(which is a linux command, even if I got a windows version of it, it keep crash on windows.) The function isFixedPointUnderConversionToLocalTime in 1.1.6.0.0 is the same. So I think it should be a same issue on 1.1.6.0.0 ---------------------------------------- Bug #131: Throw exception when use data type "timpstamp without time zone" http://software.complete.org/software/issues/show/131 Author: Benjamin Cao Status: New Priority: Normal Assigned to: Category: Target version: 1.1.4.1.0 Resolution: The database is like CREATE TABLE test ( "name" character varying(200) NOT NULL, "time" timestamp with time zone, timenotz timestamp without time zone, CONSTRAINT test_pkey PRIMARY KEY (name) ) WITH (OIDS=FALSE); ALTER TABLE test OWNER TO postgres; when call st <- prepare c "select name,time, timenotz from test" execute st [] Will get this error: Time.toClockTime: timezone offset out of range So I modified the function in statement.hsc to: isFixedPointUnderConversionToLocalTime calTime = do let hasError = False calTime' <- Control.Exception.catch (toLocalCalTime calTime) (\_->do let hasError = True return calTime) if hasError then return False else return $ eqParts calTime calTime' ---------------------------------------- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://software.complete.org/software/my/account ----- End forwarded message -----
On Thu, 2009-01-08 at 12:42 -0600, John Goerzen wrote:
As a more general question, how can one use Cabal to detect PostgreSQL paths in a way that works with both GHC 6.8 and 6.10?
Yes: The following is using "build-type: Simple" in HDBC-postgresql.cabal and it does not use HDBC-postgresql.buildinfo.in or the other autoconf files. Note that I've not actually tested that this builds HDBC-postgresql fully (I don't have postgres installed). But with a suitable hacked up pgconfig/pg_config on the $PATH that it does pass the output to ghc, hsc2hs etc. It works with Cabal-1.2 and 1.6. I've not done it but you can also require a minimum pgconfig version if you modify pgconfigProgram below to discover the version number. You'd put the following in the .cabal file: build-tools: pgconfig >= 7.3 or whatever. Duncan Setup.hs: import Distribution.Simple import Distribution.PackageDescription import Distribution.Version import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program import Distribution.Verbosity import Control.Monad main = defaultMainWithHooks simpleUserHooks { hookedPrograms = [pgconfigProgram], confHook = \pkg flags -> do lbi <- confHook defaultUserHooks pkg flags bi <- psqlBuildInfo lbi return lbi { localPkgDescr = updatePackageDescription (Just bi, []) (localPkgDescr lbi) } } pgconfigProgram = (simpleProgram "pgconfig") { programFindLocation = \verbosity -> do pgconfig <- findProgramOnPath "pgconfig" verbosity pg_config <- findProgramOnPath "pg_config" verbosity return (pgconfig `mplus` pg_config) } psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo psqlBuildInfo lbi = do (pgconfigProg, _) <- requireProgram verbosity pgconfigProgram AnyVersion (withPrograms lbi) let pgconfig = rawSystemProgramStdout verbosity pgconfigProg incDir <- pgconfig ["--includedir"] libDir <- pgconfig ["--libdir"] return emptyBuildInfo { extraLibDirs = [libDir], includeDirs = [incDir] } where verbosity = normal -- honestly, this is a hack
participants (2)
-
Duncan Coutts -
John Goerzen