Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

WIP: Relocation based build (inplace free) #445

Closed
wants to merge 232 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
f10e62b
Move package.conf.d into $build/$stage/lib
angerman Oct 25, 2017
c4a297b
[hsc2hs] provide with staged template
angerman Oct 26, 2017
1f76250
[ghc-pkg] provie the --global-package-db flag
angerman Oct 26, 2017
713617c
[ghc-cabal] Pass down the --global-package-db flag to ghc-pkg
angerman Oct 26, 2017
cc3ca47
test
angerman Oct 26, 2017
e955497
[Programs] install in $stage/bin
angerman Oct 26, 2017
315b632
dead install for now.
angerman Oct 26, 2017
b0359ed
More elaborate generate logic.
angerman Oct 26, 2017
1636836
dead install
angerman Oct 26, 2017
500336f
[ghc] no more stages, no more inplace
angerman Oct 26, 2017
c99ef5b
[Builders] most of them are in stage1/bin now, instead of stage0.
angerman Oct 26, 2017
0ecb089
[base] less in-place logic.
angerman Oct 26, 2017
89bd0fe
[Rules] Copy rules for multiple stages
angerman Oct 26, 2017
523139e
[hsc2hs] Staged, and dependent on template-hsc.h
angerman Oct 26, 2017
e41f939
[hsc2hs,ghc] drop inplace copy targets.
angerman Oct 26, 2017
1afd1c2
buildPath -> contextPath
angerman Oct 27, 2017
88a2a2c
Build ContextPath rewrite
angerman Oct 27, 2017
3206db3
reinstante /build folder
angerman Oct 27, 2017
2fcbde2
Full package names; and build dir.
angerman Oct 27, 2017
a2805b6
stage munging.
angerman Oct 27, 2017
8d43007
[ghc-cabal] commands configure/copy/reg
angerman Oct 27, 2017
8ba790d
contextInstallDir is libDir
angerman Oct 27, 2017
6977e5f
[libraries] proper pkgid
angerman Oct 27, 2017
e096710
[pkg-db] unify naming.
angerman Oct 27, 2017
966e0c2
[ghc-cabal] rules for copy and register
angerman Oct 27, 2017
7442787
Paths
angerman Oct 27, 2017
361f4b6
Use the ghc-cabal from the next stage.
angerman Oct 27, 2017
d2a2833
copy and register library logic
angerman Oct 27, 2017
7b38480
[ghc-pkg] Add clone (describe + register) logic.
angerman Oct 28, 2017
afb84ba
Logic for asking builders.
angerman Oct 28, 2017
fc3c06f
Prettify doWith
angerman Oct 28, 2017
dbb69d9
buildPath, not contextPath
angerman Oct 28, 2017
79dd24c
Do NOT require the package config file when building said pacakge.
angerman Oct 28, 2017
91ad2d2
Fix build path
angerman Oct 28, 2017
dfb361b
[ghcversion.h] adds knowledge about ghcVersionH
angerman Oct 29, 2017
93b6f2a
[rts] pass -ghc-version when building.
angerman Oct 29, 2017
ae97422
[ghc-cabal] always stage1.
angerman Oct 30, 2017
256e1f3
generated code in 'build/' dir.
angerman Oct 30, 2017
a05791b
[ghc-prim] GHC.Prim Rules only for the prim package.
angerman Oct 30, 2017
3ade23d
PlatformH logic.
angerman Oct 30, 2017
f49ab6c
[rts] it's a package.
angerman Oct 30, 2017
d26a5b6
Register and copy logic.
angerman Oct 30, 2017
97c60bc
Adds copyBootPackages logic.
angerman Oct 30, 2017
1067d26
Drop trace.
angerman Oct 30, 2017
cfaf8ea
Fix hsc2hs to stage1
angerman Oct 30, 2017
54ed0e4
Split .dependencies and .dependencies.mk rule
angerman Oct 30, 2017
9cc5092
[ghc-cabal - register] Add staged ghc / ghc-pkg
angerman Oct 30, 2017
e1321ac
Oops.
angerman Oct 30, 2017
926ff3a
[genprimop] cleanup.
angerman Oct 30, 2017
8559f25
`-ghc-version`, only with stage1 and later.
angerman Oct 30, 2017
2ba1ef1
More ask logic for builders.
angerman Oct 30, 2017
73c9b77
[package conf] depend on setings and platformConstants
angerman Oct 30, 2017
0dcb5dc
[stage0 ghc] Copy settings and platformConstants from the bootstrap c…
angerman Oct 30, 2017
9aa2ace
[ghc-cabal] pass -ghc-version if needed.
angerman Oct 30, 2017
66c776d
[register] need setup-config
angerman Oct 30, 2017
daec6c9
fix pkgFile path
angerman Oct 30, 2017
191430b
config file is not a library target.
angerman Oct 30, 2017
1934788
[rts] it's a cabal package!
angerman Oct 30, 2017
37b6b91
[Evac_thr] drop custom logic. Not present in make system anymore.
angerman Oct 31, 2017
7d95f46
Inject .cmm and .s sources as needed.
angerman Oct 31, 2017
944c894
[Evac_thr] drop PARALLEL_GC.
angerman Oct 31, 2017
90dd2fb
Drop debug.
angerman Oct 31, 2017
a02a9ff
Adds Builder boot file
angerman Oct 31, 2017
25fedd8
Builder with boot!
angerman Nov 1, 2017
02df95c
Staged cabal logic.
angerman Nov 1, 2017
3765f80
simplify pkgId lookup
angerman Nov 1, 2017
311b9a6
staged deps
angerman Nov 1, 2017
0b3d01a
Use cabalData
angerman Nov 1, 2017
32c4489
[WIP] Did not manage to get the -DPARSEC cabal to build with ghc-cabal
angerman Nov 1, 2017
e5cf931
Merge branch 'master' into angerman/feature/reloc
angerman Nov 1, 2017
e87768a
fix boot file
angerman Nov 1, 2017
e264555
Cleanup Registration Rules
angerman Nov 1, 2017
a283101
Fix package Id
angerman Nov 1, 2017
4905eef
[dependencies] hadrian should *always* be compiled with the source-tr…
angerman Nov 3, 2017
8c6ac16
[WIP] inject the hook logic from ghc-cabal
angerman Nov 3, 2017
9869a60
[GHC] Split packages.
angerman Nov 3, 2017
8819da9
Split data types and Context.Paths
angerman Nov 3, 2017
799e5bd
[Parsec Cabal] Adds Cabal/Cabal Dependencies
angerman Nov 3, 2017
2d6bf90
Meh
angerman Nov 3, 2017
8e83afd
parseCabal now with Context
angerman Nov 3, 2017
efc8bc7
Integrating ghc-cabal, part 1
angerman Nov 3, 2017
ee6f407
Merge branch 'master' of git://github.com/snowleopard/hadrian into an…
angerman Nov 3, 2017
d3a0dc0
Merge branch 'master' of git://github.com/snowleopard/hadrian into an…
angerman Nov 4, 2017
19d984b
[Package Data] DEP_LIB_DIR
angerman Nov 4, 2017
011ea7a
Move Way into TYpes
angerman Nov 5, 2017
afac41c
Move Expression into Types
angerman Nov 5, 2017
44e1988
Adds CabalFlags builder.
angerman Nov 7, 2017
b16999a
Packages provide flags via the flags builder.
angerman Nov 7, 2017
649f455
Cabal and Configured Cabal logic.
angerman Nov 7, 2017
9b38535
break retain cycles.
angerman Nov 7, 2017
acc5e7b
Adds Configured Cabal Oracle logic.
angerman Nov 7, 2017
615192d
[roll ghc-cabal into hadrian] configure, copy, register logic.
angerman Nov 7, 2017
e75834c
Cleanup parse
angerman Nov 7, 2017
06c2969
Adds Types
angerman Nov 7, 2017
ab61392
Proper arguments.
angerman Nov 7, 2017
776ad49
Propper "need" dependency
angerman Nov 7, 2017
40c3424
Use configigured cabal data instead of package-data.mk
angerman Nov 7, 2017
12a0c56
Use CabalFlags
angerman Nov 8, 2017
d732756
Fix GMP
angerman Nov 8, 2017
d512b30
Cleanup Generate a bit.
angerman Nov 8, 2017
94d8ab9
Provide the cabal configuration with the proper --basedir
angerman Nov 8, 2017
c5e465c
Cleanup
angerman Nov 8, 2017
b38fcd4
Drop backets
angerman Nov 8, 2017
5de0279
Drop stage0PackageDbDir
angerman Nov 8, 2017
f34c547
Put DerivedConstants.h into rts build dir.
angerman Nov 8, 2017
788214a
Lower stages.
angerman Nov 8, 2017
2d72f8e
Less custom logic.
angerman Nov 9, 2017
a0d0728
Adds packageDatabaseArgs
angerman Nov 9, 2017
02e9db0
Merge branch 'master' of git://github.com/snowleopard/hadrian into an…
angerman Nov 9, 2017
fe47851
More needs
angerman Nov 9, 2017
7b37f15
Do not force in-tree-gmp
angerman Nov 9, 2017
0253a7d
Drop ghc-cabal
angerman Nov 9, 2017
15f2c7f
Add phony "stage2" target.
angerman Nov 9, 2017
01f5ebd
Drop `--basedir`, we use `--cabal-file` now.
angerman Nov 10, 2017
3a357f7
Adds Data.Bitcode
angerman Nov 10, 2017
aa81fd1
Merge branch 'master' of git://github.com/snowleopard/hadrian into an…
angerman Nov 11, 2017
da424b3
Force warnings in the hadrian package to be errors.
angerman Nov 11, 2017
764d008
Warning clean up
angerman Nov 11, 2017
610351a
Adds binary-dist support
angerman Nov 11, 2017
36a0356
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 12, 2017
1e9fd7c
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 12, 2017
66b1c43
Add QuickCrossNG flavour
angerman Nov 13, 2017
b920077
Adds head.hackage repository.
angerman Nov 13, 2017
3387b7f
Better SemiMonoProp guards
angerman Nov 13, 2017
681128e
No more GhcCabal
angerman Nov 14, 2017
d5a7983
Do not hack the rts on an empty package database
angerman Nov 14, 2017
8ebbd32
Do not inject "Main" as a module, when `main-is:` is not a Haskell file.
angerman Nov 14, 2017
7d5bfac
Unlit now has it's own cabal file.
angerman Nov 14, 2017
6633cb7
No more cUtil!
angerman Nov 14, 2017
c14cf2c
Adds Hsc2Hs package flags.
angerman Nov 14, 2017
cc5f8a9
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 15, 2017
e2ab408
Drop install directory hack
angerman Nov 15, 2017
5907f14
Make --build-root a configure flag.
angerman Nov 15, 2017
cde14be
Explicit Build Root
angerman Nov 15, 2017
aab96a3
Fix GhcPkg CabalFlags
angerman Nov 15, 2017
e5fbb95
Cleanup Part 1
angerman Nov 15, 2017
92f4077
Cross compilers use integer-simple by default.
angerman Nov 16, 2017
d47fab7
Clean up rules
angerman Nov 16, 2017
796a118
ios *is* cross
angerman Nov 16, 2017
6cfbc68
Get the integer library from the flavour.
angerman Nov 16, 2017
2bcd5ab
Cleanup Package Settings.
angerman Nov 16, 2017
9f17f3a
Cleanup Program Rules.
angerman Nov 16, 2017
70b8c95
Awe... flags are messed up with configured cabal.
angerman Nov 16, 2017
9f4362a
Meh flags for text are messed up with integer-simple.
angerman Nov 16, 2017
274b135
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 18, 2017
b1e3969
Build ghc-pkg and unlit in stage1
angerman Nov 18, 2017
e648dc3
Add target triple for cross compilers.
angerman Nov 18, 2017
466e4a3
ghc-version -> ghcversion-file
angerman Nov 19, 2017
4bcdcbe
[rts] no -Werror. Cross compilers break otherwise, due undefined defi…
angerman Nov 19, 2017
711a083
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 19, 2017
a8f4526
casing
angerman Nov 19, 2017
648b2d2
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 20, 2017
7260f74
Fix pkg.
angerman Nov 20, 2017
142e89c
Yey, no more haddock custom logic!
angerman Nov 20, 2017
225139d
Make haddock a stage1 target.
angerman Nov 20, 2017
6474251
Cleanup
angerman Nov 20, 2017
ff7fc80
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Nov 22, 2017
20b0604
Move the LLVMNG logic into their own flavours.
angerman Nov 22, 2017
165bb85
Drop submodules.
angerman Nov 22, 2017
5597d62
Add targetPlatform to bindist name.
angerman Nov 22, 2017
b94742a
Move LLVMNG stuff into their own flavours.
angerman Nov 22, 2017
341d962
Nuke Oracles.PackageData
angerman Nov 22, 2017
cdf1c4c
Drop Ghc Settings query.
angerman Nov 22, 2017
9de3df3
Un-SMP
angerman Nov 22, 2017
38a9163
art*i*facts
angerman Nov 22, 2017
e75827e
Cleanup
angerman Nov 22, 2017
ab0a138
Handle system-ar supports @file.
angerman Nov 24, 2017
c26cba3
More leaf nodes.
angerman Nov 24, 2017
38d20e1
Fix Ar Args.
angerman Nov 24, 2017
6f9a823
Staged LD
angerman Nov 24, 2017
b73601a
Disable stripping.
angerman Nov 24, 2017
ad87a29
Use target platform full!
angerman Nov 24, 2017
00b6927
Arm SMP Archs.
angerman Nov 25, 2017
cf8934a
WIP
angerman Nov 25, 2017
268696c
fix compilation
angerman Nov 25, 2017
0f5c3ca
Make sure we pass `-DNOSMP` to rts.
angerman Nov 25, 2017
987c77c
Make sure we actually read the `.buildinfo` files for ConfiguredCabal…
angerman Nov 25, 2017
7272bcb
Adds ccOpts to hsc2hs.
angerman Nov 25, 2017
4ae7d9a
Disable overflowed-literals in network.
angerman Nov 25, 2017
858ffed
Use flavour args, isntead of defaultArgs only.
angerman Nov 25, 2017
f38d55f
libiserv has an incomplete pattern match.
angerman Nov 25, 2017
e027f8f
No unused import warnings for libiserv and iservProxy
angerman Nov 26, 2017
c6ffd66
For cross compilers all stage2 programs are stage1 programs
angerman Nov 26, 2017
bef861d
No `--cross-safe` for crossCompiling
angerman Nov 26, 2017
acb0955
Build -fghci ghci in stage0 for cross compilers.
angerman Nov 26, 2017
09a801b
cleanup
angerman Nov 26, 2017
bbed8e3
Be more selective about when to build, which tool.
angerman Nov 26, 2017
d1e5501
fast-llvm
angerman Dec 1, 2017
4c3cf61
Add libiserv to QuickWithNG
angerman Dec 4, 2017
940822b
Add type annotation.
angerman Dec 4, 2017
5cdc9fb
Adds includes to FindCDependencies
angerman Dec 4, 2017
0d20aa0
better include logic.
angerman Dec 4, 2017
d403356
No fail
angerman Dec 4, 2017
6de8bcc
unbreak unix.
angerman Dec 4, 2017
d1faf55
More unix fixes
angerman Dec 4, 2017
70bbb77
wip bindist configure script with hadrian
alpmestan Dec 1, 2017
b9cef84
ship root Makefile into bindist archive
alpmestan Dec 4, 2017
4983bd6
wip binary dist configure/Makefile
alpmestan Dec 4, 2017
ef6f26c
meh. -Werror hits again.
angerman Dec 4, 2017
1a6d1f9
-Werror again
angerman Dec 5, 2017
8a9d800
leave out the most I can while still having ./configure work
alpmestan Dec 5, 2017
c6836fa
ship a minimal custom Makefile in hadrian bindists
alpmestan Dec 5, 2017
27896d4
indentation
alpmestan Dec 5, 2017
d32a251
Merge pull request #1 from alpmestan/alp/bindist-configure
angerman Dec 8, 2017
b990b24
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Dec 8, 2017
8e0ff6a
Cross always -fPIC
angerman Dec 8, 2017
fbbab87
No shell for autoreconf.
angerman Dec 10, 2017
26840be
always fPIC
angerman Dec 11, 2017
2f66255
Merge branch 'master' of https://github.com/snowleopard/hadrian into …
angerman Dec 21, 2017
1239701
Adds `USE_LIBFFI_FOR_ADJUSTORS` flag to the RTS package.
angerman Jan 9, 2018
323212d
Add Show and Eq to BuildRoot.
angerman Jan 9, 2018
6c401cf
hopefully fix all documentation rules
alpmestan Jan 10, 2018
4374154
embed docs in binary distributions
alpmestan Jan 18, 2018
4af3d50
binary-dist: create tar archive of a single folder, for cleaner extra…
alpmestan Jan 18, 2018
580c8a8
document why we need 'stage/lib/llvm-targets' for the docs
alpmestan Jan 22, 2018
7b47daf
Merge pull request #2 from alpmestan/alp/docs
angerman Jan 23, 2018
84810b6
Merge pull request #3 from alpmestan/alp/bindist-docs
angerman Jan 23, 2018
13989a1
Merge remote-tracking branch 'origin/master' into angerman/feature/reloc
angerman Feb 5, 2018
b81a0fb
Update to repect new Cabal.
angerman Feb 5, 2018
19980b7
More GMP fixes.
angerman Feb 5, 2018
6b1d22d
cleanup
angerman Feb 7, 2018
65872d2
Merge remote-tracking branch 'origin/master' into angerman/feature/reloc
angerman Feb 7, 2018
0355054
No versionsH
angerman Feb 12, 2018
f7db9b4
iserv/libiserv logic
angerman Feb 13, 2018
e3d27af
Adds -fllvmng flag
angerman Feb 13, 2018
9505159
Profing flag
angerman Feb 14, 2018
f0a39fd
Flags.
angerman Feb 14, 2018
674a286
Merge branch 'master' of github.com:snowleopard/hadrian into angerman…
angerman Feb 15, 2018
025197c
Types.X modules become X.Type
alpmestan Feb 15, 2018
40709cc
Merge pull request #4 from alpmestan/angerman/feature/reloc
angerman Feb 15, 2018
709c178
Merge branch 'master' of github.com:snowleopard/hadrian into angerman…
angerman Feb 17, 2018
b5d8e2d
Adds QuickCrossNCG flavour.
angerman Feb 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file added .gitmodules
Empty file.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -104,7 +104,7 @@ use `hadrian/UserSettings.hs` for the same purpose, see [documentation](doc/user

#### Clean and full rebuild

* `build clean` removes all build artefacts.
* `build clean` removes all build artifacts.

* `build -B` forces Shake to rerun all rules, even if the previous build results are
are still up-to-date.
Expand Down
Empty file modified build.cabal.sh 100644 → 100755
Empty file.
14 changes: 14 additions & 0 deletions cabal.project
@@ -1,2 +1,16 @@
packages: ./
../libraries/Cabal/Cabal/
../libraries/hpc/
../libraries/parsec/
../libraries/text/

package hadrian
ghc-options: -Werror

repository head.hackage
url: http://head.hackage.haskell.org/
secure: True
root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740
2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb
8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e
key-threshold: 3
16 changes: 15 additions & 1 deletion cfg/system.config.in
Expand Up @@ -18,6 +18,7 @@ ranlib = @REAL_RANLIB_CMD@
sphinx-build = @SPHINXBUILD@
system-ar = @AR_STAGE0@
system-cc = @CC_STAGE0@
system-ld = @LD_STAGE0@
system-ghc = @WithGhc@
system-ghc-pkg = @GhcPkgCmd@
tar = @TarCmd@
Expand All @@ -37,7 +38,8 @@ ar-supports-at-file = @ArSupportsAtFile@
cc-clang-backend = @CC_CLANG_BACKEND@
cc-llvm-backend = @CC_LLVM_BACKEND@
gcc-is-clang = @GccIsClang@
hs-cpp-args = @HaskellCPPArgs@

system-ar-supports-at-file = @ArSupportsAtFile_STAGE0@

# Build options:
#===============
Expand All @@ -64,6 +66,7 @@ host-vendor = @HostVendor_CPP@
target-platform = @TargetPlatform@
target-platform-full = @TargetPlatformFull@
target-arch = @TargetArch_CPP@
target-arch-arm-isa = @ARM_ISA@
target-os = @TargetOS_CPP@
target-vendor = @TargetVendor_CPP@
llvm-target = @LLVMTarget_CPP@
Expand All @@ -90,6 +93,15 @@ project-git-commit-id = @ProjectGitCommitId@
# Compilation and linking flags:
#===============================

# XXX: for most of the tools we have only up to
# stage2, as such building stage3 is
# is essentially impossible to do right now.

conf-ar-args-stage0 = @AR_OPTS_STAGE0@
conf-ar-args-stage1 = @ArArgs@
conf-ar-args-stage2 = @ArArgs@
conf-ar-args-stage3 = @ArArgs@

conf-cc-args-stage0 = @CONF_CC_OPTS_STAGE0@
conf-cc-args-stage1 = @CONF_CC_OPTS_STAGE1@
conf-cc-args-stage2 = @CONF_CC_OPTS_STAGE2@
Expand All @@ -106,6 +118,8 @@ conf-ld-linker-args-stage0 = @CONF_LD_LINKER_OPTS_STAGE0@
conf-ld-linker-args-stage1 = @CONF_LD_LINKER_OPTS_STAGE1@
conf-ld-linker-args-stage2 = @CONF_LD_LINKER_OPTS_STAGE2@

conf-hs-cpp-args = @HaskellCPPArgs@

# Include and library directories:
#=================================

Expand Down
33 changes: 20 additions & 13 deletions hadrian.cabal
Expand Up @@ -10,6 +10,9 @@ category: Development
build-type: Simple
cabal-version: >=1.10

flag llvmng
default: false

source-repository head
type: git
location: https://github.com/snowleopard/hadrian
Expand All @@ -22,28 +25,35 @@ executable hadrian
, Builder
, CommandLine
, Context
, Context.Paths
, Context.Type
, Environment
, Expression
, Expression.Type
, Flavour
, GHC
, GHC.Packages
, Hadrian.Builder
, Hadrian.Builder.Ar
, Hadrian.Builder.Sphinx
, Hadrian.Builder.Tar
, Hadrian.Builder.Types
, Hadrian.Expression
, Hadrian.Haskell.Cabal
, Hadrian.Haskell.Cabal.Configured
, Hadrian.Haskell.Cabal.Parse
, Hadrian.Haskell.Cabal.Type
, Hadrian.Oracles.ArgsHash
, Hadrian.Oracles.DirectoryContents
, Hadrian.Oracles.Path
, Hadrian.Oracles.TextFile
, Hadrian.Package
, Hadrian.Package.Type
, Hadrian.Target
, Hadrian.Utilities
, Oracles.Flag
, Oracles.Setting
, Oracles.ModuleFiles
, Oracles.PackageData
, Rules
, Rules.Clean
, Rules.Compile
Expand Down Expand Up @@ -86,26 +96,23 @@ executable hadrian
, Settings.Flavours.Profiled
, Settings.Flavours.Quick
, Settings.Flavours.QuickCross
, Settings.Flavours.QuickCrossNCG
, Settings.Flavours.Quickest
, Settings.Packages.Base
, Settings.Packages.Cabal
, Settings.Packages.Compiler
, Settings.Packages.Ghc
, Settings.Packages.GhcCabal
, Settings.Packages.Ghci
, Settings.Packages.GhcPkg
, Settings.Packages.GhcPrim
, Settings.Packages.Haddock
, Settings.Packages.Haskeline
, Settings.Packages.IntegerGmp
, Settings.Packages
, Settings.Packages.Rts
, Settings.Packages.RunGhc
, Settings.Warnings
, Stage
, Stage.Type
, Target
, UserSettings
, Utilities
, Way
, Way.Type
if flag(llvmng)
other-modules: Settings.Flavours.QuickWithNG
, Settings.Flavours.QuickCrossNG
cpp-options: -DLLVMNG

default-language: Haskell2010
default-extensions: DeriveFunctor
, DeriveGeneric
Expand Down
59 changes: 39 additions & 20 deletions shell.nix
Expand Up @@ -2,11 +2,13 @@
# by only invoking hadrian.


{ nixpkgs ? import <nixpkgs> {} }:
{ nixpkgs ? import <nixpkgs> {}
, boot-ghc ? "ghc821" }:

let
haskellPackages = nixpkgs.haskell.packages.ghc821;

ourtexlive = nixpkgs.texlive.combine
{ inherit (nixpkgs.texlive) scheme-small fncychap; };
haskellPackages = nixpkgs.haskell.packages.${boot-ghc};
removeBuild = path: type:
let baseName = baseNameOf (toString path);
in
Expand All @@ -20,32 +22,49 @@ let
|| nixpkgs.lib.hasSuffix ".sh" baseName
|| !(nixpkgs.lib.cleanSourceFilter path type)) ;

