Installation hints for lazarus
==============================

Lazarus provides two main parts:
- LCL - the Lazarus Component Library
- IDE - the RAD tool

What is required for lazarus:
- FreePascal - the FreePascal Compiler plus packages plus fpc sources.
               IMPORTANT: try to get the same version of the sources and the
                          installed compiler.
- Under Linux/xxxBSD: gtk libaries - Most distributions already install them.
     See www.gtk.org. You need gtk 1.x. The new gtk2 is not yet supported.


The FAQ - Frequently Asked Question is available at www.lazarus.freepascal.org
  and some can be found in the file 'FAQ'.


The following will describe how to get FreePascal and how to install lazarus
properly:

================================================================================
1. Quick installation guide

--------------------------------------------------------------------------------
1.1 This is the short version. For more details, see the following sections.

  Lazarus is intended to be a development tool. Therefore it is designed, that
  any normal user can easily install his local copy. This means, lazarus does
  not need to be installed as root and it does not any sym links or config
  entries. You can literally just unpack it into a directory of your choice and
  compile it.


1.2 Under Linux/BSD:

  Make sure, that you have installed X, gtk1 and gtk1-devel.

  Download and install FreePascal. Either the rpm, tgz or the daily snapshot.
  You need at least fpc 1.0.10 (1.0.x is the stable version of fpc, the 1.9 is
  the development version).

  To compile lazarus (LCL + IDE) go to your unpacked lazarus source and do:
  []$ make clean all

  You don't need "./configure" and you don't need "make install". You now have
  already a complete lazarus. You can start the IDE with "./lazarus".
  The "make install" as root will just copy the files and set some nice sym
  links and desktop entries.


1.3 Under Mac OS X:

  What you need: Apple Developer-tools, X11, gtk1.2:

  1. Developer-tools: Are included on the original OSX installation-CDs, or
  download at ADC (free registration required)
  http://developer.apple.com/.

  2. Apple X11: On a fresh system: choose "Customize" in the install-dialogue,
  check "X11". On an already installed system: download at
  http://www.apple.com/downloads/macosx/apple/x11formacosx.html
  The X11-Application is in /Applications/Utilities/X11.

  3. gtk1.2: The gtk is installed easily with a package manager like fink.
  Download fink from
  http://fink.sourceforge.net/download/index.php?phpLang=en
  and follow the install instructions.

  In the Terminal, run
  sudo fink install gdk-pixbuf gtk+ gtk+-data \
    gtk+-shlibs gtk-doc 1.2-13 gtkglarea gtk-engines


  Starting any gtk application (including lazarus apps) will start with the gtk
  default theme, which does not look very nice on Mac. There are some aqua
  themes. For example: AquaGraphite or Aque.


================================================================================
2. Installing FreePascal

