qtah-cpp-qt5 0.4.0 → 0.5.0
raw patch · 3 files changed
+55/−17 lines, 3 filesdep ~qtah-generatorsetup-changed
Dependency ranges changed: qtah-generator
Files
- Setup.hs +52/−14
- cpp/qtah.pro +1/−1
- qtah-cpp-qt5.cabal +2/−2
Setup.hs view
@@ -28,7 +28,7 @@ PackageDescription, package, #if MIN_VERSION_Cabal(2,0,0)- FlagName, mkFlagName,+ mkFlagName, #else FlagName (FlagName), #endif@@ -39,17 +39,21 @@ absoluteInstallDirs, buildDir, libdir,+ dynlibdir, localPkgDescr, withPrograms, ) import Distribution.Simple.Program ( Program,- ProgramConfiguration, getProgramOutput, lookupProgram,+ programPath, runDbProgram, simpleProgram, )+-- I don't think Distribution.Simple.Program exported ProgramDb back in+-- Cabal-1.22.5.0, so we import it from the Db submodule:+import Distribution.Simple.Program.Db (ProgramDb) import Distribution.Simple.Setup ( BuildFlags, CleanFlags,@@ -70,15 +74,19 @@ import Distribution.Simple.UserHooks ( UserHooks ( buildHook,- hookedPrograms, cleanHook, copyHook,+ hookedPrograms, instHook, postConf ), )+#if MIN_VERSION_Cabal(2,0,0)+import Distribution.Simple.Utils (die')+#else+import Distribution.Simple.Utils (die)+#endif import Distribution.Simple.Utils (- die, info, installOrdinaryFile, notice,@@ -109,7 +117,7 @@ qtahHooks :: UserHooks qtahHooks = simpleUserHooks- { hookedPrograms = [generatorProgram, listenerGenProgram, makeProgram]+ { hookedPrograms = [bashProgram, generatorProgram, listenerGenProgram, makeProgram] , postConf = \args cf pd lbi -> do generateSources cf lbi postConf simpleUserHooks args cf pd lbi , buildHook = \pd lbi uh bf -> do doBuild lbi bf@@ -127,6 +135,9 @@ cleanHook simpleUserHooks pd z uh cf } +bashProgram :: Program+bashProgram = simpleProgram "bash"+ generatorProgram :: Program generatorProgram = simpleProgram "qtah-generator" @@ -136,10 +147,15 @@ makeProgram :: Program makeProgram = simpleProgram "make" -findQmake :: ProgramConfiguration -> Verbosity -> IO (FilePath, [String])+findQmake :: ProgramDb -> Verbosity -> IO (FilePath, [String]) findQmake programDb verbosity = do+#if MIN_VERSION_Cabal(2,0,0)+ let dieFn = die' verbosity+#else+ let dieFn = die+#endif generatorConfiguredProgram <-- maybe (die $ packageName ++ ": Couldn't find qtah-generator. Is it installed?") return $+ maybe (dieFn $ packageName ++ ": Couldn't find qtah-generator. Is it installed?") return $ lookupProgram generatorProgram programDb output <- fmap lines $ getProgramOutput verbosity generatorConfiguredProgram ["--qmake-executable"]@@ -154,14 +170,25 @@ let cppSourceDir = startDir </> "cpp" programDb = withPrograms localBuildInfo verbosity = fromFlagOrDefault normal $ configVerbosity configFlags+#if MIN_VERSION_Cabal(2,0,0)+ dieFn = die' verbosity+#else+ dieFn = die+#endif -- Parse the Qt version to use from flags and the environment, and export it -- to the generator. _ <- exportQtVersion configFlags localBuildInfo + listenerGenPath <- case lookupProgram listenerGenProgram programDb of+ Nothing ->+ dieFn $ packageName +++ ": Couldn't find qtah-listener-gen. Is qtah-generator installed and on the path?"+ Just configuredProgram -> return $ programPath configuredProgram+ -- Generate binding source code. runDbProgram verbosity generatorProgram programDb ["--gen-cpp", "cpp"]- runDbProgram verbosity listenerGenProgram programDb ["--gen-cpp-dir", "cpp"]+ runDbProgram verbosity bashProgram programDb [listenerGenPath, "--gen-cpp-dir", "cpp"] -- Run qmake to generate the makefile. setCurrentDirectory cppSourceDir@@ -192,11 +219,17 @@ startDir <- getCurrentDirectory let cppSourceDir = startDir </> "cpp" libDir = libdir $ absoluteInstallDirs packageDesc localBuildInfo copyDest+ dynlibDir = dynlibdir $ absoluteInstallDirs packageDesc localBuildInfo copyDest programDb = withPrograms localBuildInfo -- Call the makefile to install the C++ shared library into the package's -- libdir.+ -- XXX maksbotan: I'm done with this. When compiling TH, GHC searches for libraries+ -- in `dynlibdir`, but when configuring depending packages Cabal searches for libraries+ -- only in `libdir`. Hacking it away right now with this duplication. runDbProgram verbosity makeProgram programDb+ ["-C", cppSourceDir, "install", "INSTALL_ROOT=" ++ dynlibDir]+ runDbProgram verbosity makeProgram programDb ["-C", cppSourceDir, "install", "INSTALL_ROOT=" ++ libDir] -- Also record what version of Qt we are using, so that qtah can check that@@ -256,6 +289,11 @@ exportQtVersion configFlags localBuildInfo = do let verbosity = fromFlagOrDefault normal $ configVerbosity configFlags programDb = withPrograms localBuildInfo+#if MIN_VERSION_Cabal(2,0,0)+ dieFn = die' verbosity+#else+ dieFn = die+#endif -- Determine what version of Qt to use. If we have a Qt version preference -- specified, either through package flags or through QTAH_QT, then@@ -277,7 +315,7 @@ qt5Flag = fromMaybe False $ lookup (mkFlagName "qt5") flags qtFlag = if qt4Flag then Just 4 else if qt5Flag then Just 5 else Nothing when (qt4Flag && qt5Flag) $- die $ concat+ dieFn $ concat [packageName, ": The qt4 and qt5 flags are mutually exclusive. Please select at most one."] -- Inspect the QTAH_QT environment variable.@@ -286,8 +324,8 @@ Just s | not $ null s -> do let majorStr = takeWhile (/= '.') s unless (all isDigit majorStr) $- die $ concat [packageName, ": Invalid QTAH_QT value ", show s,- ". Expected a numeric version string."]+ dieFn $ concat [packageName, ": Invalid QTAH_QT value ", show s,+ ". Expected a numeric version string."] return $ Just (read majorStr :: Int) _ -> return Nothing @@ -297,7 +335,7 @@ -- If both QTAH_QT and one of the qtX flags above is set, then they must agree. (Just m, Just n) -> do when (m /= n) $- die $ concat+ dieFn $ concat [packageName, ": QTAH_QT=", show $ fromMaybe "" qtahQtStr, " and the qt", show n, " flag conflict."] -- Otherwise, if QTAH_QT is not already set but we have a flag preference,@@ -327,12 +365,12 @@ -- Log a message showing which Qt qtah-generator is actually using. generatorConfiguredProgram <-- maybe (die $ packageName ++ ": Couldn't find qtah-generator. Is it installed?") return $+ maybe (dieFn $ packageName ++ ": Couldn't find qtah-generator. Is it installed?") return $ lookupProgram generatorProgram programDb qtVersionOutput <- getProgramOutput verbosity generatorConfiguredProgram ["--qt-version"] qtVersion <- case lines qtVersionOutput of [line] -> return line- _ -> die $ concat+ _ -> dieFn $ concat [packageName, ": Couldn't understand qtah-generator --qt-version output: ", show qtVersionOutput] notice verbosity $
cpp/qtah.pro view
@@ -21,7 +21,7 @@ TARGET = qtah TEMPLATE = lib-VERSION = 0.3.1+VERSION = 0.5.0 # Doesn't seem to work here: CONFIG += c++11 QMAKE_CXXFLAGS += -std=c++11
qtah-cpp-qt5.cabal view
@@ -1,5 +1,5 @@ name: qtah-cpp-qt5-version: 0.4.0+version: 0.5.0 synopsis: Qt bindings for Haskell - C++ library homepage: http://khumba.net/projects/qtah license: LGPL-3@@ -42,7 +42,7 @@ build-depends: base >=4 && <5 , process >=1.2 && <1.7- , qtah-generator >=0.4 && <0.5+ , qtah-generator >=0.5 && <0.6 ghc-options: -W -fwarn-incomplete-patterns -fwarn-unused-do-bind custom-setup