[project @ 2001-10-23 14:53:14 by rrt]
[ghc-hetmet.git] / docs / building / building.sgml
index 1ad8411..2c0b172 100644 (file)
@@ -50,11 +50,12 @@ as suggested:
 <Term><IndexTerm><Primary>Binary distribution</Primary></IndexTerm>Binary distribution.</Term>
 <ListItem>
 <para>
-If your only purpose is to install some of the <Literal>fptools</Literal> suite then the easiest thing to do is to get a binary distribution. In the
-binary distribution everything is pre-compiled for your particular
-machine architecture and operating system, so all you should have to
-do is install the binaries and libraries in suitable places. The user guide
-describes how to do this.
+If your only purpose is to install some of the
+<Literal>fptools</Literal> suite then the easiest thing to do is to
+get a binary distribution. In the binary distribution everything is
+pre-compiled for your particular machine architecture and operating
+system, so all you should have to do is install the binaries and
+libraries in suitable places. The user guide describes how to do this.
 </para>
 
 <para>
@@ -154,7 +155,7 @@ of this manual in detail.</para>
 </Sect1>
 
 <Sect1 id="sec-build-checks">
-<Title>Things to check before you start typing</Title>
+<Title>Things to check before you start</Title>
 
 <para>
 Here's a list of things to check before you get started.
@@ -339,7 +340,7 @@ Works registerised.  No native-code generator.
 <IndexTerm><Primary>i386-*-linux</Primary></IndexTerm>
 <ListItem>
 
-<para>GHC works registerised, has a native code generator.  You
+<para>GHC works registerised and has a native code generator.  You
 <Emphasis>must</Emphasis> have GCC 2.7.x or later.  NOTE about
 <literal>glibc</literal> versions: GHC binaries built on a system
 running <literal>glibc 2.0</literal> won't work on a system running
@@ -449,24 +450,20 @@ script will tell you if you are missing something.
 <IndexTerm><Primary>Perl, pre-supposed</Primary></IndexTerm>
 <ListItem>
 <para>
-<Emphasis>You have to have Perl to proceed!</Emphasis> Perl is a
-language quite good for doing shell-scripty tasks that involve lots of
-text processing.  It is pretty easy to install.
+<Emphasis>You have to have Perl to proceed!</Emphasis>
+It is pretty easy to install.
 </para>
 
 <para>
-Perl&nbsp;5 is required.  For Win32 platforms, we strongly suggest you
-pick up a port of Perl&nbsp;5 for <Literal>cygwin32</Literal>, as the
-common Hip/ActiveWare port of Perl is Not Cool Enough for our
-purposes.
+Perl&nbsp;5 is required.  For Win32 platforms, you should use the binary
+supplied in the InstallShield (copy it to <filename>/bin</filename>).
+The Cygwin-supplied Perl seems not to work.
 </para>
 
 <para>
 Perl should be put somewhere so that it can be invoked by the
-<Literal>&num;!</Literal> script-invoking mechanism. (I believe
-<Filename>/usr/bin/perl</Filename> is preferred; we use
-<Filename>/usr/local/bin/perl</Filename> at Glasgow.)  The full
-pathname should may need to be less than 32 characters long on some
+<Literal>&num;!</Literal> script-invoking mechanism. The full
+pathname may need to be less than 32 characters long on some
 systems.
 </para>
 
@@ -637,6 +634,15 @@ everything you need.
 </VariableList>
 </para>
 
+      <para>
+       In order to actually build any documentation, you need to set
+       <constant>SGMLDocWays</constant> in your
+       <filename>build.mk</filename>. Valid values to add to this
+       list are: <literal>dvi</literal>, <literal>ps</literal>,
+       <literal>pdf</literal>, <literal>html</literal>, and
+       <literal>rtf</literal>.
+      </para>
+      
 </Sect2>
 
 <Sect2 id="pre-supposed-other-tools">
