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
f3199c17
Commit
f3199c17
authored
Dec 12, 2015
by
Andrey Mokhov
Browse files
Build all utils that use cabal files.
parent
f659a182
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/GHC.hs
View file @
f3199c17
module
GHC
(
array
,
base
,
binPackageDb
,
binary
,
bytestring
,
cabal
,
compiler
,
containers
,
deepseq
,
directory
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
haskeline
,
hoopl
,
hpc
,
integerGmp
,
integerSimple
,
parallel
,
pretty
,
primitive
,
process
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
compareSizes
,
deepseq
,
directory
,
dllSplit
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
ghcTags
,
haskeline
,
hsc2hs
,
hoopl
,
hpc
,
hpcBin
,
integerGmp
,
integerSimple
,
mkUserGuidePart
,
parallel
,
pretty
,
primitive
,
process
,
runghc
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
unix
,
win32
,
xhtml
,
defaultKnownPackages
,
defaultTargetDirectory
,
defaultProgramPath
...
...
@@ -20,16 +21,19 @@ import Stage
defaultKnownPackages
::
[
Package
]
defaultKnownPackages
=
[
array
,
base
,
binPackageDb
,
binary
,
bytestring
,
cabal
,
compiler
,
containers
,
deepseq
,
directory
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
haskeline
,
hoopl
,
hpc
,
integerGmp
,
integerSimple
,
parallel
,
pretty
,
primitive
,
process
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
unix
,
win32
,
xhtml
]
,
containers
,
compareSizes
,
deepseq
,
directory
,
dllSplit
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
ghcTags
,
haskeline
,
hsc2hs
,
hoopl
,
hpc
,
hpcBin
,
integerGmp
,
integerSimple
,
mkUserGuidePart
,
parallel
,
pretty
,
primitive
,
process
,
runghc
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
unix
,
win32
,
xhtml
]
-- Package definitions
array
,
base
,
binPackageDb
,
binary
,
bytestring
,
cabal
,
compiler
,
containers
,
deepseq
,
directory
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
haskeline
,
hoopl
,
hpc
,
integerGmp
,
integerSimple
,
parallel
,
pretty
,
primitive
,
process
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
compareSizes
,
deepseq
,
directory
,
dllSplit
,
filepath
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
ghcTags
,
haskeline
,
hsc2hs
,
hoopl
,
hpc
,
hpcBin
,
integerGmp
,
integerSimple
,
mkUserGuidePart
,
parallel
,
pretty
,
primitive
,
process
,
runghc
,
stm
,
templateHaskell
,
terminfo
,
time
,
transformers
,
unix
,
win32
,
xhtml
::
Package
array
=
library
"array"
...
...
@@ -40,23 +44,30 @@ bytestring = library "bytestring"
cabal
=
library
"Cabal"
`
setPath
`
"libraries/Cabal/Cabal"
compiler
=
topLevel
"ghc"
`
setPath
`
"compiler"
containers
=
library
"containers"
compareSizes
=
utility
"compareSizes"
`
setPath
`
"utils/compare_sizes"
deepseq
=
library
"deepseq"
directory
=
library
"directory"
dllSplit
=
utility
"dll-split"
filepath
=
library
"filepath"
ghc
=
topLevel
"ghc-bin"
`
setPath
`
"ghc"
ghcCabal
=
utility
"ghc-cabal"
ghcPkg
=
utility
"ghc-pkg"
ghcPrim
=
library
"ghc-prim"
ghcPwd
=
utility
"ghc-pwd"
ghcTags
=
utility
"ghctags"
haskeline
=
library
"haskeline"
hsc2hs
=
utility
"hsc2hs"
hoopl
=
library
"hoopl"
hpc
=
library
"hpc"
hpcBin
=
utility
"hpc-bin"
`
setPath
`
"utils/hpc"
integerGmp
=
library
"integer-gmp"
integerSimple
=
library
"integer-simple"
mkUserGuidePart
=
utility
"mkUserGuidePart"
parallel
=
library
"parallel"
pretty
=
library
"pretty"
primitive
=
library
"primitive"
process
=
library
"process"
runghc
=
utility
"runghc"
stm
=
library
"stm"
templateHaskell
=
library
"template-haskell"
terminfo
=
library
"terminfo"
...
...
@@ -66,7 +77,6 @@ unix = library "unix"
win32
=
library
"Win32"
xhtml
=
library
"xhtml"
-- GHC build results will be placed into target directories with the following
-- typical structure:
-- * build/ : contains compiled object code
...
...
@@ -74,7 +84,8 @@ xhtml = library "xhtml"
-- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
-- TODO: simplify to just 'show stage'?
-- TODO: we divert from the previous convention for ghc-cabal and ghc-pkg,
-- which used to store stage0 build results in 'dist' folder
-- which used to store stage 0 build results in 'dist' folder
-- On top of that, mkUserGuidePart used dist for stage 1 for some reason.
defaultTargetDirectory
::
Stage
->
Package
->
FilePath
defaultTargetDirectory
stage
pkg
|
pkg
==
compiler
=
"stage"
++
show
(
fromEnum
stage
+
1
)
...
...
@@ -84,11 +95,18 @@ defaultTargetDirectory stage pkg
defaultProgramPath
::
Stage
->
Package
->
Maybe
FilePath
defaultProgramPath
stage
pkg
|
pkg
==
ghc
=
program
$
"ghc-stage"
++
show
(
fromEnum
stage
+
1
)
|
pkg
==
ghcCabal
=
program
$
pkgName
pkg
|
pkg
==
ghcPkg
=
program
$
pkgName
pkg
|
pkg
==
ghcPwd
=
program
$
pkgName
pkg
|
otherwise
=
Nothing
|
pkg
==
compareSizes
=
program
$
pkgName
pkg
|
pkg
==
dllSplit
=
program
$
pkgName
pkg
|
pkg
==
ghc
=
program
$
"ghc-stage"
++
show
(
fromEnum
stage
+
1
)
|
pkg
==
ghcCabal
=
program
$
pkgName
pkg
|
pkg
==
ghcPkg
=
program
$
pkgName
pkg
|
pkg
==
ghcPwd
=
program
$
pkgName
pkg
|
pkg
==
ghcTags
=
program
$
pkgName
pkg
|
pkg
==
hsc2hs
=
program
$
pkgName
pkg
|
pkg
==
hpcBin
=
program
$
pkgName
pkg
|
pkg
==
mkUserGuidePart
=
program
$
pkgName
pkg
|
pkg
==
runghc
=
program
$
pkgName
pkg
|
otherwise
=
Nothing
where
program
name
=
Just
$
pkgPath
pkg
-/-
defaultTargetDirectory
stage
pkg
-/-
"build/tmp"
-/-
name
<.>
exe
src/Rules/Generate.hs
View file @
f3199c17
...
...
@@ -71,6 +71,11 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
writeFileChanged
file
contents
putBuild
$
"| Successfully generated '"
++
file
++
"'."
priority
2.0
$
when
(
pkg
==
runghc
)
$
buildPath
-/-
"Main.hs"
%>
\
file
->
do
copyFileChanged
(
pkgPath
pkg
-/-
"runghc.hs"
)
file
putBuild
$
"| Successfully generated '"
++
file
++
"'."
quote
::
String
->
String
quote
s
=
"
\"
"
++
s
++
"
\"
"
...
...
src/Rules/Library.hs
View file @
f3199c17
...
...
@@ -54,7 +54,8 @@ buildPackageLibrary _ target @ (PartialTarget stage pkg) = do
-- TODO: this looks fragile as haskell objects can match this rule if their
-- names start with "HS" and they are on top of the module hierarchy.
priority
2
$
(
buildPath
-/-
"HS*.o"
)
%>
\
obj
->
do
-- This happens with hsc2hs, which has top-level file HSCParser.hs.
when
(
pkg
/=
hsc2hs
)
$
priority
2
$
(
buildPath
-/-
"HS*.o"
)
%>
\
obj
->
do
cSrcs
<-
cSources
target
hSrcs
<-
hSources
target
let
cObjs
=
[
buildPath
-/-
src
-<.>
"o"
|
src
<-
cSrcs
]
...
...
src/Rules/Program.hs
View file @
f3199c17
module
Rules.Program
(
buildProgram
)
where
import
Expression
hiding
(
splitPath
)
import
GHC
import
Oracles
import
Rules.Actions
import
Rules.Library
import
Rules.Resources
import
Settings
-- TODO: Get rid of the Paths_hsc2hs.o hack.
buildProgram
::
Resources
->
PartialTarget
->
Rules
()
buildProgram
_
target
@
(
PartialTarget
stage
pkg
)
=
do
let
path
=
targetPath
stage
pkg
...
...
@@ -16,8 +18,9 @@ buildProgram _ target @ (PartialTarget stage pkg) = do
(
\
f
->
program
==
Just
f
)
?>
\
bin
->
do
cSrcs
<-
cSources
target
-- TODO: remove code duplication (Library.hs)
hSrcs
<-
hSources
target
let
cObjs
=
[
buildPath
-/-
src
-<.>
osuf
vanilla
|
src
<-
cSrcs
]
hObjs
=
[
buildPath
-/-
src
<.>
osuf
vanilla
|
src
<-
hSrcs
]
let
cObjs
=
[
buildPath
-/-
src
-<.>
osuf
vanilla
|
src
<-
cSrcs
]
hObjs
=
[
buildPath
-/-
src
<.>
osuf
vanilla
|
src
<-
hSrcs
]
++
[
buildPath
-/-
"Paths_hsc2hs.o"
|
pkg
==
hsc2hs
]
objs
=
cObjs
++
hObjs
need
objs
build
$
fullTargetWithWay
target
(
Ghc
stage
)
vanilla
objs
[
bin
]
...
...
src/Settings/Builders/Ghc.hs
View file @
f3199c17
...
...
@@ -5,7 +5,7 @@ module Settings.Builders.Ghc (
import
Expression
import
Oracles
import
GHC
import
Predicates
(
package
,
stagedBuilder
,
splitObjects
,
stage0
,
notStage0
)
import
Predicates
(
package
,
file
,
stagedBuilder
,
splitObjects
,
stage0
,
notStage0
)
import
Settings
-- TODO: add support for -dyno
...
...
@@ -21,6 +21,7 @@ ghcArgs = stagedBuilder Ghc ? do
let
buildObj
=
(
"//*."
++
osuf
way
)
?==
output
||
(
"//*."
++
obootsuf
way
)
?==
output
libs
<-
getPkgDataList
DepExtraLibs
libDirs
<-
getPkgDataList
DepLibDirs
version
<-
getSetting
ProjectVersion
mconcat
[
commonGhcArgs
,
arg
"-H32m"
,
stage0
?
arg
"-O"
...
...
@@ -30,6 +31,8 @@ ghcArgs = stagedBuilder Ghc ? do
,
buildObj
?
splitObjects
?
arg
"-split-objs"
,
package
ghc
?
arg
"-no-hs-main"
-- , not buildObj ? arg "-no-auto-link-packages"
,
package
runghc
?
file
"//Main.o"
?
append
[
"-cpp"
,
"-DVERSION=
\"
"
++
version
++
"
\"
"
]
,
not
buildObj
?
append
[
"-optl-l"
++
lib
|
lib
<-
libs
]
,
not
buildObj
?
append
[
"-optl-L"
++
dir
|
dir
<-
libDirs
]
,
buildObj
?
arg
"-c"
...
...
src/Settings/Packages.hs
View file @
f3199c17
...
...
@@ -17,16 +17,17 @@ defaultPackages = mconcat
packagesStage0
::
Packages
packagesStage0
=
mconcat
[
append
[
binPackageDb
,
binary
,
cabal
,
compiler
,
ghc
,
ghcCabal
,
ghcPkg
,
ghcPwd
,
hoopl
,
hpc
,
templateHaskell
,
transformers
]
,
ghcPwd
,
hsc2hs
,
hoopl
,
hpc
,
templateHaskell
,
transformers
]
,
notM
windowsHost
?
notM
(
anyHostOs
[
"ios"
])
?
append
[
terminfo
]
]
-- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
packagesStage1
::
Packages
packagesStage1
=
mconcat
[
packagesStage0
,
append
[
array
,
base
,
bytestring
,
containers
,
deepseq
,
directory
,
filepath
,
ghcCabal
,
ghcPkg
,
ghcPrim
,
ghcPwd
,
haskeline
,
integerLibrary
,
pretty
,
process
,
time
]
,
append
[
array
,
base
,
bytestring
,
containers
,
compareSizes
,
deepseq
,
directory
,
dllSplit
,
filepath
,
ghcPrim
,
ghcTags
,
haskeline
,
hpcBin
,
integerLibrary
,
mkUserGuidePart
,
pretty
,
process
,
runghc
,
time
]
,
windowsHost
?
append
[
win32
]
,
notM
windowsHost
?
append
[
unix
]
,
buildHaddock
?
append
[
xhtml
]
]
...
...
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