Skip to content
GitLab
Menu
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
acde0ea2
Commit
acde0ea2
authored
Jun 16, 2015
by
Andrey Mokhov
Browse files
Add comments. Minor refactoring.
parent
8f6fe558
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/Expression.hs
View file @
acde0ea2
...
...
@@ -124,7 +124,7 @@ interpretDiff env = interpret env . fromDiff
(
??
)
::
Monoid
a
=>
Predicate
->
(
Expr
a
,
Expr
a
)
->
Expr
a
p
??
(
t
,
f
)
=
p
?
t
<>
(
liftM
not
p
)
?
f
-- Basic predicates
-- Basic predicates
(see Switches.hs for derived predicates)
stage
::
Stage
->
Predicate
stage
s
=
liftM
(
s
==
)
(
asks
getStage
)
...
...
@@ -137,6 +137,7 @@ package p = liftM (p ==) (asks getPackage)
configKeyValue
::
String
->
String
->
Predicate
configKeyValue
key
value
=
liftM
(
value
==
)
(
lift
$
askConfig
key
)
-- checks if there is at least one match
-- Check if there is at least one match
-- Example: configKeyValues "host-os-cpp" ["mingw32", "cygwin32"]
configKeyValues
::
String
->
[
String
]
->
Predicate
configKeyValues
key
values
=
liftM
(`
elem
`
values
)
(
lift
$
askConfig
key
)
src/Rules.hs
View file @
acde0ea2
...
...
@@ -13,7 +13,7 @@ import Rules.Package
import
Settings.Packages
-- generateTargets needs package-data.mk files of all target packages
-- TODO: make interpret total
-- TODO: make interpret
Diff
total
generateTargets
::
Rules
()
generateTargets
=
action
$
forM_
[
Stage0
..
]
$
\
stage
->
do
...
...
@@ -23,7 +23,6 @@ generateTargets = action $
let
dir
=
targetDirectory
stage
pkg
need
[
pkgPath
pkg
</>
dir
</>
"package-data.mk"
]
-- TODO: make interpret total
-- TODO: add Stage2 (compiler only?)
packageRules
::
Rules
()
packageRules
=
...
...
src/Settings.hs
View file @
acde0ea2
...
...
@@ -12,6 +12,7 @@ import Expression hiding (when, liftIO)
settings
::
Settings
settings
=
defaultSettings
<>
userSettings
-- TODO: add all other settings
defaultSettings
::
Settings
defaultSettings
=
mconcat
[
cabalSettings
...
...
src/Settings/GhcCabal.hs
View file @
acde0ea2
...
...
@@ -105,7 +105,7 @@ packageConstraints = do
++
cabal
++
"'."
args
$
concatMap
(
\
c
->
[
"--constraint"
,
c
])
$
constraints
-- TODO:
remov
e
-- TODO:
should be in a different fil
e
ccSettings
::
Settings
ccSettings
=
validating
?
do
let
gccGe46
=
liftM
not
gccLt46
...
...
src/Settings/Util.hs
View file @
acde0ea2
...
...
@@ -47,6 +47,7 @@ argStagedConfigList key = do
stage
<-
asks
getStage
argConfigList
(
stagedKey
stage
key
)
-- Pass arguments to Gcc and corresponding lists of sub-arguments of GhcCabal
appendCcArgs
::
[
String
]
->
Settings
appendCcArgs
args
=
do
stage
<-
asks
getStage
...
...
@@ -54,6 +55,10 @@ appendCcArgs args = do
,
builder
GhcCabal
?
appendSub
"--configure-option=CFLAGS"
args
,
builder
GhcCabal
?
appendSub
"--gcc-options"
args
]
-- packageData :: Arity -> String -> Settings
-- packageData arity key =
-- return $ EnvironmentParameter $ PackageData arity key Nothing Nothing
...
...
src/Switches.hs
View file @
acde0ea2
...
...
@@ -12,6 +12,8 @@ module Switches (
import
Base
import
Expression
-- TODO: This setting should be moved to UserSettings.hs
-- TODO: Define three packages for integer library instead of one in Targets.hs
-- Support for multiple integer library implementations
data
IntegerLibraryImpl
=
IntegerGmp
|
IntegerGmp2
|
IntegerSimple
...
...
src/Targets.hs
View file @
acde0ea2
...
...
@@ -20,6 +20,7 @@ import Oracles.Builder
-- * build/ : contains compiled object code
-- * doc/ : produced by haddock
-- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
-- TODO: This is currently not user configurable. Is this right?
targetDirectory
::
Stage
->
Package
->
FilePath
targetDirectory
stage
package
|
package
==
compiler
=
"stage"
++
show
(
fromEnum
stage
+
1
)
...
...
@@ -85,14 +86,14 @@ customPackageSettings :: Settings
customPackageSettings
=
mconcat
[
package
integerLibrary
?
mconcat
[
windowsHost
?
builder
GhcCabal
?
a
ppend
[
"--configure-option=--with-intree-gmp"
]
a
rg
"--configure-option=--with-intree-gmp"
,
appendCcArgs
[
"-Ilibraries/integer-gmp2/gmp"
]
]
,
package
base
?
builder
GhcCabal
?
a
ppend
[
"--flags="
++
integerLibraryName
]
builder
GhcCabal
?
a
rg
(
"--flags="
++
integerLibraryName
)
,
package
ghcPrim
?
builder
GhcCabal
?
a
ppend
[
"--flag=include-ghc-prim"
]
]
builder
GhcCabal
?
a
rg
"--flag=include-ghc-prim"
]
-- Note [Cabal name weirdness]
-- Find out if we can move the contents to just Cabal/
...
...
src/UserSettings.hs
View file @
acde0ea2
...
...
@@ -10,18 +10,23 @@ import Ways
import
Targets
import
Switches
import
Expression
import
Settings.Util
-- No user-specific settings by default
userSettings
::
Settings
userSettings
=
mempty
-- Control conditions of which packages get to be built
-- TODO: adding *new* packages is not possible (see knownPackages in Targets.hs)
userPackages
::
Packages
userPackages
=
mempty
-- Control which ways are built
userWays
::
Ways
userWays
=
mempty
-- User-defined predicates
-- TODO: migrate more predicates here from configuration files
buildHaddock
::
Predicate
buildHaddock
=
return
True
...
...
@@ -31,7 +36,7 @@ validating = return False
-- Examples:
userSettings'
::
Settings
userSettings'
=
mconcat
[
package
compiler
?
stage0
?
a
ppend
[
"foo"
,
"bar"
]
[
package
compiler
?
stage0
?
a
rg
"foo"
,
builder
(
Ghc
Stage0
)
?
remove
[
"-O2"
]
,
builder
GhcCabal
?
removeSub
"--configure-option=CFLAGS"
[
"-Werror"
]
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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