@@ -962,7 +968,7 @@ You set the configuration using a three-step process.
                  
                <varlistentry>
                  <term><literal>--with-hc=<parameter>path</parameter></literal></term>
-                 <indexterm><primary><literal>--with-hhc</literal></primary>
+                 <indexterm><primary><literal>--with-hc</literal></primary>
                  </indexterm>
                  <listitem>
                    <para>Specifies the path to any installed Haskell
@@ -971,6 +977,20 @@ You set the configuration using a three-step process.
                    use <literal>ghc</literal>.</para>
                  </listitem>
                </varlistentry>
+
+               <varlistentry>
+                 <term><literal>--with-gcc=<parameter>path</parameter></literal></term>
+                 <indexterm><primary><literal>--with-gcc</literal></primary>
+                 </indexterm>
+                 <listitem>
+                   <para>Specifies the path to the installed
+                   GCC. This compiler will be used to compile all C
+                   files, <emphasis>except</emphasis> any generated
+                   by the installed Haskell compiler, which will have
+                   its own idea of which C compiler (if any) to use.
+                   The default is to use <literal>gcc</literal>.</para>
+                 </listitem>
+               </varlistentry>
              </variablelist>
 
              <para><command>configure</command> caches the results of
@@ -1182,11 +1202,12 @@ emacs mk/build.mk
 
 </OrderedList>
 
-You can make subsequent changes to <filename>mk/build.mk</filename> as often 
-as you like.  You do not have to run any further configuration 
-programs to make these changes take effect.
-In theory you should, however, say <Command>gmake clean</Command>, <Command>gmake all</Command>,
-because configuration option changes could affect anything&mdash;but in practice you are likely to know what's affected.
+You can make subsequent changes to <filename>mk/build.mk</filename> as often
+as you like.  You do not have to run any further configuration programs to
+make these changes take effect. In theory you should, however, say
+<Command>gmake clean</Command>, <Command>gmake all</Command>, because
+configuration option changes could affect anything&mdash;but in practice you
+are likely to know what's affected.
 </para>
 
 </Sect2>
@@ -1257,7 +1278,7 @@ file.  Typing <Command>gmake</Command> alone is generally the same as typing <Co
 <Term><Literal>install</Literal>:</Term>
 <ListItem>
 <para>
-installs the things built by <Literal>all</Literal>.  Where does it
+installs the things built by <Literal>all</Literal> (except for the documentation).  Where does it
 install them?  That is specified by
 <filename>mk/config.mk.in</filename>; you can override it in
 <filename>mk/build.mk</filename>, or by running
@@ -1267,6 +1288,13 @@ install them?  That is specified by
 </para>
 </ListItem></VarListEntry>
 <VarListEntry>
+<Term><Literal>install-docs</Literal>:</Term>
+<ListItem>
+<para>
+installs the documentation. Otherwise behaves just like <literal>install</literal>.
+</para>
+</ListItem></VarListEntry>
+<VarListEntry>
 <Term><Literal>uninstall</Literal>:</Term>
 <ListItem>
 <para>
@@ -2470,7 +2498,7 @@ WARNINGS about pitfalls and known ``problems'':
 
 <para>
 One difficulty that comes up from time to time is running out of space
