[project @ 2001-01-18 15:19:22 by simonmar]
[ghc-hetmet.git] / ghc / docs / users_guide / installing.sgml
index 09c443c..7040cad 100644 (file)
@@ -5,13 +5,12 @@
 
 <Para>
 Installing from binary distributions is easiest, and recommended!
-(Why binaries?  Because GHC is a Haskell compiler written in Haskell,
-so you've got to &ldquo;bootstrap&rdquo; it, somehow.  We provide
+(Why binaries? Because GHC is a Haskell compiler written in Haskell,
+so you've got to bootstrap it somehow.  We provide
 machine-generated C-files-from-Haskell for this purpose, but it's
 really quite a pain to use them.  If you must build GHC from its
 sources, using a binary-distributed GHC to do so is a sensible way to
-proceed. For the other <Literal>fptools</Literal> programs, many are written in Haskell,
-so binary distributions allow you to install them without having a Haskell compiler.)
+proceed. For the other <Literal>fptools</Literal> programs, many are written in Haskell, so binary distributions allow you to install them without having a Haskell compiler.)
 </Para>
 
 <Para>This guide is in two parts: installing on Unix-a-likes, and installing on Windows.</Para>
@@ -353,7 +352,7 @@ stuff in your bin directory.
 <XRef LinkEnd="sec-GHC-test">.  Be sure to use a <Literal>-v</Literal>
 option, so you can see exactly what pathnames it's using.
 
-If things don't work as expected, check the list of know pitfalls in
+If things don't work as expected, check the list of known pitfalls in
 the building guide.
 </Para>
 </ListItem>
@@ -502,72 +501,20 @@ with a binary distribution, or in source form in
 </Sect1>
 
 
-<Sect1><Title>Installing on Windows</Title>
+<Sect1 id="sec-install-windows"><Title>Installing on Windows</Title>
 
 <Para>