filterSrc = path: builtins.filterSource removeBuild path;

filterSrc = path: builtins.filterSource removeBuild path ;

hadrianPackages = nixpkgs.haskell.packages.ghc821.override {
hadrianPackages = haskellPackages.override {
overrides = self: super: let
localPackage = name: path: self.callCabal2nix name (filterSrc path) {};
localPackage = name: path: self.callCabal2nix name (filterSrc path) {} ;
noCheck = nixpkgs.haskell.lib.dontCheck ;
in {
hadrian = localPackage "hadrian" ./. ;
shake = self.callHackage "shake" "0.16" {};
Cabal = localPackage "Cabal" ./../libraries/Cabal/Cabal ;
filepath = localPackage "filepath" ./../libraries/filepath ;
text = localPackage "text" ./../libraries/text ;
hpc = localPackage"hpc" ./../libraries/hpc ;
parsec = localPackage "parsec" ./../libraries/parsec ;
HUnit = nixpkgs.haskell.lib.dontCheck (self.callHackage "HUnit" "1.3.1.2" {});
process = localPackage "process" ./../libraries/process ;
directory = localPackage "directory" ./../libraries/directory ;
shake = noCheck (self.callHackage "shake" "0.16" {}) ;
Cabal = noCheck (localPackage "Cabal" ./../libraries/Cabal/Cabal) ;
filepath = noCheck (localPackage "filepath" ./../libraries/filepath) ;
text = noCheck (localPackage "text" ./../libraries/text) ;
hpc = noCheck (localPackage "hpc" ./../libraries/hpc) ;
parsec = noCheck (localPackage "parsec" ./../libraries/parsec) ;
HUnit = noCheck (self.callHackage "HUnit" "1.3.1.2" {}) ;
process = noCheck (localPackage "process" ./../libraries/process) ;
directory = noCheck (localPackage "directory" ./../libraries/directory) ;
}; };

in
nixpkgs.lib.overrideDerivation nixpkgs.haskell.packages.ghcHEAD.ghc
nixpkgs.lib.overrideDerivation
(nixpkgs.haskell.compiler.ghcHEAD.override {
bootPkgs = haskellPackages;
})
(drv: {
name = "ghc-dev";
buildInputs = drv.buildInputs ++ [
hadrianPackages.hadrian
nixpkgs.arcanist
];
})

haskellPackages.alex
haskellPackages.happy
nixpkgs.python3
nixpkgs.git
nixpkgs.autoconf
nixpkgs.automake
nixpkgs.perl
nixpkgs.gcc
nixpkgs.python3Packages.sphinx
nixpkgs.ncurses
nixpkgs.m4
nixpkgs.gmp
nixpkgs.file
nixpkgs.llvm_5
ourtexlive
];
})
71 changes: 34 additions & 37 deletions src/Base.hs
Expand Up @@ -18,12 +18,14 @@ module Base (
module Stage,
module Way,

-- * Files
configH, ghcVersionH,
-- * Paths
hadrianPath, configPath, configFile, sourcePath, configH, shakeFilesDir,
generatedDir, inplaceBinPath, inplaceLibBinPath, inplaceLibPath,
inplaceLibCopyTargets, haddockHtmlResourcesStamp, templateHscPath,
stage0PackageDbDir, inplacePackageDbPath, packageDbPath, packageDbStamp,
ghcSplitPath
hadrianPath, configPath, configFile, sourcePath, shakeFilesDir,
generatedDir, generatedPath, inplaceBinPath, inplaceLibBinPath, inplaceLibPath,
stageBinPath, stageLibPath,
ghcDeps, templateHscPath,
inplacePackageDbPath, packageDbPath, packageDbStamp, ghcSplitPath
) where

import Control.Applicative
Expand Down Expand Up @@ -65,6 +67,9 @@ sourcePath = hadrianPath -/- "src"
configH :: FilePath
configH = "mk/config.h"

ghcVersionH :: Action FilePath
ghcVersionH = generatedPath <&> (-/- "ghcversion.h")

-- | The directory in 'buildRoot' containing the Shake database and other
-- auxiliary files generated by Hadrian.
shakeFilesDir :: FilePath
Expand All @@ -87,47 +92,39 @@ inplaceLibBinPath = inplaceLibPath -/- "bin"
generatedDir :: FilePath
generatedDir = "generated"

-- | The directory in 'buildRoot' containing the 'Stage0' package database.
stage0PackageDbDir :: FilePath
stage0PackageDbDir = "stage0/bootstrapping.conf"
generatedPath :: Action FilePath
generatedPath = buildRoot <&> (-/- generatedDir)

-- | Path to the inplace package database used in 'Stage1' and later.
inplacePackageDbPath :: FilePath
inplacePackageDbPath = inplaceLibPath -/- "package.conf.d"
-- | Path to the inplace package database.
inplacePackageDbPath :: Stage -> FilePath
inplacePackageDbPath stage = stageString stage -/- "lib" -/- "package.conf.d"

-- | Path to the package database used in a given 'Stage'.
packageDbPath :: Stage -> Action FilePath
packageDbPath Stage0 = buildRoot <&> (-/- stage0PackageDbDir)
packageDbPath _ = return inplacePackageDbPath
packageDbPath stage = buildRoot <&> (-/- inplacePackageDbPath stage)

