summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
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)/.