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
0c9571aa
Commit
0c9571aa
authored
Dec 29, 2015
by
Andrey Mokhov
Browse files
Add Settings/Builders/Common.hs for storing common Args, refactor code.
parent
f415ad1d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/Rules/Data.hs
View file @
0c9571aa
...
...
@@ -8,7 +8,7 @@ import Predicates (registerPackage)
import
Rules.Actions
import
Rules.Resources
import
Settings
import
Settings.Builders.
GhcCabal
import
Settings.Builders.
Common
-- Build package-data.mk by using GhcCabal to process pkgCabal file
buildPackageData
::
Resources
->
PartialTarget
->
Rules
()
...
...
@@ -42,9 +42,9 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
postProcessPackageData
dataFile
-- TODO: PROGNAME was $(CrossCompilePrefix)hp2ps
-- TODO: code duplication around ghcIncludeDirs
priority
2.0
$
do
when
(
pkg
==
hp2ps
)
$
dataFile
%>
\
mk
->
do
includes
<-
interpretPartial
target
$
fromDiffExpr
includesArgs
let
prefix
=
"utils_hp2ps_stage"
++
show
(
fromEnum
stage
)
++
"_"
cSrcs
=
[
"AreaBelow.c"
,
"Curves.c"
,
"Error.c"
,
"Main.c"
,
"Reorder.c"
,
"TopTwenty.c"
,
"AuxFile.c"
...
...
@@ -57,7 +57,7 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
,
"INSTALL = YES"
,
"INSTALL_INPLACE = YES"
,
"DEP_EXTRA_LIBS = m"
,
"CC_OPTS = "
++
unwords
(
map
(
"-I"
++
)
ghcI
nclude
Dirs
)
]
,
"CC_OPTS = "
++
unwords
i
nclude
s
]
writeFileChanged
mk
contents
putSuccess
$
"| Successfully generated '"
++
mk
++
"'."
...
...
src/Settings/Builders/Ar.hs
View file @
0c9571aa
...
...
@@ -26,15 +26,15 @@ arCmd path argList = do
fileArgs
=
drop
arFlagsCount
argList
if
arSupportsAtFile
then
useAtFile
path
flagArgs
fileArgs
else
useSuccessiveInvo
k
ations
path
flagArgs
fileArgs
else
useSuccessiveInvo
c
ations
path
flagArgs
fileArgs
useAtFile
::
FilePath
->
[
String
]
->
[
String
]
->
Action
()
useAtFile
path
flagArgs
fileArgs
=
withTempFile
$
\
tmp
->
do
writeFile'
tmp
$
unwords
fileArgs
cmd
[
path
]
flagArgs
(
'@'
:
tmp
)
useSuccessiveInvo
k
ations
::
FilePath
->
[
String
]
->
[
String
]
->
Action
()
useSuccessiveInvo
k
ations
path
flagArgs
fileArgs
=
do
useSuccessiveInvo
c
ations
::
FilePath
->
[
String
]
->
[
String
]
->
Action
()
useSuccessiveInvo
c
ations
path
flagArgs
fileArgs
=
do
maxChunk
<-
cmdLineLengthLimit
forM_
(
chunksOfSize
maxChunk
fileArgs
)
$
\
argsChunk
->
unit
.
cmd
[
path
]
$
flagArgs
++
argsChunk
src/Settings/Builders/Common.hs
0 → 100644
View file @
0c9571aa
module
Settings.Builders.Common
(
includesArgs
)
where
import
Expression
includes
::
[
FilePath
]
includes
=
[
"includes"
,
"includes/dist-derivedconstants/header"
]
includesArgs
::
Args
includesArgs
=
append
$
map
(
"-I"
++
)
includes
src/Settings/Builders/DeriveConstants.hs
View file @
0c9571aa
...
...
@@ -7,6 +7,7 @@ import Expression
import
Oracles.Config.Flag
import
Oracles.Config.Setting
import
Predicates
(
builder
,
file
)
import
Settings.Builders.Common
import
Settings.Builders.GhcCabal
derivedConstantsPath
::
FilePath
...
...
@@ -39,7 +40,7 @@ includeCcArgs = do
,
ccWarnings
,
append
confCcArgs
,
flag
GhcUnregisterised
?
arg
"-DUSE_MINIINTERPRETER"
,
append
$
map
(
"-I"
++
)
ghcIncludeDirs
-- TODO: fix code duplication
,
includesArgs
,
arg
"-Irts"
,
notM
ghcWithSMP
?
arg
"-DNOSMP"
,
arg
"-fcommon"
]
src/Settings/Builders/GhcCabal.hs
View file @
0c9571aa
module
Settings.Builders.GhcCabal
(
cabalArgs
,
ghcCabalHsColourArgs
,
ghcIncludeDirs
,
bootPackageDbArgs
,
cabalArgs
,
ghcCabalHsColourArgs
,
bootPackageDbArgs
,
customPackageArgs
,
ccArgs
,
cppArgs
,
ccWarnings
,
argStagedSettingList
,
needDll0
)
where
...
...
@@ -14,6 +14,7 @@ import Stage
import
Expression
import
Predicates
hiding
(
stage
)
import
Settings
import
Settings.Builders.Common
cabalArgs
::
Args
cabalArgs
=
builder
GhcCabal
?
do
...
...
@@ -115,13 +116,8 @@ ccWarnings = do
ldArgs
::
Args
ldArgs
=
mempty
ghcIncludeDirs
::
[
FilePath
]
ghcIncludeDirs
=
[
"includes"
,
"includes/dist"
,
"includes/dist-derivedconstants/header"
,
"includes/dist-ghcconstants/header"
]
cppArgs
::
Args
cppArgs
=
append
$
map
(
"-I"
++
)
ghcI
nclude
Dir
s
cppArgs
=
i
nclude
sArg
s
-- TODO: Is this needed?
-- ifeq "$(GMP_PREFER_FRAMEWORK)" "YES"
...
...
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