-Getting the Glasgow Haskell Compiler (GHC) to run on Windows95/98 or
-Windows NT4 platforms can be a bit of a trying experience. This document
-tries to simplify the task by enumerating the steps you need to
-follow in order to set up and configure your machine to run GHC (at
-least that's the intention ;-)
+Getting the Glasgow Haskell Compiler (GHC) to run on Windows platforms can
+be a bit of a trying experience. This document tries to simplify the task by
+enumerating the steps you need to follow in order to set up and configure
+your machine to run GHC.
 </Para>
 
 <Sect2><Title>System requirements</Title>
 
 <Para>
-An installation of GHC requires ca. 70M of disk space. The size of the
-installed GHC distribution is just(!) 17M, the rest is needed by
-supporting software.
-</Para>
-
-<Para>
-To run GHC comfortably, your machine should have at least 32M of memory.
-</Para>
-
-</Sect2>
-
-
-<Sect2><Title>Your environment variables</Title>
-
-<Para>
-Much of the Unixy stuff below involves setting environment variables.  
-This section summarises  how to set these variables on a Windows machine, in
-case you don't know alread.y
-On WinNT/Win2k, to edit your <Constant>PATH</Constant> variable (for example),
-do the following:
-</Para>
-
-<ItemizedList>
-<ListItem><Para>Press Start/Settings/Control Panels</Para></ListItem>
-<ListItem><Para>Double-click System</Para></ListItem>
-<ListItem><Para>Press Advanced</Para></ListItem>
-<ListItem><Para>Press Environment Variables</Para></ListItem>
-<ListItem><Para>Under System Variables, select PATH</Para></ListItem>
-<ListItem><Para>Press Edit</Para></ListItem>
-<ListItem><Para>Add "<Filename>;C:/whatever/</Filename>" to the end of the string (for example)</Para></ListItem>
-<ListItem><Para>Press OK</Para></ListItem>
-</ItemizedList>
-
-<Para>
-Some environment variables are &ldquo;user variables&rdquo; and
-some are &ldquo;system variables&rdquo;.  I'm not sure of the difference
-but both are changed though the same dialogue.
-</Para>
-
-<Para>
-In addition, when running a Cygwin (see <XRef LinkEnd="sec-required">) shell
-you can set environment variables in your <Filename>.bashrc</Filename> file.
-But it is better to set your environment variables from the
-control panel (they get inherited by bash) because then they are visible
-to applications that aren't started by bash.  For example,
-when you're invoking CVS (and ssh) via Emacs keybindings;
-it invokes <Filename>cvs.exe</Filename> without going via bash.
-</Para>
-
-<Para>
-On a Win9x machine you need to edit <Filename>autoexec.bat</Filename> using
-<Filename>Windows/system/Sysedit</Filename>.  You need to reboot to make
-the new settings take effect.
+An installation of GHC requires about 50M of disk space (which can be lowered by choosing a &ldquo;compact&rdquo; installation). The Cygwin support tools take another 200M or so (though if you really need to this can be halved by installing only the following packages: bash, binutils, cygwin, diff, fileutils, findutils, gcc, grep, make, perl, mingw, sed, textutils, w32api; however, it's fiddly and not recommended). To run GHC
+comfortably, your machine should have at least 64M of memory.
 </Para>
 
 </Sect2>
@@ -579,14 +526,13 @@ the new settings take effect.
 You need two chunks of software other than GHC itself: the Cygwin toolchain, and Perl.  Here's how to get and install them.
 </Para>
 
-<Sect3><Title>The cygwin toolchain (beta20.1)</Title>
+<Sect3><Title>The Cygwin toolchain (1.1.x)</Title>
 
 <Para>
-GHC depends at the moment on the cygwin tools to operate, which
-dresses up the Win32 environment into something more UNIX-like.
-(notably, it provides <Command>gcc</Command>, <Command>as</Command> and <Command>ld</Command>),
-so you'll need to install these tools first. You also need
-Cygwin to use CVS.
+At the moment you'll need Cygwin to use GHC. Cygwin dresses up the Win32
+environment into something more UNIX-like; (notably, it provides
+<Command>gcc</Command>, <Command>as</Command> and <Command>ld</Command>).
+You also need Cygwin to use CVS.
 </Para>
 
 <Para>
@@ -624,38 +570,24 @@ Here's how to install Cygwin.
 
 <ListItem>
 <Para>
-Download cygwin, beta20.1 (<filename>full.exe</filename>) from
-<ULink URL="http://sourceware.cygnus.com/cygwin/">sourceware.cygnus.com</ULink>
-Install this somewhere locally.
-</Para>
-</ListItem>
-
-<ListItem>
-<Para>
-Create the following directories (if they aren't already there):
-</Para>
+Install the latest Cygwin 1.1.x from <ULink
+URL="http://sources.redhat.com/cygwin/">sources.redhat.com/cygwin</ULink>.
+If you have a pre-1.1 version, you should deinstall this first. Choose DOS
+text mode. After installation, start up a Cygwin shell and issue the
+following command:
 
-<ItemizedList>
-<ListItem><Para><Filename>c:/etc</Filename></Para></ListItem>
-<ListItem><Para><Filename>c:/bin</Filename></Para></ListItem>
-<ListItem><Para><Filename>c:/usr/local/bin</Filename></Para></ListItem>
-</ItemizedList>
+<Screen>
+mount -f c: /</Screen>
 
-<Para>
-(using <Command>mkdir -p /bin</Command>, etc.)
+assuming you installed Cygwin at <Filename>C:\cygwin</Filename>; otherwise
+change the drive and directory as appropriate.
 </Para>
 </ListItem>
 
 <ListItem>
 <Para>
-Copy <Filename>bash.exe</Filename> from the <Filename>bin</Filename>
-directory of the cygwin tree
-(<Filename>cygwin-b20/H-i586-cygwin32/bin/bash.exe</Filename>) to
-<Filename>/bin</Filename> as <Filename>sh.exe</Filename>.  You might
-think that it was easier to use bash directly from it original Cygwin
-directory, but (a) some UNIX utils have got
-<Filename>/bin/sh</Filename> hardwired in, and (b) the path following
-<Literal>#!</Literal> is limited to 32 characters.
+Create <Filename>C:/Temp</Filename> if it doesn't already exist; substitute
+the drive you installed Cygwin on for <Filename>C:</Filename>).
 </Para>
 </ListItem>
 
@@ -669,6 +601,50 @@ instructions on how to set this up.
 
 </ItemizedList>
 
+</Sect3>
+
+
+<Sect3><Title>Environment variables</Title>
+
+<Para>
+In case you don't already know how to set environment variables on a Windows
+machine, here's how. On WinNT/Win2k, to edit your <Constant>PATH</Constant>
+variable (for example), do the following:
+</Para>
+
+<ItemizedList>
+<ListItem><Para>Press Start/Settings/Control Panels</Para></ListItem>
+<ListItem><Para>Double-click System</Para></ListItem>
+<ListItem><Para>Press Advanced</Para></ListItem>
+<ListItem><Para>Press Environment Variables</Para></ListItem>
+<ListItem><Para>Under System Variables, select <Constant>PATH</Constant></Para></ListItem>
+<ListItem><Para>Press Edit</Para></ListItem>
+<ListItem><Para>Add "<Filename>;C:\whatever</Filename>" to the end of the string (for example)</Para></ListItem>
+<ListItem><Para>Press OK</Para></ListItem>
+</ItemizedList>
+
+<Para>
+Some environment variables are &ldquo;user variables&rdquo; and
+some are &ldquo;system variables&rdquo;.  I'm not sure of the difference
+but both are changed though the same dialogue.
+</Para>
+
+<Para>
+In addition, when running <Command>bash</Command>
+you can set environment variables in your <Filename>.bashrc</Filename> file.
+But it is better to set your environment variables from the
+control panel (they get inherited by bash) because then they are visible
+to applications that aren't started by bash.  For example,
+when you're invoking CVS (and ssh) via Emacs keybindings;
+it invokes <Filename>cvs.exe</Filename> without going via bash.
+</Para>
+
+<Para>
+On a Win9x machine you need to edit <Filename>autoexec.bat</Filename> using
+<Filename>Windows/System/Sysedit</Filename>.  You must reboot to make
+the new settings take effect.
+</Para>
+
 <Para>
 The following environment variables must be set:
 </Para>
@@ -684,9 +660,9 @@ The following environment variables must be set:
 <Entry><Constant>PATH</Constant></Entry>
 <Entry>System</Entry>
 <Entry><Para>
-Add <Filename>C:\cygnus\cygwin-b20\H-i586-cygwin32\bin</Filename>.
-<Command>bash</Command> needs this, and when it is invoked from <Filename>/bin</Filename> it can't
-find it. <Filename>c:/bin</Filename> and <Filename>c:/usr/local/bin</Filename> should also be added.
+Add <Filename>C:\usr\bin</Filename>.
+This should come <Emphasis>before</Emphasis> the Windows system directories
+(e.g. <Filename>\WINNT\system32</Filename>).
 </Para></Entry>
 </Row>
 
@@ -694,7 +670,7 @@ find it. <Filename>c:/bin</Filename> and <Filename>c:/usr/local/bin</Filename> s
 <Entry><Constant>SHELL</Constant></Entry>
 <Entry>User</Entry>
 <Entry><Para>
-<Filename>c:/bin/sh</Filename>.
+<Filename>C:/usr/bin/bash</Filename>.
 </Para></Entry>
 </Row>
 
@@ -702,7 +678,8 @@ find it. <Filename>c:/bin</Filename> and <Filename>c:/usr/local/bin</Filename> s
 <Entry><Constant>HOME</Constant></Entry>
 <Entry>User</Entry>
 <Entry><Para>
-Set to point to your home directory.  This is where, for example,
+Set to point to your home directory (normally under
+<Filename>C:/WINNT/Profiles</Filename> on Win2k).  This is where, for example,
 <Command>bash</Command> will look for your <Filename>.bashrc</Filename>
 file.
 </Para></Entry>
@@ -713,7 +690,7 @@ file.
 <Entry>User</Entry>
 <Entry><Para>
 Set to <Literal>UNIX</Literal>.  If you don't do
-this you get very weird messages when you type `<Command>make</Command>', such as:
+this you get very weird messages when you type <Command>make</Command>, such as:
 </Para><Screen>
 /c: /c: No such file or directory</Screen></Entry>
 </Row>
@@ -722,19 +699,13 @@ this you get very weird messages when you type `<Command>make</Command>', such a
 <Entry><Constant>TMPDIR</Constant></Entry>
 <Entry>User</Entry>
 <Entry><Para>
-Set to <Filename>c:/tmp</Filename>. For some reason, Win2k invisibly sets
-this variable to point to a temporary directory in your profile, that
-contains embedded spaces.  If GHC sees the <Constant>TMPDIR</Constant>
-variable set, it tries to use it for temporary files, but Cygwin
-doesn't grok filenames with spaces, so disaster results.
+Set to <Filename>C:/Temp</Filename>. For some reason, Win2k invisibly sets this variable to point to a temporary directory in your profile, that contains embedded spaces.  If GHC sees the <Constant>TMPDIR</Constant> variable set, it tries to use it for temporary files, but Cygwin doesn't grok filenames with spaces, so disaster results.
 </Para><Para>
-Furthermore, it seems that <Constant>TMPDIR</Constant> must be set to a directory
-in the same file system in which you invoke GHC.  Otherwise you get very werid messages
-when you invoke GHC, such as:
+Furthermore, it seems that <Constant>TMPDIR</Constant> must be set to a directory in the same file system in which you invoke GHC.  Otherwise you get very weird messages when you invoke GHC, such as:
 <Screen>
 does not exist
 Action: openFile
-Reason: file does not exist /tmp/ghc11068.cpp</Screen>
+Reason: file does not exist /Temp/ghc11068.cpp</Screen>
 We think this is due to a bug in Cygwin.
 </Para></Entry>
 </Row>
@@ -744,20 +715,16 @@ We think this is due to a bug in Cygwin.
 </InformalTable>
 </Para>
 
-</Sect3>
-
-
-<Sect3><Title>Perl5</Title>
-
 <Para>
-The driver script is written in Perl, so you'll need to have this
-installed too. However, the ghc binary distribution includes a
-perl binary for you to make use of, should you not already have a
-cygwin compatible one. Note: GHC does <Emphasis>not</Emphasis>
-work with the ActiveState port of perl.
+In addition, we've had problems in the past with certain environment
+variables being set that seem to have bad effects on GHC. If you have
+installed other systems ported from Unix, you might too. If you get weird
+inexplicable failures to build GHC, then it might be worth weeding out unused
+environment variables. Known culprits from the past include
+<Constant>GCC_EXEC_PREFIX</Constant> and <Constant>INCLUDE</Constant>.
 </Para>
 
-</Sect3>  <!-- Perl -->
+</Sect3>
 
 </Sect2>  <!-- Reqd software -->
 
@@ -765,18 +732,20 @@ work with the ActiveState port of perl.
 <Sect2><Title>Installing GHC</Title>
 
 <Para>
-Download a GHC distribution:
+Download the latest GHC distribution:
 </Para>
 
 <VariableList>
 
 <VarListEntry>
-<Term>ghc-4.045&mdash;InstallShield installer, 10M: <ULink URL="http://www.dcs.gla.ac.uk/~sof/ghc-4.045-win32-IS.zip">http</ULink> or <ULink URL="ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/4.04/ghc-4.045-win32-IS.zip">ftp</ULink>
+<Term>ghc-4.08 InstallShield installer, 15M: <ULink
+URL="http://www.haskell.org/ghc/download.html">http</ULink>
 </Term>
 
 <ListItem>
 <Para>
-(The version number may change.) It is packaged up using an installer that should be familiar-looking to Windows users. Unpack and double click on <Filename>setup.exe</Filename>.
+It is packaged up using an installer that should be familiar-looking to
+Windows users.
 </Para>
 
 <Para>
@@ -787,56 +756,27 @@ in <Filename>/Program Files/</Filename>!)
 </Para>
 
 <Para>
-When the installer has completed its job, you may delete the
-<Filename>ghcInstall</Filename> directory.
-</Para>
-
-<Para>
 When the installer has completed, make sure you add the location of the
-ghc <Filename>bin/</Filename> directory to your path (i.e. <Filename>/path/to/wherever/ghc-4.05/bin </Filename>).
-You need to do this in order to bring the various GHC DLLs into scope;
-if not, then you need to copy the DLLs into a directory that is (the
-system directory, for example).
+ghc <Filename>bin/</Filename> directory to your path (e.g.
+<Filename>/ghc/ghc-4.08/bin </Filename>).
+You need to do this in order to bring the various GHC binaries into scope.
 </Para>
 
 <Para>
-Note: In case you haven't got perl already installed,
-you will have to manually copy the <Filename>perl.exe</Filename> binary from the
-ghc <Filename>bin/</Filename> into your <Filename>/bin</Filename> directory before continuing&mdash;the installer will not currently do this.
+Note: If you haven't got perl already installed, you will have to manually
+copy the <Filename>perl.exe</Filename> binary from the ghc
+<Filename>bin/</Filename> into your <Filename>/bin</Filename> directory
+before continuing&mdash;the installer will not currently do this.
 </Para>
 </ListItem>
 
 </VarListEntry>
 
-<VarListEntry>
-<Term>
-ghc-4.045 - gzip'ed tarfile, 7.5M: <ULink URL="http://www.dcs.gla.ac.uk/~sof/ghc-4.045-win32.tar.gz">
-http</ULink> or <ULink URL="ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/4.04/ghc-4.045-win32.tar.gz">ftp</ULink>
-</Term>
-
-<ListItem>
-<Para>
-A `normal' GHC binary distribution packaged up as a compressed tar file.
-If you're already accustomed to installing and using GHC distributions
-on other platforms, the setup should be familiar to you, I
-hope. Unpack and read the INSTALL file contained in the
-distribution for instructions on how to set it up.
-</Para>
-
-<Para>
-Notice that the top directory of the distribution contains
-(rather clumsily) a perl binary (version 5.005_02). If you
-haven't already got a working perl, install this somewhere
-along your path too.
-</Para>
-</ListItem>
-
-</VarListEntry>
 </VariableList>
 
 <Para>
 Make sure that you set all the environment variables described above
-under Cygwin installation, including <Constant>TMPDIR</Constant>
+under Cygwin installation, including <Constant>TMPDIR</Constant>.
 </Para>
 <Para>
 To test the fruits of your labour, try now to compile a simple
@@ -848,7 +788,7 @@ bash$ cat main.hs
 module Main(main) where
 
 main = putStrLn "Hello, world!"
-bash$ /path/to/the/ghc/bin/directory/ghc-4.05 -o main main.hs
+bash$ ghc -o main main.hs
 ..
 bash$ ./main
 Hello, world!
@@ -859,16 +799,17 @@ OK, assuming that worked, you're all set. Go forth and write useful
 Haskell programs :-) If not, consult the installation FAQ (<XRef LinkEnd="winfaq">); if that still doesn't help then please report the problems you're experiencing (see <Xref LinkEnd="wrong">).
 </Para>
 
-<Para>
-Further information on using GHC under Windows can be found in <ULink URL="http://www.dcs.gla.ac.uk/~sof/ghc-win32.html">Sigbj&oslash;rn Finne's pages</ULink>.
-</Para>
+<Para> Further information on using GHC under Windows can be found in <ULink
+URL="http://www.dcs.gla.ac.uk/~sof/ghc-win32.html">Sigbj&oslash;rn Finne's
+pages</ULink>. Note: ignore the installation instructions, which are rather
+out of date; the <Emphasis>Miscellaneous</Emphasis> section at the bottom of
+the page is of most interest, covering topics beyond the scope of this
+manual. </Para>
 
 </Sect2>
 
-</Sect1>
-
 
-<Sect1 id="winfaq"><title>Installing ghc-win32 FAQ</title>
+<Sect2 id="winfaq"><title>Installing ghc-win32 FAQ</title>
 
 <QandASet>
 
@@ -876,21 +817,35 @@ Further information on using GHC under Windows can be found in <ULink URL="http:
 
 <Question>
 <Para>
-Invoking ghc doesn't seem to do anything, it immediately returns without having compiled the input file.
+I'm having trouble with symlinks.
 </Para>
 </Question>
 
 <Answer>
 <Para>
-One cause of this is that <Filename>/bin/sh</Filename> is missing. To verify, open up a
-bash session and type <Command>ls -l /bin/sh.exe</Command>. If <Filename>sh.exe</Filename> is 
-reported as not being there, copy <Filename>bash.exe</Filename> (which you'll find
-inside the cygwin installation tree as <Filename>H-i586-cygwin32/bin/bash.exe</Filename>)
-to <Filename>/bin/sh.exe</Filename>.
+Symlinks only work under Cygwin (<Xref LinkEnd="sec-install">), so binaries
+not linked to the Cygwin DLL, in particular those built for Mingwin, will not
+work with symlinks.
+</Para>
+</Answer>
+
+</QandAEntry>
+
+<QandAEntry>
+
+<Question>
+<Para>
+I'm getting &ldquo;permission denied&rdquo; messages from <Command>rm</Command> or
+<Command>mv</Command>.
 </Para>
+</Question>
 
+<Answer>
 <Para>
-All being well, ghc should then start to function.
+This can have various causes: trying to rename a directory when an Explorer
+window is open on it tends to fail. Closing the window generally cures the
+problem, but sometimes its cause is more mysterious, and logging off and back
+on or rebooting may be the quickest cure.
 </Para>
 </Answer>
 
@@ -900,108 +855,169 @@ All being well, ghc should then start to function.
 
 <Question>
 <Para>
-When compiling up the <Literal>Hello World</Literal> example, the following happens:
+I get errors when trying to build GHC 4.08 with GHC 4.05.
 </Para>
+</Question>
 
-<Screen>
-bash$ /ghc/ghc-4.05/bin/ghc-4.05 main.hs
-&lt;stdin&gt;:0:25: Character literal '{-# LINE 1 "main.hs" -}' too long
-&lt;stdin&gt;:0:25:  on input: "'"
-bash$ </Screen>
+<Answer> <Para> This seems to work better if you don't use
+<Option>-O</Option> in <Constant>GhcHcOpts</Constant>. It's a bug in 4.05,
+unfortunately. Anyway, better to install 4.08 binaries and use those.
+</Para> </Answer>
+
+</QandAEntry>
+
+<QandAEntry>
 
+<Question>
 <Para>
-or
+My programs compile fine but do nothing when run.
 </Para>
-
-<Screen>
-bash$ /ghc/ghc-4.05/bin/ghc-4.05 main.hs
-Program too big fit into memory under NT
-bash$ </Screen>
 </Question>
 
-<Answer>
+<Answer> <Para>Some recent versions of the mingw package in Cygwin seem to
+cause this. mingwin version 20001111-1 works fine; you should be able to
+select it by clicking on the version number of the mingw package in the list
+presented by the Cygwin setup program.</Para>
+</Answer>
+
+</QAndAEntry>
+
+</QandASet>
+
+</Sect2>
+
+</Sect1>
+
+
+<Sect1 id="building-docs">
+<Title>Building the documentation</Title>
+
 <Para>
-The cause of this is that you're using a version of <Command>perl</Command> that employs the Microsoft <Command>cmd</Command>/<Command>command</Command> shell when launching sub-processes to execute <Function>system()</Function> calls.
+We use the DocBook DTD, which is widely used. Most shrink-wrapped distributions seem to be broken in one way or another; thanks to heroic efforts by Sven Panne and Manuel Chakravarty, we now support most of them, plus properly installed versions.
 </Para>
 
 <Para>
-The GHC driver really needs a <Command>perl</Command> which uses a `UNIX'y  shell instead, so
-make sure that the version you're using is of an compatible ilk. In particular, 
-if <Command>perl -v</Command> reports that you've got a copy of the (otherwise fine) port
-of perl done by ActiveState, you're in trouble.
+Instructions on installing and configuring the DocBook tools follow.
 </Para>
 
+<Sect2>
+<Title>Installing the DocBook tools from RPMs</Title>
+
+<Para> If you're using a system that can handle RedHat RPM packages, you can
+probably use the <ULink
+URL="http://sourceware.cygnus.com/docbook-tools/">Cygnus DocBook
+tools</ULink>, which is the most shrink-wrapped SGML suite that we could
+find. You need all the RPMs except for psgml (i.e.
+<Filename>docbook</Filename>, <Filename>jade</Filename>,
+<Filename>jadetex</Filename>, <Filename>sgmlcommon</Filename> and
+<Filename>stylesheets</Filename>). Note that most of these RPMs are
+architecture neutral, so are likely to be found in a
+<Filename>noarch</Filename> directory. The SuSE RPMs also work; the RedHat
+ones <Emphasis>don't</Emphasis> as of version 6.2, but they are easy to fix:
+just make a symlink from
+<Filename>/usr/lib/sgml/stylesheets/nwalsh-modular/lib/dblib.dsl</Filename> to
+<Filename>/usr/lib/sgml/lib/dblib.dsl</Filename>. </Para>
+
+</Sect2>
+
+
+<Sect2>
+<Title>Installing from binaries on Windows</Title>
+
 <Para>
-If you're stuck with an incompatible <Command>perl</Command>, the GHC installation comes with a very basic <Command>perl</Command> binary for you to use. Simply copy it into the <Command>/bin</Command> directory.
+It's a good idea to use Norman Walsh's <ULink
+URL="http://nwalsh.com/docbook/dsssl/doc/install.html">installation
+notes</ULink> as a guide. You should get version 3.1 of DocBook, and note
+that his file <Filename>test.sgm</Filename> won't work, as it needs version
+3.0. You should unpack Jade into <Filename>\Jade</Filename>, along with the
+entities, DocBook into <Filename>\docbook</Filename>, and the DocBook
+stylesheets into <Filename>\docbook\stylesheets</Filename> (so they actually
+end up in <Filename>\docbook\stylesheets\docbook</Filename>).
 </Para>
 
+</Sect2>
+
+
+<Sect2>
+<Title>Installing the DocBook tools from source</Title>
+
+<Sect3>
+<Title>Jade</Title>
+
 <Para>
-Notice that copying <Filename>perl.exe</Filename> into <Filename>/bin</Filename> will not cause
-the GHC install to suddenly start functioning. If you don't want to
-re-run the InstallShield installer again, you need to edit the following
-files within the directory tree that the installer created:
-</Para>
+Install <ULink URL="http://openjade.sourceforge.net/">OpenJade</ULink> (Windows binaries are available as well as sources). If you want DVI, PS, or PDF then install JadeTeX from the <Filename>dsssl</Filename>
+subdirectory. (If you get the error:
 
 <Screen>
-bin/ghc-4.xx   -- where xx is the minor release number
-bin/stat2resid
-bin/hstags
-lib/mkdependHS</Screen>
+! LaTeX Error: Unknown option implicit=false' for package hyperref'.
+</Screen>
 
-<Para>
-For each of these files, you need to edit the first line from instead
-saying <Command>#!/path/to/your/other/perl/install</Command> to <Command>#!/bin/perl</Command>.
-Once that is done, try compiling up the Hello, World example again.
+your version of <Command>hyperref</Command> is out of date; download it from
+CTAN (<Filename>macros/latex/contrib/supported/hyperref</Filename>), and
+make it, ensuring that you have first removed or renamed your old copy. If
+you start getting file not found errors when making the test for
+<Command>hyperref</Command>, you can abort at that point and proceed
+straight to <Command>make install</Command>, or enter them as
+<Filename>../</Filename><Emphasis>filename</Emphasis>.)
 </Para>
 
 <Para>
-Should you want to pick up a complete installation of a ghc-friendly port
-of perl instead, a <ULink URL="http://cygutils.netpedia.net/">cygwin port</ULink> is available.
+Make links from <Filename>virtex</Filename> to <Filename>jadetex</Filename>
+and <Filename>pdfvirtex</Filename> to <Filename>pdfjadetex</Filename>
+(otherwise DVI, PostScript and PDF output will not work). Copy
+<Filename>dsssl/*.{dtd,dsl}</Filename> and <Filename>catalog</Filename> to <Filename>/usr/[local/]lib/sgml</Filename>.
 </Para>
-</Answer>
 
-</QandAEntry>
+</Sect3>
 
-<QAndAEntry>
+<Sect3>
+<Title>DocBook and the DocBook stylesheets</Title>
 
-<Question>
 <Para>
-<Function>System.getArgs</Function> always return the empty list, i.e. the following program always prints &ldquo;<Literal>[]</Literal>&rdquo;:
+Get a Zip of <ULink
+URL="http://www.oasis-open.org/docbook/sgml/3.1/index.html">DocBook</ULink> 
+and install the contents in <Filename>/usr/[local/]/lib/sgml</Filename>.
 </Para>
 
-<ProgramListing>
-module Main(main) where
-import qualified System
-main = System.getArgs >>= print
-</ProgramListing>
-
-</Question>
-
-<Answer>
 <Para>
-This is a bug with the RTS DLL that comes with ghc-4.03. To fix, upgrade to
-ghc-4.05.
+Get the <ULink URL="http://nwalsh.com/docbook/dsssl/">DocBook
+stylesheets</ULink> and install in
+<Filename>/usr/[local/]lib/sgml/stylesheets</Filename> (thereby creating a
+subdirectory docbook). For indexing, copy or link <Filename>collateindex.pl</Filename> from the DocBook stylesheets archive in <Filename>bin</Filename> into a directory on your <Constant>PATH</Constant>.
 </Para>
-</Answer>
 
-</QAndAEntry>
-
-</QandASet>
+<Para>
+Download the <ULink
+URL="http://www.oasis-open.org/cover/ISOEnts.zip">ISO
+entities</ULink> into <Filename>/usr/[local/]lib/sgml</Filename>.
+</Para>
 
-</Sect1>
+</Sect3>
 
+</Sect2>
 
-<Sect1>
-<Title>Building the documentation</Title>
+<Sect2>
+<Title>Configuring the DocBook tools</Title>
 
 <Para>
-This is a slightly sore point at the moment, because the GHC team has been unable to strike a good balance between having a documentation system that is easy to maintain and one that is widely available. We use the DocBook DTD, which is widely used; however, shrink-wrapped distributions of DocBook are few and far between, and getting it to work out of the box is a nightmare. We settled on the Cygnus DocBook tools; however, these are only available as Red Hat RPMs, and hence at the moment the documentation can only be built on systems which can use RPMs (i.e. most versions of Linux). Sorry about that. We will probably add pre-built documentation to future source distributions (it's already in binary distributions, of course) until the situation is sorted out (either we bite the bullet and have our own version of the DocBook tools, or a more portable distribution is made available).
+Once the DocBook tools are installed, the configure script will detect them and set up the build system accordingly. If you have a system that isn't supported, let us know, and we'll try to help.
 </Para>
 
+</Sect2>
+
+<Sect2>
+<Title>Remaining problems</Title>
+
 <Para>
-See the Building Guide for details of what to install to get the DocBook tools and how to build the documentation (it's done by the build system, but just isn't part of a normal build).
+If you install from source, you'll get a pile of warnings of the form
+
+<Screen>DTDDECL catalog entries are not supported</Screen>
+
+every time you build anything. These can safely be ignored, but if you find them tedious you can get rid of them by removing all the <Constant>DTDDECL</Constant> entries from <Filename>docbook.cat</Filename>.
 </Para>
 
+</Sect2>
+
 </Sect1>
 
 </Chapter>