Installation
************

   GNUstep-HOWTO

   Last Update: 11 March 1998

   This document explains how to build the different components
   of GNUstep.

   Copyright (C) 1996 - 1998 Free Software Foundation, Inc.

   Authors:  Pascal Forget <pascal@wsc.com>,
             Ovidiu Predescu <ovidiu@net-community.com>,
             Adam Fedor <fedor@doc.com>.

   This file is part of GNUstep.

Introduction
============

This document explains how to build the GNUstep project along with all
the tools required to develop applications with it.

In order to easily compile and debug GNUstep projects, you will need the
latest GNU ObjC compiler `GCC' and a modified version of the GNU
debugger `GDB'.

You will need at least 80Mb of hard disk space in order to compile the
GNUstep project.  Luckily, you can delete the object files and the
uncompressed source code after each piece of the project has been
successfully built and installed in order to save some space.  The
biggest offender is the GCC compiler, which eats up 50Mb of hard disk
space while it compiles.

Summary
=======

Currently, you pretty much need to get and install the latest versions
of the following packages:
     GCC or egcs
     GDB and patch to make it work with better Objective-C
     GNU make
     TIFF library
     DGS or Adobe DPS
     gstep-core which is composed of the individual packages:
       gstep-make
       gstep-base or libFoundation
       gstep-gui
       gstep-xdps
       FoundationExt

Getting the files
=================

Most of the files needed by GNUstep are available from the following ftp
sites. Except for GCC, GDB, GNU make and TIFF, alpha.gnu.org and
ftp.gnustep.org should contain the latest versions of all the required
packages.

`ftp://ftp.gnu.org/pub/gnu'
     GCC, GDB, and other GNU tools, and GNUstep public releases

`ftp://ftp.sgi.com/graphics/tiff'
     TIFF library

`ftp://alpha.gnu.org/gnu/gnustep'
     GNUstep developer releases and snapshots

`ftp://ftp.gnustep.org/pub/gnustep'
     All GNUstep releases

You need the following packages of either the version given or any later
version, in order to compile GNUstep.

     gcc-2.8.0.tar.gz (The GCC compiler)
       ftp://ftp.gnu.org/pub/gnu or from other GNU mirror sites.
       You can also use egcs-1.0.1.tar.gz, from ftp://ftp.cygnus.com/pub/egcs
     
     gdb-4.16.tar.gz (The GDB debugger)
     make-3.75.tar.gz (You need GNU make to compile GNUstep).
       ftp://ftp.gnu.org/pub/gnu or from other GNU mirror sites.
     
     gdb-4.16-objc-971112.diff.gz (A patch for easier debugging of Objective-C).
       ftp://alpha.gnu.org/gnu/gnustep
     
     tiff-970711.tar.gz (The TIFF library), or
       you can use tiff-v3.4beta036-tar.gz or greater version
       ftp://ftp.sgi.com/graphics/tiff/
       ftp://alpha.gnu.org/gnu/gnustep
       ftp://ftp.gnustep.org/pub/gnustep
     
     pcthreads-1.1.0.tar.gz (PCThreads for Linux/GNU Inel x86 systems)
       ftp://alpha.gnu.org/gnu/gnustep
       ftp://ftp.gnustep.org/pub/gnustep
     
     gstep-core-0.5.0.tar.gz (Contains gstep-make, -extensions, -base, -gui, -xdps)
     gstep-make-0.5.0.tar.gz (Makefile package)
     gstep-base-0.5.0.tar.gz (Foundation)
     gstep-gui-0.5.0.tar.gz (AppKit)
     gstep-xdps-0.5.0.tar.gz (X11/PostScript backend)
     extensions-0.5.0.tar.gz (Foundation extensions)
     dgs-0.5.0.tar.gz (The Display Ghostscript distribution)
       ftp://ftp.gnu.org/pub/gnu
       ftp://ftp.gnustep.org/pub/gnustep
       ftp://alpha.gnu.org/gnu/gnustep
     
     libFoundation-0.8.0.tar.gz (Alternate Foundation)
       ftp://ftp.gnustep.org/pub/gnustep
       ftp://alpha.gnu.org/gnu/gnustep
       ftp://ftp.gnu.org/pub/gnu

You may get either one of the Foundations libraries (you only need to
take one of them, not both) gstep-base or libFoundation.

Note that you should get the latest version available, not necessarily
the one listed here. For the more adventurous, and since the project is
still in development, it might be better to get the latest snapshot
located in the snap or snapshot subdirectories at
ftp://alpha.gnu.org/gnu/gnustep/snap or the other appropriate ftp
locations.

For the following instructions, some version numbers are replaced by
XXX.  You shoule replace the 'X's with the version of the package you
have.

Compiling and Installing the packages
=====================================

Compiling GNU make
------------------

GNU make is required to compile all GNUstep packages.

     cd /usr/src
     tar fvxz make-XXX.tar.gz
     cd make-XXX
     ./configure
     make
     su root
     make install

Compiling PCThreads
-------------------

For Linux/GNU systems on Intel x86 processors, the PCThreads library is
known to work with GNUstep.  PCThreads version 1.1.0 is an enhanced
version of PCThread 1.0.0 with better support for GNUstep.

     cd /usr/src
     tar fvxz pcthreads-1.1.0.tar.gz
     cd pcthreads-1.1.0
     ./configure
     make
     su root
     make install

If you are using the GNUstep makefile package and wish PCThreads to be
installed with the GNUstep directory structure; then you should specify
the GNUstep system root as the prefix when you configure the package.

     ./configure --prefix=$GNUSTEP_SYSTEM_ROOT

Compiling GCC
-------------

The following commands assume that all the aforementioned files have
been copied to the /usr/src directory on your machine.  If you already
have GCC 2.8.0 installed on your system then there is no need to compile
it again, just set up your PATH so that the new GCC is used for
compiling GNUstep.

Special note for Solaris users.  GNUstep works on Solaris/Intel systems;
however, GCC 2.8.0 has problems, so you must use the older patched GCC
2.7.2 instead.  GCC 2.8.0 has also induced a problem on Solaris/Sparc
systems; however, there is a patch to fix this in the contrib directory
on the ftp sites.

1. Uncompress GCC:
       cd /usr/src
       tar fvxz gcc-2.8.0.tar.gz

2. Configure the GCC compiler's makefile for your machine:
       ./configure

     If you are using the GNUstep makefile package and wish GCC to be
     installed within the GNUstep directory structure; then you should
     specify the GNUstep system root as the prefix when you configure
     the package.  This setup requires that you compile and install the
     GNUstep Makefile Package before configuring GCC.

       ./configure --prefix=$GNUSTEP_SYSTEM_ROOT

     To enable multiple threads in the Objective-C library use the
     --ENABLE-THREADS=LIB argument to configure, where LIB is the
     thread library to use or --DISABLE-THREADS to use a
     single-threaded Objective-C runtime.  If your system has a native
     threads library, like Solaris or SGI, then the --ENABLE-THREADS
     parameter without the LIB specification will use that native
     threads library.

4. Compile GCC
     make bootstrap

5. Wait
       If you have a Pentium Pro, go drink a coffee.
       If you have a fast Pentium, count from 0 to 100 in your head.
       If you have a slow Pentium, go eat a bagel.
       If you have a 486, go watch the news.
       If you have a 386, come back tomorrow.

6. Install GCC
       su root
       make install

7. Delete the GCC directory if you're low on disk space
       rm -rf /usr/src/gcc-2.8.0

Patching and Compiling GDB
--------------------------

Uncompress GDB, and patch it:
       cd /usr/src
       tar fvxz gdb-4.16.tar.gz
       gunzip gdb-4.16-objc-971112.diff.gz
       cd gdb-4.16
       patch -p1 < ../gdb-4.16-objc-971112.diff

Configure, compile and install GDB:
       cd /usr/src/gdb-4.16
       ./configure
       make
       su root
       make install

     If you are using the GNUstep makefile package and wish GDB to be
     installed with the GNUstep directory structure; then you should
     specify the GNUstep system root as the prefix when you configure
     the package.  This setup requires that you compile and install the
     GNUstep Makefile Package before configuring GCC.

       ./configure --prefix=$GNUSTEP_SYSTEM_ROOT

4. Make sure GDB is where you think it is
     On Linux/GNU, GDB should be installed in /usr/bin, whereas on other
     systems, the default installation path is usually /usr/local/bin.
     If you have a Linux/GNU box, you can do this:

       ln -s /usr/local/bin/gdb /usr/bin/gdb

     Note that this is only a suggestion, you are free to do whatever
     you want.

Installing the GNUstep libraries
--------------------------------

If you have the gstep-core package, you can make and install all the
GNUstep core packages at one time. If you already have a TIFF library
and a Display Postscript system installed, you can do this following the
example instructions below.  If you don't already have a TIFF library or
DPS, you have to do things in a slightly different order.

If you have the separate gstep packages, skip to the next section
(Installing the Makefile package).

First decide where you want the GNUstep files to go, and use this as an
argument to configure. If you don't choose a location, the default is
/usr/GNUstep.  The example below shows how to configure the packages
for installation in /usr/local/GNUstep.

If you don't have the TIFF library or DPS, first make and install the
Makefile package, the TIFF library and DGS, as shown in the following
three sections.

After you have TIFF and DPS/DGS installed, make the core libraries:

     tar fvxz gstep-core-XXXXX.tar.gz
     cd gstep-core-XXXX
     ./configure --prefix=/usr/local/GNUstep
     make
     su root
     make install

