Commit c686af58 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

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
parent c662d41e
......@@ -361,6 +361,10 @@ compiler_CONFIGURE_OPTS += --ghc-option=-DNOSMP
compiler_CONFIGURE_OPTS += --ghc-option=-optc-DNOSMP
endif
ifeq "$(WITH_TERMINFO)" "NO"
compiler_stage2_CONFIGURE_OPTS += --flags=-terminfo
endif
# Careful optimisation of the parser: we don't want to throw everything
# at it, because that takes too long and doesn't buy much, but we do want
# to inline certain key external functions, so we instruct GHC not to
......
......@@ -431,9 +431,7 @@ else # CLEANING
# compiler already has installed (or up-to-date enough).
PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot-th ghc-boot hoopl transformers template-haskell ghci
ifeq "$(Windows_Host)" "NO"
PACKAGES_STAGE0 += terminfo
endif
PACKAGES_STAGE1 += ghc-prim
PACKAGES_STAGE1 += $(INTEGER_LIBRARY)
......@@ -469,7 +467,7 @@ ifeq "$(HADDOCK_DOCS)" "YES"
PACKAGES_STAGE1 += xhtml
endif
ifeq "$(Windows_Target)" "NO"
ifeq "$(WITH_TERMINFO)" "YES"
PACKAGES_STAGE1 += terminfo
endif
PACKAGES_STAGE1 += haskeline
......
......@@ -100,6 +100,15 @@ GhcDynamic=NO
# GhcProfiled=YES means compile a profiled stage-2 compiler
GhcProfiled=NO
# WITH_TERMINFO can be used to disable terminfo support throughout the compiler
# and its tools. This is handy in the case of cross-compilation, where we may
# not have an ncurses build for the target.
ifeq "$(Windows_Target)" "NO"
WITH_TERMINFO=YES
else
WITH_TERMINFO=NO
endif
ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" ""
TargetElf = NO
else
......
......@@ -8,6 +8,7 @@ HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
INTEGER_LIBRARY = integer-simple
Stage1Only = YES
......
......@@ -8,6 +8,7 @@ HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
INTEGER_LIBRARY = integer-simple
Stage1Only = YES
......
......@@ -8,6 +8,7 @@ HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
WITH_TERMINFO = NO
INTEGER_LIBRARY = integer-simple
Stage1Only = YES
......
......@@ -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
......
......@@ -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
......@@ -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)/.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment