# Installing &tdevelop;

In this chapter we will discuss the steps necessary to compile and install the &tdevelop; IDE:

- How to obtain &tdevelop; mainly concentrates on downloading the most recent &tdevelop; sources from svn.

- &tdevelop; requirements lists the programs and libraries which you need installed to successfully compile the IDE.

- &tdevelop; compilation and installation leads you through all the steps of compilation and installation of the application.

- How to obtain a &tdevelop; &API; documentation tells what an API is and how you get such a useful tool for navigating the &tdevelop; sources.

## How to Obtain &tdevelop;

&tdevelop; is available in binary form from many different &Linux; distributions such as SuSE, RedHat and others. These binaries are packed in some convenient format, mostly RPM, for easy installation. To install, follow the standard instructions given in your distribution.

You may as well obtain the &tdevelop; sources, compile and install them by yourself. These sources can be found via the project home page at http://www.kdevelop.org or via the &kde; ftp site.

### Get Daily &tdevelop; Snapshots from svn

If you want to be in front of current development, anonymous svn repository snapshots are available.

The module name is tdevelop at `svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/tdevelop`.

#### Initial svn Checkout

To obtain an initial version of &tdevelop; you must download it from anonymous svn. For this so-called checkout operation follow these steps.

We assume you want to put your &tdevelop; copy into the `trinitysrc` subdirectory of your home directory (`~`).

- # Create the destination directory, if necessary:
- `~>` `mkdir trinitysrc`
- `~>` `cd trinitysrc`
- `~/trinitysrc>` `svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/tdevelop`
- `~/trinitysrc>` `cd tdevelop`

Once you have successfully checked out your &tdevelop; version, you may keep up with the changes using the update procedure shown in the next section.

Keep the server load low. Please do not checkout every time you want to keep your &tdevelop; up to date! Use svn update for this purpose.

Now you may compile your &tdevelop; version as shown in the &tdevelop; Compilation and Installation section.

#### Keeping Your svn Copy up to Date

After you checked out (and successfully compiled) &tdevelop; from svn as shown above, you'll want to keep it up to date in order to get all the patches. Follow these steps. (We again assume you have put your &tdevelop; copy into the `trinitysrc` directory.)

Note the `up` (= update) command instead of the `co` (which stands for checkout).

- `~>` `cd trinitysrc`
- `~/trinitysrc>` `cd tdevelop`
- `~/trinitysrc>` `svn up`

Keep an eye on the messages svn produces during the update sequence. The exact steps in the compilation sequence depend on this.

Now you can compile a new &tdevelop; version as shown in the Special svn compilation considerations chapter.

## &tdevelop; Requirements

In order to successfully compile and use &tdevelop;, you need the following programs and libraries. They are available on most platforms as distribution packages and thereby can be installed easily.

## Required:

- gcc/g++ ≥ 2.95.3 (or compatible)

  Available from gcc.gnu.org

- &GNU; make (or compatible)

  Available from www.gnu.org/software/make

- &perl; 5.004 (or higher)

  Available from www.perl.com

- autoconf ≥ 2.52 (or higher)

  Available from www.gnu.org/software/autoconf

- automake ≥ 1.6 (or higher)

  Available from www.gnu.org/software/automake

- flex 2.5.4 (or higher)

  Available from www.gnu.org/software/flex

- &Qt; ≥ 3.3.0 (or higher)

  Available from www.trolltech.com/products/qt

- KDE ≥ 3.4.0 (or higher)

  Available from www.kde.org

## Optional:

- The ctags source navigation tool, from http://ctags.sourceforge.net, which enables you fast access to declarations and definitions by a few simple clicks on a name in the editor.

- dot, a graphics language compiler, from http:/www.graphviz.org. This tool is needed in conjunction with &doxygen; below if you want to have class relationships graphically displayed (which is highly recommended).

- The &doxygen; documentation tool, from http://www.doxygen.org if you want to generate concise and powerful API documentation from your projects.

- valgrind from http://developer.kde.org/~sewardj/ helps you to find memory management problems in your applications.

- svn from http://subversion.tigris.org/ if you want to use the svn versioning system.

- Any other compiler and/or tool in case you want to develop for another language/platform than C++/&kde; or use some special facility.

1. You can, to a certain extent, circumvent the need for &autoconf; ≥ 2.52 and &automake; ≥ 1.6. Just remove the `admin` directory in your &tdevelop; installation directory and type

   - `(your-tdevelop-directory)>` `ln -s $TDEDIR/share/apps/tdelibs/admin admin`

   at the console. This causes &tdevelop; to use the standard settings in the &kde; `admin` directory instead.

2. Be careful not to mix &Qt; versions. Always link &tdevelop; to the same &Qt; version your &kde; library was compiled. Otherwise you will most likely experience very strange behaviours.

