Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
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
Service Desk
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 JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
e0384672
Commit
e0384672
authored
4 years ago
by
Bo Anderson
Browse files
Options
Downloads
Patches
Plain Diff
language/haskell: move to compat
parent
9fcaa46c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/compat/language/haskell.rb
+114
-0
114 additions, 0 deletions
Library/Homebrew/compat/language/haskell.rb
Library/Homebrew/language/haskell.rb
+1
-94
1 addition, 94 deletions
Library/Homebrew/language/haskell.rb
with
115 additions
and
94 deletions
Library/Homebrew/compat/language/haskell.rb
0 → 100644
+
114
−
0
View file @
e0384672
# frozen_string_literal: true
module
Language
module
Haskell
module
Cabal
module
Compat
def
cabal_sandbox
(
options
=
{})
# odeprecated "Language::Haskell::Cabal.cabal_sandbox"
pwd
=
Pathname
.
pwd
home
=
options
[
:home
]
||
pwd
# pretend HOME is elsewhere, so that ~/.cabal is kept as untouched
# as possible (except for ~/.cabal/setup-exe-cache)
# https://github.com/haskell/cabal/issues/1234
saved_home
=
ENV
[
"HOME"
]
ENV
[
"HOME"
]
=
home
system
"cabal"
,
"v1-sandbox"
,
"init"
cabal_sandbox_bin
=
pwd
/
".cabal-sandbox/bin"
mkdir_p
cabal_sandbox_bin
# make available any tools that will be installed in the sandbox
saved_path
=
ENV
[
"PATH"
]
ENV
.
prepend_path
"PATH"
,
cabal_sandbox_bin
# avoid updating the cabal package database more than once
system
"cabal"
,
"v1-update"
unless
(
home
/
".cabal/packages"
).
exist?
yield
# remove the sandbox and all build products
rm_rf
[
".cabal-sandbox"
,
"cabal.sandbox.config"
,
"dist"
]
# avoid installing any Haskell libraries, as a matter of policy
rm_rf
lib
unless
options
[
:keep_lib
]
# restore the environment
ENV
[
"HOME"
]
=
saved_home
ENV
[
"PATH"
]
=
saved_path
end
def
cabal_sandbox_add_source
(
*
args
)
# odeprecated "Language::Haskell::Cabal.cabal_sandbox_add_source"
system
"cabal"
,
"v1-sandbox"
,
"add-source"
,
*
args
end
def
cabal_install
(
*
args
)
# odeprecated "Language::Haskell::Cabal.cabal_install",
# "cabal v2-install directly with std_cabal_v2_args"
# cabal hardcodes 64 as the maximum number of parallel jobs
# https://github.com/Homebrew/legacy-homebrew/issues/49509
make_jobs
=
(
ENV
.
make_jobs
>
64
)
?
64
:
ENV
.
make_jobs
# cabal-install's dependency-resolution backtracking strategy can easily
# need more than the default 2,000 maximum number of "backjumps," since
# Hackage is a fast-moving, rolling-release target. The highest known
# needed value by a formula at this time (February 2016) was 43,478 for
# git-annex, so 100,000 should be enough to avoid most gratuitous
# backjumps build failures.
system
"cabal"
,
"v1-install"
,
"--jobs=
#{
make_jobs
}
"
,
"--max-backjumps=100000"
,
*
args
end
def
cabal_configure
(
flags
)
# odeprecated "Language::Haskell::Cabal.cabal_configure"
system
"cabal"
,
"v1-configure"
,
flags
end
def
cabal_install_tools
(
*
tools
)
# odeprecated "Language::Haskell::Cabal.cabal_install_tools"
# install tools sequentially, as some tools can depend on other tools
tools
.
each
{
|
tool
|
cabal_install
tool
}
# unregister packages installed as dependencies for the tools, so
# that they can't cause dependency conflicts for the main package
rm_rf
Dir
[
".cabal-sandbox/*packages.conf.d/"
]
end
def
install_cabal_package
(
*
args
,
**
options
)
# odeprecated "Language::Haskell::Cabal.install_cabal_package",
# "cabal v2-update directly followed by v2-install with std_cabal_v2_args"
cabal_sandbox
do
cabal_install_tools
(
*
options
[
:using
])
if
options
[
:using
]
# if we have build flags, we have to pass them to cabal install to resolve the necessary
# dependencies, and call cabal configure afterwards to set the flags again for compile
flags
=
"--flags=
#{
options
[
:flags
].
join
(
" "
)
}
"
if
options
[
:flags
]
args_and_flags
=
args
args_and_flags
<<
flags
unless
flags
.
nil?
# install dependencies in the sandbox
cabal_install
"--only-dependencies"
,
*
args_and_flags
# call configure if build flags are set
cabal_configure
flags
unless
flags
.
nil?
# install the main package in the destination dir
cabal_install
"--prefix=
#{
prefix
}
"
,
*
args
yield
if
block_given?
end
end
end
prepend
Compat
end
end
end
This diff is collapsed.
Click to expand it.
Library/Homebrew/language/haskell.rb
+
1
−
94
View file @
e0384672
# frozen_string_literal: true
module
Language
module
Haskell
module
Cabal
def
cabal_sandbox
(
options
=
{})
pwd
=
Pathname
.
pwd
home
=
options
[
:home
]
||
pwd
# pretend HOME is elsewhere, so that ~/.cabal is kept as untouched
# as possible (except for ~/.cabal/setup-exe-cache)
# https://github.com/haskell/cabal/issues/1234
saved_home
=
ENV
[
"HOME"
]
ENV
[
"HOME"
]
=
home
system
"cabal"
,
"v1-sandbox"
,
"init"
cabal_sandbox_bin
=
pwd
/
".cabal-sandbox/bin"
mkdir_p
cabal_sandbox_bin
# make available any tools that will be installed in the sandbox
saved_path
=
ENV
[
"PATH"
]
ENV
.
prepend_path
"PATH"
,
cabal_sandbox_bin
# avoid updating the cabal package database more than once
system
"cabal"
,
"v1-update"
unless
(
home
/
".cabal/packages"
).
exist?
yield
# remove the sandbox and all build products
rm_rf
[
".cabal-sandbox"
,
"cabal.sandbox.config"
,
"dist"
]
# avoid installing any Haskell libraries, as a matter of policy
rm_rf
lib
unless
options
[
:keep_lib
]
# restore the environment
ENV
[
"HOME"
]
=
saved_home
ENV
[
"PATH"
]
=
saved_path
end
def
cabal_sandbox_add_source
(
*
args
)
system
"cabal"
,
"v1-sandbox"
,
"add-source"
,
*
args
end
def
cabal_install
(
*
args
)
# cabal hardcodes 64 as the maximum number of parallel jobs
# https://github.com/Homebrew/legacy-homebrew/issues/49509
make_jobs
=
(
ENV
.
make_jobs
>
64
)
?
64
:
ENV
.
make_jobs
# cabal-install's dependency-resolution backtracking strategy can easily
# need more than the default 2,000 maximum number of "backjumps," since
# Hackage is a fast-moving, rolling-release target. The highest known
# needed value by a formula at this time (February 2016) was 43,478 for
# git-annex, so 100,000 should be enough to avoid most gratuitous
# backjumps build failures.
system
"cabal"
,
"v1-install"
,
"--jobs=
#{
make_jobs
}
"
,
"--max-backjumps=100000"
,
*
args
end
def
cabal_configure
(
flags
)
system
"cabal"
,
"v1-configure"
,
flags
end
def
cabal_install_tools
(
*
tools
)
# install tools sequentially, as some tools can depend on other tools
tools
.
each
{
|
tool
|
cabal_install
tool
}
# unregister packages installed as dependencies for the tools, so
# that they can't cause dependency conflicts for the main package
rm_rf
Dir
[
".cabal-sandbox/*packages.conf.d/"
]
end
def
install_cabal_package
(
*
args
,
**
options
)
cabal_sandbox
do
cabal_install_tools
(
*
options
[
:using
])
if
options
[
:using
]
# if we have build flags, we have to pass them to cabal install to resolve the necessary
# dependencies, and call cabal configure afterwards to set the flags again for compile
flags
=
"--flags=
#{
options
[
:flags
].
join
(
" "
)
}
"
if
options
[
:flags
]
args_and_flags
=
args
args_and_flags
<<
flags
unless
flags
.
nil?
# install dependencies in the sandbox
cabal_install
"--only-dependencies"
,
*
args_and_flags
# call configure if build flags are set
cabal_configure
flags
unless
flags
.
nil?
# install the main package in the destination dir
cabal_install
"--prefix=
#{
prefix
}
"
,
*
args
yield
if
block_given?
end
end
end
end
end
require
"compat/language/haskell"
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