-- | We use a stamp file to track the existence of a package database.
packageDbStamp :: FilePath
packageDbStamp = ".stamp"

-- ref: GHC_DEPENDENCIES in ghc/ghc.mk
-- ref: INSTALL_LIBS in driver/ghc.mk
-- TODO: Derive this from Builder.runtimeDependencies
-- | Files that need to be copied over to 'inplaceLibPath'.
inplaceLibCopyTargets :: [FilePath]
inplaceLibCopyTargets = map (inplaceLibPath -/-)
[ "ghc-usage.txt"
, "ghci-usage.txt"
, "llvm-targets"
, "platformConstants"
, "settings"
, "template-hsc.h" ]

-- TODO: This is fragile and will break if @README.md@ is removed. We need to
-- improve the story of program runtime dependencies on directories.
-- See: https://github.com/snowleopard/hadrian/issues/492.
-- | Path to a file in Haddock's HTML resource library.
haddockHtmlResourcesStamp :: FilePath
haddockHtmlResourcesStamp = inplaceLibPath -/- "html/README.md"

-- ref: utils/hsc2hs/ghc.mk
-- | Path to 'hsc2hs' template.
templateHscPath :: FilePath
templateHscPath = inplaceLibPath -/- "template-hsc.h"
stageBinPath :: Stage -> Action FilePath
stageBinPath stage = buildRoot <&> (-/- stageString stage -/- "bin")

stageLibPath :: Stage -> Action FilePath
stageLibPath stage = buildRoot <&> (-/- stageString stage -/- "lib")

-- | Files the `ghc` binary depends on
ghcDeps :: Stage -> Action [FilePath]
ghcDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f))
[ "ghc-usage.txt"
, "ghci-usage.txt"
, "llvm-targets"
, "platformConstants"
, "settings" ]

-- | Path to hsc2hs template.
templateHscPath :: Stage -> Action FilePath
templateHscPath stage = stageLibPath stage <&> (-/- "/template-hsc.h")

-- | @ghc-split@ is a Perl script used by GHC when run with @-split-objs@ flag.
-- It is generated in "Rules.Generate".
Expand Down