Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
f79678a9
Commit
f79678a9
authored
Jan 07, 2015
by
Andrey Mokhov
Browse files
Clean up code.
parent
7792b9a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Package/Data.hs
View file @
f79678a9
...
...
@@ -8,17 +8,16 @@ libraryArgs ways =
let
argEnable
x
suffix
=
arg
$
(
if
x
then
"--enable-"
else
"--disable-"
)
++
suffix
in
mconcat
[
argEnable
False
"library-for-ghci"
-- TODO: why always disable?
,
argEnable
(
vanilla
`
elem
`
ways
)
"library-vanilla"
,
argEnable
(
vanilla
`
elem
`
ways
)
"library-vanilla"
,
when
(
ghcWithInterpreter
&&
not
DynamicGhcPrograms
&&
vanilla
`
elem
`
ways
)
$
argEnable
True
"library-for-ghci"
argEnable
True
"library-for-ghci"
,
argEnable
(
profiling
`
elem
`
ways
)
"library-profiling"
,
argEnable
(
dynamic
`
elem
`
ways
)
"shared"
]
configureArgs
::
Stage
->
Settings
->
Args
configureArgs
stage
settings
=
let
argConf
::
String
->
Args
->
Args
argConf
key
as
=
unless
(
null
<$>
as
)
$
joinArgs
"--configure-option="
key
"="
as
let
argConf
key
as
=
unless
(
null
<$>
as
)
$
joinArgs
"--configure-option="
key
"="
(
as
::
Args
)
cflags
=
joinArgsSpaced
(
commonCcArgs
`
filterOut
`
[
"-Werror"
])
(
ConfCcArgs
stage
)
...
...
src/Package/Dependencies.hs
View file @
f79678a9
...
...
@@ -69,22 +69,16 @@ buildPackageDependencies pkg @ (Package name path _) (stage, dist, settings) =
need
[
"shake/src/Package/Dependencies.hs"
]
-- Track changes in this file
let
pkgData
=
buildDir
</>
"package-data.mk"
usePackageKey
<-
SupportsPackageKey
||
stage
/=
Stage0
-- TODO: check reasoning (distdir-way-opts)
[
mods
,
srcDirs
,
includeDirs
,
deps
,
depKeys
]
<-
mapM
((
fmap
words
)
.
(
packagaDataOption
pkgData
))
[
Modules
,
SrcDirs
,
IncludeDirs
,
Deps
,
DepKeys
]
srcs
<-
getDirectoryFiles
""
$
do
dir
<-
srcDirs
modPath
<-
map
(
replaceEq
'.'
pathSeparator
)
mods
extension
<-
[
"hs"
,
"lhs"
]
return
$
path
</>
dir
</>
modPath
<.>
extension
packageKey
<-
packagaDataOption
pkgData
PackageKey
mods
<-
map
(
replaceEq
'.'
pathSeparator
)
<$>
arg
(
Modules
pkgData
)
srcDirs
<-
arg
$
SrcDirs
pkgData
srcs
<-
getDirectoryFiles
""
$
[
path
</>
dir
</>
mPath
<.>
ext
|
dir
<-
srcDirs
,
mPath
<-
mods
,
ext
<-
[
"hs"
,
"lhs"
]]
run
(
Ghc
stage
)
$
mconcat
[
arg
"-M"
,
wayHcOpts
vanilla
-- TODO: i) is this needed? ii) shall we run GHC -M multiple times?
,
arg
SrcHcOpts
-- TODO: get rid of splitArgs
,
arg
SrcHcOpts
,
when
(
stage
==
Stage0
)
$
arg
"-package-db libraries/bootstrapping.conf"
,
arg
$
if
usePackageKey
then
"-this-package-key"
else
"-package-name"
,
arg
p
ackageKey
-- TODO: check reasoning ($$($4_THIS_PACKAGE_KEY) $$($1_$2_PACKAGE_KEY))
,
arg
$
P
ackageKey
pkgData
-- TODO: check reasoning ($$($4_THIS_PACKAGE_KEY) $$($1_$2_PACKAGE_KEY))
,
arg
"-hide-all-packages"
,
arg
"-i"
-- resets the search path to nothing; TODO: check if really needed
,
arg
$
map
(
\
d
->
"-i"
++
path
</>
d
)
srcDirs
...
...
@@ -92,13 +86,13 @@ buildPackageDependencies pkg @ (Package name path _) (stage, dist, settings) =
prefix
<-
[
"-i"
,
"-I"
]
-- 'import' and '#include' search paths
suffix
<-
[
"build"
,
"build/autogen"
]
return
$
prefix
++
buildDir
</>
suffix
,
arg
$
map
(
\
d
->
"-I"
++
path
</>
d
)
$
filter
isRelative
i
ncludeDirs
,
arg
$
map
(
\
d
->
"-I"
++
d
)
$
filter
isAbsolute
i
ncludeDirs
,
map
(
\
d
->
"-I"
++
path
</>
d
)
<$>
filter
isRelative
<$>
arg
(
I
ncludeDirs
pkgData
)
,
map
(
\
d
->
"-I"
++
d
)
<$>
filter
isAbsolute
<$>
arg
(
I
ncludeDirs
pkgData
)
,
arg
"-optP-include"
,
arg
$
"-optP"
++
buildDir
</>
"build/autogen/cabal_macros.h"
,
if
usePackageKey
then
arg
$
concatMap
(
\
d
->
[
"-package-key"
,
d
])
depKeys
else
arg
$
concatMap
(
\
d
->
[
"-package"
,
d
])
deps
then
map
(
"-package-key "
++
)
<$>
arg
(
DepKeys
pkgData
)
else
map
(
"-package
"
++
)
<$>
arg
(
Deps
pkgData
)
,
args
"-dep-makefile"
out
"-dep-suffix"
""
"-include-pkg-deps"
,
arg
$
map
normalise
srcs
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment