Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
176bfd4d
Commit
176bfd4d
authored
Aug 20, 2017
by
Zhen Zhang
Committed by
Andrey Mokhov
Aug 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DESTDIR to command line arguments (
#397
)
parent
c413722e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
6 deletions
+23
-6
README.md
README.md
+1
-1
src/CommandLine.hs
src/CommandLine.hs
+12
-1
src/Rules/Install.hs
src/Rules/Install.hs
+6
-0
src/Settings.hs
src/Settings.hs
+3
-4
src/Settings/Packages/Rts.hs
src/Settings/Packages/Rts.hs
+1
-0
No files found.
README.md
View file @
176bfd4d
...
...
@@ -111,7 +111,7 @@ To build a GHC source distribution tarball, run Hadrian with the `sdist-ghc` tar
To build and install GHC artifacts, run the
`install`
target.
By default, the artifacts will be installed to
`<prefix>`
on your system. For example,
`ghc`
will be installed to
`/usr/local/bin`
. By
modifying
`defaultD
est
D
ir
`
in
`UserSettings.hs
`
,
`ghc`
will be installed to
`/usr/local/bin`
. By
setting flag
`--install-d
est
d
ir
=[DESTDIR]
`
,
you can install things to non-system path
`DESTDIR/<prefix>`
instead.
#### Testing
...
...
src/CommandLine.hs
View file @
176bfd4d
module
CommandLine
(
optDescrs
,
cmdLineArgsMap
,
cmdBuildHaddock
,
cmdFlavour
,
cmdIntegerSimple
,
cmdProgressColour
,
cmdProgressInfo
,
cmdSkipConfigure
,
cmdSplitObjects
cmdProgressColour
,
cmdProgressInfo
,
cmdSkipConfigure
,
cmdSplitObjects
,
cmdInstallDestDir
)
where
import
Data.Either
...
...
@@ -14,6 +15,7 @@ import System.Environment
-- | All arguments that can be passed to Hadrian via the command line.
data
CommandLineArgs
=
CommandLineArgs
{
buildHaddock
::
Bool
,
installDestDir
::
Maybe
String
,
flavour
::
Maybe
String
,
integerSimple
::
Bool
,
progressColour
::
UseColour
...
...
@@ -27,6 +29,7 @@ defaultCommandLineArgs :: CommandLineArgs
defaultCommandLineArgs
=
CommandLineArgs
{
buildHaddock
=
False
,
flavour
=
Nothing
,
installDestDir
=
Nothing
,
integerSimple
=
False
,
progressColour
=
Auto
,
progressInfo
=
Normal
...
...
@@ -39,6 +42,9 @@ readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }
readFlavour
::
Maybe
String
->
Either
String
(
CommandLineArgs
->
CommandLineArgs
)
readFlavour
ms
=
Right
$
\
flags
->
flags
{
flavour
=
lower
<$>
ms
}
readInstallDestDir
::
Maybe
String
->
Either
String
(
CommandLineArgs
->
CommandLineArgs
)
readInstallDestDir
ms
=
Right
$
\
flags
->
flags
{
installDestDir
=
ms
}
readIntegerSimple
::
Either
String
(
CommandLineArgs
->
CommandLineArgs
)
readIntegerSimple
=
Right
$
\
flags
->
flags
{
integerSimple
=
True
}
...
...
@@ -80,6 +86,8 @@ optDescrs =
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
,
Option
[]
[
"haddock"
]
(
NoArg
readBuildHaddock
)
"Generate Haddock documentation."
,
Option
[]
[
"install-destdir"
]
(
OptArg
readInstallDestDir
"DESTDIR"
)
"Installation destination directory."
,
Option
[]
[
"integer-simple"
]
(
NoArg
readIntegerSimple
)
"Build GHC with integer-simple library."
,
Option
[]
[
"progress-colour"
]
(
OptArg
readProgressColour
"MODE"
)
...
...
@@ -107,6 +115,9 @@ cmdLineArgs = userSetting defaultCommandLineArgs
cmdBuildHaddock
::
Action
Bool
cmdBuildHaddock
=
buildHaddock
<$>
cmdLineArgs
cmdInstallDestDir
::
Action
(
Maybe
String
)
cmdInstallDestDir
=
installDestDir
<$>
cmdLineArgs
cmdFlavour
::
Action
(
Maybe
String
)
cmdFlavour
=
flavour
<$>
cmdLineArgs
...
...
src/Rules/Install.hs
View file @
176bfd4d
...
...
@@ -60,6 +60,7 @@ getLibExecDir = (-/- "bin") <$> installGhcLibDir
installLibExecScripts
::
Action
()
installLibExecScripts
=
do
libExecDir
<-
getLibExecDir
destDir
<-
getDestDir
installDirectory
(
destDir
++
libExecDir
)
forM_
libExecScripts
$
\
script
->
do
installScript
script
(
destDir
++
libExecDir
)
...
...
@@ -72,6 +73,7 @@ installLibExecScripts = do
installLibExecs
::
Action
()
installLibExecs
=
do
libExecDir
<-
getLibExecDir
destDir
<-
getDestDir
installDirectory
(
destDir
++
libExecDir
)
forM_
installBinPkgs
$
\
pkg
->
do
withLatestBuildStage
pkg
$
\
stage
->
do
...
...
@@ -88,6 +90,7 @@ installBins :: Action ()
installBins
=
do
binDir
<-
setting
InstallBinDir
libDir
<-
installGhcLibDir
destDir
<-
getDestDir
installDirectory
(
destDir
++
binDir
)
win
<-
windowsHost
when
win
$
...
...
@@ -153,6 +156,7 @@ installPackages = do
ghcLibDir
<-
installGhcLibDir
binDir
<-
setting
InstallBinDir
destDir
<-
getDestDir
-- Install package.conf
let
installedPackageConf
=
destDir
++
ghcLibDir
-/-
"package.conf.d"
...
...
@@ -271,6 +275,7 @@ installPackages = do
installCommonLibs
::
Action
()
installCommonLibs
=
do
ghcLibDir
<-
installGhcLibDir
destDir
<-
getDestDir
installLibsTo
inplaceLibCopyTargets
(
destDir
++
ghcLibDir
)
-- ref: ghc.mk
...
...
@@ -296,6 +301,7 @@ includeHSubdirs = [".", "rts", "rts/prof", "rts/storage", "stg"]
installIncludes
::
Action
()
installIncludes
=
do
ghclibDir
<-
installGhcLibDir
destDir
<-
getDestDir
let
ghcheaderDir
=
ghclibDir
-/-
"include"
installDirectory
(
destDir
++
ghcheaderDir
)
forM_
includeHSubdirs
$
\
dir
->
do
...
...
src/Settings.hs
View file @
176bfd4d
...
...
@@ -2,7 +2,7 @@ module Settings (
getArgs
,
getPackages
,
getLibraryWays
,
getRtsWays
,
flavour
,
knownPackages
,
findKnownPackage
,
getPkgData
,
getPkgDataList
,
isLibrary
,
stagePackages
,
builderPath
,
getBuilderPath
,
isSpecified
,
latestBuildStage
,
programPath
,
programContext
,
integerLibraryName
,
d
estDir
,
stage1Only
,
buildDll0
programContext
,
integerLibraryName
,
getD
estDir
,
stage1Only
,
buildDll0
)
where
import
Context
...
...
@@ -103,7 +103,6 @@ programPath context@Context {..} = do
stage1Only
::
Bool
stage1Only
=
defaultStage1Only
-- TODO: Set this from command line
-- | Install's DESTDIR setting.
d
estDir
::
FilePath
d
estDir
=
default
DestDir
getD
estDir
::
Action
FilePath
getD
estDir
=
fromMaybe
""
<$>
cmdInstall
DestDir
src/Settings/Packages/Rts.hs
View file @
176bfd4d
...
...
@@ -62,6 +62,7 @@ rtsPackageArgs = package rts ? do
ffiIncludeDir
<-
getSetting
FfiIncludeDir
ffiLibraryDir
<-
getSetting
FfiLibDir
ghclibDir
<-
expr
installGhcLibDir
destDir
<-
expr
getDestDir
let
cArgs
=
[
arg
"-Irts"
,
arg
$
"-I"
++
path
...
...
Write
Preview
Markdown
is supported
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