Compare commits
12 Commits
issue-285
...
v0.1.17.4-
| Author | SHA1 | Date | |
|---|---|---|---|
|
185a9822ea
|
|||
|
c97ade81fa
|
|||
|
82a22fe993
|
|||
|
dbadcf1858
|
|||
|
ff8865c5c3
|
|||
|
9833dee925
|
|||
|
aac2874f8f
|
|||
|
17524b21b3
|
|||
|
3f0befe30d
|
|||
|
76c286f95e
|
|||
|
0c415314b6
|
|||
|
717f386077
|
@@ -217,6 +217,9 @@ variables:
|
|||||||
- .freebsd13
|
- .freebsd13
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
before_script:
|
before_script:
|
||||||
|
- sudo pkg update
|
||||||
|
- sudo pkg install --yes compat12x-amd64
|
||||||
|
- sudo ln -s libncurses.so.6 /usr/local/lib/libncurses.so.6.2
|
||||||
- ./.gitlab/before_script/freebsd/install_deps.sh
|
- ./.gitlab/before_script/freebsd/install_deps.sh
|
||||||
|
|
||||||
.test_ghcup_version:windows:
|
.test_ghcup_version:windows:
|
||||||
@@ -595,6 +598,9 @@ release:freebsd13:
|
|||||||
- .release_ghcup
|
- .release_ghcup
|
||||||
- .root_cleanup
|
- .root_cleanup
|
||||||
before_script:
|
before_script:
|
||||||
|
- sudo pkg update
|
||||||
|
- sudo pkg install --yes compat12x-amd64
|
||||||
|
- sudo ln -s libncurses.so.6 /usr/local/lib/libncurses.so.6.2
|
||||||
- ./.gitlab/before_script/freebsd/install_deps.sh
|
- ./.gitlab/before_script/freebsd/install_deps.sh
|
||||||
variables:
|
variables:
|
||||||
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
|
||||||
|
|||||||
@@ -8,9 +8,15 @@ package ghcup
|
|||||||
tests: True
|
tests: True
|
||||||
flags: +tui
|
flags: +tui
|
||||||
|
|
||||||
|
source-repository-package
|
||||||
|
type: git
|
||||||
|
location: https://github.com/bgamari/terminal-size.git
|
||||||
|
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
constraints: http-io-streams -brotli,
|
constraints: http-io-streams -brotli,
|
||||||
any.Cabal ==3.6.2.0,
|
any.Cabal ==3.6.2.0,
|
||||||
any.aeson >= 2.0.1.0
|
any.aeson >= 2.0.1.0,
|
||||||
|
streamly == 0.8.0
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
|
|||||||
@@ -166,11 +166,10 @@ library
|
|||||||
GHCup.Utils.File.Posix
|
GHCup.Utils.File.Posix
|
||||||
GHCup.Utils.Posix
|
GHCup.Utils.Posix
|
||||||
GHCup.Utils.Prelude.Posix
|
GHCup.Utils.Prelude.Posix
|
||||||
System.Console.Terminal.Common
|
|
||||||
System.Console.Terminal.Posix
|
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
, bz2 >=0.5.0.5 && <1.1
|
, bz2 >=0.5.0.5 && <1.1
|
||||||
|
, terminal-size ^>=0.3.2.1
|
||||||
, unix ^>=2.7
|
, unix ^>=2.7
|
||||||
, unix-bytestring ^>=0.3.7.3
|
, unix-bytestring ^>=0.3.7.3
|
||||||
|
|
||||||
|
|||||||
@@ -1141,11 +1141,11 @@ ensureDirectories (Dirs baseDir binDir cacheDir logsDir confDir trashDir) = do
|
|||||||
|
|
||||||
-- | For ghc without arch triple, this is:
|
-- | For ghc without arch triple, this is:
|
||||||
--
|
--
|
||||||
-- - ghc-<ver> (e.g. ghc-8.10.4)
|
-- - ghc
|
||||||
--
|
--
|
||||||
-- For ghc with arch triple:
|
-- For ghc with arch triple:
|
||||||
--
|
--
|
||||||
-- - <triple>-ghc-<ver> (e.g. arm-linux-gnueabihf-ghc-8.10.4)
|
-- - <triple>-ghc (e.g. arm-linux-gnueabihf-ghc)
|
||||||
ghcBinaryName :: GHCTargetVersion -> String
|
ghcBinaryName :: GHCTargetVersion -> String
|
||||||
ghcBinaryName (GHCTargetVersion (Just t) v') = T.unpack (t <> "-ghc-" <> prettyVer v' <> T.pack exeExt)
|
ghcBinaryName (GHCTargetVersion (Just t) _) = T.unpack (t <> "-ghc" <> T.pack exeExt)
|
||||||
ghcBinaryName (GHCTargetVersion Nothing v') = T.unpack ("ghc-" <> prettyVer v' <> T.pack exeExt)
|
ghcBinaryName (GHCTargetVersion Nothing _) = T.unpack ("ghc" <> T.pack exeExt)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import Data.Sequence ( Seq, (|>) )
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Data.Word8
|
import Data.Word8
|
||||||
import GHC.IO.Exception
|
import GHC.IO.Exception
|
||||||
import System.Console.Terminal.Common
|
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Directory
|
import System.Directory
|
||||||
@@ -51,7 +50,7 @@ import qualified Data.Sequence as Sq
|
|||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import qualified System.Posix.Process as SPP
|
import qualified System.Posix.Process as SPP
|
||||||
import qualified System.Console.Terminal.Posix as TP
|
import qualified System.Console.Terminal.Size as TP
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.ByteString.Lazy as BL
|
import qualified Data.ByteString.Lazy as BL
|
||||||
import qualified "unix-bytestring" System.Posix.IO.ByteString
|
import qualified "unix-bytestring" System.Posix.IO.ByteString
|
||||||
@@ -182,7 +181,7 @@ execLogged exe args chdir lfile env = do
|
|||||||
modify (swapRegs bs')
|
modify (swapRegs bs')
|
||||||
liftIO TP.size >>= \case
|
liftIO TP.size >>= \case
|
||||||
Nothing -> pure ()
|
Nothing -> pure ()
|
||||||
Just (Window _ w) -> do
|
Just (TP.Window _ w) -> do
|
||||||
regs <- get
|
regs <- get
|
||||||
liftIO $ forM_ (Sq.zip regs (Sq.fromList [0..(Sq.length regs - 1)])) $ \(bs, i) -> do
|
liftIO $ forM_ (Sq.zip regs (Sq.fromList [0..(Sq.length regs - 1)])) $ \(bs, i) -> do
|
||||||
BS.putStr
|
BS.putStr
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE DeriveDataTypeable #-}
|
|
||||||
{-# LANGUAGE DeriveTraversable #-}
|
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ >= 702
|
|
||||||
#define LANGUAGE_DeriveGeneric
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
module System.Console.Terminal.Common
|
|
||||||
( Window(..)
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Data.Data (Typeable, Data)
|
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ < 710
|
|
||||||
import Data.Foldable (Foldable)
|
|
||||||
import Data.Traversable (Traversable)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LANGUAGE_DeriveGeneric
|
|
||||||
import GHC.Generics
|
|
||||||
( Generic
|
|
||||||
#if __GLASGOW_HASKELL__ >= 706
|
|
||||||
, Generic1
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-- | Terminal window width and height
|
|
||||||
data Window a = Window
|
|
||||||
{ height :: !a
|
|
||||||
, width :: !a
|
|
||||||
} deriving
|
|
||||||
( Show, Eq, Read, Data, Typeable
|
|
||||||
, Foldable, Functor, Traversable
|
|
||||||
#ifdef LANGUAGE_DeriveGeneric
|
|
||||||
, Generic
|
|
||||||
#if __GLASGOW_HASKELL__ >= 706
|
|
||||||
, Generic1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
{-# LANGUAGE CApiFFI #-}
|
|
||||||
|
|
||||||
module System.Console.Terminal.Posix
|
|
||||||
( size, fdSize, hSize
|
|
||||||
) where
|
|
||||||
|
|
||||||
import System.Console.Terminal.Common
|
|
||||||
import Control.Exception (catch)
|
|
||||||
import Data.Typeable (cast)
|
|
||||||
import Foreign
|
|
||||||
import Foreign.C.Error
|
|
||||||
import Foreign.C.Types
|
|
||||||
import GHC.IO.FD (FD(FD, fdFD))
|
|
||||||
import GHC.IO.Handle.Internals (withHandle_)
|
|
||||||
import GHC.IO.Handle.Types (Handle, Handle__(Handle__, haDevice))
|
|
||||||
#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 706)
|
|
||||||
import Prelude hiding (catch)
|
|
||||||
#endif
|
|
||||||
import System.Posix.Types (Fd(Fd))
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
|
||||||
#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
|
|
||||||
|
|
||||||
|
|
||||||
-- Interesting part of @struct winsize@
|
|
||||||
data CWin = CWin CUShort CUShort
|
|
||||||
|
|
||||||
instance Storable CWin where
|
|
||||||
sizeOf _ = (#size struct winsize)
|
|
||||||
alignment _ = (#alignment struct winsize)
|
|
||||||
peek ptr = do
|
|
||||||
row <- (#peek struct winsize, ws_row) ptr
|
|
||||||
col <- (#peek struct winsize, ws_col) ptr
|
|
||||||
return $ CWin row col
|
|
||||||
poke ptr (CWin row col) = do
|
|
||||||
(#poke struct winsize, ws_row) ptr row
|
|
||||||
(#poke struct winsize, ws_col) ptr col
|
|
||||||
|
|
||||||
|
|
||||||
fdSize :: Integral n => Fd -> IO (Maybe (Window n))
|
|
||||||
fdSize (Fd fd) = with (CWin 0 0) $ \ws -> do
|
|
||||||
_ <- throwErrnoIfMinus1 "ioctl" $
|
|
||||||
ioctl fd (#const TIOCGWINSZ) ws
|
|
||||||
CWin row col <- peek ws
|
|
||||||
return . Just $ Window (fromIntegral row) (fromIntegral col)
|
|
||||||
`catch`
|
|
||||||
handler
|
|
||||||
where
|
|
||||||
handler :: IOError -> IO (Maybe (Window h))
|
|
||||||
handler _ = return Nothing
|
|
||||||
|
|
||||||
foreign import capi "sys/ioctl.h ioctl"
|
|
||||||
ioctl :: CInt -> CULong -> Ptr CWin -> IO CInt
|
|
||||||
|
|
||||||
size :: Integral n => IO (Maybe (Window n))
|
|
||||||
size = fdSize (Fd (#const STDOUT_FILENO))
|
|
||||||
|
|
||||||
hSize :: Integral n => Handle -> IO (Maybe (Window n))
|
|
||||||
hSize h = withHandle_ "hSize" h $ \Handle__ { haDevice = dev } ->
|
|
||||||
case cast dev of
|
|
||||||
Nothing -> return Nothing
|
|
||||||
Just FD { fdFD = fd } -> fdSize (Fd fd)
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
plat="$(uname -s)"
|
plat="$(uname -s)"
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
ghver="0.1.17.3"
|
ghver="0.1.17.4"
|
||||||
base_url="https://downloads.haskell.org/~ghcup"
|
base_url="https://downloads.haskell.org/~ghcup"
|
||||||
|
|
||||||
export GHCUP_SKIP_UPDATE_CHECK=yes
|
export GHCUP_SKIP_UPDATE_CHECK=yes
|
||||||
@@ -39,7 +39,6 @@ case "${plat}" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
: "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}"
|
: "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}"
|
||||||
export GHCUP_USE_XDG_DIRS
|
|
||||||
|
|
||||||
if [ -n "${GHCUP_USE_XDG_DIRS}" ] ; then
|
if [ -n "${GHCUP_USE_XDG_DIRS}" ] ; then
|
||||||
GHCUP_DIR=${XDG_DATA_HOME:=$HOME/.local/share}/ghcup
|
GHCUP_DIR=${XDG_DATA_HOME:=$HOME/.local/share}/ghcup
|
||||||
@@ -223,7 +222,8 @@ download_ghcup() {
|
|||||||
if freebsd-version | grep -E '^12.*' ; then
|
if freebsd-version | grep -E '^12.*' ; then
|
||||||
freebsd_ver=12
|
freebsd_ver=12
|
||||||
elif freebsd-version | grep -E '^13.*' ; then
|
elif freebsd-version | grep -E '^13.*' ; then
|
||||||
freebsd_ver=13
|
# TODO: missing FreeBSD13 version
|
||||||
|
freebsd_ver=12
|
||||||
else
|
else
|
||||||
die "Unsupported FreeBSD version! Please report a bug at https://gitlab.haskell.org/haskell/ghcup-hs/-/issues"
|
die "Unsupported FreeBSD version! Please report a bug at https://gitlab.haskell.org/haskell/ghcup-hs/-/issues"
|
||||||
fi
|
fi
|
||||||
@@ -237,7 +237,7 @@ download_ghcup() {
|
|||||||
*) die "Unknown architecture: ${arch}"
|
*) die "Unknown architecture: ${arch}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
_url=${base_url}/${ghver}/x86_64-portbld-freebsd${freebsd_ver}-ghcup-${ghver}
|
_url=${base_url}/${ghver}/x86_64-freebsd${freebsd_ver}-ghcup-${ghver}
|
||||||
;;
|
;;
|
||||||
"Darwin"|"darwin")
|
"Darwin"|"darwin")
|
||||||
case "${arch}" in
|
case "${arch}" in
|
||||||
|
|||||||
Reference in New Issue
Block a user