--------------------------------------------------------------------------------
2.1 Installing FreePascal under Linux:

  Lazarus requires a fpc (FreePascal) version 1.0.10 and it requires both - the
  compiled fpc libs (binaries) and the fpc sources. The fpc 1.0.6 is too buggy.

  The fpc binaries:
  At the lazarus downloads section (www.lazarus.freepascal.org
  or http://sourceforge.net/project/showfiles.php?group_id=89339) you can get
  the rpm/deb of the freepascal compiler(compiler / linux) and its packages.
  Or if you don't have a rpm system, you can download and install the tars from
  the www.freepascal.org.
  If you want to compile the binaries for yourself see the BSD section.

  The fpc sources:
  The easiest way to get the freepascal sources is via svn. Of course you can
  also download it as whole, see http://www.freepascal.org/develop.html
  for the daily snapshot of the release tree (2.0.x).

  The fpc sources via svn:
  Create a directory, where you would like to put the sources. You don't need
  to be root to do this. Any normal user can do this.
  First create a directory for fpc (e.g. /home/username/freepascal) then do
  the following:

  []$ bash
  []$ svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc

  This will create a directory fpc, which can be later used in the IDE.

  Hint:
  To download/update the latest changes you can simply do

  []$ cd /home/username/freepascal/fpc
  []$ svn up



--------------------------------------------------------------------------------
2.2 Installing FreePascal under Windows:

    ToDo: Write me.
    
  See http://www.freepascal.org/down-win32.html. You can find a list of mirrors
  at http://www.freepascal.org/sdown.html. Download for example fpc as one big
  file, unzip it and run the install.exe. Then extend your PATH variable to the
  fpc directory. For example under win98: Edit autoexec.bat and add the line
  PATH=%PATH%;C:\pp\bin\bin\win32
  Then restart win98.

  ToDo: explain how to download fpc sources and build the compiler


--------------------------------------------------------------------------------
2.3 Installing FreePascal under BSD/manually:

 Read 1.2 first.
 
 Effectively, you need:

 - a file with all sources, or two (fpc and lazarus)
    (1) e.g. for fpc  ftp://ftp.freepascal.org/fpc/dist/Linux/separate/sources.tar
     preferably an export (no SVN/ dirs). The above file misses this
    (2) Lazarus source snapshot.
  - _any_ starting compiler from the 1.0 branch) You can do a check by parsing
	the output of ppc386 -i   if it is 1.0.6 .. 1.0.8 it is ok.
  - dependant packages. (for FreeBSD that is gtk12, glib12 and gdk_pixbuf and
    GNU make, iconv and gettext)


  FPC build:

  (1) (fetch)   necessary files (FPC source, starting compiler)
  (2) (extract) Then de-tgz in work directory,
  (3  (build)   enter work/fpc/  and run

  	$MAKE all OPT='-gl -O3p3'  PP=/path/to/startingcompiler-name-ppc386

  	(/path/to/ can be omitted when ppc386 is in the path)
        ($MAKE is make on linux and gmake on BSD)

  (4) (install) then, again in work/fpc, run
  	$MAKE install PP=compiler/ppc386 PREFIX=$THEPREFIX

  	(THEPREFIX= usually is /usr/lcoal, but e.g. on NetBSD it is /usr/pkg
  	            for ports)

       Create a symlink
         ln -s $THEPREFIX/lib/fpc/1.0.8/ppc386 $THEPREFIX/bin/ppc386

       install sourceinstall PREFIX=$THEPREFIX

  (5) (configure) run compiler/utils/samplecfg  $THEPREFIX/lib/fpc/1.0.8 $ETCDIR
  (6) (optional, test), see if ppc386 -i gives output, else give a warning
                        that user need to add $PREFIX/bin to his current path.
      Try to compiler a program with -viwn, and see if that gives errors.


  Notes:
  - If you need fpcmake package lists, you need to generate or supply them
    yourself, (in the port, or in an extra archive)
    either way, do a dummy install to /tmp/pack and determine the files
    installed with find . >ll

  - $THEPREFIX and $ETCDIR should be user configurable. Otherwise local installs
  	aren't possible.

  - BSDHIER=1 on all make commands forces BSD hierarchy conventions.


--------------------------------------------------------------------------------
2.4 Installing FPC on Mac OS X

  Read 1.3 first.

  Information:
  http://www.freepascal.org/fpcmac.html#TargetDarwin

  Download the latest Mac OS X dmg package.
  Since fpc for Mac OS X is under heavy development, it s recommended to use
  the latest fpc from svn.

  Open a terminal and type (without the []$)
  
  []$ svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc

  This will create a directory fpc, which can also be later used by the IDE.
  
  Compile fpc:
  
  []$ make clean all
  
  Install fpc
  
  []$ sudo make install
  
  This will install fpc in /usr/local/bin. The compiler is for example
  /usr/local/bin/ppcppc. You can add the path to your /Users/username/.profile.


  Hint:
  To download/update the latest changes you can simply do

  []$ cd /Users/username/fpc
  []$ svn up


================================================================================
3. Installing Lazarus

--------------------------------------------------------------------------------
3.1 Installing Lazarus under Linux/BSD/MacOSX:

  Because the whole lazarus stuff is installed into one directory, uninstall
  is very easy and you don't need to be root to install lazarus.
  You can get tgz/zip files from the downloads section or you can download it
  directly via svn.
  
  ToDo: more details about the tars.
  
  Downloading lazarus svn: svn provides an easy way to update your sources by
  only downloading the changes. This is the recommended way and saves you a lot
  of time. A connection to the internet is needed for this:
  You don't to be root. Lazarus does not need any special permissions, neither
  during installation nor at runtime.
  First create a directory for lazarus (e.g. /home/username/freepascal) then do
  the following:
  
  connect to the svn server (note: lazarus and freepascal use the same server)
  
  []$ svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus

  compile lazarus:

  []$ cd lazarus
  []$ make          (gmake on BSD)

  If fpc is installed correct, the compilation should work without problems. If
  not, see FAQ.
  Start lazarus

  []$ ./lazarus

  The IDE should start. If you started lazarus in a terminal, you can see some
  notes about missing settings. This is normal at first start.
  The IDE automatically tries to find out where the freepascal compiler and its
  sources are installed by searching in the most common directories.
  Check the paths:
    Use the IDE menu to go to
      Environment -> Environment Options -> Files

    The 'FPC Source directory' should point to your fpc source directory. This
    directory normally ends with /fpc/ or /fpcsrc/ (e.g. /usr/share/fpcsrc or
    /home/username/freepascal/fpc) and
    contains directories like 'compiler', 'docs', 'fcl', 'rtl' and 'packages'.

    ToDo: explain the other paths


  Hint:
  To update lazarus you can use

  []$ cd /home/username/freepascal/lazarus
  []$ svn up
  []$ make clean all   (gmake on BSD)
  
  This will rebuild lazarus and create an IDE without lazarus packages. To
  link your installed packages do *after* the above:
  
  []$ make idepkg


--------------------------------------------------------------------------------
3.1 Installing Lazarus under Windows:

  Under windows the IDE does not run well. So don't expect too much.

  Thx to Joe for this Step-by-step description:

  You have to download the lazarus source:
  ftp://ftp.freepascal.org/pub/fpc/source/lazarus.zip

  Then unzip it to c:\lazarus for example.
  You have to install at least fpc1.0.6. It compiles to me and lazarus.exe
  works. The path to my fpc is: c:\pp\bin\win32. In this directory you
  can find a lot of exe (make, grep, ppc386, and so on).

  Open a command line. Start->Run...>command or choose MS-DOS icon.
  Type:
  cd c:\lazarus
  set path=c:\pp\bin\win32;c:\lazarus  //of course change the first to
                                       //the path of yours
  windres -i lazarus.rc -o lazarus.res
  make

  If you are lucky then you can type: lazarus.exe
  At this moment I do not suggest to try source editor (if you compiled
  with 1.0.6 on win98se). Maybe you have to reboot. Dialogs work and the
  property editor but... Look and you will see.
  (With fpc1.0.7 no hangs.)

  You can compile examples also:
  cd examples
  make

  If you extracted lazarus to another drive, eg.: d:\lazarus. It can happen
  that you need the gnu utility to make it. If you have it, you can take its
  path to set path=...;<gmakepath> but it is simpler not to choose drive d:\

  That's all.



