qtah-qt5 0.1.0 → 0.1.1
raw patch · 2 files changed
+28/−12 lines, 2 filessetup-changed
Files
- Setup.hs +27/−11
- qtah-qt5.cabal +1/−1
Setup.hs view
@@ -53,12 +53,15 @@ import Distribution.Simple.Setup ( CleanFlags, ConfigFlags,- CopyDest (NoCopyDest),+ CopyDest (CopyTo, NoCopyDest), cleanVerbosity, configConfigurationsFlags, configVerbosity,+ copyDest, copyVerbosity,+ flagToMaybe, fromFlagOrDefault,+ installDistPref, installVerbosity, ) import Distribution.Simple.UserHooks (@@ -110,11 +113,14 @@ , preTest = \_ _ -> addLibDir , preCopy = \_ _ -> addLibDir -- Not sure if necessary, but doesn't hurt. , copyHook = \pd lbi uh cf -> do let verbosity = fromFlagOrDefault normal $ copyVerbosity cf- doInstall verbosity pd lbi+ dest = fromFlagOrDefault NoCopyDest $ copyDest cf+ doInstall verbosity pd lbi dest copyHook simpleUserHooks pd lbi uh cf , preInst = \_ _ -> addLibDir -- Not sure if necessary, but doesn't hurt. , instHook = \pd lbi uh if' -> do let verbosity = fromFlagOrDefault normal $ installVerbosity if'- doInstall verbosity pd lbi+ dest = maybe NoCopyDest CopyTo $+ flagToMaybe $ installDistPref if'+ doInstall verbosity pd lbi dest instHook simpleUserHooks pd lbi uh if' , preReg = \_ _ -> addLibDir -- Necessary. , cleanHook = \pd z uh cf -> do doClean cf@@ -163,7 +169,7 @@ -- Parse the Qt version to use from flags and the environment, and export it -- to the generator.- (_, qtVersion) <- exportQtVersion configFlags localBuildInfo+ qtVersion <- exportQtVersion configFlags localBuildInfo -- Ensure that we're using the same version of Qt that qtah-cpp is. let qtahCppQtVersionFile = qtahCppLibDir </> "qtah-qt-version"@@ -182,10 +188,10 @@ -- Generate binding source code. runDbProgram verbosity generatorProgram programDb ["--gen-hs", "src"] -doInstall :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()-doInstall verbosity packageDesc localBuildInfo = do+doInstall :: Verbosity -> PackageDescription -> LocalBuildInfo -> CopyDest -> IO ()+doInstall verbosity packageDesc localBuildInfo copyDest = do -- Record what version of Qt we are using.- let libDir = libdir $ absoluteInstallDirs packageDesc localBuildInfo NoCopyDest+ let libDir = libdir $ absoluteInstallDirs packageDesc localBuildInfo copyDest createDirectoryIfMissing True libDir installOrdinaryFile verbosity (buildDir localBuildInfo </> "qtah-qt-version")@@ -237,7 +243,8 @@ getDirectoryContents dir -- | This function should be called in a 'postConf' hook. It determines the--- requested Qt version based on package flags and the program environment.+-- requested Qt version based on package flags and the program environment, and+-- sets the environment variables @QTAH_QT@ and @QT_SELECT@ appropriately. -- -- The mutually exclusive package flags @qt4@ and @qt5@ specify a preference on -- a major version of Qt. Additionally, the environment variable @QTAH_QT@ can@@ -256,12 +263,14 @@ -- (@String@). -- -- !!! KEEP THIS FUNCTION IN SYNC WITH qtah-cpp/Setup.hs !!!-exportQtVersion :: ConfigFlags -> LocalBuildInfo -> IO (Maybe Int, String)+exportQtVersion :: ConfigFlags -> LocalBuildInfo -> IO String exportQtVersion configFlags localBuildInfo = do let verbosity = fromFlagOrDefault normal $ configVerbosity configFlags programDb = withPrograms localBuildInfo - -- Determine what version of Qt to use.+ -- Determine what version of Qt to use. If we have a Qt version preference+ -- specified, either through package flags or through QTAH_QT, then+ -- maybeQtMajor will get that value. let PackageName myName = pkgName $ package $ localPkgDescr localBuildInfo maybeQtMajor <- case reverse myName of -- If the package name ends in "-qtX", then build for Qt X (whatever the@@ -320,6 +329,13 @@ return $ qtahQtMajor <|> qtFlag + -- If we have a major version preference, then set QT_SELECT in case we're+ -- calling QMake. We use QT_SELECT over "-qt=X" because it doesn't break when+ -- qtchooser isn't available.+ case maybeQtMajor of+ Just qtMajor -> setEnv "QT_SELECT" $ show qtMajor+ Nothing -> return ()+ -- Log a message showing which Qt qtah-generator is actually using. generatorConfiguredProgram <- maybe (die $ packageName ++ ": Couldn't find qtah-generator. Is it installed?") return $@@ -338,4 +354,4 @@ createDirectoryIfMissing True $ takeDirectory qtVersionFile writeFile qtVersionFile $ unlines [qtVersion] - return (maybeQtMajor, qtVersion)+ return qtVersion
qtah-qt5.cabal view
@@ -1,5 +1,5 @@ name: qtah-qt5-version: 0.1.0+version: 0.1.1 synopsis: Qt bindings for Haskell homepage: http://khumba.net/projects/qtah license: LGPL-3