[project @ 2004-02-05 14:35:44 by panne]
[ghc-hetmet.git] / docs / building / building.sgml
index 4d25aa2..3163611 100644 (file)
@@ -58,7 +58,7 @@
           the parser specifications.  If you don't want to alter the
           parser then this saves you having to find and install
           <command>happy</command>. You will still need a working
-          version of GHC (preferably version 4.08+) on your machine in
+          version of GHC (version 5.x or later) on your machine in
           order to compile (most of) the sources, however.</para>
        </listitem>
       </varlistentry>
          <listitem>
            <para>Set your <literal>$CVSROOT</literal> environment variable to
             <literal>:pserver:anoncvs@glass.cse.ogi.edu:/cvs</literal></para>
+           <para>If you set <literal>$CVSROOT</literal> in a shell script, be sure not to
+             have any trailing spaces on that line, otherwise CVS will respond with 
+             a perplexing message like
+             <programlisting>
+               /cvs : no such repository
+         </programlisting></para>
          </listitem>
          <listitem>
             <para>Run the command</para>
@@ -1000,12 +1006,21 @@ $ cvs checkout nofib/spectral
          <term>sparc-sun-solaris2</term>
          <indexterm><primary>sparc-sun-solaris2</primary></indexterm>
          <listitem>
-           <para>Fully supported (at least for Solaris 2.7),
+           <para>Fully supported (at least for Solaris 2.7 and 2.6),
            including native-code generator.</para>
          </listitem>
        </varlistentry>
 
        <varlistentry>
+         <term>sparc-unknown-openbsd</term>
+         <indexterm><primary>sparc-unknown-openbsd</primary></indexterm>
+         <listitem>
+           <para>Supported, including native-code generator. The
+           same should also be true of NetBSD</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
          <term>hppa1.1-hp-hpux (HP-PA boxes running HPUX 9.x)</term>
          <indexterm><primary>hppa1.1-hp-hpux</primary></indexterm>
          <listitem>
@@ -1080,8 +1095,8 @@ $ cvs checkout nofib/spectral
          <term>ia64-unknown-linux</term>
          <indexterm><primary>ia64-unknown-linux</primary></indexterm>
          <listitem>
-           <para>GHC currently works unregisterised.  A registerised
-           port is in progress.</para>
+           <para>Supported, except there is no native code
+           generator.</para>
          </listitem>
        </varlistentry>
 
@@ -1107,6 +1122,14 @@ $ cvs checkout nofib/spectral
        </varlistentry>
 
        <varlistentry>
+         <term>mips64-sgi-irix6</term>
+         <indexterm><primary>mips-sgi-irix6</primary></indexterm>
+         <listitem>
+           <para>GHC currently works unregisterised.</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
          <term>powerpc-ibm-aix</term>
          <indexterm><primary>powerpc-ibm-aix</primary></indexterm>
          <listitem>
@@ -1275,23 +1298,24 @@ $ cvs checkout nofib/spectral
       </varlistentry>
 
       <varlistentry>
-       <term>Autoconf</term>
-       <indexterm><primary>pre-supposed: Autoconf</primary></indexterm>
-       <indexterm><primary>Autoconf, pre-supposed</primary></indexterm>
+       <term>autoconf</term>
+       <indexterm><primary>pre-supposed: autoconf</primary></indexterm>
+       <indexterm><primary>autoconf, pre-supposed</primary></indexterm>
        <listitem>
-         <para>GNU Autoconf is needed if you intend to build from the
+         <para>GNU autoconf is needed if you intend to build from the
           CVS sources, it is <emphasis>not</emphasis> needed if you
           just intend to build a standard source distribution.</para>
 
-         <para>Version 2.52 or later of autoconf is required.
-         NB. vesrion 2.13 will no longer work, as of GHC version
+         <para>Version 2.52 or later of the autoconf package is required.
+         NB. version 2.13 will no longer work, as of GHC version
          6.1.</para>
 
-         <para>Autoconf builds the <command>configure</command>
-          script from <filename>configure.ac</filename> and
-          <filename>aclocal.m4</filename>.  If you modify either of
-          these files, you'll need <command>autoconf</command> to
-          rebuild <filename>configure</filename>.</para>
+         <para><command>autoreconf</command> (from the autoconf package)
+          recursively builds <command>configure</command> scripts from
+          the corresponding <filename>configure.ac</filename> and
+          <filename>aclocal.m4</filename> files.  If you modify one of
+          the latter files, you'll need <command>autoreconf</command> to
+          rebuild the corresponding <filename>configure</filename>.</para>
        </listitem>
       </varlistentry>
 
