aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Runtime
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2017-12-14 16:00:59 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-01-18 14:10:26 +0100
commitf03e60f73844afe81bdefddce28733ac16da3c4a (patch)
treec102941abadbc8c45f9e1850acc4d668ac7989e0 /src/CabalHelper/Runtime
parentc76893a035c37c949cca9c09f10ccea59402cf55 (diff)
Tests pass for backpack
Diffstat (limited to 'src/CabalHelper/Runtime')
-rw-r--r--src/CabalHelper/Runtime/Main.hs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/CabalHelper/Runtime/Main.hs b/src/CabalHelper/Runtime/Main.hs
index e2829b3..5c2b9fb 100644
--- a/src/CabalHelper/Runtime/Main.hs
+++ b/src/CabalHelper/Runtime/Main.hs
@@ -338,7 +338,6 @@ main = do
"ghc-options":flags -> do
res <- componentOptions lvd True flags id
- -- putStrLn $ "\n*************ghc-options:" ++ show res
return $ Just $ ChResponseCompList (res ++ [(ChSetupHsName, [])])
"ghc-src-options":flags -> do
@@ -510,8 +509,11 @@ componentOptions' (lbi, v, distdir) inplaceFlag flags rf f = do
componentsMap lbi v distdir $ \c clbi bi ->
let
- -- outdir = componentOutDir lbi c
+#if CH_MIN_VERSION_Cabal(2,0,0)
outdir = componentBuildDir lbi clbi
+#else
+ outdir = componentOutDir lbi c
+#endif
(clbi', adopts) = case flags of
_ | not inplaceFlag -> (clbi, mempty)
["--with-inplace"] -> (clbi, mempty)
@@ -568,18 +570,20 @@ removeInplaceDeps _v lbi pd clbi includeDirs = let
opts { ghcOptSourcePath = ghcOptSourcePath opts <> toNubListR extraIncludes
, ghcOptPackages = ghcOptPackages opts <> toNubListR extraDeps }
- (hasIdeps,clbi') = removeInplace clbi
+ (hasIdeps,clbi') = case needsBuild of
+ NoBuildOutput -> removeInplace clbi
+ ProduceBuildOutput -> (False, clbi)
libopts =
-- AZ:TODO: we already have the clbi, use it rather
case (getLibraryClbi pd lbi,getExeClbi pd lbi) of
- (Just (lib, libclbi),_) | hasIdeps && (needsBuild == NoBuildOutput) ->
+ (Just (lib, libclbi),_) | hasIdeps ->
let
libbi = libBuildInfo lib
opts = cleanRecursiveOpts (CLib lib) libbi libclbi
in
-- ghcOptInputModules = toNubListR $ allLibModules lib clbi,
opts { ghcOptInputModules = ghcOptInputModules opts <> (toNubListR $ allLibModules lib libclbi) }
- (_,Just (exe,execlbi)) | hasIdeps && (needsBuild == NoBuildOutput) ->
+ (_,Just (exe,execlbi)) | hasIdeps ->
let
exebi = buildInfo exe
in
@@ -757,7 +761,13 @@ componentEntrypoints (CFLib (ForeignLib{..}))
[]
#endif
componentEntrypoints (CExe Executable {..})
- = ChExeEntrypoint modulePath (map gmModuleName $ otherModules buildInfo)
+ = ChExeEntrypoint
+#if CH_MIN_VERSION_Cabal(2,0,0)
+ ( head ((hsSourceDirs buildInfo) ++ ["."]) </> modulePath)
+#else
+ modulePath
+#endif
+ (map gmModuleName $ otherModules buildInfo)
componentEntrypoints (CTest TestSuite { testInterface = TestSuiteExeV10 _ fp, ..})
= ChExeEntrypoint fp (map gmModuleName $ otherModules testBuildInfo)
componentEntrypoints (CTest TestSuite { testInterface = TestSuiteLibV09 _ mn, ..})