parent
1d8f173456
commit
54c42c7718
31
ghcup
31
ghcup
@ -65,11 +65,13 @@ INSTALL_BASE="$HOME/.ghcup"
|
|||||||
# @VARIABLE: GHC_LOCATION
|
# @VARIABLE: GHC_LOCATION
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# The location where ghcup will install different ghc versions.
|
# The location where ghcup will install different ghc versions.
|
||||||
|
# This is expected to be a subdirectory of INSTALL_BASE.
|
||||||
GHC_LOCATION="$INSTALL_BASE/ghc"
|
GHC_LOCATION="$INSTALL_BASE/ghc"
|
||||||
|
|
||||||
# @VARIABLE: BIN_LOCATION
|
# @VARIABLE: BIN_LOCATION
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# The location where ghcup will create symlinks for GHC binaries.
|
# The location where ghcup will create symlinks for GHC binaries.
|
||||||
|
# This is expected to be a subdirectory of INSTALL_BASE.
|
||||||
BIN_LOCATION="$INSTALL_BASE/bin"
|
BIN_LOCATION="$INSTALL_BASE/bin"
|
||||||
|
|
||||||
# @VARIABLE: DOWNLOADER
|
# @VARIABLE: DOWNLOADER
|
||||||
@ -265,15 +267,16 @@ USAGE:
|
|||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
-h, --help Prints help information
|
-h, --help Prints help information
|
||||||
-f, --force Overwrite already existing installation
|
|
||||||
|
|
||||||
ARGS:
|
ARGS:
|
||||||
<VERSION> E.g. \"2.4.0.0\"
|
<VERSION> E.g. \"2.4.0.0\"
|
||||||
|
|
||||||
DISCUSSION:
|
DISCUSSION:
|
||||||
Installs the specified cabal-install version (or the default ${KNOWN_GOOD_CABAL})
|
Installs the specified cabal-install version (or the default ${KNOWN_GOOD_CABAL})
|
||||||
into the global \"~/.cabal/bin\" directory, so it can be overwritten
|
into \"${BIN_LOCATION}\", so it can be overwritten
|
||||||
by later \"cabal new-install cabal-install\".
|
by later \"cabal new-install cabal-install\", which installs into
|
||||||
|
\"~/.cabal/bin\". Make sure to set up your PATH appropriately, so
|
||||||
|
the cabal installation takes precedence.
|
||||||
")
|
")
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -812,27 +815,29 @@ install_cabal() {
|
|||||||
|
|
||||||
mycabalver=$1
|
mycabalver=$1
|
||||||
myarch=$(get_arch)
|
myarch=$(get_arch)
|
||||||
inst_location=$HOME/.cabal/bin
|
inst_location=$BIN_LOCATION
|
||||||
|
|
||||||
if [ -e "${inst_location}"/cabal ] && ! ${FORCE} ; then
|
|
||||||
die "\"${inst_location}/cabal\" already exist, use --force to overwrite"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -e "${inst_location}" ] || {
|
[ -e "${inst_location}" ] || {
|
||||||
edo mkdir "$HOME"/.cabal
|
# TODO: this is a bit shaky because we don't use -p
|
||||||
edo mkdir "$HOME"/.cabal/bin
|
edo mkdir "${INSTALL_BASE}"
|
||||||
|
edo mkdir "${BIN_LOCATION}"
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
edo cd "$(mktemp -d)"
|
edo cd "$(mktemp -d)"
|
||||||
edo download "https://downloads.haskell.org/~cabal/cabal-install-${mycabalver}/cabal-install-${mycabalver}-${myarch}-unknown-linux.tar.gz"
|
edo download "https://downloads.haskell.org/~cabal/cabal-install-${mycabalver}/cabal-install-${mycabalver}-${myarch}-unknown-linux.tar.gz"
|
||||||
edo tar -xzf "cabal-install-${mycabalver}-${myarch}-unknown-linux.tar.gz"
|
edo tar -xzf "cabal-install-${mycabalver}-${myarch}-unknown-linux.tar.gz"
|
||||||
edo mv cabal "${inst_location}"/cabal
|
edo mv -f cabal "${inst_location}"/cabal
|
||||||
) || die "Failed to install cabal-install"
|
) || die "Failed to install cabal-install"
|
||||||
|
|
||||||
status_message "Successfully installed cabal-install, you may want to run the following"
|
status_message "Successfully installed cabal-install into"
|
||||||
status_message "to get the really latest version:"
|
status_message " ${BIN_LOCATION}"
|
||||||
|
status_message ""
|
||||||
|
status_message "You may want to run the following to get the really latest version:"
|
||||||
status_message " cabal new-install cabal-install"
|
status_message " cabal new-install cabal-install"
|
||||||
|
status_message ""
|
||||||
|
status_message "And make sure that \"~/.cabal/bin\" comes *before* \"${BIN_LOCATION}\""
|
||||||
|
status_message "in your PATH!"
|
||||||
|
|
||||||
unset mycabalver myarch inst_location
|
unset mycabalver myarch inst_location
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user