building ghc-6.10.1 against readline

Reid Barton rwbarton at math.harvard.edu
Thu Jan 8 00:58:08 EST 2009


Hello all,

Here are quick and dirty instructions for building ghc-6.10.1 against
readline instead of editline, for anyone who may be interested.

1. Unpack the ghc source and extralibs trees into ~/build/ghc-6.10.1
   (Where you put your build tree obviously doesn't matter; I just
   specify it for clarity.)

2. Download this patch to ~/build:

   http://mauke.ath.cx/stuff/haskell/ghc-6.10.1-readline.diff

3. Apply the patch by running (from ~/build):

   patch -p0 < ghc-6.10.1-readline.diff

4. Download the readline package to ~/build/ghc-6.10.1/libraries:

   http://hackage.haskell.org/packages/archive/readline/1.0.1.0/readline-1.0.1.0.tar.gz

5. Unpack it, and create a symlink (in ~/build/ghc-6.10.1/libraries):

   ln -s readline-1.0.1.0 readline

6. Now in ~/build/ghc-6.10.1, you can run ./configure, make, etc.

Thanks to mauke on #haskell for the patch, which is also appended to
this email for posterity.

Regards,
Reid

----------- ghc-6.10.1-readline.diff

diff -ru ghc-6.10.1/compiler/ghc.cabal.in ghc-6.10.1-hax/compiler/ghc.cabal.in
--- ghc-6.10.1/compiler/ghc.cabal.in	2008-11-03 19:13:13.000000000 +0100
+++ ghc-6.10.1-hax/compiler/ghc.cabal.in	2008-11-10 04:17:42.000000000 +0100
@@ -72,7 +72,7 @@
         Build-Depends: unix
 
     if flag(editline)
-        Build-Depends: editline
+        Build-Depends: readline
         CPP-Options: -DUSE_EDITLINE
 
     GHC-Options: -Wall -fno-warn-name-shadowing -fno-warn-orphans
diff -ru ghc-6.10.1/compiler/ghci/InteractiveUI.hs ghc-6.10.1-hax/compiler/ghci/InteractiveUI.hs
--- ghc-6.10.1/compiler/ghci/InteractiveUI.hs	2008-11-03 19:13:13.000000000 +0100
+++ ghc-6.10.1-hax/compiler/ghci/InteractiveUI.hs	2008-11-10 04:28:39.000000000 +0100
@@ -66,7 +66,7 @@
 
 #ifdef USE_EDITLINE
 import Control.Concurrent	( yield )	-- Used in readline loop
-import System.Console.Editline.Readline as Readline
+import System.Console.Readline as Readline
 #endif
 
 --import SystemExts
@@ -327,7 +327,7 @@
             Readline.initialize
 
             withGhcAppData
-                 (\dir -> Readline.readHistory (dir </> "ghci_history"))
+                 (\dir -> return True {- Readline.readHistory (dir </> "ghci_history") -})
                  (return True)
             
             Readline.setAttemptedCompletionFunction (Just completeWord)
@@ -367,8 +367,8 @@
 
 #ifdef USE_EDITLINE
    liftIO $ do
-     Readline.stifleHistory 100
-     withGhcAppData (\dir -> Readline.writeHistory (dir </> "ghci_history"))
+     -- Readline.stifleHistory 100
+     withGhcAppData (\dir -> return True {- Readline.writeHistory (dir </> "ghci_history") -})
                     (return True)
      Readline.resetTerminal Nothing
 #endif
diff -ru ghc-6.10.1/libraries/Makefile ghc-6.10.1-hax/libraries/Makefile
--- ghc-6.10.1/libraries/Makefile	2008-11-03 19:13:13.000000000 +0100
+++ ghc-6.10.1-hax/libraries/Makefile	2008-11-10 04:12:01.000000000 +0100
@@ -46,7 +46,7 @@
 ifeq "$(Windows)" "YES"
 SUBDIRS += $(wildcard Win32)
 endif
-SUBDIRS += directory process pretty hpc template-haskell editline Cabal random haskell98
+SUBDIRS += directory process pretty hpc template-haskell readline Cabal random haskell98
 
 # Set GhcBootLibs=YES from the command line to work with just the libraries
 # needed to bootstrap GHC.


More information about the Glasgow-haskell-users mailing list