## &tdevelop; Compilation and Installation

Once all requirements are met, you are ready to compile and install &tdevelop;. This appendix will discuss the necessary steps to do so.

- Preliminary Steps tells you about setting up a proper environment.

- Compile &tdevelop; deals with obtaining the &tdevelop; sources from svn, how to prepare them for the installation process, and finally shows the steps necessary to compile and install &tdevelop;.

- Some Notes on configure Options tells you how to run &tdevelop; if it has been installed in a location other than the &kde; directory.

### Preliminary Steps

Before entering the compile sequence you must make sure all libraries and tools are available to the make system. To accomplish this some environment variables need to be properly set. The actual steps to be performed depend on the console shell you use.

To avoid typing in all the statements that set the necessary environment variables every time you want to compile, you should put them into your `.bashrc` or `.cshrc` file. This way the environment variables will be properly set every time you start the shell.

#### Setting the Environment for the bash Shell

If you use the bash shell add the following lines:

- `export TDEDIR=`(path to your KDE installation)
- `export TQTDIR=`(path to your Qt library)
- `export LD_LIBRARY_PATH=$TQTDIR/lib:$TDEDIR/lib:$LD_LIBRARY_PATH`
- `export LIBRARY_PATH=$TQTDIR/lib:$TDEDIR/lib:$LIBRARY_PATH`
- `export PATH=$TQTDIR/bin:$TDEDIR/bin:$PATH`

#### Setting the Environment for the tcsh Shell

If you use the tcsh shell add the following lines:

- `setenv TDEDIR` (path to your KDE installation)
- `setenv TQTDIR` (path to your Qt library)
- `setenv LD_LIBRARY_PATH=$TQTDIR/lib:$TDEDIR/lib:$LD_LIBRARY_PATH`
- `setenv LIBRARY_PATH $TQTDIR/lib:$TDEDIR/lib:$LIBRARY_PATH`
- `setenv PATH $TQTDIR/bin:$TDEDIR/bin:$PATH`

### Compile &tdevelop;

In the following discussion we assume that you have put your &tdevelop; sources in the `~/trinitysrc/tdevelop` directory.

#### Special svn Compilation Considerations

In case you use a &tdevelop; snapshot from svn the initial compilation steps depend on whether you just did a complete checkout or only updated the source.

After a svn Checkout

- You must initialize the make system after a fresh checkout. The same is true every time you need to start over from scratch. Type:

  - `~/trinitysrc/tdevelop>` `make -f admin/Makefile.common svn-clean`

  and then all of the following steps.

  You might need access to the svn repository for the clean-up if any corrupted or missing files must be reconstructed.

  The `svn-clean` command will remove every file not in svn from the directory! Make sure to back up any valuable information before you issue this clean-up command.

After a svn Update

- The next step depends on the output of the svn update sequence. If you got something like (there may be a U or a P marker in the leftmost column, both denoting the file has been changed):

      U /some_directory_path/Makefile.am

  or if you just did a full checkout, you must enter:

  - `~/trinitysrc/tdevelop>` `make -f Makefile.svn`

  before you proceed with all of the following steps.

#### Basic `make` Command Sequence

Once the basic make system is set up you must decide which type of the &tdevelop; system you want to use. This is done in the following configure step which builds the actual `Makefile`s the `make` command will use.

You may drop the `--prefix` option in the following `configure` command lines if you want &tdevelop; be installed in the default &kde; directory. See the Some notes on configure options chapter for this.

A Debug-Compiled Version

- If you want to keep track of what your &tdevelop; application does at run-time you may build a debug-compiled version. Just command `configure` to do so:

  - `~/trinitysrc/tdevelop>` `./configure --enable-debug=full --prefix=`(where-your-trinity-is)

A Release-Compiled Version