-in <filename>/tmp</filename>.  (It is impossible for the configuration stuff to
+in <literal>TMPDIR</literal>.  (It is impossible for the configuration stuff to
 compensate for the vagaries of different sysadmin approaches to temp
 space.)
 <IndexTerm><Primary>tmp, running out of space in</Primary></IndexTerm>
@@ -2646,71 +2674,32 @@ Workaround: don't put weird things in string args to <Command>cpp</Command> macr
 This section summarises how to get the utilities you need on your
 Win95/98/NT/2000 machine to use CVS and build GHC. Similar notes for
 installing and running GHC may be found in the user guide. In general,
-Win95/Win98 behave the same, and WinNT/Win2k behave the same. It is based
-largely on detailed advice from Sigbj&oslash;rn Finne. You should read the
-GHC installation guide sections on Windows (in the user guide) before
-continuing to read these notes.
-</para>
-
-
-<Sect2><Title>Installing ssh</Title>
-
-<ItemizedList>
-
-<ListItem>
-<para>
-Extract the whole of <ULink URL="http://research.microsoft.com/~simonpj/ssh-1_2_26-cygwinb19.tar.gz">the ssh archive</ULink> into your <filename>C:\</filename> directory, and use the ``All files'' and ``User folder names'' options in WinZip extract dialogue box. This populates your <filename>C:\usr\local</filename> tree.
-</para>
-</ListItem>
-
-<ListItem>
-<para>
-Extract <ULink URL="http://research.microsoft.com/~simonpj/cygwinb19.dll.zip">cygwinb19.dll</ULink> into <filename>/usr/local/bin</filename>.  The current version
-of Cywin is b20, but this version of ssh was compiled with b19.
-</para>
-</ListItem>
-
-<ListItem>
-<para>
-On a Win2k machine, open up a bash and do 
+Win95/Win98 behave the same, and WinNT/Win2k behave the same.
+You should read the GHC installation guide sections on Windows (in the user
+guide) before continuing to read these notes.
 </para>
 
-<Screen>
-foo$ cd /etc
-foo$ mkpasswd -l > passwd
-</Screen>
-
 <para>
-Check that your login entry is on the first line
-of that file. If not, move it to the top.  It's OK
-for 'Administrator' to be the first entry, assuming you are one.
+Because of various hard-wired infelicities, you need to copy
+<Filename>bash.exe</Filename> (from GHC's <Filename>extra-bin</Filename>
+directory), and <Filename>perl.exe</Filename> and
+<Filename>cat.exe</Filename> (from GHC's <Filename>bin</Filename> directory)
+to <Filename>/bin</Filename> (discover where your Cygwin root directory is
+by typign <Command>mount</Command>).
 </para>
 
 <para>
-However, Win9x doesn't support the calls that <Command>mkpasswd</Command> relies on
-(e.g., <Function>NetUserEnum</Function>). If you run <Command>mkpasswd</Command> you
-get errors like:
+Before you start, you need to make sure that the user environment variable
+<Constant>MAKE_MODE</Constant> is set to <Literal>UNIX</Literal>. If you
+don't do this you get very weird messages when you type
+<Command>make</Command>, such as:
 </para>
-
 <Screen>
-linked to missing export netapi32.dll:NetUserEnum
-</Screen>
-
-<para>
-The passwd file is used
-by ssh in a fairly rudimentary manner, so I'd simply 
-synthesise/copy an existing Unix <filename>/etc/passwd</filename>, i.e., create
-an <filename>/etc/passwd</filename> file containing the line
-</para>
+/c: /c: No such file or directory</Screen>
 
-<Screen>
-&lt;login&gt;::500:513:::/bin/sh
-</Screen>
+<Sect2><Title>Configuring ssh</Title>
 
-<para>
-where <Literal>&lt;login&gt;</Literal> is your login id.
-</para>
-</ListItem>
+<ItemizedList>
 
 <ListItem>
 <para>
@@ -2767,21 +2756,12 @@ If you don't have an account on <Literal>cvs.haskell.org</Literal>, send
 </Sect2>
 
 
-<Sect2><Title>Installing CVS</Title>
+<Sect2><Title>Configuring CVS</Title>
 
 <ItemizedList>
 
 <ListItem>
 <para>
-Unpack 
-<ULink URL="http://research.microsoft.com/~simonpj/cvs-1_10-win.zip">
-CVS</ULink> and, following the instructions in the <filename>README</filename>, copy the
-appropriate files into <filename>/usr/local/bin</filename>.
-</para>
-</ListItem>
-
-<ListItem>
-<para>
 From the System control panel,
 set the following <Emphasis>user</Emphasis> environment variables (see the GHC user guide)
 </para>
@@ -2796,7 +2776,7 @@ will look for its <filename>.cvsrc</filename> file.
 
 <ListItem>
 <para>
-<Constant>CVS_RSH</Constant>: <filename>c:/usr/local/bin/ssh1</filename>
+<Constant>CVS_RSH</Constant>: <filename>c:/path_to_ghc/extra-bin/ssh</filename>
 </para>
 </ListItem>
 
@@ -2812,6 +2792,14 @@ where <Literal>username</Literal> is your userid
 <Constant>CVSEDITOR</Constant>: <filename>bin/gnuclient.exe</filename> if you want to use an Emacs buffer for typing in those long commit messages.
 </para>
 </ListItem>
+
+<ListItem>
+<para>
+<Constant>SHELL</Constant>: To use bash as the shell in Emacs, you need to
+set this to point to <Filename>bash.exe</Filename>.
+</para>
+</ListItem>
+
 </ItemizedList>
 </ListItem>
 
@@ -2834,7 +2822,7 @@ free to change them.)
 </para>
 
 <para>
-Filenames starting with "<filename>.</filename>" were illegal in 
+Filenames starting with <filename>.</filename> were illegal in 
 the 8.3 DOS filesystem, but that restriction should have
 been lifted by now (i.e., you're using VFAT or later filesystems.) If
 you're still having problems creating it, don't worry; <filename>.cvsrc</filename> is entirely
@@ -2846,7 +2834,8 @@ optional.
 <para>
 Try doing <Command>cvs co fpconfig</Command>. All being well, bytes should
 start to trickle through, leaving a directory <filename>fptools</filename>
-in your current directory.  (You can <Command>rm</Command> it if you don't want to keep it.)  The following messages appear to be harmless:
+in your current directory.  (You can <Command>rm</Command> it if you don't
+want to keep it.) The following messages appear to be harmless:
 </para>
 
 <Screen>
@@ -2856,10 +2845,10 @@ setsockopt IPTOS_THROUGHPUT: Invalid argument
 
 <para>
 At this point I found that CVS tried to invoke a little dialogue with
-me (along the lines of `do you want to talk to this host'), but
-somehow bombed out.  This was from a bash shell running in emacs.
+me (along the lines of `do you want to talk to this host?'), but
+for some reason bombed out.  This was from a bash shell running in Emacs.
 I solved this by invoking a Cygnus shell, and running CVS from there.
-Once things are dialogue free, it seems to work OK from within emacs.
+Once things are dialogue free, it seems to work OK from within Emacs.
 </para>
 </ListItem>
 
@@ -2900,65 +2889,22 @@ I have not tried it yet.
 </Sect2>
 
 
-<Sect2><Title>Installing autoconf</Title>
+    <Sect2><Title>Building GHC</Title>
+      
+      <ItemizedList>
 
-<para>
-Only required if you are doing builds from GHC's sources
-checked out from the CVS tree.
-</para>
-
-<ItemizedList>
-<ListItem>
-<para>
-Fetch the (standard, Unix) <Command>autoconf</Command> distribution from
-<ULink URL="ftp://ftp.gnu.org/gnu/autoconf">ftp.gnu.org</ULink>.
-</para>
-</ListItem>
-<ListItem>
-<para>
-Unpack it into an arbitrary directory.
-</para>
-</ListItem>
-<ListItem>
-<para>
-Make sure that the directory <filename>/usr/local/bin</filename> exists.
-</para>
-</ListItem>
-<ListItem>
-<para>
-Say "<filename>./configure</filename>".
-</para>
-</ListItem>
-<ListItem>
-<para>
-Now <Command>make install</Command>.  This should put <filename>autoheader</filename>
-and <filename>autoconf</filename> in <filename>/usr/local/bin</filename>.
-</para>
-</ListItem>
-</ItemizedList>
-
-<para>
-<Command>autoheader</Command> doesn't seem to work, but you don't need it
-for GHC.
-</para>
-
-</Sect2>
-
-
-<Sect2><Title>Building GHC</Title>
-
-<ItemizedList>
-
-<ListItem>
-<para>
-In the <filename>./configure</filename> output, ignore 
-"<Literal>
-checking whether #! works in shell scripts... 
-./configure: ./conftest: No such file or directory</Literal>", 
-and "<Literal>not updating unwritable cache ./config.cache</Literal>".
-Nobody knows why these happen, but they seem to be harmless.
-</para>
-</ListItem>
+       <ListItem>
+         <para>
+           You should give the option
+           <option>--host=i386-unknown-mingw32</option> to
+           <command>autoconf</command>, so that it doesn't try to
+           build for Cygwin (unless that's what you really
+           want). Since it's possible to get into trouble using the
+           wrong C compiler, it's wise either to avoid installing
+           Cygwin gcc, or to explicitly specify
+           <option>--with-gcc=/mingw/bin/gcc</option>.
+         </para>
+       </ListItem>
 
 <ListItem>
 <para>
@@ -2981,11 +2927,8 @@ configure: error: ./configure failed for ghc
 <ListItem>
 <para>
 You need <filename>ghc</filename> to be in your <Constant>PATH</Constant> before you run
-<Command>configure</Command>.  The default GHC InstallShield creates only
-<filename>ghc-4.08</filename>, so you may need to duplicate this file as <filename>ghc</filename>
-in the same directory, in order that <Command>configure</Command> will see it (or
-just rename <filename>ghc-4.08</filename> to <filename>ghc</filename>.
-And make sure that the directory is in your path.
+<Command>configure</Command>. The InstallShield tells you the path
+when you install it.
 </para>
 </ListItem>
 
@@ -2993,6 +2936,79 @@ And make sure that the directory is in your path.
 
 </Sect2>
 
+    <sect2>
+      <title>Building the Windows InstallShield&reg; Installer</title>
+
+      <para>
+       This section is intended for GHC developers only; no-one else
+       should need to build an InstallShield.
+      </para>
+
+      <para>
+       Having built a second-stage tree and done <command>make
+       install</command> on it, open the InstallShield
+       (<filename>.ism</filename>) file. Open the Project screen, and
+       then the Project subfolder of the Path variables folder, and
+       set <literal>SourceFiles</literal> to the top of your
+       tree. You might also need to set <literal>GHCBITS</literal> to
+       point to the tree of various external bits that are added into
+       the IS mix. You should then be able to build an InstallShield.
+      </para>
+
+      <sect3>
+       <title>Extra features of the InstallShield</title>
+
+       <para>
+         The InstallShield has some IS-specific twiddles:
+
+         <itemizedlist>
+           <listitem>
+             <para>
+               Two registry entries are set under
+               <literal>HKEY_LOCAL_MACHINE\SOFTWARE\GHC</literal>:
+               <literal>Path</literal> and
+               <literal>Version</literal>, which record respectively
+               the directory in which GHC was installed, and the
+               version number.
+             </para>
+           </listitem>
+           <listitem>
+             <para>
+               The InstallShield adds some entries to the Program
+               menu, for GHCi and for the documentation. See under
+               Setup Design and the individual components (each
+               component can add entries to the menu).
+             </para>
+           </listitem>
+         </itemizedlist>
+       </para>
+      </sect3>
+      
+      <sect3>
+       <title>External add-ins</title>
+
+       <para>
+         The external add-ins consist of Mingwin gcc and Mingwin
+         Perl. The layout of the add-ins tree is as follows:
+
+         <screen>
+extra-bin/
+  gcc.exe
+  perl.exe    (Mingwin perl)
+  perl56.dll
+gcc-lib/
+  Mingwin gcc binaries, libraries and headers
+imports/
+  com/
+    imports for HDirect's com library
+include/
+  Mingwin includes
+</screen>
+         </para>
+       </sect3>
+      
+    </sect2>
+
 </Sect1>
 
 </Article>