With the various GNUstep libraries you can use the various switches,
shared, debug. As in ``make shared=no debug=yes'' (Make sure you use
the same switches for every package you compile, and also when you
install).

Skip to the Additional Instructions sections to finish up installation
of the GNUstep system.

Installing the Makefile package
-------------------------------

Decide where you want the GNUstep files to go, and use this as an
argument to configure in the makefile package. If you don't choose a
location, the default is /usr/GNUstep.  The example below shows how to
configure the packages for installation in /usr/local/GNUstep.

     tar fvxz gstep-make-XXXXXX.tar.gz
     cd gstep-make-XXXXXX
     ./configure --prefix=/usr/local/GNUstep
     make
     su root
     make install

If you are using, or intend to compile the GCC Objective-C runtime with
threads, you need to specify the thread package you are using when
running configure:

     LIBS=-lpthread; ./configure --prefix=/usr/local/GNUstep

After this you should add the shell script `GNUstep.sh' in the makefile
package to you initialization file (such as `.profile'). For instance:

     . /usr/local/GNUstep/Makefiles/GNUstep.sh

in your `.profile' file will work. It defines environment variables that
are needed to find GNUstep files and executables.  Users of csh need to
change the `GNUstep.sh' script so it will work with csh. Read the
`README' for more info.

GNUstep packages will automatically install in this directory
structure. You can install other packages (such as GCC) in the same
structure if you specify the GNUstep system root as the prefix when you
configure the package.

     ./configure --prefix=$GNUSTEP_SYSTEM_ROOT

Compiling the TIFF library
--------------------------

You don't need a customized version of the TIFF library, or necessarily
even the newest one, but the customized version located at the GNUstep
ftp sites will install in the GNUstep directory structure.

       cd /usr/src
       tar fvxz tiff-XXXXX.tar.gz
       cd tiff-XXX
       ./configure
       make
       su root
       make install

Building DGS
------------

If you have a real Display Postscript system already on your computer,
you don't necessarily need DGS. Linux/GNU michines need DGS.  You can
also read the file DGS-HOWTO located at the ftp machines listed above.

       tar fvxz dgs-XXXXXX.tar.gz
       cd dgs-XXXXXX/dgs
       ./configure
       make
       su root
       make install

Building a Foundation library
-----------------------------

If you work with gstep-base:

       cd /usr/src
       tar fvxz gstep-base-XXXXXX.tar.gz
       cd gstep-base-XXXXXX
       ./configure
       make
       su root
       make install

On some Linux systems, you may have to change the optimization level
(particularly if you get an error compiling mframe.m):

       make OPTFLAG=-O

If you work with libFoundation:

       cd /usr/src
       tar zxf libFoundation-0.8.0.tar.gz
       cd libFoundation-0.8.0/libFoundation
       ./configure --with-gnustep
       make
       su root
       make install

Building the GUI libraries
--------------------------

Compile the GUI library:

       cd /usr/src
       tar zxf gstep-gui-XXXXXX.tar.gz
       cd gstep-gui
       make
       su root
       make install

Compile the XDPS library:

       cd /usr/src
       tar zxf gstep-xdps-XXXXXX.tar.gz
       cd gstep-xdps
       ./configure
       make
       cd Testing
       make

Building the Foundation extensions
----------------------------------

The Foundation extensions have some useful features in them. The one
reason you definitely might want to use it is to read in GNUstep model
files which store User Interface structures in ASCII format, and can
also be used to translate NeXT and OpenStep NIB files to GNUstep model
format.

Compiling:

       cd /usr/src
       tar zxf FoundationExt-XXX.tar.gz
       cd extensions
       make
       su root
       make install

Additional Installation
=======================

If you haven't already done so when installing the Makefile package,
you should add the shell script `GNUstep.sh' in the Makefile package to
you initialization file (such as `.profile'). For instance:

     . /usr/local/GNUstep/Makefiles/GNUstep.sh

in your `.profile' file will work. It defines environment variables that
are needed to find GNUstep files and executables.  Users of csh need to
change the `GNUstep.sh' script so it will work with csh. Read the
`README' for more info.

Set up your home GNUstep directory. This is where user defaults are
kept, and in the future, other files may be kept there.

     cd
     mkdir GNUstep

Next, set your local time zone.  There are three ways to do this, pick
one:

  1. Use the dwrite utility to set ``Local Time Zone'' to your local
     time zone.

  2. Set the TZ environment variable.

  3. Create the file





     `$GNUSTEP_SYSTEM_ROOT/Libraries/Resources/gnustep/NSTimeZones/localtime'
     with the name of the local time zone in it.

Finally, run the tests in the Testing directory. Use the openapp utility
that is part of the GNUstep makefile package (and stored in
`$GNUSTEP_SYSTEM_ROOT/Tools'). Usage is:

     openapp [--library-combo=...] application [additional arguments to app]

Good Luck!

