Skip to content

Commit

Permalink
Link in extra-libs and frameworks for ghci
Browse files Browse the repository at this point in the history
Fixes #467
  • Loading branch information
mtolly authored and chrisdone committed Aug 6, 2015
1 parent 4d4b8b5 commit 542f027
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ generatePkgDescOpts locals cabalfp pkg = do
-- | Generate GHC options for the target.
generateBuildInfoOpts :: Maybe (Path Abs File) -> Path Abs Dir -> Path Abs Dir -> [PackageName] -> BuildInfo -> [String]
generateBuildInfoOpts mcabalmacros cabalDir distDir locals b =
nub (concat [ghcOpts b, extOpts b, srcOpts, includeOpts b, macros, deps])
nub (concat [ghcOpts b, extOpts b, srcOpts, includeOpts, macros, deps, extra b, extraDirs, fworks b])
where
deps =
concat
Expand All @@ -317,10 +317,26 @@ generateBuildInfoOpts mcabalmacros cabalDir distDir locals b =
(cabalDir :
map (cabalDir </>) (mapMaybe parseRelDir (hsSourceDirs b)) <>
[autogenDir distDir])
includeOpts
= map (("-I" <>) . toFilePath . (cabalDir </>))
. mapMaybe parseRelDir
. includeDirs
includeOpts =
[ "-I" <> toFilePath absDir
| dir <- includeDirs b
, absDir <- case (parseAbsDir dir, parseRelDir dir) of
(Just ab, _ ) -> [ab]
(_ , Just rel) -> [cabalDir </> rel]
(Nothing, Nothing ) -> []
]
extra
= map ("-l" <>)
. extraLibs
extraDirs =
[ "-L" <> toFilePath absDir
| dir <- extraLibDirs b
, absDir <- case (parseAbsDir dir, parseRelDir dir) of
(Just ab, _ ) -> [ab]
(_ , Just rel) -> [cabalDir </> rel]
(Nothing, Nothing ) -> []
]
fworks = map (\fwk -> "-framework=" <> fwk) . frameworks

-- | Make the autogen dir.
autogenDir :: Path Abs Dir -> Path Abs Dir
Expand Down

0 comments on commit 542f027

Please sign in to comment.