Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sheaf
GHC
Commits
20a4f251
Commit
20a4f251
authored
3 years ago
by
Ben Gamari
Committed by
Marge Bot
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
hadrian: Factor out --extra-*-dirs=... pattern
We repeated this idiom quite a few times. Give it a name.
parent
083a7583
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hadrian/src/Settings/Packages.hs
+19
-9
19 additions, 9 deletions
hadrian/src/Settings/Packages.hs
with
19 additions
and
9 deletions
hadrian/src/Settings/Packages.hs
+
19
−
9
View file @
20a4f251
...
...
@@ -210,10 +210,7 @@ ghcBignumArgs = package ghcBignum ? do
-- Ensure that the ghc-bignum package registration includes
-- knowledge of the system gmp's library and include directories.
,
notM
(
flag
GmpInTree
)
?
mconcat
[
if
not
(
null
librariesGmp
)
then
arg
(
"--extra-lib-dirs="
++
librariesGmp
)
else
mempty
,
if
not
(
null
includesGmp
)
then
arg
(
"--extra-include-dirs="
++
includesGmp
)
else
mempty
]
,
notM
(
flag
GmpInTree
)
?
cabalExtraDirs
includesGmp
librariesGmp
]
]
_
->
mempty
...
...
@@ -357,11 +354,9 @@ rtsPackageArgs = package rts ? do
,
Debug
`
wayUnit
`
way
`
cabalFlag
`
"find-ptr"
]
,
builder
(
Cabal
Setup
)
?
mconcat
[
if
not
(
null
libdwLibraryDir
)
then
arg
(
"--extra-lib-dirs="
++
libdwLibraryDir
)
else
mempty
,
if
not
(
null
libdwIncludeDir
)
then
arg
(
"--extra-include-dirs="
++
libdwIncludeDir
)
else
mempty
,
if
not
(
null
libnumaLibraryDir
)
then
arg
(
"--extra-lib-dirs="
++
libnumaLibraryDir
)
else
mempty
,
if
not
(
null
libnumaIncludeDir
)
then
arg
(
"--extra-include-dirs="
++
libnumaIncludeDir
)
else
mempty
]
[
cabalExtraDirs
libdwIncludeDir
libdwLibraryDir
,
cabalExtraDirs
libnumaIncludeDir
libnumaLibraryDir
]
,
builder
(
Cc
(
FindCDependencies
CDep
))
?
cArgs
,
builder
(
Cc
(
FindCDependencies
CxxDep
))
?
cArgs
,
builder
(
Ghc
CompileCWithGhc
)
?
map
(
"-optc"
++
)
<$>
cArgs
...
...
@@ -429,3 +424,18 @@ rtsWarnings = mconcat
,
arg
"-Wredundant-decls"
,
arg
"-Wundef"
,
arg
"-fno-strict-aliasing"
]
-- | Expands to Cabal `--extra-lib-dirs` and `--extra-include-dirs` flags if
-- the respective paths are not null.
cabalExtraDirs
::
FilePath
-- ^ include path
->
FilePath
-- ^ libraries path
->
Args
cabalExtraDirs
include
lib
=
mconcat
[
extraDirFlag
"--extra-lib-dirs"
lib
,
extraDirFlag
"--extra-include-dirs"
include
]
where
extraDirFlag
::
String
->
FilePath
->
Args
extraDirFlag
flag
dir
|
null
dir
=
mempty
|
otherwise
=
arg
(
flag
++
"="
++
dir
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment