Compare commits
18 Commits
fix-ghcToo
...
fix-instal
| Author | SHA1 | Date | |
|---|---|---|---|
|
ec98826e6d
|
|||
|
1345ec938b
|
|||
|
227f3acaa5
|
|||
|
c20636f597
|
|||
|
c2d437150a
|
|||
|
9ff1467612
|
|||
|
9218efd71a
|
|||
|
bcd244a92a
|
|||
|
7de552ed82
|
|||
|
5cf297a4d2
|
|||
|
d86f84eef4
|
|||
|
83458c6c1e
|
|||
|
b862ca52a9
|
|||
|
e8d79c9d38
|
|||
|
59e1eee8ce
|
|||
|
57c8ffda35
|
|||
|
171ebd213d
|
|||
|
2a240cbd09
|
@@ -41,7 +41,7 @@ variables:
|
|||||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||||
|
|
||||||
.linux:armv7:
|
.linux:armv7:
|
||||||
image: "arm32v7/fedora"
|
image: "registry.gitlab.haskell.org/ghc/ci-images/armv7-linux-deb10:$DOCKER_REV"
|
||||||
tags:
|
tags:
|
||||||
- armv7-linux
|
- armv7-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -50,7 +50,7 @@ variables:
|
|||||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||||
|
|
||||||
.linux:aarch64:
|
.linux:aarch64:
|
||||||
image: "arm64v8/fedora"
|
image: "registry.gitlab.haskell.org/ghc/ci-images/aarch64-linux-deb10:$DOCKER_REV"
|
||||||
tags:
|
tags:
|
||||||
- aarch64-linux
|
- aarch64-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -124,14 +124,14 @@ variables:
|
|||||||
- .test_ghcup_version
|
- .test_ghcup_version
|
||||||
- .linux:armv7
|
- .linux:armv7
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
|
|
||||||
.test_ghcup_version:aarch64:
|
.test_ghcup_version:aarch64:
|
||||||
extends:
|
extends:
|
||||||
- .test_ghcup_version
|
- .test_ghcup_version
|
||||||
- .linux:aarch64
|
- .linux:aarch64
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
|
|
||||||
.test_ghcup_version:darwin:
|
.test_ghcup_version:darwin:
|
||||||
extends:
|
extends:
|
||||||
@@ -374,7 +374,7 @@ release:linux:armv7:
|
|||||||
- .linux:armv7
|
- .linux:armv7
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "armv7-linux-ghcup"
|
ARTIFACT: "armv7-linux-ghcup"
|
||||||
GHC_VERSION: "8.10.4"
|
GHC_VERSION: "8.10.4"
|
||||||
@@ -387,7 +387,7 @@ release:linux:aarch64:
|
|||||||
- .linux:aarch64
|
- .linux:aarch64
|
||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
before_script:
|
before_script:
|
||||||
- ./.gitlab/before_script/linux/install_deps_manual.sh
|
- ./.gitlab/before_script/linux/install_deps.sh
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "aarch64-linux-ghcup"
|
ARTIFACT: "aarch64-linux-ghcup"
|
||||||
GHC_VERSION: "8.10.4"
|
GHC_VERSION: "8.10.4"
|
||||||
|
|||||||
@@ -7,13 +7,60 @@ set -eux
|
|||||||
mkdir -p "${TMPDIR}"
|
mkdir -p "${TMPDIR}"
|
||||||
|
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget
|
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https
|
||||||
|
|
||||||
curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ./ghcup-bin
|
case "${ARCH}" in
|
||||||
chmod +x ghcup-bin
|
ARM*)
|
||||||
|
case "${ARCH}" in
|
||||||
|
"ARM")
|
||||||
|
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-armv7-deb10-linux.tar.xz
|
||||||
|
cabal_url=home.smart-cactus.org/~ben/cabal-install-${CABAL_VERSION}-armv7-linux-bootstrapped.tar.xz
|
||||||
|
;;
|
||||||
|
"ARM64")
|
||||||
|
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz
|
||||||
|
cabal_url=https://downloads.haskell.org/~cabal/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}-aarch64-ubuntu-18.04.tar.xz
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
./ghcup-bin upgrade -i -f
|
mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin
|
||||||
./ghcup-bin install ${GHC_VERSION}
|
|
||||||
./ghcup-bin set ${GHC_VERSION}
|
curl -O "${ghc_url}"
|
||||||
./ghcup-bin install-cabal ${CABAL_VERSION}
|
tar -xf ghc-*.tar.*
|
||||||
|
cd ghc-${GHC_VERSION}
|
||||||
|
./configure --prefix="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}
|
||||||
|
make install
|
||||||
|
for i in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}/bin/*-${GHC_VERSION} ; do
|
||||||
|
ln -s "${i}" "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/${i##*/}
|
||||||
|
done
|
||||||
|
for x in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/*-${GHC_VERSION} ; do
|
||||||
|
ln -s ${x##*/} ${x%-${GHC_VERSION}}
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
rm -rf ghc-${GHC_VERSION} ghc-*.tar.*
|
||||||
|
unset x i
|
||||||
|
|
||||||
|
mkdir cabal-install
|
||||||
|
cd cabal-install
|
||||||
|
curl -O "${cabal_url}"
|
||||||
|
tar -xf cabal-install-*
|
||||||
|
mv cabal "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/cabal
|
||||||
|
cd ..
|
||||||
|
rm -rf cabal-install
|
||||||
|
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
url=https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup
|
||||||
|
|
||||||
|
curl -sSfL "${url}" > ./ghcup-bin
|
||||||
|
chmod +x ghcup-bin
|
||||||
|
|
||||||
|
./ghcup-bin upgrade -i -f
|
||||||
|
./ghcup-bin install ${GHC_VERSION}
|
||||||
|
./ghcup-bin set ${GHC_VERSION}
|
||||||
|
./ghcup-bin install-cabal ${CABAL_VERSION}
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
|
|
||||||
|
|
||||||
mkdir -p "${TMPDIR}"
|
|
||||||
|
|
||||||
ednf() {
|
|
||||||
case "${ARCH}" in
|
|
||||||
"ARM")
|
|
||||||
sudo dnf -y --forcearch armv7hl "$@"
|
|
||||||
;;
|
|
||||||
"ARM64")
|
|
||||||
sudo dnf -y --forcearch aarch64 "$@"
|
|
||||||
;;
|
|
||||||
*) exit 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
ednf update
|
|
||||||
ednf install gcc gcc-c++ gmp gmp-devel make ncurses ncurses-devel xz xz-devel perl zlib zlib-devel openssl-devel openssl-libs openssl libffi libffi-devel lbzip2 lbzip2-utils bzip2-devel
|
|
||||||
if [ "${ARCH}" = "ARM64" ] ; then
|
|
||||||
ednf install numactl numactl-libs numactl-devel
|
|
||||||
fi
|
|
||||||
ednf install bash wget curl git tar
|
|
||||||
ednf install llvm9.0 llvm9.0-devel llvm9.0-libs llvm9.0-static
|
|
||||||
|
|
||||||
case "${ARCH}" in
|
|
||||||
"ARM")
|
|
||||||
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-armv7-deb10-linux.tar.xz
|
|
||||||
cabal_url=home.smart-cactus.org/~ben/cabal-install-${CABAL_VERSION}-armv7-linux-bootstrapped.tar.xz
|
|
||||||
;;
|
|
||||||
"ARM64")
|
|
||||||
ghc_url=https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-aarch64-deb10-linux.tar.xz
|
|
||||||
cabal_url=https://downloads.haskell.org/~cabal/cabal-install-${CABAL_VERSION}/cabal-install-${CABAL_VERSION}-aarch64-ubuntu-18.04.tar.xz
|
|
||||||
;;
|
|
||||||
*) exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
mkdir -p "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin
|
|
||||||
|
|
||||||
curl -O "${ghc_url}"
|
|
||||||
tar -xf ghc-*.tar.*
|
|
||||||
cd ghc-${GHC_VERSION}
|
|
||||||
./configure --prefix="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}
|
|
||||||
make install
|
|
||||||
for i in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/ghc/${GHC_VERSION}/bin/*-${GHC_VERSION} ; do
|
|
||||||
ln -s "${i}" "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/${i##*/}
|
|
||||||
done
|
|
||||||
for x in "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/*-${GHC_VERSION} ; do
|
|
||||||
ln -s ${x##*/} ${x%-${GHC_VERSION}}
|
|
||||||
done
|
|
||||||
cd ..
|
|
||||||
rm -rf ghc-${GHC_VERSION} ghc-*.tar.*
|
|
||||||
unset x i
|
|
||||||
|
|
||||||
mkdir cabal-install
|
|
||||||
cd cabal-install
|
|
||||||
curl -O "${cabal_url}"
|
|
||||||
tar -xf cabal-install-*
|
|
||||||
mv cabal "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup/bin/cabal
|
|
||||||
cd ..
|
|
||||||
rm -rf cabal-install
|
|
||||||
@@ -4,6 +4,6 @@ if [ "${OS}" = "WINDOWS" ] ; then
|
|||||||
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
||||||
else
|
else
|
||||||
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
|
||||||
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:$PATH"
|
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:/opt/llvm/bin:$PATH"
|
||||||
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
export TMPDIR="$CI_PROJECT_DIR/tmp"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ ghcup-gen check -f ghcup-${JSON_VERSION}.yaml
|
|||||||
eghcup --numeric-version
|
eghcup --numeric-version
|
||||||
|
|
||||||
eghcup install ${GHC_VERSION}
|
eghcup install ${GHC_VERSION}
|
||||||
|
[ `$(eghcup whereis ghc ${GHC_VERSION}) --numeric-version` = "${GHC_VERSION}" ]
|
||||||
eghcup set ${GHC_VERSION}
|
eghcup set ${GHC_VERSION}
|
||||||
eghcup install-cabal ${CABAL_VERSION}
|
eghcup install-cabal ${CABAL_VERSION}
|
||||||
|
[ `$(eghcup whereis cabal ${CABAL_VERSION}) --numeric-version` = "${CABAL_VERSION}" ]
|
||||||
|
|
||||||
cabal --version
|
cabal --version
|
||||||
|
|
||||||
@@ -125,10 +127,10 @@ else
|
|||||||
|
|
||||||
if [ "${OS}" = "DARWIN" ] ; then
|
if [ "${OS}" = "DARWIN" ] ; then
|
||||||
eghcup install hls
|
eghcup install hls
|
||||||
haskell-language-server-wrapper --version
|
$(eghcup whereis hls) --version
|
||||||
|
|
||||||
eghcup install stack
|
eghcup install stack
|
||||||
stack --version
|
$(eghcup whereis stack) --version
|
||||||
elif [ "${OS}" = "LINUX" ] ; then
|
elif [ "${OS}" = "LINUX" ] ; then
|
||||||
if [ "${ARCH}" = "64" ] ; then
|
if [ "${ARCH}" = "64" ] ; then
|
||||||
eghcup install hls
|
eghcup install hls
|
||||||
|
|||||||
@@ -69,3 +69,7 @@ yaml files: `ghcup-<yaml-ver>.yaml`.
|
|||||||
Most of the `Version` parameters to functions had to be replaced with
|
Most of the `Version` parameters to functions had to be replaced with
|
||||||
that and ensured the logic is consistent for cross and non-cross
|
that and ensured the logic is consistent for cross and non-cross
|
||||||
installs.
|
installs.
|
||||||
|
2. This refactor added windows support wrt [#130](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/130).
|
||||||
|
The major changes here were switching `hpath` library out for `filepath`/`directory` (sadly) and
|
||||||
|
introducing a non-unix way of handling processes via the `process` library. It also introduced considerable
|
||||||
|
amounts of CPP wrt file handling, installation etc.
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ data Command
|
|||||||
| Rm (Either RmCommand RmOptions)
|
| Rm (Either RmCommand RmOptions)
|
||||||
| DInfo
|
| DInfo
|
||||||
| Compile CompileCommand
|
| Compile CompileCommand
|
||||||
|
| Whereis WhereisOptions WhereisCommand
|
||||||
| Upgrade UpgradeOpts Bool
|
| Upgrade UpgradeOpts Bool
|
||||||
| ToolRequirements
|
| ToolRequirements
|
||||||
| ChangeLog ChangeLogOptions
|
| ChangeLog ChangeLogOptions
|
||||||
@@ -190,6 +191,13 @@ data ChangeLogOptions = ChangeLogOptions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
||||||
|
|
||||||
|
data WhereisOptions = WhereisOptions {
|
||||||
|
directory :: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- https://github.com/pcapriotti/optparse-applicative/issues/148
|
-- https://github.com/pcapriotti/optparse-applicative/issues/148
|
||||||
|
|
||||||
-- | A switch that can be enabled using --foo and disabled using --no-foo.
|
-- | A switch that can be enabled using --foo and disabled using --no-foo.
|
||||||
@@ -335,6 +343,17 @@ com =
|
|||||||
<$> info (compileP <**> helper)
|
<$> info (compileP <**> helper)
|
||||||
(progDesc "Compile a tool from source")
|
(progDesc "Compile a tool from source")
|
||||||
)
|
)
|
||||||
|
<> command
|
||||||
|
"whereis"
|
||||||
|
(info
|
||||||
|
( (Whereis
|
||||||
|
<$> (WhereisOptions <$> switch (short 'd' <> long "directory" <> help "return directory of the binary instead of the binary location"))
|
||||||
|
<*> whereisP
|
||||||
|
) <**> helper
|
||||||
|
)
|
||||||
|
(progDesc "Find a tools location"
|
||||||
|
<> footerDoc ( Just $ text whereisFooter ))
|
||||||
|
)
|
||||||
<> commandGroup "Main commands:"
|
<> commandGroup "Main commands:"
|
||||||
)
|
)
|
||||||
<|> subparser
|
<|> subparser
|
||||||
@@ -402,6 +421,23 @@ com =
|
|||||||
By default returns the URI of the ChangeLog of the latest GHC release.
|
By default returns the URI of the ChangeLog of the latest GHC release.
|
||||||
Pass '-o' to automatically open via xdg-open.|]
|
Pass '-o' to automatically open via xdg-open.|]
|
||||||
|
|
||||||
|
whereisFooter :: String
|
||||||
|
whereisFooter = [s|Discussion:
|
||||||
|
Finds the location of a tool. For GHC, this is the ghc binary, that
|
||||||
|
usually resides in a self-contained "~/.ghcup/ghc/<ghcver>" directory.
|
||||||
|
For cabal/stack/hls this the binary usually at "~/.ghcup/bin/<tool>-<ver>".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/ghc.exe
|
||||||
|
ghcup whereis ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/
|
||||||
|
ghcup whereis --directory ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/bin/cabal-3.4.0.0
|
||||||
|
ghcup whereis cabal 3.4.0.0
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory cabal 3.4.0.0|]
|
||||||
|
|
||||||
|
|
||||||
installCabalFooter :: String
|
installCabalFooter :: String
|
||||||
installCabalFooter = [s|Discussion:
|
installCabalFooter = [s|Discussion:
|
||||||
Installs the specified cabal-install version (or a recommended default one)
|
Installs the specified cabal-install version (or a recommended default one)
|
||||||
@@ -706,6 +742,86 @@ Examples:
|
|||||||
ghcup compile ghc -j 4 -v 8.4.2 -b 8.2.2 -x armv7-unknown-linux-gnueabihf --config $(pwd)/build.mk -- --enable-unregisterised|]
|
ghcup compile ghc -j 4 -v 8.4.2 -b 8.2.2 -x armv7-unknown-linux-gnueabihf --config $(pwd)/build.mk -- --enable-unregisterised|]
|
||||||
|
|
||||||
|
|
||||||
|
whereisP :: Parser WhereisCommand
|
||||||
|
whereisP = subparser
|
||||||
|
( command
|
||||||
|
"ghc"
|
||||||
|
(WhereisTool GHC <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
||||||
|
( progDesc "Get GHC location"
|
||||||
|
<> footerDoc (Just $ text whereisGHCFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"cabal"
|
||||||
|
(WhereisTool Cabal <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just Cabal)) <**> helper )
|
||||||
|
( progDesc "Get cabal location"
|
||||||
|
<> footerDoc (Just $ text whereisCabalFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"hls"
|
||||||
|
(WhereisTool HLS <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just HLS)) <**> helper )
|
||||||
|
( progDesc "Get HLS location"
|
||||||
|
<> footerDoc (Just $ text whereisHLSFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"stack"
|
||||||
|
(WhereisTool Stack <$> info
|
||||||
|
( optional (toolVersionArgument Nothing (Just Stack)) <**> helper )
|
||||||
|
( progDesc "Get stack location"
|
||||||
|
<> footerDoc (Just $ text whereisStackFooter ))
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"ghcup"
|
||||||
|
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
||||||
|
)
|
||||||
|
where
|
||||||
|
whereisGHCFooter = [s|Discussion:
|
||||||
|
Finds the location of a GHC executable, which usually resides in
|
||||||
|
a self-contained "~/.ghcup/ghc/<ghcver>" directory.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/ghc.exe
|
||||||
|
ghcup whereis ghc 8.10.5
|
||||||
|
# outputs ~/.ghcup/ghc/8.10.5/bin/
|
||||||
|
ghcup whereis --directory ghc 8.10.5 |]
|
||||||
|
|
||||||
|
whereisCabalFooter = [s|Discussion:
|
||||||
|
Finds the location of a Cabal executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/cabal-3.4.0.0
|
||||||
|
ghcup whereis cabal 3.4.0.0
|
||||||
|
# outputs ~/.ghcup/bin
|
||||||
|
ghcup whereis --directory cabal 3.4.0.0|]
|
||||||
|
|
||||||
|
whereisHLSFooter = [s|Discussion:
|
||||||
|
Finds the location of a HLS executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/haskell-language-server-wrapper-1.2.0
|
||||||
|
ghcup whereis hls 1.2.0
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory hls 1.2.0|]
|
||||||
|
|
||||||
|
whereisStackFooter = [s|Discussion:
|
||||||
|
Finds the location of a stack executable, which usually resides in
|
||||||
|
"~/.ghcup/bin/".
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
# outputs ~/.ghcup/bin/stack-2.7.1
|
||||||
|
ghcup whereis stack 2.7.1
|
||||||
|
# outputs ~/.ghcup/bin/
|
||||||
|
ghcup whereis --directory stack 2.7.1|]
|
||||||
|
|
||||||
|
|
||||||
ghcCompileOpts :: Parser GHCCompileOptions
|
ghcCompileOpts :: Parser GHCCompileOptions
|
||||||
ghcCompileOpts =
|
ghcCompileOpts =
|
||||||
GHCCompileOptions
|
GHCCompileOptions
|
||||||
@@ -1265,6 +1381,17 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
#endif
|
#endif
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let
|
||||||
|
runWhereIs =
|
||||||
|
runLogger
|
||||||
|
. flip runReaderT appstate
|
||||||
|
. runE
|
||||||
|
@'[ NotInstalled
|
||||||
|
, NoToolVersionSet
|
||||||
|
, NextVerNotFound
|
||||||
|
, TagNotFound
|
||||||
|
]
|
||||||
|
|
||||||
let runUpgrade =
|
let runUpgrade =
|
||||||
runLogger
|
runLogger
|
||||||
. flip runReaderT appstate
|
. flip runReaderT appstate
|
||||||
@@ -1628,6 +1755,22 @@ Make sure to clean up #{tmpdir} afterwards.|])
|
|||||||
runLogger $ $(logError) $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 9
|
pure $ ExitFailure 9
|
||||||
|
|
||||||
|
Whereis WhereisOptions{..} (WhereisTool tool whereVer) ->
|
||||||
|
runWhereIs (do
|
||||||
|
(v, _) <- liftE $ fromVersion whereVer tool
|
||||||
|
loc <- liftE $ whereIsTool tool v
|
||||||
|
if directory
|
||||||
|
then pure $ takeDirectory loc
|
||||||
|
else pure loc
|
||||||
|
)
|
||||||
|
>>= \case
|
||||||
|
VRight r -> do
|
||||||
|
putStr r
|
||||||
|
pure ExitSuccess
|
||||||
|
VLeft e -> do
|
||||||
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
Upgrade uOpts force -> do
|
Upgrade uOpts force -> do
|
||||||
target <- case uOpts of
|
target <- case uOpts of
|
||||||
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
||||||
|
|||||||
@@ -201,10 +201,13 @@ download_ghcup() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
edo mkdir -p "${GHCUP_DIR}"
|
edo mkdir -p "${GHCUP_DIR}"
|
||||||
|
|
||||||
|
# we may overwrite this in adjust_bashrc
|
||||||
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
edo . "${GHCUP_DIR}"/env
|
edo . "${GHCUP_DIR}"/env
|
||||||
eghcup upgrade
|
eghcup upgrade
|
||||||
@@ -238,28 +241,49 @@ adjust_bashrc() {
|
|||||||
|
|
||||||
warn ""
|
warn ""
|
||||||
warn "Detected ${MY_SHELL} shell on your system..."
|
warn "Detected ${MY_SHELL} shell on your system..."
|
||||||
warn "If you want ghcup to automatically add the required PATH variable to \"${GHCUP_PROFILE_FILE}\""
|
warn "Do you want ghcup to automatically add the required PATH variable to \"${GHCUP_PROFILE_FILE}\"?"
|
||||||
warn ""
|
warn ""
|
||||||
warn "[Y] Yes [N] No [?] Help (default is \"Y\")."
|
warn "[P] Yes, prepend [A] Yes, append [N] No [?] Help (default is \"P\")."
|
||||||
warn ""
|
warn ""
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
||||||
read -r next_answer </dev/tty
|
read -r next_answer </dev/tty
|
||||||
else
|
else
|
||||||
next_answer="yes"
|
next_answer="prepend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case $next_answer in
|
||||||
|
[Pp]* | "")
|
||||||
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
|
export PATH="\$HOME/.cabal/bin:${GHCUP_BIN}:\$PATH"
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
[Aa]*)
|
||||||
|
cat <<-EOF > "${GHCUP_DIR}"/env || die "Failed to create env file"
|
||||||
|
export PATH="\$HOME/.cabal/bin:\$PATH:${GHCUP_BIN}"
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case $next_answer in
|
case $next_answer in
|
||||||
[Nn]*)
|
[Nn]*)
|
||||||
return ;;
|
return ;;
|
||||||
[Yy]* | "")
|
[Pp]* | [Aa]* | "")
|
||||||
case $MY_SHELL in
|
case $MY_SHELL in
|
||||||
"") break ;;
|
"") break ;;
|
||||||
fish)
|
fish)
|
||||||
mkdir -p "${GHCUP_PROFILE_FILE%/*}"
|
mkdir -p "${GHCUP_PROFILE_FILE%/*}"
|
||||||
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
||||||
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; test -f $GHCUP_DIR/env ; and set -gx PATH \$HOME/.cabal/bin $GHCUP_BIN \$PATH # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
case $next_answer in
|
||||||
|
[Pp]* | "")
|
||||||
|
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; set -gx PATH \$HOME/.cabal/bin $GHCUP_BIN \$PATH # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
;;
|
||||||
|
[Aa]*)
|
||||||
|
echo "set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX \$HOME ; set -gx PATH \$HOME/.cabal/bin \$PATH $GHCUP_BIN # ghcup-env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
break ;;
|
break ;;
|
||||||
bash)
|
bash)
|
||||||
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
sed -i -e '/# ghcup-env$/ s/^#*/#/' "${GHCUP_PROFILE_FILE}"
|
||||||
@@ -285,7 +309,8 @@ adjust_bashrc() {
|
|||||||
*)
|
*)
|
||||||
echo "Possible choices are:"
|
echo "Possible choices are:"
|
||||||
echo
|
echo
|
||||||
echo "Y - Yes, update my \"${GHCUP_PROFILE_FILE}\" (default)"
|
echo "P - Yes, prepend to PATH, taking precedence (default)"
|
||||||
|
echo "A - Yes, append to PATH"
|
||||||
echo "N - No, don't mess with my configuration"
|
echo "N - No, don't mess with my configuration"
|
||||||
echo
|
echo
|
||||||
echo "Please make your choice and press ENTER."
|
echo "Please make your choice and press ENTER."
|
||||||
@@ -416,7 +441,7 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
|||||||
|
|
||||||
case $hls_answer in
|
case $hls_answer in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
eghcup --cache install hls || warn "HLS installation failed, continuing anyway"
|
_eghcup --cache install hls || warn "HLS installation failed, continuing anyway"
|
||||||
break ;;
|
break ;;
|
||||||
[Nn]* | "")
|
[Nn]* | "")
|
||||||
break ;;
|
break ;;
|
||||||
@@ -443,7 +468,7 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
|||||||
|
|
||||||
case $stack_answer in
|
case $stack_answer in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
eghcup --cache install stack || warn "Stack installation failed, continuing anyway"
|
_eghcup --cache install stack || warn "Stack installation failed, continuing anyway"
|
||||||
break ;;
|
break ;;
|
||||||
[Nn]* | "")
|
[Nn]* | "")
|
||||||
break ;;
|
break ;;
|
||||||
|
|||||||
@@ -150,6 +150,15 @@ function Exec
|
|||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$elevated = ([Security.Principal.WindowsPrincipal] `
|
||||||
|
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||||||
|
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||||
|
|
||||||
|
if ($elevated) {
|
||||||
|
Print-Msg -color Yellow -msg ('This script should not be run as administrator/elevated. Waiting 10s before continuing anyway...')
|
||||||
|
Start-Sleep -s 10
|
||||||
|
}
|
||||||
|
|
||||||
$GhcupBasePrefixEnv = [System.Environment]::GetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', 'user')
|
$GhcupBasePrefixEnv = [System.Environment]::GetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', 'user')
|
||||||
|
|
||||||
if ($GhcupBasePrefixEnv) {
|
if ($GhcupBasePrefixEnv) {
|
||||||
|
|||||||
@@ -2060,8 +2060,8 @@ ghcupDownloads:
|
|||||||
A_ARM64:
|
A_ARM64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-linux-ghcup-0.1.15.2
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-linux-ghcup-0.1.15.2-r1
|
||||||
dlHash: d91b7a5416f292f2cf813824eb419f76ad9976d258cee3581123cb6eb01db9a7
|
dlHash: d853372440f3d43babbb868fad399811241760f2233829c92403fcbea8c547ec
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-apple-darwin-ghcup-0.1.15.2
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/aarch64-apple-darwin-ghcup-0.1.15.2
|
||||||
@@ -2069,8 +2069,8 @@ ghcupDownloads:
|
|||||||
A_ARM:
|
A_ARM:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/armv7-linux-ghcup-0.1.15.2
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.15.2/armv7-linux-ghcup-0.1.15.2-r1
|
||||||
dlHash: 03a4af5ed895ada1dd21f4cc3f64dc9078a5bf4268313021d004c04bea7f9c2e
|
dlHash: f8add9b39e1f7d0f03904dc69a8683259972a4472432c1ade27d918c39a4a874
|
||||||
HLS:
|
HLS:
|
||||||
1.1.0:
|
1.1.0:
|
||||||
viTags: []
|
viTags: []
|
||||||
@@ -2120,8 +2120,17 @@ ghcupDownloads:
|
|||||||
- old
|
- old
|
||||||
viChangeLog: https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md#v251
|
viChangeLog: https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md#v251
|
||||||
viPostInstall: &stack-post |
|
viPostInstall: &stack-post |
|
||||||
Stack manages GHC versions internally by default. In order to make it use ghcup installed GHC versions have a look at the options 'system-ghc', 'compiler-check' and 'compiler': https://docs.haskellstack.org/en/stable/yaml_configuration/#system-ghc
|
Stack manages GHC versions internally by default. In order to make it use ghcup installed
|
||||||
Additionally, you should upgrade stack only through ghcup.
|
GHC versions you can run the following commands:
|
||||||
|
stack config set install-ghc false --global
|
||||||
|
stack config set system-ghc true --global
|
||||||
|
|
||||||
|
On windows, you may find the following config options useful too:
|
||||||
|
skip-msys, extra-path, extra-include-dirs, extra-lib-dirs
|
||||||
|
|
||||||
|
Also check out: https://docs.haskellstack.org/en/stable/yaml_configuration
|
||||||
|
|
||||||
|
!!! Additionally, you should upgrade stack only through ghcup and not use 'stack upgrade' !!!
|
||||||
viArch:
|
viArch:
|
||||||
A_64:
|
A_64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
|
|||||||
48
lib/GHCup.hs
48
lib/GHCup.hs
@@ -586,7 +586,7 @@ installStackBindist dlinfo ver = do
|
|||||||
, settings
|
, settings
|
||||||
} <- lift ask
|
} <- lift ask
|
||||||
|
|
||||||
whenM (lift (hlsInstalled ver))
|
whenM (lift (stackInstalled ver))
|
||||||
(throwE $ AlreadyInstalled Stack ver)
|
(throwE $ AlreadyInstalled Stack ver)
|
||||||
|
|
||||||
-- download (or use cached version)
|
-- download (or use cached version)
|
||||||
@@ -1880,3 +1880,49 @@ postGHCInstall ver@GHCTargetVersion {..} = do
|
|||||||
$ getMajorMinorV _tvVersion
|
$ getMajorMinorV _tvVersion
|
||||||
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
||||||
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
||||||
|
|
||||||
|
|
||||||
|
-- | Reports the binary location of a given tool:
|
||||||
|
--
|
||||||
|
-- * for GHC, this reports: @~\/.ghcup\/ghc\/\<ver\>\/bin\/ghc@
|
||||||
|
-- * for cabal, this reports @~\/.ghcup\/bin\/cabal-\<ver\>@
|
||||||
|
-- * for hls, this reports @~\/.ghcup\/bin\/haskell-language-server-wrapper-\<ver\>@
|
||||||
|
-- * for stack, this reports @~\/.ghcup\/bin\/stack-\<ver\>@
|
||||||
|
-- * for ghcup, this reports the location of the currently running executable
|
||||||
|
whereIsTool :: ( MonadReader AppState m
|
||||||
|
, MonadLogger m
|
||||||
|
, MonadThrow m
|
||||||
|
, MonadFail m
|
||||||
|
, MonadIO m
|
||||||
|
, MonadCatch m
|
||||||
|
, MonadMask m
|
||||||
|
, MonadUnliftIO m
|
||||||
|
)
|
||||||
|
=> Tool
|
||||||
|
-> GHCTargetVersion
|
||||||
|
-> Excepts '[NotInstalled] m FilePath
|
||||||
|
whereIsTool tool ver@GHCTargetVersion {..} = do
|
||||||
|
AppState { dirs } <- lift ask
|
||||||
|
|
||||||
|
case tool of
|
||||||
|
GHC -> do
|
||||||
|
whenM (lift $ fmap not $ ghcInstalled ver)
|
||||||
|
$ throwE (NotInstalled GHC ver)
|
||||||
|
bdir <- lift $ ghcupGHCDir ver
|
||||||
|
pure (bdir </> "bin" </> "ghc" <> exeExt)
|
||||||
|
Cabal -> do
|
||||||
|
whenM (lift $ fmap not $ cabalInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled Cabal (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "cabal-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
HLS -> do
|
||||||
|
whenM (lift $ fmap not $ hlsInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled HLS (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "haskell-language-server-wrapper-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
|
||||||
|
Stack -> do
|
||||||
|
whenM (lift $ fmap not $ stackInstalled _tvVersion)
|
||||||
|
$ throwE (NotInstalled Stack (GHCTargetVersion Nothing _tvVersion))
|
||||||
|
pure (binDir dirs </> "stack-" <> T.unpack (prettyVer _tvVersion) <> exeExt)
|
||||||
|
GHCup -> do
|
||||||
|
currentRunningExecPath <- liftIO getExecutablePath
|
||||||
|
liftIO $ canonicalizePath currentRunningExecPath
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import GHCup.Utils.String.QQ
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Control.Monad.Logger
|
import Control.Monad.Logger
|
||||||
|
import Data.Char ( ord )
|
||||||
import Prelude hiding ( appendFile )
|
import Prelude hiding ( appendFile )
|
||||||
import System.Console.Pretty
|
import System.Console.Pretty
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
@@ -43,20 +44,33 @@ myLoggerT LoggerConfig {..} loggingt = runLoggingT loggingt mylogger
|
|||||||
mylogger :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
|
mylogger :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
|
||||||
mylogger _ _ level str' = do
|
mylogger _ _ level str' = do
|
||||||
-- color output
|
-- color output
|
||||||
|
let style' = case level of
|
||||||
|
LevelDebug -> style Bold . color Blue
|
||||||
|
LevelInfo -> style Bold . color Green
|
||||||
|
LevelWarn -> style Bold . color Yellow
|
||||||
|
LevelError -> style Bold . color Red
|
||||||
|
LevelOther _ -> id
|
||||||
let l = case level of
|
let l = case level of
|
||||||
LevelDebug -> toLogStr (style Bold $ color Blue "[ Debug ]")
|
LevelDebug -> toLogStr (style' "[ Debug ]")
|
||||||
LevelInfo -> toLogStr (style Bold $ color Green "[ Info ]")
|
LevelInfo -> toLogStr (style' "[ Info ]")
|
||||||
LevelWarn -> toLogStr (style Bold $ color Yellow "[ Warn ]")
|
LevelWarn -> toLogStr (style' "[ Warn ]")
|
||||||
LevelError -> toLogStr (style Bold $ color Red "[ Error ]")
|
LevelError -> toLogStr (style' "[ Error ]")
|
||||||
LevelOther t -> toLogStr "[ " <> toLogStr t <> toLogStr " ]"
|
LevelOther t -> toLogStr "[ " <> toLogStr t <> toLogStr " ]"
|
||||||
let out = fromLogStr (l <> toLogStr " " <> str' <> toLogStr "\n")
|
let strs = fmap toLogStr . B.split (fromIntegral $ ord '\n') . fromLogStr $ str'
|
||||||
|
let out = case strs of
|
||||||
|
[] -> B.empty
|
||||||
|
(x:xs) -> fromLogStr
|
||||||
|
. foldr (\a b -> a <> toLogStr "\n" <> b) mempty
|
||||||
|
. ((l <> toLogStr " " <> x) :)
|
||||||
|
. fmap (\line' -> toLogStr (style' "[ ... ] ") <> line' )
|
||||||
|
$ xs
|
||||||
|
|
||||||
when (lcPrintDebug || (not lcPrintDebug && (level /= LevelDebug)))
|
when (lcPrintDebug || (not lcPrintDebug && (level /= LevelDebug)))
|
||||||
$ colorOutter out
|
$ colorOutter out
|
||||||
|
|
||||||
-- raw output
|
-- raw output
|
||||||
let lr = case level of
|
let lr = case level of
|
||||||
LevelDebug -> toLogStr "Debug: "
|
LevelDebug -> toLogStr "Debug:"
|
||||||
LevelInfo -> toLogStr "Info:"
|
LevelInfo -> toLogStr "Info:"
|
||||||
LevelWarn -> toLogStr "Warn:"
|
LevelWarn -> toLogStr "Warn:"
|
||||||
LevelError -> toLogStr "Error:"
|
LevelError -> toLogStr "Error:"
|
||||||
|
|||||||
Reference in New Issue
Block a user