- If you only want to use &tdevelop; as-is a (smaller and faster running) release version suffices. `configure` defaults to this.

  - `~/trinitysrc/tdevelop>` `./configure --prefix=`(where-your-trinity-is)

  If you want to build your own API documentation for &tdevelop; you must include yet another option in the `configure` command:

  - `~/trinitysrc/tdevelop>` `./configure --`(options-as-above) `\`
  - `--with-tdelibsdoxy-dir=$TDEDIR/share/doc/tde/HTML/en/tdelibs-apidocs`

Make and Install &tdevelop;

- `configure` will check the system and build some `Makefile`s according to what it found. The `make` command will use the main `Makefile` by default. Thus

  - `~/trinitysrc/tdevelop>` `make`

  suffices. If necessary, now gain root user rights using the command

  - `~/trinitysrc/tdevelop>` `su`

  and entering the root password. Then install the application:

  - `~/trinitysrc/tdevelop>` `make install`

  That's all. If you installed &tdevelop; in the default &kde; directory you may now run the IDE. Otherwise some additional steps will be necessary as shown in the Non-default installation directory section below.

  In fact there usually will have been three &tdevelop;-based applications installed:

  - The &tdevelop; IDE — this is the place where you will usually work.

  - The stand-alone &tdevelop; Assistant documentation browser — isolates all the powerful documentation facilities of the &tdevelop; IDE in a separate tool. This comes in handy when you want to look up some programming documentation but do not want to start the full IDE.

  - The &tdevelop; Designer — enhances the &Qt; User Interface Designer by &kde; specific elements and integrates nicely in the &tdevelop; IDE.

### Some Notes on `configure` Options

#### Non-default Installation Directory

By default `configure` prepares the IDE to be installed in the default &kde; directory. This is necessary because &tdevelop; assumes direct access to some tools and parts which reside there. If want to use your own installation directory, you must tell `configure` this by the `--prefix` option:

- `~/trinitysrc/tdevelop>` `./configure --prefix=`(where-your-trinity-is)

There is a caveat if you do so. You must provide a means for &tdevelop; to access the needed tools and parts in the &kde; directory when running. (You can still use the IDE without doing so, but with very restrained capabilities.)

Call up a shell and have the following commands executed before you start &tdevelop; at the shell prompt.

Take care to use the plural: It is `TDEDIRS`, not just `TDEDIR`)

- `~>` `export TDEDIRS=/usr/local/kde:/opt/trinity`
- `~>` `tdebuildsycoca`
- (Now start &tdevelop;:)
- `~>` `tdevelop`

- The `TDEDIRS` environment variable must be set to the list of active &kde; directories in your system. We use
- `/usr/local/kde`:`/opt/trinity`
- as an example only.
- The `/usr/local/kde` directory may for instance contain an incomplete &kde; version you compiled for debug purposes, and the `/opt/trinity` directory may in addition contain the standard &kde; version from your distribution that is used for everyday work.

In a tcsh shell you must set the environment variables using:

- `~>` `setenv TDEDIRS /usr/local/kde:/opt/trinity`

The `tdebuildsycoca` command (build system control cache) looks around for libraries and caches their location and version, so that &tdevelop; can find them. The caveat is that it takes noticeable time—and it has to be run any time you call up the shell to start &tdevelop; from a non-default directory. You may want to put the above commands into a shell script to reduce the typing effort.

(You could as well put the lines in your `.bashrc` or `.cshrc` file, but this is not advisable as `tdebuildsycoca` will then be run any time you call up the shell.)

The `tdebuildsycoca` command does not run from within the root. You must call it from a non-root user. (But is not a very good idea after all to do software development from within the root!)

## How to Obtain a &tdevelop; API Documentation

API is the short form of Application Program Interface. Actually such an API cotains a series of descriptions (&ie; calling conventions) by which an application program can access the operating system and other services. In our context, however, a broader definition was adopted. The API of a &kde; or &Qt; application is an abstract of the classes and methods interfaces, a synopsis to be used like a dictionary to navigate the sources.

There is a version of the most current API available at the KDevelop-Home website. It will be automatically updated every 24 hours so you can keep up.

Alas, this version is best used read-only over the internet. If you do not always have internet access you may as well build your own API documentation from the &tdevelop; sources. To do so, you must tell the automake system where to find the KDELIBS API in your system. This is accomplished by the special option `--with-tdelibsdoxy-dir` in the `configure` command when you prepare to compile the &tdevelop; sources:

- `~/trinitysrc/tdevelop>` `./configure --`(options-as-usual)`\`
- `--with-tdelibsdoxy-dir=$TDEDIR/share/doc/tde/HTML/en/tdelibs-apidocs`

(`make` will replace the global `$TDEDIR` variable with the actual &kde; directory setting recorded therein.) Then issue a `make` command as usual. After the &tdevelop; IDE has been built you have the option to build the API as well. For this you must issue

- `~/trinitysrc/tdevelop>` `make apidocs`

This will build a `Doxyfile` in your &tdevelop; base directory which in turn will be processed by the Doxygen application to build quite a lot of `.html` API files. When this rather lengthy API building process (may last more than an hour on a slow system) finally comes to an end, you must install the API just like you have to install the &tdevelop; IDE itself. If necessary obtain superuser rights by

- `~/trinitysrc/tdevelop>` `su`

and entering the root password. Then install the API files:

- `~/trinitysrc/tdevelop>` `make install-apidox`

Once this is done, `make` will inform you about the directory where you can finally look at the API documentation's contents. Note this address, you can use it from &konqueror; as well as from inside &tdevelop;, in case you have set up the &tdevelop; sources themselves as a project to work on.

You will most probably see a lot of warning and/or error messages during the API build run by Doxygen. It is best to ignore them, they are of interest to the &tdevelop; developers only. If the API generation ever comes to a successful end, the `.html` API files will be usable.