# Eclipse Source Builds (Source from Zip)

## Table of Contents

1. What is an Eclipse source build?
2. Getting the source
3. Building Eclipse using Ant
4. Setting the bootclasspath
5. Supported build platforms
6. Known limitations

## What is an Eclipse Source Build?

Eclipse source builds provide developers with an automated method for compiling the Java code, generating javadoc, and finally, creating a zip file of an Eclipse runtime from a downloaded source tree. The end result of a source build is a runnable Eclipse.

## Getting the Source

This source build download contains all the Java code, non-Java resources, and scripts that build a particular version of Eclipse. Although you can manually edit build.xml files in each feature and plug-in, they are typically generated by the Eclipse pde-build plug-in. As a result you will need to download a fresh source build zip file when major changes occur to Eclipse source, such as the addition or removal of plug-ins. The version of Eclipse a particular source build will create is embedded in the source build zip file name. For example, eclipse-sourceBuild-srcIncluded-3.0.zip builds Eclipse version 3.0

## Building Eclipse using Ant and a JDK

#### Description

Produces an Eclipse SDK using the Java compiler you have installed.

#### System Requirements

1. Ant 1.6.1 or higher
2. 1.4, 1.5 and 1.6 JDKs.
3. Info-Zip zip and unzip executables on system path. Tar for *nix distributions
4. 1 GB free disk space
5. Source build zip from eclipse.org

#### Initial Setup

Install Ant and a JDK as per each program's instructions. Minimally you will need the following environment variables set.

1. Add the Ant bin directory to your path.
2. Set the JAVA_HOME environment variable to the root of your 1.6 JDK installation.
3. Set the ANT_HOME environment variable to the root of your Ant installation.
4. (Windows 98) Increase the default environment space as specified here.

#### Run the Build

1. Extract the eclipse-sourceBuild-srcIncluded-*.zip to an empty directory. Extract using tar if using a *nix drop.
2. cd to the directory.
3. Update the build.properties file included at the root of this zip to point to the bootstrap classpath of your 1.4, 1.5, and 1.6 JDK locations.
4. Execute build -os <osType> -ws <windowSystemType> -arch <architecture> [-bc <bootclasspath>] [-target <target>]

Parameter Name | Description
osType | Target operating system (See supported types).
windowSystemType | Target windowing system (See supported types).
architecture | Target system architecture (See supported types).
bootclasspath (optional) | The default list of bootclasspath jars to compile against using either a colon or semi-colon as separators. The jars that make up a bootclasspath are part of any JDK or JRE. Typically this parameter is only specified if you are cross compiling Eclipse. The default is set to the jars in the JDK or JRE in JAVA_HOME.
| target (optional) | The Ant target from build.xml to execute. The default target is run and performs a complete build and generates an install. Other valid targets are: compile (compiles Java code and generates javadoc) clean install

Install Eclipse

When the Eclipse build is complete, there will be a zip file called

<osType>-<windowSystemType>-<architecture>-sdk.zip

in the results subdirectory of your build directory. If you are building for Linux or Mac, there will be a tar.gz file.

Extract this file to the directory where you would like to run Eclipse. If you extract it to your root directory, a directory called eclipse will be created.

Run Eclipse with the desired command line parameters.

## Supported Platforms

Eclipse can be built on any of the following platforms. With some limitations any platform can be used to build Eclipse for any or all supported platforms. To see the latest information on the platforms supported for a given release, refer to the latest project plan.

Operating System (os) | Windowing System (ws) | Archecture
win32 | win32 | x86
win32 | wpf | x86
linux | gtk | x86
linux | gtk | x86_64
linux | gtk | ppc
macosx | carbon | ppc
aix | motif | ppc
solaris | gtk | sparc

## Unsupported platforms

In addition, it may be possible to use the source build to build eclipse for the following platforms. However, the libraries for these platforms are not actively maintained by committers, so there is no guarantee that they will compile. If you are interested in contributing these libraries, please follow the following process.

Operating System (os) | Windowing System (ws) | Archecture
linux | gtk | ia64
linux | gtk | s390
linux | gtk | s390x
hpux | motif | PA_RISC
hpux | motif | ia64_32
qnx | photon | x86
solaris | motif | sparc
solaris | gtk | x86
solaris | gtk | x86

## Known Limitations

1. Building unix flavours of Eclipse on Windows will result in incorrect file permissions. The *.so, *.sl, and Eclipse executable files will not have execute permissions. In addition, linux-motif and linux-gtk builds will not have soft links to libXm.so.2.1 in the installation root directory. In these cases you would have to write an install or post install script to set permissions properly. (UNIX builds built on UNIX systems will set sufficient permissions and make the appropriate soft links).
2. Only Java source code is compiled. *.dll, *so, *sl and Eclipse executables are all provided prebuilt in this build process. The linux-gtk-ia64, linux-gtk-s390, linux-gtk-s390x, hpux-motif-ia64_32 and hpux-motif-ia64 configurations will require a re-compilation of the eclipse executable and swt libaries and copying these files to the apppropriate directories. The instructions on recompiling the eclipse executable and recompiling the swt libraries available in the SWT FAQ are also a useful reference. This document also includes a list of the prerequisites for running SWT on Linux GTK
3. For the platforms were JDK 1.6 support is not yet available e.g linux-gtk-s390, linux-gtk-s390x the Eclipse SDK can be built with JDK 1.5 in place JDK 1.6. To do that, please follow the following steps:

   - Edit the file build.xml: replacing the tags <property name="javacSource" value="1.6"> with <property name="javacSource" value="1.5"> and <property name="javacTarget" value="1.6"> with <property name="javacTarget" value="1.5">
   - Remove code which compile and package the plugins that require JDK 1.6 currently: org.eclipse.jdt.compiler.tool, org.eclipse.jdt.compiler.apt and org.eclipse.jdt.apt.pluggable.core from the files features/org.eclipse.jdt/feature.xml and features/org.eclipse.jdt/feature.xml.

## Using the source build to construct a new Eclipse port

The Eclipse platform releng team has limited hardware, software and time to compile Eclipse on every conceivable platform. If you would like to enhance the source build scripts to build eclipse on a platform that is not currently included, please follow the following steps:

- Extract the source build drop
- Update the build.bat and build files to reflect the new architecture. For example:
  - in the `build` file: add an another entry to the `if [ "$os-$ws-$arch" = "linux-motif-x86" ]` line similar to `|| [ "$os-$ws-$arch" = "newOs-newWs-newArch"]` that reflects the new os-ws-arch combination
  - in the `build.bat` file: add an entry similar to `if %os%-%ws%-%arch%==NewOs-newWs-newArch goto run` that reflects the new os-ws-arch combination
- Copy an existing `assemble.org.eclipse.sdk.os.ws.arch.xml` script to a new one that indicates that platform being built
- In the `build.xml`

- update the compilelibs property in the init target to reflect the new architecture
- update the compilelibs target to reflect the new architecture

- Run the build using "build -compilelibs" to force the recompilation of the native libaries
- Patches may be required to the swt native library and launcher build scripts to compile the new port. The swt native library files and launcher source and build files are stored in the `swttmp` and `launchertmp` directories respectively.
- Please open a bug with platform-releng with patches required to build this platform so they can be included in future source builds. This allows others to use your contribution and compile the new eclipse port