Commit 0ff04ea7 authored by refold's avatar refold
Browse files

Merge pull request #1249 from 23Skidoo/issue1241

 Make it possible to build empty libraries again.
parents 527084a2 887dccb7
......@@ -641,11 +641,11 @@ buildLib verbosity pkg_descr lbi lib clbi = do
libBi <- hackThreadedFlag verbosity
comp (withProfLib lbi) (libBuildInfo lib)
ghcDynamic <- ghcDynamic verbosity ghcProg
isGhcDynamic <- ghcDynamic verbosity ghcProg
let libTargetDir = pref
doingTH = EnableExtension TemplateHaskell `elem` allExtensions libBi
forceVanillaLib = doingTH && not ghcDynamic
forceSharedLib = doingTH && ghcDynamic
forceVanillaLib = doingTH && not isGhcDynamic
forceSharedLib = doingTH && isGhcDynamic
-- TH always needs default libs, even when building for profiling
createDirectoryIfMissingVerbose verbosity True libTargetDir
......@@ -675,7 +675,7 @@ buildLib verbosity pkg_descr lbi lib clbi = do
unless (null (libModules lib)) $
do let vanilla = ifVanillaLib forceVanillaLib (runGhcProg vanillaOpts)
shared = ifSharedLib forceSharedLib (runGhcProg sharedOpts)
if ghcDynamic then do shared; vanilla
if isGhcDynamic then do shared; vanilla
else do vanilla; shared
ifProfLib (runGhcProg profOpts)
......@@ -1183,4 +1183,3 @@ ghcDynamicByDefault verbosity ghcProg
return $ case lookup "Dynamic by default" xs of
Just "YES" -> True
_ -> False
......@@ -295,7 +295,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg lib clbi installDirs =
then libdir installDirs : extraLibDirs bi
else extraLibDirs bi,
IPI.hsLibraries = [ libname
| LibraryName libname <- componentLibraries clbi ],
| LibraryName libname <- componentLibraries clbi
, hasLibrary ],
IPI.extraLibraries = extraLibs bi,
IPI.extraGHCiLibraries = [],
IPI.includeDirs = absinc ++ adjustRelIncDirs relinc,
......
......@@ -490,6 +490,10 @@ rawSystemStdInOut verbosity path args input outputBinary = do
debug verbosity $ path ++ " returned " ++ show exitcode
++ if null err then "" else
" with error message:\n" ++ err
++ case input of
Nothing -> ""
Just ("", _) -> ""
Just (inp, _) -> "\nstdin input:\n" ++ inp
return (out, err, exitcode)
......
......@@ -34,6 +34,7 @@ import PackageTests.PathsModule.Library.Check
import PackageTests.PreProcess.Check
import PackageTests.TemplateHaskell.Check
import PackageTests.CMain.Check
import PackageTests.EmptyLib.Check
import PackageTests.TestOptions.Check
import PackageTests.TestStanza.Check
import PackageTests.TestSuiteExeV10.Check
......@@ -74,6 +75,8 @@ tests version =
, hunit "PathsModule/Executable"
PackageTests.PathsModule.Executable.Check.suite
, hunit "PathsModule/Library" PackageTests.PathsModule.Library.Check.suite
, hunit "EmptyLib/emptyLib"
PackageTests.EmptyLib.Check.emptyLib
] ++
-- These tests are only required to pass on cabal version >= 1.7
(if version >= Version [1, 7] []
......@@ -104,4 +107,3 @@ main = do
-- Create a shared Setup executable to speed up Simple tests
compileSetup "."
defaultMain (tests cabalVersion)
module PackageTests.EmptyLib.Check where
import PackageTests.PackageTester
import System.FilePath
import Test.HUnit
-- See https://github.com/haskell/cabal/issues/1241
emptyLib :: Test
emptyLib = TestCase $ do
let spec = PackageSpec ("PackageTests" </> "EmptyLib"
</> "empty") []
result <- cabal_build spec
assertBuildSucceeded result
name: emptyLib
Cabal-version: >= 1.2
version: 1.0
build-type: Simple
Library
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment