|Version 7 (modified by 8 years ago) (diff),|
Installing GHC from a build tree
After GHC has been built, it can be installed on your system with
$ make install
This will build anything that isn't up-to-date, copy the files into the right places (see below) and make sure all the packages are registered properly.
If you are wondering where the make system is going to install, just say
$ make show VALUE=prefix
See the section on debugging the build system
Layout of the installed files
This section describes how the files of a GHC installation are laid out. The root of the GHC installation is specified via the
--prefix flag to
configure (see Running the configure script), and we refer to that location as
A GHC installation typically has three parts:
This is where the programs that you can run are installed, such as
Where all of GHC's support files are kept, including
package.conf, the header files, and the libraries. The location of
libdircan be found by asking GHC:
ghc --print-libdir. Normally you shouldn't have to look in here, and you shouldn't install extra files here. The only reason you might need to know the location of
libdirat all is for passing to the GHC API, and the best way to do that is to use the ghc-paths package.
Where the documentation is installed.
On Unix systems you can change
bindir using the
--bindir options respectively, and the location of the documentation can be changed using
--datadir. On Windows all you can do is change
$(prefix), because GHC finds the rest of its files by knowing their location relative to the
ghc.exe binary, so the layout of the install tree is fixed (see How GHC finds its files, below).
To see how the install directories are derived from
$(prefix), look in mk/config.mk.in.
The installed copy of MinGW on Windows
On Windows, GHC also comes with a copy of (most of) MinGW, in
$(prefix)/mingw. So for instance, you can invoke the
gcc that comes with GHC as
How GHC finds its files
GHC, when it starts, needs to find
libdir, so that it can read
package.conf, and find things like the
unlit program. It does this in one of two ways:
- On Windows,
libdiris in a fixed location relative to the
../lib. The advantage of the Windows way is that the installed GHC on Windows is independent of its location; it can be moved anywhere on the system, as long as the layout of the tree remains intact (however, links from the start menu and other shortcuts will break if you do this).
- On Unix, it is standard to be able to change
bindir, and also it is typically hard (or at least non-portable) to find the pathname to a running binary. So on Unix systems we use a different method: we make a wrapper script that passes the location of
libdirto the GHC binary proper using the
$(bindir)/ghcis a script that invokes
-B<libdir>, and the rest of the command-line arguments. All the other files that GHC needs are found by reading the