Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Haskell
ghcup-hs
Commits
e9575aba
Verified
Commit
e9575aba
authored
2 years ago
by
Julian Ospald
Browse files
Options
Downloads
Patches
Plain Diff
Add stack ghc installation hooks and install stack by default
parent
81c7f6a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!285
Add stack ghc installation hooks and install stack by default
Pipeline
#57008
failed
2 years ago
Stage: checks
Stage: quick-test
Stage: test
Stage: expensive-test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/bootstrap/bootstrap-haskell
+47
-14
47 additions, 14 deletions
scripts/bootstrap/bootstrap-haskell
scripts/hooks/stack/ghc-install.sh
+21
-0
21 additions, 0 deletions
scripts/hooks/stack/ghc-install.sh
with
68 additions
and
14 deletions
scripts/bootstrap/bootstrap-haskell
+
47
−
14
View file @
e9575aba
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
# * BOOTSTRAP_HASKELL_CABAL_VERSION - the cabal version to install
# * BOOTSTRAP_HASKELL_CABAL_VERSION - the cabal version to install
# * BOOTSTRAP_HASKELL_INSTALL_STACK - whether to install latest stack
# * BOOTSTRAP_HASKELL_INSTALL_NO_STACK - disable installation of stack
# * BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK - disable installation stack ghcup hook
# * BOOTSTRAP_HASKELL_INSTALL_HLS - whether to install latest hls
# * BOOTSTRAP_HASKELL_INSTALL_HLS - whether to install latest hls
# * BOOTSTRAP_HASKELL_ADJUST_BASHRC - whether to adjust PATH in bashrc (prepend)
# * BOOTSTRAP_HASKELL_ADJUST_BASHRC - whether to adjust PATH in bashrc (prepend)
# * BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG - whether to adjust mingw paths in cabal.config on windows
# * BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG - whether to adjust mingw paths in cabal.config on windows
...
@@ -692,40 +693,44 @@ ask_hls() {
...
@@ -692,40 +693,44 @@ ask_hls() {
}
}
ask_stack
()
{
ask_stack
()
{
if
[
-n
"
${
BOOTSTRAP_HASKELL_INSTALL_STACK
}
"
]
;
then
if
[
-n
"
${
BOOTSTRAP_HASKELL_INSTALL_NO_STACK
}
"
]
;
then
return
0
elif
[
-n
"
${
BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK
}
"
]
;
then
return
1
return
1
fi
fi
if
[
-z
"
${
BOOTSTRAP_HASKELL_NONINTERACTIVE
}
"
]
;
then
if
[
-z
"
${
BOOTSTRAP_HASKELL_NONINTERACTIVE
}
"
]
;
then
echo
"-------------------------------------------------------------------------------"
echo
"-------------------------------------------------------------------------------"
warn
"Do you want to install stack?"
warn
"Do you want to enable better integration of stack with GHCup?"
warn
"Stack is a haskell build tool similar to cabal that is used by some projects."
warn
"This means that stack won't install its own GHC versions, but uses GHCup's."
warn
"Also see https://docs.haskellstack.org/"
warn
"For more information see:"
warn
" https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation-experimental"
warn
"If you want to keep stacks vanilla behavior, answer 'No'."
warn
""
warn
""
warn
"[Y] Yes [N] No [?] Help (default is
\"
N
\"
)."
warn
"[Y] Yes [N] No [?] Help (default is
\"
Y
\"
)."
warn
""
warn
""
while
true
;
do
while
true
;
do
read
-r
stack_answer </dev/tty
read
-r
stack_answer </dev/tty
case
$stack_answer
in
case
$stack_answer
in
[
Yy]
*
)
[
Yy]
*
|
""
)
return
2
;;
[
Nn]
*
)
return
1
;;
return
1
;;
[
Nn]
*
|
""
)
return
0
;;
*
)
*
)
echo
"Possible choices are:"
echo
"Possible choices are:"
echo
echo
echo
"Y - Yes, install stack
"
echo
"Y - Yes, enable better integration (default)
"
echo
"N - No,
don't install anything more (default)
"
echo
"N - No,
keep stacks vanilla behavior
"
echo
echo
echo
"Please make your choice and press ENTER."
echo
"Please make your choice and press ENTER."
;;
;;
esac
esac
done
done
else
else
return
0
return
2
fi
fi
unset
stack_answer
unset
stack_answer
...
@@ -742,7 +747,7 @@ echo "This script can download and install the following binaries:"
...
@@ -742,7 +747,7 @@ echo "This script can download and install the following binaries:"
echo
" * ghcup - The Haskell toolchain installer"
echo
" * ghcup - The Haskell toolchain installer"
echo
" * ghc - The Glasgow Haskell Compiler"
echo
" * ghc - The Glasgow Haskell Compiler"
echo
" * cabal - The Cabal build tool for managing Haskell software"
echo
" * cabal - The Cabal build tool for managing Haskell software"
echo
" * stack -
(optional)
A cross-platform program for developing Haskell projects"
echo
" * stack - A cross-platform program for developing Haskell projects
(similar to cabal)
"
echo
" * hls - (optional) A language server for developers to integrate with their editor/IDE"
echo
" * hls - (optional) A language server for developers to integrate with their editor/IDE"
echo
echo
if
[
-z
"
${
GHCUP_USE_XDG_DIRS
}
"
]
;
then
if
[
-z
"
${
GHCUP_USE_XDG_DIRS
}
"
]
;
then
...
@@ -839,7 +844,35 @@ esac
...
@@ -839,7 +844,35 @@ esac
case
$ask_stack_answer
in
case
$ask_stack_answer
in
1
)
1
)
_eghcup
--cache
install
stack
||
warn
"Stack installation failed, continuing anyway"
_eghcup
--cache
install
stack
||
die
"Stack installation failed"
;;
2
)
_eghcup
--cache
install
stack
||
die
"Stack installation failed"
edo
mkdir
-p
"
${
STACK_ROOOT
:-
$HOME
/.stack
}
"
/hooks
hook_exe
=
"
${
STACK_ROOOT
:-
$HOME
/.stack
}
"
/hooks/ghc-install.sh
hook_url
=
"https://www.haskell.org/ghcup/sh/hooks/stack/ghc-install.sh"
if
[
-e
"
${
hook_exe
}
"
]
;
then
warn
"
$hook_exe
already exists, skipping hook installation."
warn
"If you want to reinstall the hook, delete it manually and re-run"
warn
"this script!"
else
case
"
${
BOOTSTRAP_HASKELL_DOWNLOADER
}
"
in
"curl"
)
# shellcheck disable=SC2086
edo curl
-Lf
${
GHCUP_CURL_OPTS
}
"
${
hook_url
}
"
>
"
${
hook_exe
}
"
;;
"wget"
)
# shellcheck disable=SC2086
edo wget
-O
/dev/stdout
${
GHCUP_WGET_OPTS
}
"
${
hook_url
}
"
>
"
${
hook_exe
}
"
;;
*
)
die
"Unknown downloader:
${
BOOTSTRAP_HASKELL_DOWNLOADER
}
"
;;
esac
edo
chmod
+x
"
${
hook_exe
}
"
fi
;;
;;
*
)
;;
*
)
;;
esac
esac
...
...
This diff is collapsed.
Click to expand it.
scripts/hooks/stack/ghc-install.sh
0 → 100644
+
21
−
0
View file @
e9575aba
#!/bin/bash
# see https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation-experimental
# for documentation about hooks
set
-euo
pipefail
case
$HOOK_GHC_TYPE
in
bindist
)
echo
"
$(
ghcup run
--ghc
"
$HOOK_GHC_VERSION
"
--install
)
/ghc"
;;
git
)
# TODO: should be somewhat possible
>
&2
echo
"Hook doesn't support installing from source"
exit
1
;;
*
)
>
&2
echo
"Unsupported GHC installation type:
$HOOK_GHC_TYPE
"
exit
2
;;
esac
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