Add several new record features
[ghc-hetmet.git] / docs / users_guide / installing.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <chapter id="installing-bin-distrib">
3   <title>Installing GHC</title>
4 <indexterm><primary>binary installations</primary></indexterm>
5 <indexterm><primary>installation, of binaries</primary></indexterm>
6
7 <para>
8 Installing from binary distributions is easiest, and recommended!
9 (Why binaries? Because GHC is a Haskell compiler written in Haskell,
10 so you've got to bootstrap it somehow.  We provide machine-generated
11 C-files-from-Haskell for this purpose, but it's really quite a pain to
12 use them.  If you must build GHC from its sources, using a
13 binary-distributed GHC to do so is a sensible way to proceed. For the
14 other <literal>fptools</literal> programs, many are written in
15 Haskell, so binary distributions allow you to install them without
16 having a Haskell compiler.)
17 </para>
18
19 <para>This guide is in several parts:</para>
20
21   <itemizedlist>
22     <listitem>
23       <para> Installing on Unix-a-likes (<xref
24       linkend="unix-a-likes"/>). </para>
25     </listitem>
26     <listitem>
27       <para> Installing on Windows (<xref
28       linkend="install-windows"/>).  </para>
29     </listitem>
30     <listitem>
31       <para> The layout of installed files (<xref
32       linkend="install-files"/>).  You don't need to know this to
33       install GHC, but it's useful if you are changing the
34       implementation.</para>
35     </listitem>
36   </itemizedlist>
37   
38   <sect1 id="unix-a-likes"><title>Installing on Unix-a-likes</title>
39
40     <sect2>
41       <title>When a platform-specific package is available</title>
42       
43       <para>For certain platforms, we provide GHC binaries packaged
44       using the native package format for the platform.  This is
45       likely to be by far the best way to install GHC for your
46       platform if one of these packages is available, since
47       dependencies will automatically be handled and the package
48       system normally provides a way to uninstall the package at a
49       later date.</para>
50
51       <para>We generally provide the following packages:</para>
52
53       <variablelist>
54         <varlistentry>
55           <term>RedHat or SuSE Linux/x86</term>
56           <listitem>
57             <para>RPM source &amp; binary packages for RedHat and SuSE
58             Linux (x86 only) are available for most major
59             releases.</para>
60           </listitem>
61         </varlistentry>
62
63         <varlistentry>
64           <term>Debian Linux/x86</term>
65           <listitem>
66             <para>Debian packages for Linux (x86 only), also for most
67             major releases.</para>
68           </listitem>
69         </varlistentry>
70
71         <varlistentry>
72           <term>FreeBSD/x86</term>
73           <listitem>
74             <para>On FreeBSD/x86, GHC can be installed using either
75             the ports tree (<literal>cd /usr/ports/lang/ghc &amp;&amp; make
76             install</literal>) or from a pre-compiled package
77             available from your local FreeBSD mirror.</para>
78           </listitem>
79         </varlistentry>
80       </variablelist>
81       
82       <para>Other platform-specific packages may be available, check
83       the GHC download page for details.</para>
84     </sect2>
85
86 <sect2>
87 <title>GHC binary distributions</title>
88
89 <para>
90 <indexterm><primary>bundles of binary stuff</primary></indexterm>
91 </para>
92
93 <para>
94 Binary distributions come in &ldquo;bundles,&rdquo; one bundle per file called
95 <literal><replaceable>bundle</replaceable>-<replaceable>platform</replaceable>.tar.gz</literal>.  (See the <ulink url="http://hackage.haskell.org/trac/ghc/wiki/Building">building guide</ulink> for the definition of a platform.)  Suppose that you untar a binary-distribution bundle, thus:
96 </para>
97
98 <para>
99
100 <screen>
101 % cd /your/scratch/space
102 % gunzip &#60; ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -</screen>
103
104 </para>
105
106 <para>
107 Then you should find a single directory,
108 <literal>ghc-<replaceable>version</replaceable></literal>, with the
109 following structure:
110 </para>
111
112 <para>
113 <indexterm><primary>binary distribution, layout</primary></indexterm>
114 <indexterm><primary>directory layout (binary distributions)</primary></indexterm>
115 <variablelist>
116
117 <varlistentry>
118 <term><literal>Makefile.in</literal></term>
119 <listitem>
120 <para>
121 the raw material from which the <literal>Makefile</literal>
122 will be made (<xref linkend="install"/>).
123 </para>
124 </listitem></varlistentry>
125 <varlistentry>
126 <term><literal>configure</literal></term>
127 <listitem>
128 <para>
129 the configuration script (<xref linkend="install"/>).
130 </para>
131 </listitem></varlistentry>
132 <varlistentry>
133 <term><literal>README</literal></term>
134 <listitem>
135 <para>
136 Contains this file summary.
137 </para>
138 </listitem></varlistentry>
139 <varlistentry>
140 <term><literal>INSTALL</literal></term>
141 <listitem>
142 <para>
143 Contains this description of how to install
144 the bundle.
145 </para>
146 </listitem></varlistentry>
147 <varlistentry>
148 <term><literal>ANNOUNCE</literal></term>
149 <listitem>
150 <para>
151 The announcement message for the bundle.
152 </para>
153 </listitem></varlistentry>
154 <varlistentry>
155 <term><literal>NEWS</literal></term>
156 <listitem>
157 <para>
158 release notes for the bundle&mdash;a longer version
159 of <literal>ANNOUNCE</literal>.  For GHC, the release notes are contained in the User
160 Guide and this file isn't present.
161 </para>
162 </listitem></varlistentry>
163 <varlistentry>
164             <term><literal>bin/<replaceable>platform</replaceable></literal></term>
165 <listitem>
166 <para>
167 contains platform-specific executable
168 files to be invoked directly by the user.  These are the files that
169 must end up in your path.
170 </para>
171 </listitem></varlistentry>
172 <varlistentry>
173 <term><literal>lib/<replaceable>platform</replaceable>/</literal></term>
174 <listitem>
175 <para>
176 contains platform-specific support
177 files for the installation.  Typically there is a subdirectory for
178 each <literal>fptools</literal> project, whose name is the name of the project with its
179 version number.  For example, for GHC there would be a sub-directory
180 <literal>ghc-x.xx</literal>/ where <literal>x.xx</literal> is the version number of GHC in the bundle.
181 </para>
182
183 <para>
184 These sub-directories have the following general structure:
185 </para>
186
187 <para>
188 <variablelist>
189
190 <varlistentry>
191 <term><literal>libHSstd.a</literal> etc:</term>
192 <listitem>
193 <para>
194 supporting library archives.
195 </para>
196 </listitem></varlistentry>
197 <varlistentry>
198 <term><literal>ghc-iface.prl</literal> etc:</term>
199 <listitem>
200 <para>
201 support scripts.
202 </para>
203 </listitem></varlistentry>
204 <varlistentry>
205 <term><literal>import/</literal></term>
206 <listitem>
207 <para>
208 <indexterm><primary>Interface files</primary></indexterm> (<literal>.hi</literal>) for the prelude.
209 </para>
210 </listitem></varlistentry>
211 <varlistentry>
212 <term><literal>include/</literal></term>
213 <listitem>
214 <para>
215 A few C <literal>&num;include</literal> files.
216 </para>
217 </listitem></varlistentry>
218 </variablelist>
219 </para>
220 </listitem></varlistentry>
221 <varlistentry>
222 <term><literal>share/</literal></term>
223 <listitem>
224 <para>
225 contains platform-independent support files
226 for the installation.  Again, there is a sub-directory for each
227 <literal>fptools</literal> project.
228 </para>
229 </listitem></varlistentry>
230 <varlistentry>
231 <term><literal>html/</literal></term>
232 <listitem>
233 <para>
234 contains HTML documentation files (one
235 sub-directory per project).
236 </para>
237 </listitem></varlistentry>
238 </variablelist>
239 </para>
240
241 <sect3 id="install">
242 <title>Installing</title>
243
244 <para>
245 OK, so let's assume that you have unpacked your chosen bundles. What
246 next? Well, you will at least need to run the
247 <literal>configure</literal><indexterm><primary>configure</primary></indexterm>
248 script by changing directory into the top-level directory for the
249 bundle and typing <literal>./configure</literal>.  That should convert
250 <literal>Makefile.in</literal> to <literal>Makefile</literal>.
251 </para>
252
253 <para>
254 <indexterm><primary>installing in-place</primary></indexterm>
255 <indexterm><primary>in-place installation</primary></indexterm>
256 You can now either start using the tools <emphasis>in-situ</emphasis> without going
257 through any installation process, just type <literal>make in-place</literal> to set the
258 tools up for this. You'll also want to add the path which <literal>make</literal> will
259 now echo to your <literal>PATH</literal> environment variable. This option is useful if
260 you simply want to try out the package and/or you don't have the
261 necessary privileges (or inclination) to properly install the tools
262 locally. Note that if you do decide to install the package `properly'
263 at a later date, you have to go through the installation steps that
264 follow.
265 </para>
266
267 <para>
268 To install a package, you'll have to do the following:
269 </para>
270
271 <para>
272
273 <orderedlist>
274 <listitem>
275
276 <para>
277  Edit the <literal>Makefile</literal> and check the settings of the following variables:
278
279 <indexterm><primary>directories, installation</primary></indexterm>
280 <indexterm><primary>installation directories</primary></indexterm>
281
282 <variablelist>
283
284 <varlistentry>
285 <term><literal>platform</literal></term>
286 <listitem>
287 <para>
288 the platform you are going to install for.
289 </para>
290 </listitem></varlistentry>
291 <varlistentry>
292 <term><literal>bindir</literal></term>
293 <listitem>
294 <para>
295 the directory in which to install user-invokable
296 binaries.
297 </para>
298 </listitem></varlistentry>
299 <varlistentry>
300 <term><literal>libdir</literal></term>
301 <listitem>
302 <para>
303 the directory in which to install
304 platform-dependent support files.
305 </para>
306 </listitem></varlistentry>
307 <varlistentry>
308 <term><literal>datadir</literal></term>
309 <listitem>
310 <para>
311 the directory in which to install
312 platform-independent support files.
313 </para>
314 </listitem></varlistentry>
315 <varlistentry>
316 <term><literal>infodir</literal></term>
317 <listitem>
318 <para>
319 the directory in which to install Emacs info
320 files.
321 </para>
322 </listitem></varlistentry>
323 <varlistentry>
324 <term><literal>htmldir</literal></term>
325 <listitem>
326 <para>
327 the directory in which to install HTML
328 documentation.
329 </para>
330 </listitem></varlistentry>
331 <varlistentry>
332 <term><literal>dvidir</literal></term>
333 <listitem>
334 <para>
335 the directory in which to install DVI
336 documentation.
337 </para>
338 </listitem></varlistentry>
339 </variablelist>
340
341 The values for these variables can be set through invocation of the
342 <command>configure</command><indexterm><primary>configure</primary></indexterm>
343 script that comes with the distribution, but doing an optical diff to
344 see if the values match your expectations is always a Good Idea.
345 </para>
346
347 <para>
348 <emphasis>Instead of running <command>configure</command>, it is
349 perfectly OK to copy <filename>Makefile.in</filename> to
350 <filename>Makefile</filename> and set all these variables directly
351 yourself.  But do it right!</emphasis>
352 </para>
353
354 </listitem>
355 <listitem>
356
357 <para>
358 Run <literal>make install</literal>.  This <emphasis>
359 should</emphasis> work with ordinary Unix
360 <literal>make</literal>&mdash;no need for fancy stuff like GNU
361 <literal>make</literal>.
362
363 </para>
364 </listitem>
365 <listitem>
366
367 <para>
368 <literal>rehash</literal> (t?csh or zsh users), so your shell will see the new
369 stuff in your bin directory.
370
371 </para>
372 </listitem>
373 <listitem>
374
375 <para>
376  Once done, test your &ldquo;installation&rdquo; as suggested in 
377 <xref linkend="GHC-test"/>.  Be sure to use a <literal>-v</literal>
378 option, so you can see exactly what pathnames it's using.
379
380 If things don't work as expected, check the list of known pitfalls in
381 the <ulink url="http://hackage.haskell.org/trac/ghc/wiki/Building">building guide</ulink>.
382 </para>
383 </listitem>
384
385 </orderedlist>
386
387 </para>
388
389 <para>
390 <indexterm><primary>link, installed as ghc</primary></indexterm>
391 When installing the user-invokable binaries, this installation
392 procedure will install GHC as <literal>ghc-x.xx</literal> where <literal>x.xx</literal> is the version
393 number of GHC.  It will also make a link (in the binary installation
394 directory) from <literal>ghc</literal> to <literal>ghc-x.xx</literal>.  If you install multiple versions
395 of GHC then the last one &ldquo;wins&rdquo;, and &ldquo;<literal>ghc</literal>&rdquo; will invoke the last
396 one installed.  You can change this manually if you want.  But
397 regardless, <literal>ghc-x.xx</literal> should always invoke GHC version <literal>x.xx</literal>.
398 </para>
399
400 </sect3>
401
402
403 <sect3>
404 <title>What bundles there are</title>
405
406 <para>
407 <indexterm><primary>bundles, binary</primary></indexterm> There are
408 plenty of &ldquo;non-basic&rdquo; GHC bundles.  The files for them are
409 called
410 <literal>ghc-x.xx-<replaceable>bundle</replaceable>-<replaceable>platform</replaceable>.tar.gz</literal>,
411 where the <replaceable>platform</replaceable> is as above, and
412 <replaceable>bundle</replaceable> is one of these:
413 </para>
414
415 <para>
416 <variablelist>
417
418 <varlistentry>
419 <term><literal>prof</literal>:</term>
420 <listitem>
421 <para>
422 Profiling with cost-centres.  You probably want this.
423 <indexterm><primary>profiling bundles</primary></indexterm>
424 <indexterm><primary>bundles, profiling</primary></indexterm>
425 </para>
426 </listitem></varlistentry>
427 <varlistentry>
428 <term><literal>par</literal>:</term>
429 <listitem>
430 <para>
431 Parallel Haskell features (sits on top of PVM).
432 You'll want this if you're into that kind of thing.
433 <indexterm><primary>parallel bundles</primary></indexterm>
434 <indexterm><primary>bundles, parallel</primary></indexterm>
435 </para>
436 </listitem></varlistentry>
437 <varlistentry>
438 <term><literal>gran</literal>:</term>
439 <listitem>
440 <para>
441 The &ldquo;GranSim&rdquo; parallel-Haskell simulator
442 (hmm&hellip; mainly for implementors).
443 <indexterm><primary>bundles, gransim</primary></indexterm>
444 <indexterm><primary>gransim bundles</primary></indexterm>
445 </para>
446 </listitem></varlistentry>
447 <varlistentry>
448 <term><literal>ticky</literal>:</term>
449 <listitem>
450 <para>
451 &ldquo;Ticky-ticky&rdquo; profiling; very detailed
452 information about &ldquo;what happened when I ran this program&rdquo;&mdash;really
453 for implementors.
454 <indexterm><primary>bundles, ticky-ticky</primary></indexterm>
455 <indexterm><primary>ticky-ticky bundles</primary></indexterm>
456 </para>
457 </listitem></varlistentry>
458 </variablelist>
459 </para>
460
461 <para>
462 One likely scenario is that you will grab <emphasis>two</emphasis>
463 binary bundles&mdash;basic, and profiling.  We don't usually make the
464 rest, although you can build them yourself from a source distribution.
465 </para>
466
467 <para>The various GHC bundles are designed to be unpacked into the
468 same directory; then installing as per the directions above will
469 install the whole lot in one go.  Note: you <emphasis>must</emphasis>
470 at least have the basic GHC binary distribution bundle, these extra
471 bundles won't install on their own.</para>
472
473 </sect3>
474
475 <sect3 id="GHC-test">
476 <title>Testing that GHC seems to be working
477 </title>
478
479 <para>
480 <indexterm><primary>testing a new GHC</primary></indexterm>
481 </para>
482
483 <para>
484 The way to do this is, of course, to compile and run <emphasis>this</emphasis> program
485 (in a file <literal>Main.hs</literal>):
486 </para>
487
488 <para>
489
490 <programlisting>
491 main = putStr "Hello, world!\n"
492 </programlisting>
493
494 </para>
495
496 <para>
497 Compile the program, using the <literal>-v</literal> (verbose) flag to verify that
498 libraries, etc., are being found properly:
499
500 <screen>
501 % ghc -v -o hello Main.hs</screen>
502
503 </para>
504
505 <para>
506 Now run it:
507
508 <screen>
509 % ./hello
510 Hello, world!</screen>
511
512 </para>
513
514 <para>
515 Some simple-but-profitable tests are to compile and run the notorious
516 <literal>nfib</literal><indexterm><primary>nfib</primary></indexterm> program, using different numeric types.  Start with
517 <literal>nfib :: Int -&gt; Int</literal>, and then try <literal>Integer</literal>, <literal>Float</literal>, <literal>Double</literal>,
518 <literal>Rational</literal> and perhaps the overloaded version.  Code for this is
519 distributed in <literal>ghc/misc/examples/nfib/</literal> in a source distribution.
520 </para>
521
522 <para>For more information on how to &ldquo;drive&rdquo; GHC, read
523 on...</para>
524
525 </sect3>
526
527 </sect2>
528
529 </sect1>
530
531
532 <sect1 id="install-windows"><title>Installing on Windows</title>
533
534 <para>
535 Getting the Glasgow Haskell Compiler (post 5.02) to run on Windows platforms is
536 a snap: the installer does everything you need.  
537 </para>
538
539 <sect2><title>Installing GHC on Windows</title>
540
541 <para>
542 To install GHC, use the following steps:
543 </para>
544 <itemizedlist>
545 <listitem><para>Download the installer
546 from the
547 <ulink
548 url="http://www.haskell.org/ghc/download.html">GHC download page</ulink>.
549 </para></listitem>
550
551 <listitem><para>Run the installer.
552 On Windows, all of GHC's files are installed in a single directory.
553 You can override it, but by default this directory is
554 <filename>c:/ghc/<replaceable>ghc-version</replaceable></filename>.
555 The executable binary for GHC will be installed in the
556 <filename>bin/</filename> sub-directory of the installation directory.
557 If you want to invoke GHC from a command line, add this
558 to your PATH environment variable.
559 </para>
560 <para>
561 When installation is complete, you should find GHCi and the GHC
562 documentation are available in your Start menu under
563 "Start/All Programs/GHC/<replaceable>ghc-version</replaceable>".
564 </para>
565 </listitem>
566
567 <listitem><para>
568 GHC needs a directory in which to create, and later delete, temporary files.
569 It uses the standard Windows procedure <literal>GetTempPath()</literal> to
570 find a suitable directory.  This procedure returns:
571 <itemizedlist>
572 <listitem><para>The path in environment variable TMP, 
573 if TMP is set.</para></listitem>
574 <listitem><para>Otherwise, the path in environment variable TEMP, 
575 if TEMP is set.</para></listitem>
576 <listitem><para>Otherwise, there is a per-user default which varies
577 between versions of Windows. On NT and XP-ish versions, it might 
578 be:
579 <filename>c:\Documents and Settings\&lt;username&gt;\Local Settings\Temp</filename>
580 </para></listitem>
581 </itemizedlist>
582 The main point is that if you don't do anything GHC will work fine;
583 but if you want to control where the directory is, you can do so by
584 setting TMP or TEMP.
585 </para></listitem>
586
587 <listitem>
588 <para>
589 To test the fruits of your labour, try now to compile a simple
590 Haskell program:
591 </para>
592
593 <screen>
594 bash$ cat main.hs
595 module Main(main) where
596
597 main = putStrLn "Hello, world!"
598 bash$ ghc -o main main.hs
599 ..
600 bash$ ./main
601 Hello, world!
602 bash$</screen>
603 </listitem>
604 </itemizedlist>
605
606 <para>
607 You do <emphasis>not</emphasis> need the Cygwin toolchain, or anything
608 else, to install and run GHC.
609 </para>
610 <para>
611 An installation of GHC requires about 340M of disk space.
612 To run GHC comfortably, your machine should have at least
613 64M of memory.
614 </para>
615 </sect2>
616
617 <sect2><title>Moving GHC around</title>
618 <para>
619 Once GHC is installed, you can freely move the entire GHC tree just by copying
620 the <filename>c:/ghc/<replaceable>ghc-version</replaceable></filename>
621 directory. (You will need to fix up 
622 the links in "Start/All Programs/GHC/<replaceable>ghc-version</replaceable>"
623 if you do this.)
624 </para>
625 <para>
626 It is OK to put GHC tree in a directory whose path involves spaces.  However,
627 don't do this if you use want to use GHC with the Cygwin tools, 
628 because Cygwin can get confused when this happens.
629 We havn't quite got to the bottom of this, but so far as we know it's not 
630 a problem with GHC itself.  Nevertheless, just to keep life simple we usually
631 put GHC in a place with a space-free path.
632 </para>
633 </sect2>
634
635 <sect2 id="winfaq">
636 <title>Installing ghc-win32 FAQ</title>
637
638       <variablelist>
639         <varlistentry>
640           <term>I'm having trouble with symlinks.</term>
641           <listitem>
642             <para>Symlinks only work under Cygwin (<xref linkend="install" />),
643           so binaries not linked to the Cygwin
644               DLL, in particular those built for Mingwin, will not work with
645               symlinks.</para>
646           </listitem>
647         </varlistentry>
648
649         <varlistentry>
650           <term>I'm getting &ldquo;permission denied&rdquo; messages from the
651             <command>rm</command> or <command>mv</command>.</term>
652           <listitem>
653             <para>This can have various causes: trying to rename a directory
654               when an Explorer window is open on it tends to fail. Closing the
655               window generally cures the problem, but sometimes its cause is
656               more mysterious, and logging off and back on or rebooting may be
657               the quickest cure.</para>
658           </listitem>
659         </varlistentry>
660       </variablelist>
661 </sect2>
662
663 </sect1>
664
665
666 <sect1 id="install-files"><title>The layout of installed files</title>
667
668 <para>
669 This section describes what files get installed where.  You don't need to know it
670 if you are simply installing GHC, but it is vital information if you are changing
671 the implementation.
672 </para>
673 <para> GHC is installed in two directory trees:</para>
674 <variablelist>
675 <varlistentry>
676 <term>Library directory,</term>
677 <listitem> <para> known as <filename>$(libdir)</filename>, holds all the 
678 support files needed to run GHC.  On Unix, this 
679 directory is usually something like <filename>/usr/lib/ghc/ghc-5.02</filename>. </para>
680 </listitem>
681 </varlistentry>
682 <varlistentry>
683 <term>Binary directory</term>
684 <listitem> <para> known as <filename>$(bindir)</filename>, holds executables that 
685 the user is expected to invoke.
686 Notably, it contains
687 <filename>ghc</filename> and <filename>ghci</filename>.  On Unix, this directory
688 can be anywhere, but is typically something like <filename>/usr/local/bin</filename>.  On Windows,
689 however, this directory <emphasis>must be</emphasis> <filename>$(libdir)/bin</filename>.
690 </para>
691 </listitem>
692 </varlistentry>
693 </variablelist>
694
695 <para>
696 When GHC runs, it must know where its library directory is.
697 It finds this out in one of two ways:
698 </para>
699 <itemizedlist>
700 <listitem>
701 <para>
702 <filename>$(libdir)</filename> is passed to GHC using the <option>-B</option> flag.
703 On Unix (but not Windows), the installed <filename>ghc</filename> is just a one-line 
704 shell script that invokes the real GHC, passing a suitable <option>-B</option> flag. 
705 [All the user-supplied flags
706 follow, and a later <option>-B</option> flag overrides an earlier one, so a user-supplied
707 one wins.]
708 </para>
709 </listitem>
710 <listitem>
711 <para> On Windows (but not Unix), if no <option>-B</option> flag is given, GHC uses a system
712 call to find the directory in which the running GHC executable lives, and derives 
713 <filename>$(libdir)</filename> from that. [Unix lacks such a system call.]
714 That is why <filename>$(bindir)</filename> must be <filename>$(libdir)/bin</filename>.
715 </para>
716 </listitem>
717 </itemizedlist>
718
719 <sect2> <title>The binary directory</title>
720
721 <para>The binary directory, <filename>$(bindir)</filename> contains user-visible
722 executables, notably <filename>ghc</filename> and <filename>ghci</filename>.
723 You should add it to your <literal>$PATH</literal>
724 </para>
725
726 <para>On Unix, the user-invokable <filename>ghc</filename> invokes <filename>$(libdir)/ghc-<replaceable>version</replaceable></filename>,
727 passing a suitable <option>-B</option> flag to tell <filename>ghc-<replaceable>version</replaceable></filename> where
728 <filename>$(libdir)</filename> is.
729 Similarly <filename>ghci</filename>, except the extra flag <literal>--interactive</literal> is passed.
730 </para>
731
732 <para>On Win32, the user-invokable <filename>ghc</filename> binary 
733 is the Real Thing (no intervening
734 shell scripts or <filename>.bat</filename> files). 
735 Reason: we sometimes invoke GHC with very long command lines,
736 and <filename>cmd.exe</filename> (which executes <filename>.bat</filename> files)
737 truncates them.  Similarly <filename>ghci</filename> is a C wrapper program that invokes <filename>ghc --interactive</filename>
738 (passing on all other arguments), not a <filename>.bat</filename> file.
739 </para>
740
741
742 </sect2>
743
744 <sect2> <title>The library directory</title>
745
746 <para>The layout of the library directory, <filename>$(libdir)</filename> is almost identical on
747 Windows and Unix, as follows.  Differences between Windows and Unix
748 are noted thus <literal>[Win32 only]</literal> and are commented below.</para>
749
750 <programlisting>
751   $(libdir)/
752     package.conf           GHC package configuration
753     ghc-usage.txt          Message displayed by ghc &ndash;&ndash;help
754     
755     bin/                   [Win32 only]  User-visible binaries
756          ghc.exe
757          ghci.exe
758
759     unlit                  Remove literate markup
760     
761     touchy.exe             [Win32 only]
762     perl.exe               [Win32 only]
763     gcc.exe                [Win32 only]
764    
765     ghc-x.xx               GHC executable [Unix only]
766    
767     ghc-split              Asm code splitter
768     ghc-asm                Asm code mangler
769
770     gcc-lib/               [Win32 only] Support files for gcc
771         specs              gcc configuration
772  
773         cpp0.exe           gcc support binaries
774         as.exe
775         ld.exe
776
777         crt0.o              Standard
778            ..etc..          binaries
779         
780         libmingw32.a        Standard
781            ..etc..          libraries
782
783         *.h                 Include files
784
785     imports/                GHC interface files
786         std/*.hi              'std' library
787         lang/*.hi             'lang' library
788         ..etc..
789
790     include/                 C header files
791         StgMacros.h           GHC-specific
792         ..etc...              header files
793
794         mingw/*.h            [Win32 only] Mingwin header files
795
796     libHSrts.a              GHC library archives
797     libHSstd.a
798     libHSlang.a
799       ..etc..
800
801     HSstd1.o                GHC library linkables
802     HSstd2.o                  (used by ghci, which does
803     HSlang.o                  not grok .a files yet)
804 </programlisting>
805
806 <para>Note that:
807 <itemizedlist>
808
809         <listitem>
810           <para><filename>$(libdir)</filename> also contains support
811           binaries.  These are <emphasis>not</emphasis> expected to be
812           on the user's <filename>PATH</filename>, but and are invoked
813           directly by GHC.  In the Makefile system, this directory is
814           also called <filename>$(libexecdir)</filename>, but
815           <emphasis>you are not free to change it</emphasis>.  It must
816           be the same as <filename>$(libdir)</filename>.</para>
817         </listitem>
818
819 <listitem>
820 <para>We distribute <filename>gcc</filename> with the Win32 distribution of GHC, so that users
821 don't need to install <filename>gcc</filename>, nor need to care about which version it is.
822 All <filename>gcc</filename>'s support files are kept in  <filename>$(libdir)/gcc-lib/</filename>.
823 </para> 
824 </listitem>
825
826 <listitem>
827 <para>Similarly, we distribute <filename>perl</filename> and a <filename>touch</filename> 
828 replacement (<filename>touchy.exe</filename>)
829 with the Win32 distribution of GHC. </para> 
830 </listitem>
831
832         <listitem>
833           <para>The support programs <filename>ghc-split</filename>
834           and <filename>ghc-asm</filename> are Perl scripts.  The
835           first line says <literal>#!/bin/perl</literal>; on Unix, the
836           script is indeed invoked as a shell script, which invokes
837           Perl; on Windows, GHC invokes
838           <filename>$(libdir)/perl.exe</filename> directly, which
839           treats the <literal>#!/bin/perl</literal> as a comment.
840           Reason: on Windows we want to invoke the Perl distributed
841           with GHC, rather than assume some installed one.  </para>
842         </listitem>
843 </itemizedlist>
844 </para>
845
846 </sect2>
847
848 </sect1>
849
850 </chapter>
851
852 <!-- Emacs stuff:
853      ;;; Local Variables: ***
854      ;;; mode: xml ***
855      ;;; sgml-parent-document: ("users_guide.xml" "book" "chapter") ***
856      ;;; End: ***
857  -->