summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-28 09:27:04 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-28 10:56:07 -0500
commitc686af5818686efb55cfd81ac104027c959d6277 (patch)
treef30c9924759689db56fc1e7a684392a54fea697f /utils/ghc-pkg
parentc662d41e2006f5a45619d40d2369b24642348f1a (diff)
downloadhaskell-c686af5818686efb55cfd81ac104027c959d6277.tar.gz
Add flag allowing convenient disabling of terminfo support
This is a common thing that users who cross-compile must fight against. It turns out that it's pretty straightforward to make is convenient. Test Plan: Cross compile without a target `ncurses` available Reviewers: danharaj, hvr, erikd, austin, rwbarton Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3177
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs12
-rw-r--r--utils/ghc-pkg/ghc-pkg.cabal11
-rw-r--r--utils/ghc-pkg/ghc.mk4
3 files changed, 23 insertions, 4 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 44960ca0b6..dd49180615 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -9,6 +9,14 @@
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+-- We never want to link against terminfo while bootstrapping.
+#ifdef BOOTSTRAPPING
+#ifdef WITH_TERMINFO
+#undef WITH_TERMINFO
+#endif
+#endif
+
-----------------------------------------------------------------------------
--
-- (c) The University of Glasgow 2004-2009.
@@ -80,7 +88,7 @@ import System.Posix hiding (fdToHandle)
import qualified System.Info(os)
#endif
-#if !defined(mingw32_HOST_OS) && !defined(BOOTSTRAPPING)
+#ifdef WITH_TERMINFO
import System.Console.Terminfo as Terminfo
#endif
@@ -1429,7 +1437,7 @@ listPackages verbosity my_flags mPackageName mModuleName = do
if simple_output then show_simple stack else do
-#if defined(mingw32_HOST_OS) || defined(BOOTSTRAPPING)
+#ifndef WITH_TERMINFO
mapM_ show_normal stack
#else
let
diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal
index 3511e36691..8776cb955e 100644
--- a/utils/ghc-pkg/ghc-pkg.cabal
+++ b/utils/ghc-pkg/ghc-pkg.cabal
@@ -15,6 +15,11 @@ Category: Development
build-type: Simple
cabal-version: >=1.10
+Flag terminfo
+ Description: Build GHC with terminfo support on non-Windows platforms.
+ Default: True
+ Manual: False
+
Executable ghc-pkg
Default-Language: Haskell2010
Main-Is: Main.hs
@@ -30,8 +35,10 @@ Executable ghc-pkg
binary,
ghc-boot,
bytestring
+ if !os(windows) && flag(terminfo)
+ Build-Depends: terminfo
+ Cpp-Options: -DWITH_TERMINFO
if !os(windows)
- Build-Depends: unix,
- terminfo
+ Build-Depends: unix
if os(windows)
c-sources: CRT_noglob.c
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
index f7d97debfa..002c8122f2 100644
--- a/utils/ghc-pkg/ghc.mk
+++ b/utils/ghc-pkg/ghc.mk
@@ -57,6 +57,10 @@ utils/ghc-pkg_dist_INSTALL = YES
utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
endif
+ifeq "$(WITH_TERMINFO)" "NO"
+utils/ghc-pkg_dist-install_CONFIGURE_OPTS += -f-terminfo
+endif
+
$(eval $(call build-prog,utils/ghc-pkg,dist,0))
$(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/.