on master help sign in
Remove curses dependency
commitb64f0fd31b42a43c117a49c08ae1c894405d4485 authorNiklas Larsson <niklas@mm.st> dateThu 3 Mar 2016, 12:43 (11 years ago) parentd2a9e91
5 files changed+9−28
custom.mk-alldeps+1−1 idris.cabal+1−8 src/Util/ScreenSize.hs+7−17 stack-shell.nix−1 stack.yaml−1
custom.mk-alldeps+1−1
@@ -1 +1 @@
1−CABALFLAGS += -f LLVM -f FFI -f curses --disable-documentation --disable-profiling --disable-library-profiling
1+CABALFLAGS += -f GMP -f FFI --disable-documentation --disable-profiling --disable-library-profiling
idris.cabal+1−8
@@ -839,11 +839,6 @@ Flag GMP
839839 Default: False
840840 manual: True
841841
842−Flag curses
843− Description: Use Curses to get the screen width
844− Default: False
845− manual: True
846−
847842-- This flag determines whether to show Git hashes in version strings
848843-- Defaults to True because Hackage is a source release
849844Flag release
@@ -1002,6 +997,7 @@ Library
1002997 , pretty < 1.2
1003998 , process < 1.3
1004999 , split < 0.3
1000+ , terminal-size < 0.4
10051001 , text >=1.2.1.0 && < 1.3
10061002 , time >= 1.4 && < 1.6
10071003 , transformers < 0.5
@@ -1053,9 +1049,6 @@ Library
10531049 build-depends: libffi < 0.2
10541050 extra-libraries: gmp
10551051 cpp-options: -DIDRIS_GMP
1056− if flag(curses)
1057− build-depends: hscurses < 1.5
1058− cpp-options: -DCURSES
10591052 if flag(freestanding)
10601053 other-modules: Target_idris
10611054 cpp-options: -DFREESTANDING
src/Util/ScreenSize.hs+7−17
@@ -1,24 +1,14 @@
1−{-# LANGUAGE CPP #-}
21module Util.ScreenSize(getScreenWidth) where
32
4−#ifndef CURSES
5−
6−getScreenWidth :: IO Int
7−getScreenWidth = return 80
8−
9−#else
10−
11−import UI.HSCurses.Curses
3+import System.Console.Terminal.Size (size, width)
124import System.IO (hIsTerminalDevice, stdout)
135
146getScreenWidth :: IO Int
157getScreenWidth = do term <- hIsTerminalDevice stdout
8+ sz <- size
169 if term
17− then do
18− initScr
19− refresh
20− size <- scrSize
21− endWin
22− return (snd size)
23− else return 80
24−#endif
10+ then case sz of
11+ Just w -> return $ width w
12+ Nothing -> return 80
13+ else return 80
14+
stack-shell.nix−1
@@ -7,7 +7,6 @@ let
77 native_libs = [
88 libffi
99 zlib
10− ncurses
1110 gmp
1211 pkgconfig
1312 ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
stack.yaml−1
@@ -9,7 +9,6 @@ flags:
99extra-deps:
1010- annotated-wl-pprint-0.7.0
1111- cheapskate-0.1.0.4
12−- hscurses-1.4.2.0
1312- libffi-0.1
1413nix:
1514 enable: false