@@ -1411,7 +1435,8 @@ $ cvs checkout nofib/spectral
       want a completely standard build, then the following should
       work:</para>
 
-<screen>$ ./configure
+<screen>$ autoreconf
+$ ./configure
 $ make
 $ make install
 </screen>
@@ -1582,26 +1607,32 @@ $ make install
 
            <para>Change directory to
             <constant>&dollar;(FPTOOLS&lowbar;TOP)</constant> and
-            issue the command
-            <command>autoconf</command><indexterm><primary>autoconf</primary></indexterm>
-            (with no arguments). This GNU program converts
-            <filename><constant>&dollar;(FPTOOLS&lowbar;TOP)</constant>/configure.ac</filename>
+            issue the command</para>
+<ProgramListing>
+autoreconf
+</ProgramListing>
+            <indexterm><primary>autoreconf</primary></indexterm>
+            <para>(with no arguments). This GNU program (recursively) converts
+            <filename><constant>&dollar;(FPTOOLS&lowbar;TOP)</constant>/configure.ac</filename> and
+            <filename><constant>&dollar;(FPTOOLS&lowbar;TOP)</constant>/aclocal.m4</filename>
             to a shell script called
             <filename><constant>&dollar;(FPTOOLS&lowbar;TOP)</constant>/configure</filename>.
+             If <command>autoreconf</command> bleats that it can't write the file <filename>configure</filename>,
+             then delete the latter and try again.  Note that you must use <command>autoreconf</command>,
+             and not the old <command>autoconf</command>!  If you erroneously use the latter, you'll get 
+             a message like "No rule to make target 'mk/config.h.in'".
             </para>
 
-           <para>Some projects, including GHC, have their own
-            configure script.  If there's an
-            <constant>&dollar;(FPTOOLS&lowbar;TOP)/&lt;project&gt;/configure.ac</constant>,
-            then you need to run <command>autoconf</command> in that
-            directory too.</para>
-
-           <para>Both these steps are completely
-            platform-independent; they just mean that the
-            human-written file (<filename>configure.ac</filename>) can
-            be short, although the resulting shell script,
-            <command>configure</command>, and
-            <filename>mk/config.h.in</filename>, are long.</para>
+           <para>Some projects, including GHC, have their own configure script.
+            <command>autoreconf</command> takes care of that, too, so all you have
+             to do is calling <command>autoreconf</command> in the top-level directory
+            <constant>&dollar;(FPTOOLS&lowbar;TOP)</constant>.</para>
+
+           <para>These steps are completely platform-independent; they just mean
+            that the human-written files (<filename>configure.ac</filename> and
+            <filename>aclocal.m4</filename>) can be short, although the resulting
+            files (the <command>configure</command> shell scripts and the C header
+            template <filename>mk/config.h.in</filename>) are long.</para>
          </listitem>
        </varlistentry>
 
@@ -1705,13 +1736,6 @@ $ make install
                </listitem>
              </varlistentry>
            </variablelist>
-           
-           <para><command>configure</command> caches the results of
-            its run in <filename>config.cache</filename>.  Quite often
-            you don't want that; you're running
-            <command>configure</command> a second time because
-            something has changed.  In that case, simply delete
-            <filename>config.cache</filename>.</para>
          </listitem>
        </varlistentry>
        
@@ -1876,21 +1900,13 @@ $ cd /scratch/joe-bloggs/myfptools-sun4
          <para>Prepare for system configuration:</para>
 
 <programlisting>
-$ autoconf
+$ autoreconf
 </programlisting>
 
          <para>(You can skip this step if you are starting from a
           source distribution, and you already have
           <filename>configure</filename> and
           <filename>mk/config.h.in</filename>.)</para>
-
-         <para>Some projects, including GHC itself, have their own
-         configure scripts, so it is necessary to run autoconf again
-         in the appropriate subdirectories. eg:</para>
-
-<programlisting>
-$ (cd ghc; autoconf)
-</programlisting>
        </listitem>
 
        <listitem>
@@ -3829,7 +3845,13 @@ GhcStage2HcOpts = -O -fvia-C -keep-hc-files
              <itemizedlist>
                <listitem>
                  <para>change <literal>TARGETPLATFORM</literal>
-                  appropriately.</para>
+                  appropriately, and set the variables involving
+                  <literal>TARGET</literal> to the correct values for
+                  the target platform.  This step is necessary because
+                  currently <literal>configure</literal> doesn't cope
+                  with specifying different values for the
+                  <literal>--host</literal> and
+                  <literal>--target</literal> flags.</para>
                </listitem>
                <listitem>
                  <para>copy <literal>LeadingUnderscore</literal>
@@ -3837,7 +3859,7 @@ GhcStage2HcOpts = -O -fvia-C -keep-hc-files
                </listitem>
              </itemizedlist>
            </listitem>
-           
+
            <listitem>
              <para>Copy
              <filename><replaceable>T</replaceable>/ghc/includes/config.h</filename>
@@ -4078,10 +4100,13 @@ Hello World!
        <para>To support GHCi, you need to port the dynamic linker
        (<filename>fptools/ghc/rts/Linker.c</filename>).  The linker
        currently supports the ELF and PEi386 object file formats - if
-       your platform uses one of these then you probably don't have
-       to do anything except fiddle with the
-       <literal>#ifdef</literal>s at the top of
-       <filename>Linker.c</filename> to tell it about your OS.</para>
+       your platform uses one of these then things will be
+       significantly easier.  The majority of Unix platforms use the
+       ELF format these days.  Even so, there are some
+       machine-specific parts of the ELF linker: for example, the
+       code for resolving particular relocation types is
+       machine-specific, so some porting of this code to your
+       architecture will probaly be necessary.</para>
        
        <para>If your system uses a different object file format, then
        you have to write a linker &mdash; good luck!</para>
@@ -4413,14 +4438,34 @@ but you do need it to <emphasis>build</emphasis> GHC.</para>
 
 <para> Install Cygwin from <ulink url="http://www.cygwin.com/">http://www.cygwin.com/</ulink>.
 The installation process is straightforward; we install it in <Filename>c:/cygwin</Filename>.
-During the installation dialogue, make sure that you select:
-<command>cvs</command>, <command>openssh</command>,
-<command>autoconf</command>,
-<command>binutils</command> (includes ld and (I think) ar),
-<command>gcc</command>,
-<command>flex</command>,
-<command>make</command>.
-
+During the installation dialogue, make sure that you select all of the following:
+<itemizedlist>
+<listitem><para>
+             <command>cvs</command>, 
+</para></listitem>
+<listitem><para>
+             <command>openssh</command>,
+</para></listitem>
+<listitem><para>
+             <command>autoconf</command>,
+</para></listitem>
+<listitem><para>
+             <command>binutils</command> (includes ld and (I think) ar),
+</para></listitem>
+<listitem><para>
+             <command>gcc</command>,
+</para></listitem>
+<listitem><para>
+             <command>flex</command>,
+</para></listitem>
+<listitem><para>
+             <command>make</command>.
+</para></listitem>
+</itemizedlist>
+If you miss out any of these, strange things will happen to you.   To see thse packages, 
+click on the "View" button in the "Select Packages" 
+stage of Cygwin's installation dialogue, until the view says "Full".  The default view, which is
+"Category" isn't very helpful, and the "View" button is rather unobtrousive.
 </para>
 <para> Now set the following user environment variables:
 <itemizedlist>
@@ -4440,7 +4485,7 @@ don't do this you get very weird messages when you type
 </listitem>
 
 <listitem><para> Set <constant>SHELL</constant> to
-<Filename>c:/cygwin/bin/sh</Filename>. When you invoke a shell in Emacs, this
+<Filename>c:/cygwin/bin/bash</Filename>. When you invoke a shell in Emacs, this
 <constant>SHELL</constant> is what you get.
 </para></listitem>
 
@@ -4662,9 +4707,8 @@ you about Windows-specific wrinkles.</para>
 <ItemizedList>
 <listitem>
 <para>
-Run <Command>autoconf</Command> both in <filename>fptools</filename>
-and in <filename>fptools/ghc</filename>.  If you omit the latter step you'll
-get an error when you run <filename>./configure</filename>:
+If you used <Command>autoconf</Command> instead of <Command>autoreconf</Command>,
+you'll get an error when you run <filename>./configure</filename>:
 <Screen>
 ...lots of stuff...
 creating mk/config.h
@@ -4677,8 +4721,8 @@ configure: error: ./configure failed for ghc
 </para>
 </listitem>
 
-<listitem> <para><command>autoconf</command> seems to create the file <filename>configure</filename>
-read-only.  So if you need to run autoconf again (which I sometimes do for safety's sake),
+<listitem> <para><command>autoreconf</command> seems to create the file <filename>configure</filename>
+read-only.  So if you need to run autoreconf again (which I sometimes do for safety's sake),
 you get
 <screen>
 /usr/bin/autoconf: cannot create configure: permission denied
@@ -4704,7 +4748,7 @@ can be really confusing.
 
 <listitem>
   <para> 
-    After <command>autoconf</command> run <command>./configure</command> in
+    After <command>autoreconf</command> run <command>./configure</command> in
     <filename>fptools/</filename> thus:
 
 <Screen>