Blob Blame Raw
# Uncomment this if you have pre-jpackage ant.
#%%define ant  JAVA_HOME=%{java_home} classic-ant

# The intersection of the IBM-supported platforms and
# the platforms we want.
ExclusiveArch:		i386

%define pkg_summary     An open extensible IDE
%define section         free
%define swt_version     3116
%define corelib_version 2_1_0b
%define eclipse_major   3
%define eclipse_minor   1
%define eclipse_majmin  %{eclipse_major}.%{eclipse_minor}
%define eclipse_oldmajmin  3.0
%define eclipse_micro   0
%define libname         libswt3
%define selfbuild	1

%ifarch %{ix86}
%define eclipse_arch    x86
%define java_arch	i386
%endif
%ifarch alpha
%define eclipse_arch	alpha
%define java_arch	alpha
%endif
%ifarch ia64
%define eclipse_arch	ia64
%define java_arch	ia64
%endif
%ifarch ppc
%define eclipse_arch	ppc
%define java_arch	ppc
%endif
%ifarch ppc64
%define eclipse_arch	ppc64
%define java_arch	ppc
%endif
%ifarch ppc64pseries
%define eclipse_arch	ppc64
%define java_arch	ppc
%endif
%ifarch sparc64
%define eclipse_arch	sparc64
%define java_arch	sparc
%endif
%ifarch x86_64
%define eclipse_arch	amd64
%define java_arch	amd64
%endif

Summary:        %{pkg_summary}
Name:           eclipse
Version:        %{eclipse_majmin}.M4
Release:        8
License:        CPL
Group:          Text Editors/Integrated Development Environments (IDE)
URL:            http://www.eclipse.org/
Source0: ftp://download.eclipse.org/S-3.1M4-200412162000/eclipse-sourceBuild-srcIncluded-3.1M4.zip
Source1:        %{name}.script
Source2:        %{name}.desktop
Source3:        %{name}-16.gif
Source4:        %{name}-32.gif
Source5:        %{name}-48.png
Source6:        %{name}.conf
Source7:        %{name}-jdt.install
Source8:        %{name}-pde.install     
Source9:        %{name}-platform.install
Source10:       %{name}-source.install
Source14:       %{name}-gtk.install
Source17:	%{name}-tools-build.xml
Source18:	%{name}-redhat-splash.png
Source20:	%{name}-rhdocs-r20041017.tar.gz
Source21:	%{name}-copy-platform.sh
Source22:       %{name}-tutorials.pdf
Source23:       %{name}-bootstrapjavahome.tar.gz

Patch0:         %{name}-make-gtk.patch
Patch1:         %{name}-make-core.patch
Patch2:         %{name}-make-gtk2.patch
Patch16:        %{name}-make-gtk3.patch
Patch17:	%{name}-platformOptions.patch
# We don't use this one yet but we want to keep it around.
# The mozilla stuff requires 1.6.
Patch18:        %{name}-make-gtk4.patch
Patch19:	%{name}-jnigen.patch
Patch20:	%{name}-gtk-launcher.patch
Patch21:	%{name}-org.eclipse.help.appserver-host.patch
Patch22:	%{name}-welcome-screen.patch
Patch25:	%{name}-webappcpfix.patch
Patch26:	%{name}-webappcompiler.patch
Patch27:	%{name}-textsearch.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires:  ant
BuildRequires:  perl
BuildRequires:  jpackage-utils >= 0:1.5, make, gcc
# Until we get gnujaxp into libgcj (libgcj PR 19301),
# we need xalan, xerces and xml-common-apis
BuildRequires:  xalan-j2, xerces-j2, xml-commons-apis
# MDK 9.1 libgnome-vfs2_0-devel
# RH 8.0, 9, FC 1: gnome-vfs2-devel
BuildRequires:  %{_libdir}/pkgconfig/gnome-vfs-2.0.pc
# MDK 9.1: libgtk+2.0_0-devel
# RH 8.0, 9, FC 1: gtk2-devel
BuildRequires:  %{_libdir}/pkgconfig/gtk+-2.0.pc
# MDK 9.1: libglib2.0_0-devel
# RH 8.0, 9, FC 1: glib2-devel
BuildRequires:  %{_libdir}/pkgconfig/gthread-2.0.pc
BuildRequires:	gcc4-java >= 4.0.0-0.17


%description
The Eclipse Platform is designed for building integrated development
environments (IDEs) that can be used to create applications as diverse
as web sites, embedded Java(tm) programs, C++ programs, and Enterprise
JavaBeans(tm).

%package        ecj
Summary:        Eclipse Compiler for Java
Group:          Development/Languages
Obsoletes:	ecj

%description    ecj
Eclipse compiler for Java.

%package        platform
Summary:        Eclipse platform common files
Group:          Text Editors/Integrated Development Environments (IDE)
Provides:       %{name} = %{version}-%{release}
Obsoletes:	%{name}-sdk eclipse
Provides:	%{name}-sdk
Requires:	java >= 1.4.2
Requires:	%{name}-gtk2
Requires:       /usr/bin/perl

%description    platform
Eclipse platform common files.  In addition to this, you'll need a UI package
(GTK2) to be able to run the IDE.

%package        gtk2
Summary:        GTK2 UI for the Eclipse IDE
Group:          Text Editors/Integrated Development Environments (IDE)
Provides:       %{name}-ui = %{version}-%{release}
Requires:       %{name}-platform = %{version}-%{release}
Requires:       %{libname}-gtk2 = %{version}-%{release}
Requires:       /usr/bin/mozilla

%description    gtk2
GTK2 UI for the Eclipse IDE.

%package        jdt
Summary:        Eclipse Java development tools
Group:          Text Editors/Integrated Development Environments (IDE)
Requires:       %{name}-ui = %{version}-%{release}
Requires:       %{name}-ecj = %{version}-%{release}

%description    jdt
Eclipse Java developments tools.

%package        source
Summary:        Eclipse Source
Group:          Text Editors/Integrated Development Environments (IDE)

%description    source
Eclipse Source.

%package        pde
Summary:        Eclipse PDE
Group:          Text Editors/Integrated Development Environments (IDE)
Requires:       %{name}-ui = %{version}-%{release}
Requires:       %{name}-source = %{version}-%{release}
# FIXME:  Should PDE require JDT?
#Requires:       %{name}-jdt = %{version}-%{release}

%description    pde
Eclipse PDE.

%package     -n %{libname}-gtk2
Summary:        SWT Library for GTK2
Group:          Text Editors/Integrated Development Environments (IDE)

%description -n %{libname}-gtk2
SWT Library for GTK2.

%prep
%setup -q -c
pushd "plugins/org.eclipse.swt.tools"
cp %{SOURCE17} build.xml
popd
pushd "plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library"
%patch0 -p0
popd
%patch1 -p0
%patch2 -p0
pushd "plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library"
%patch16 -p0
popd
%patch17 -p0
pushd "plugins/org.eclipse.swt.tools/JNI Generation"
%patch19 -p0
popd
%patch20 -p0
pushd "plugins/org.eclipse.help.appserver"
%patch21 -p0
popd
pushd "plugins/org.eclipse.platform"
%patch22 -p0
popd
%if %selfbuild
pushd "plugins"
%patch25 -p1
popd
%endif
%patch26 -p0
%patch27 -p0

# Red Hat splash screen.
pushd plugins/org.eclipse.platform
cp %{SOURCE18} splash.bmp
popd

# Nuke platform-dependent libs and executables
find . -type f -name "*.s[lo]" -exec rm -f {} ';'
find plugins/platform-launcher/bin -type f -name eclipse -exec rm -f {} ';'

# That's a bit too verbose to me...
perl -pi -e 's|(<javac[^>]+verbose=)"true"|${1}"false"|g' \
  `find . -type f -name "build*.xml"`

# Fail on error...
perl -pi -e 's|failonerror="[A-Za-z]*"|failonerror="yes"|g' \
  `find . -type f -name "build*.xml"`

# Eclipse assumes you will only want to build on platforms for which
# they ship.  There are hard-coded files and directories in a few
# places.  For "non-approved" platforms we make a copy and massage it
# into shape.  This is written in a somewhat funny way so we can
# extend it later if need be.
src=
dest=
%ifarch ia64 ppc64 sparc64
src=amd64
dest=%{eclipse_arch}
%endif

if test -n "$src"; then
  find . -name "*$src*" -print |
  while read f; do
    d=$(echo $f | sed -e "s/$src/$dest/g")
    mv $f $d
  done

  # Now update all the xml files to report our real arch.
  find . -name '*.xml' -print0 |
  xargs -0 perl -pi -e "s/$src/$dest/g;"
fi

# Set up bootstrapping JAVA_HOME
tar zxvf %{SOURCE23}
export JAVA_HOME=`pwd`/%{name}-bootstrapjavahome
export PATH=`pwd`/%{name}-bootstrapjavahome/bin:$PATH

%build
export ANT_OPTS=-Xmx768m

%if %selfbuild
### -------- ecj build -------- 
## Build ecj that we can use for the rest of the build
##
#
## We're going to muck with this, so let's keep a clean copy
#cp -r plugins/org.eclipse.jdt.core plugins/org.eclipse.jdt.core.original
#
#pushd plugins/org.eclipse.jdt.core
#cp model/org/eclipse/jdt/core/Signature.java compiler/org/eclipse/jdt/core
#cp -r batch/org/eclipse/jdt/internal/compiler/batch \
#  compiler/org/eclipse/jdt/internal/compiler
#cd compiler
#for f in `find -name '*.java' -o -name '*.properties' | cut -c 3-`; do
#    gcj4 -I. -Wno-deprecated -C $f
#done
#
#find -name '*.class' -or -name '*.properties' -or -name '*.rsc' |\
#    xargs jar cf ../../../ecj-bootstrap.jar
#
#popd
#
## Let's return o.e.jdt.core to its original src state
#rm -rf plugins/org.eclipse.jdt.core
#mv plugins/org.eclipse.jdt.core.original plugins/org.eclipse.jdt.core
#
## Now use this built ecj for the rest of the build
# FIXME:  gcj PR 19295 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19295
#export CLASSPATH=`pwd`/ecj-bootstrap.jar:$CLASSPATH
export CLASSPATH=`pwd`/jdtcore.jar:$CLASSPATH
# -------- ecj build -------- 
%endif

pushd plugins/org.eclipse.swt.tools
rm -f swttools.jar
%{ant} \
    -DinstallOs=linux -DinstallWs=gtk -DinstallArch=%{eclipse_arch} \
    -DjavacVerbose=false -DjavacFailOnError=true \
    -Dbuild.compiler=modern \
    -Dbootclasspath=
popd

%if %selfbuild
# I had to add stuff to the bootclasspath to get this to work with
# our pseudo-java-gcj-compat setup. --overholt
mkdir -p './JNI Generation/org/eclipse/swt/tools/internal/'
%{ant} -buildfile build.xml \
    -DinstallOs=linux -DinstallWs=gtk -DinstallArch=%{eclipse_arch} \
    -Dbuild.compiler=modern \
    -DjavacVerbose=false -DjavacFailOnError=true \
    -Dbootclasspath=%{_datadir}/java/libgcj-4.0.0.jar:%{_datadir}/java/xml-commons-apis-1.0.jar \
  compile
%else
mkdir -p './JNI Generation/org/eclipse/swt/tools/internal/'
%{ant} -buildfile build.xml \
    -DinstallOs=linux -DinstallWs=gtk -DinstallArch=%{eclipse_arch} \
    -Dbuild.compiler=modern \
    -DjavacVerbose=false -DjavacFailOnError=true \
    -Dbootclasspath= \
  compile
%endif

# FIXME:  need a gjdoc RPM
## Overwrite eclipse.org documentation with our own and then build the docs
#pushd plugins
#ln org.eclipse.platform/startup.jar ../.
#for buildDoc in `/usr/bin/gzip -dc %{SOURCE20} | tar -vxf - | grep build.xml`; do
#	pushd `echo $buildDoc | sed -e 's/build.xml//g'`
#	if [ -e buildDoc.xml ]; then
#	    %{ant} -f buildDoc.xml
#	fi
#	popd
#done
#rm ../startup.jar
#popd

suff=
%ifarch alpha ia64 ppc64 sparc64 x86_64
suff=.gtk64
%endif

# Symlink some gtk sources.
pushd "plugins/org.eclipse.swt${suff}/Eclipse SWT PI/gtk/library" &&
ln -sf "../../../Eclipse SWT Program/gnome/library/"*.[ch] . &&
ln -sf "../../../Eclipse SWT AWT/gtk/library/"*.[ch] . &&
ln -sf "../../../Eclipse SWT Mozilla/common/library/"*.cpp . &&
popd

pushd "plugins/org.eclipse.swt${suff}/Eclipse SWT/common/library"
cp -p callback.c callback.h make_common.mak swt.h swt.c \
  "../../../Eclipse SWT PI/gtk/library"
popd

pushd "plugins/org.eclipse.swt${suff}/Eclipse SWT PI/gtk/library"
swtflags=
%ifarch alpha ia64 ppc64 sparc64 x86_64
swtflags='SWT_PTR_CFLAGS=-DSWT_PTR_SIZE_64'
#%ifarch ia64
## Sigh.
#swtflags="$swtflags XTEST_LIB_PATH=/usr/X11R6/lib"
#%endif
%endif
swtflags="$swtflags XTEST_LIB_PATH=/usr/X11R6/lib"
make \
$swtflags \
JAVA_HOME="%{java_home}" \
JAVA_JNI="%{java_home}/include" \
AWT_LIB_PATH="%{java_home}/jre/bin" \
JPACKAGE_CFLAGS="$RPM_OPT_FLAGS -DNO_LONG -I%{java_home}/include \
-I%{java_home}/include/linux \
-I%_libdir}/gcc/%{arch}-redhat-linux/4.0.0/include/"\
MOZILLA_HOME="" \
MOZILLA_INCLUDE_BASE="/usr/include/mozilla-1.4.2" \
MOZILLA_LIBFLAG="" \
-f make_linux.mak all
mkdir -p ../../../os/linux/%{eclipse_arch}
cp -p libswt-*.so ../../../os/linux/%{eclipse_arch}
popd

pushd plugins/platform-launcher/library/gtk
make \
JPACKAGE_CFLAGS="$RPM_OPT_FLAGS" \
DEFAULT_OS="linux" \
DEFAULT_OS_ARCH="%{eclipse_arch}" \
DEFAULT_WS="gtk" \
PROGRAM_OUTPUT="eclipse" \
PROGRAM_NAME="Eclipse" \
-f make_linux.mak clean all
mkdir -p ../../bin/gtk/linux/%{eclipse_arch}
cp -p eclipse ../../bin/gtk/linux/%{eclipse_arch}
popd
cp -p plugins/platform-launcher/bin/gtk/linux/%{eclipse_arch}/eclipse .

pushd plugins/org.eclipse.core.resources.linux/src
make JPACKAGE_CFLAGS="$RPM_OPT_FLAGS"
mkdir -p ../os/linux/%{eclipse_arch}
cp -p libcore_*.so ../os/linux/%{eclipse_arch}
popd

# This could probably be done with build.xml in this directory
pushd plugins/org.eclipse.update.core.linux/src
gcc $RPM_OPT_FLAGS -fPIC -o  libupdate.so -shared *.c -I.  -I%{java_home}/include
popd

#pushd plugins/org.eclipse.team.cvs.core/library
#make \
#JAVA_HOME="%{java_home}" \
#OS="linux" \
#clean all
#popd

%install
rm -rf $RPM_BUILD_ROOT

# Use our bootstrapped JAVA_HOME and javac (ecj)
export JAVA_HOME=`pwd`/%{name}-bootstrapjavahome
export PATH=`pwd`/%{name}-bootstrapjavahome/bin:$PATH
# FIXME:  gcj PR 19295 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19295
#export CLASSPATH=`pwd`/ecj-bootstrap.jar:$CLASSPATH
export CLASSPATH=`pwd`/jdtcore.jar:$CLASSPATH

#export ANT_OPTS=-Xmx768m
# I had to add stuff to the bootclasspath to get this to work with our
# pseudo java-gcj-compat setup. --overholt
%if %selfbuild
%{ant} \
    -DinstallOs=linux -DinstallWs=gtk -DinstallArch=%{eclipse_arch} \
    -Dbuild.compiler=modern \
    -DjavacVerbose=false -DjavacFailOnError=true \
    -Djavadoc=%{javadoc} \
    -Dbootclasspath=%{_datadir}/java/libgcj-4.0.0.jar:%{_datadir}/java/xml-commons-apis-1.0.jar \
  install
%else
%{ant} \
    -DinstallOs=linux -DinstallWs=gtk -DinstallArch=%{eclipse_arch} \
    -Dbuild.compiler=modern \
    -DjavacVerbose=false -DjavacFailOnError=true \
    -Dbootclasspath= \
    -Djavadoc=%{javadoc} \
  install
%endif

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
find result -type f -name "*.zip" -exec unzip -d $RPM_BUILD_ROOT%{_datadir} {} \;

install -m 644 plugins/org.eclipse.platform/startup.jar $RPM_BUILD_ROOT%{_datadir}/%{name}/startup.jar
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.platform_*/startup.jar
install -m 644 plugins/platform-launcher/bin/gtk/linux/%{eclipse_arch}/icon.xpm  $RPM_BUILD_ROOT%{_datadir}/%{name}/icon.xpm

# binaries and libs
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}/%{name}

install -m 755 eclipse $RPM_BUILD_ROOT%{_libdir}/%{name}/eclipse
touch $RPM_BUILD_ROOT%{_libdir}/%{name}/eclipse

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}

pushd $RPM_BUILD_ROOT%{_datadir}/%{name}
ln -sf %{_libdir}/%{name}/eclipse eclipse
popd

suff=
%ifarch alpha ia64 ppc64 sparc64 x86_64
suff=.gtk64/src
%endif

cp -p plugins/org.eclipse.update.core.linux/src/libupdate*.so $RPM_BUILD_ROOT%{_libdir}/%{name}/
cp -p plugins/org.eclipse.core.resources.linux/os/linux/%{eclipse_arch}/libcore_*.so $RPM_BUILD_ROOT%{_libdir}/%{name}/
cp -p plugins/org.eclipse.swt${suff}/os/linux/%{eclipse_arch}/libswt*.so $RPM_BUILD_ROOT%{_libdir}/%{name}/
#cp -p plugins/org.eclipse.team.cvs.core/library/libcvs.so $RPM_BUILD_ROOT%{_libdir}/%{name}/

pushd $RPM_BUILD_ROOT%{_libdir}/%{name}
chmod 755 eclipse *.so
popd

install -d -m 755 $RPM_BUILD_ROOT%{_jnidir}
install -d -m 755 $RPM_BUILD_ROOT%{_libdir}

### begin core lib symlinks
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.core.resources.linux_%{eclipse_oldmajmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.core.resources.linux_%{eclipse_oldmajmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
ln -sf %{_libdir}/%{name}/libcore_%{corelib_version}.so libcore_%{corelib_version}.so
popd

install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.update.core.linux_%{eclipse_majmin}.%{eclipse_micro}/os/linux
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.update.core.linux_%{eclipse_majmin}.%{eclipse_micro}/os/linux
ln -sf %{_libdir}/%{name}/libupdate.so libupdate.so
popd
### end core lib symlinks

### begin libswt-gtk2 symlinks
pushd $RPM_BUILD_ROOT%{_libdir}
for base in atk-gtk gnome-gtk gtk pi-gtk; do
  ln -sf %{_libdir}/%{name}/libswt-${base}-%{swt_version}.so \
         libswt-${base}-%{swt_version}.so
done
popd

pushd $RPM_BUILD_ROOT%{_jnidir}
ln -sf %{_datadir}/%{name}/plugins/org.eclipse.swt.gtk*_%{eclipse_majmin}.%{eclipse_micro}/ws/gtk/swt.jar swt-gtk-%{version}.jar
ln -sf %{_datadir}/%{name}/plugins/org.eclipse.swt.gtk*_%{eclipse_majmin}.%{eclipse_micro}/ws/gtk/swt-pi.jar swt-pi-gtk-%{version}.jar
popd

mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.swt.gtk*_%{eclipse_majmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.swt.gtk*_%{eclipse_majmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
for base in atk-gtk gnome-gtk gtk pi-gtk; do
  ln -sf %{_libdir}/%{name}/libswt-${base}-%{swt_version}.so \
         libswt-${base}-%{swt_version}.so
done
popd

### end libswt-gtk2 symlinks

### begin libcvs symlink
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.team.cvs.core_%{eclipse_majmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins/org.eclipse.team.cvs.core_%{eclipse_majmin}.%{eclipse_micro}/os/linux/%{eclipse_arch}
ln -sf %{_libdir}/%{name}/libcvs.so libcvs.so
popd
### end libcvs symlink

### begin jar symlinks
(cd $RPM_BUILD_ROOT%{_jnidir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
### end jar symlinks

# Script
mkdir -p $RPM_BUILD_ROOT%{_bindir}
perl -pe \
  's|/usr/lib/eclipse/|%{_libdir}/%{name}/|g ;
   s|/etc/|%{_sysconfdir}/|g ;
   s|/usr/bin/|%{_bindir}/|g' \
  %{SOURCE1} > $RPM_BUILD_ROOT%{_bindir}/eclipse

# Default config
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
perl -pe 's|/usr/lib/eclipse/|%{_datadir}/%{name}/|g' \
  %{SOURCE6} > $RPM_BUILD_ROOT%{_sysconfdir}/eclipse.conf

# symlink for build scripts that rely on 3.0.0 path
pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/plugins
ln -s org.eclipse.pde.build_%{eclipse_majmin}.%{eclipse_micro} org.eclipse.pde.build_3.0.0
popd

# rh/freedesktop.org icons
install -p -D -m0644 %{SOURCE5} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
install -p -D -m0644 %{SOURCE4} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
install -p -D -m0644 %{SOURCE3} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
install -d -m0755 $RPM_BUILD_ROOT%{_datadir}/pixmaps
ln -s ../icons/hicolor/48x48/apps/%{name}.png \
  $RPM_BUILD_ROOT%{_datadir}/pixmaps

# rh docs
install -p -D -m0644 %{SOURCE22} \
  $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{eclipse_majmin}.%{eclipse_micro}/%{name}-tutorial.pdf

# A sanity check.
desktop-file-validate %{SOURCE2}

# freedesktop.org menu entry
install -p -D -m0644 %{SOURCE2} \
  $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

cat %{SOURCE7} > %{name}-jdt.install
cat %{SOURCE8} > %{name}-pde.install
cat %{SOURCE9} > %{name}-platform.install

cat %{SOURCE10} > %{name}-source.install
cat %{SOURCE14} > %{name}-gtk.install

cat >> $RPM_BUILD_ROOT%{_datadir}/%{name}/.eclipseproduct << EOF
name=Eclipse Platform
id=org.eclipse.platform
version=%{eclipse_majmin}.%{eclipse_micro}
EOF

# Create a script that can be used to make a symlink tree of the
# eclipse platform.
cp %{SOURCE21} copy-platform
(
  cd $RPM_BUILD_ROOT%{_datadir}/%{name}
  ls -d * | egrep -v '^(plugins|features)$'
  ls -d plugins/* features/*
) |
sed -e's/^\(.*\)$/\1 \1/' -e's,^,ln -s $eclipse/,' >> copy-platform

mkdir $RPM_BUILD_ROOT%{_datadir}/%{name}/buildscripts
cp copy-platform $RPM_BUILD_ROOT%{_datadir}/%{name}/buildscripts

# Native build
gcj-dbtool4 -n $RPM_BUILD_ROOT%{_datadir}/%{name}/.eclipse.db 80000
for j in `find $RPM_BUILD_ROOT%{_datadir}/%{name} -name \*.jar`; do
    gcj4 -fPIC -fjni -findirect-dispatch -shared \
      -o $RPM_BUILD_ROOT%{_libdir}/%{name}/`basename $j .jar`.so $j;
done

# FIXME until libgcj contains gnujaxp (libgcj PR 19301)
gcj4 -fPIC -fjni -findirect-dispatch -shared \
      -o $RPM_BUILD_ROOT%{_libdir}/%{name}/xml-commons-apis-1.0.so \
      %{_datadir}/java/xml-commons-apis-1.0.jar
gcj4 -fPIC -fjni -findirect-dispatch -shared \
      -o $RPM_BUILD_ROOT%{_libdir}/%{name}/xalan-j2-2.6.0.so \
      %{_datadir}/java/xalan-j2-2.6.0.jar
gcj4 -fPIC -fjni -findirect-dispatch -shared \
      -o $RPM_BUILD_ROOT%{_libdir}/%{name}/xerces-j2-2.6.2.so \
      %{_datadir}/java/xerces-j2-2.6.2.jar

# Copy jdtcore.jar to %{_datadir}/java
mkdir -p $RPM_BUILD_ROOT%{_datadir}/java
ln -s %{_datadir}/java/jdtcore-%{version}.jar \
  $RPM_BUILD_ROOT%{_datadir}/%{name}/jdtcore.jar

%if %selfbuild
# FIXME:  gcj PR 19295
#rm ecj-bootstrap.jar
%endif

%post
for j in `find %{_datadir}/%{name} -name \*.jar`; do
    gcj-dbtool4 -a %{_datadir}/%{name}/.eclipse.db \
      $j %{_libdir}/%{name}/`basename $j .jar`.so;
done


%clean
rm -rf $RPM_BUILD_ROOT

%files ecj
%defattr(0644,root,root,0755)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/plugins/org.eclipse.jdt.core_3.*
%{_libdir}/%{name}/jdtcore.so

%files platform -f %{name}-platform.install
%defattr(0644,root,root,0755)
%dir %{_datadir}/%{name}
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*.so
%{_datadir}/%{name}/.eclipseproduct
%{_datadir}/%{name}/.eclipse.db
%{_datadir}/%{name}/startup.jar
%{_datadir}/%{name}/icon.xpm
%{_datadir}/%{name}/eclipse
%attr(0755,root,root) %{_datadir}/%{name}/buildscripts/copy-platform
# formerly in scripts
%attr(0755,root,root) %{_bindir}/eclipse
%{_datadir}/applications/*
%{_datadir}/pixmaps/*
%{_datadir}/icons/*/*/apps/*
%config(noreplace) %{_sysconfdir}/eclipse.conf

%files gtk2 -f %{name}-gtk.install
%defattr(0644,root,root,0755)
%attr(0755,root,root) %{_libdir}/%{name}/eclipse

%files -n %{libname}-gtk2
%defattr(0644,root,root,0755)
/usr/share/eclipse/plugins/org.eclipse.swt.gtk*_3.*
%attr(0755,root,root) %{_libdir}/%{name}/libswt-gnome-gtk-*.so
%attr(0755,root,root) %{_libdir}/%{name}/libswt-gtk-*.so
%attr(0755,root,root) %{_libdir}/%{name}/libswt-pi-gtk-*.so
%attr(0755,root,root) %{_libdir}/%{name}/libswt-atk-gtk-*.so
%{_libdir}/libswt-*.so
%{_jnidir}/swt-gtk*.jar
%{_jnidir}/swt-pi-gtk*.jar

%files jdt -f %{name}-jdt.install
%defattr(0644,root,root,0755)

%files source -f %{name}-source.install
%defattr(0644,root,root,0755)

%files pde -f %{name}-pde.install
%defattr(0644,root,root,0755)

%changelog
* Tue Jan 11 2005 Andrew Overholt <overholt@redhat.com> 3.1.M4-5
- import all necessary patches

* Mon Jan 10 2005 Andrew Overholt <overholt@redhat.com> 3.1.M4-4
- fix /usr/lib -> %{_datadir} to be /usr/lib -> %{_libdir} in 
  %{_bindir}/eclipse

* Mon Jan 10 2005 Andrew Overholt <overholt@redhat.com> 3.1.M4-3
- add xerces

* Mon Jan 10 2005 Andrew Overholt <overholt@redhat.com> 3.1.M4-2
- fold ecj-native into ecj
- add FIXMEs for necessary work
- add xml .jar->.so compilations so we can work without gnujaxp
- modify launching script to take this into account

* Wed Jan 05 2005 Andrew Overholt <overholt@redhat.com> 3.1.M4-1
- new upstream milestone build
- re-organize sub-rpms

* Mon Dec 20 2004 Andrew Overholt <overholt@redhat.com> 3.0.1-4
- build ecj first and use it to build the rest
- add %selfbuild to toggle between builds with java-gcj-compat style and other
  JREs
- fold scripts into platform

* Mon Nov 22 2004 Ben Konrath <bkonrath@redhat.com> 3.0.1-3
- split cvs-permission-bits.patch in two
- bug fix for cvs-permission-bits.patch

* Fri Oct 29 2004 Ben Konrath <bkonrath@redhat.com> 3.0.1-2
- add symlink for releng plugins that rely on o.e.pde.build_3.0.0

* Fri Oct 29 2004 Ben Konrath <bkonrath@redhat.com> 3.0.1-1
- updated to Eclipse 3.0.1
- updated jnigen patch
- removed some debugging print statements 
- updated Red Hat documentaion sources
- added Red Hat documentation pdf
- remove commented ftp-webdav stuff as it will be in it's own spec file

* Tue Oct 04 2004 Aaron Luchko <aluchko@redhat.com> 3.0.0-26
- Changed the splash screen from a bmp to a png and fixed 
- copyright date

* Mon Aug 31 2004 Aaron Luchko <aluchko@redhat.com> 3.0.0-25
- Building docs after the main build using headless eclise
  to build the extension points 

* Mon Aug 16 2004 Ben Konrath <bkonrath@redhat.com> 3.0.0-24
- Add cvs permission bits patch

* Wed Aug 04 2004 Elliot Lee <sopwith@redhat.com> 3.0.0-23
- Unblock hack no longer needed.

* Mon Jul 26 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-22
- Update Red Hat documentation sources

* Thu Jul 22 2004 Tom Tromey <tromey@redhat.com> 3.0.0-21
- Set eclipse_arch for ppc
- Tell build about real platform
- Make swt.gtk install directory

* Thu Jul 22 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-20
- Don't build on ppc64
- Change Requires and BuildRequires to java >= 1.4.2
- eclipse-platform package obsoletes old eclipse package

* Wed Jul 21 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-19
- Update copy-platform with patch from Keith Seitz

* Tue Jul 20 2004 Tom Tromey <tromey@redhat.com> 3.0.0-18
- Allow copy-platform to copy non-core parts as well

* Tue Jul 20 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-17
- Update Red Hat documentation sources

* Tue Jul 20 2004 Ben Konrath <bkonrath@redhat.com> 3.0.0-16
- Add patch for welcome screen

* Mon Jul 19 2004 Tom Tromey <tromey@redhat.com> 3.0.0-15
- Don't require IBM JDK
- Don't build AWT/SWT interaction code

* Fri Jul 16 2004 Tom Tromey <tromey@redhat.com> 3.0.0-14
- Install copy-platform correctly

* Fri Jul 16 2004 Tom Tromey <tromey@redhat.com> 3.0.0-13
- Removed debugging code
- Added copy-platform script

* Thu Jul 15 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-12
- Add Red Hat-specific documentation

* Thu Jul 15 2004 Tom Tromey <tromey@redhat.com> 3.0.0-12
- Fixed provides/requires versioning buglets

* Wed Jul 14 2004 Tom Tromey <tromey@redhat.com> 3.0.0-11
- Unblock signals before running ant

* Wed Jul 14 2004 Tom Tromey <tromey@redhat.com> 3.0.0-10
- Added some debugging code

* Tue Jul 13 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-9
- Add help server patch to prevent outside access

* Fri Jul  9 2004 Tom Tromey <tromey@redhat.com> 3.0.0-9
- Handle libswt*.so correctly

* Wed Jul  8 2004 Tom Tromey <tromey@redhat.com> 3.0.0-9
- Reworked 64 bit platform support
- org.eclipse.swt.tools now included in standard zip file
- Removed alternatives
- Added platform launcher patch

* Thu Jul  8 2004 Jeremy Handcock <handcock@redhat.com> 3.0.0-9
- Don't BuildRequires: junit
- Don't symlink against JPackage jars; use eclipse.org ones instead

* Tue Jul  6 2004 Tom Tromey <tromey@redhat.com> 3.0.0-8
- Work around "ppc64pseries" arch oddity
- Add classic-ant hack

* Wed Jun 30 2004 Tom Tromey <tromey@redhat.com> 3.0.0-7
- Only install one desktop file; check it; updated contents

* Tue Jun 29 2004 Tom Tromey <tromey@redhat.com> 3.0.0-6
- Require IBM JDK
- Only build on our platforms

* Mon Jun 28 2004 Tom Tromey <tromey@redhat.com> 3.0.0-5
- Inlined libswt install source
- Special case for ia64 Xtst directory

* Fri Jun 25 2004 Tom Tromey <tromey@redhat.com> 3.0.0-4
- Added patch for Mozilla build; disabled though
- Updated to 3.0 final

* Thu Jun 24 2004 Tom Tromey <tromey@redhat.com> 3.0.0-3
- Removed more Motif code
- Updated to use more jpackage macros

* Tue Jun 22 2004 Tom Tromey <tromey@redhat.com> 3.0.0-2
- Updated to Eclipse 3.0RC3

* Mon May 24 2004 Tom Tromey <tromey@redhat.com> 3.0.0-1
- Updated to Eclipse 3.0M8
- Removed Motif build
- Removed some non-Red Hat code
- Added Red Hat artwork
- Build on non-x86 architectures

* Sun Apr 25 2004 Ville Skyttä <ville.skytta at iki.fi> - 0:2.1.3-2jpp
- Fix "patch -p" levels.
- More coverage for failonerror and non-verbosity during build.

* Fri Apr 23 2004 David Walluck <david@anti-microsoft.org> 0:2.1.3-1jpp
- remove patches that were fixed upstream since the last release
- eclipse-pde now requires eclipse-source (thanks Michael Reinsch)
- add patch to allow compilation on recent GTK+ versions
  (thanks Rudi Chiarito)
- include %%{_libdir}/libswt-gnome-gtk-%%{swt_version}.so in gtk2
  package

* Sun Nov 16 2003 David Walluck <david@anti-microsoft.org> 0:2.1.2-6jpp
- 2.1.2 public release
- %{_datadir}/%{name}/plugins is now used for plugins, and you must
  move any plugins that you have manually installed into
  %{_libdir}/%{name}/plugins to the new location. The new location is
  not expected to change

* Sat Nov 15 2003 David Walluck <david@anti-microsoft.org> 0:2.1.2-5jpp
- apply patch from Ville to remove some motif conditional parts
- apply patch from Ville for .desktop
- make platform own %%{_libdir}/%{name}

* Fri Nov 14 2003 David Walluck <david@anti-microsoft.org> 0:2.1.2-4jpp
- have platform package provide and obsolete sdk package
- fold javac package back into jdt package

* Tue Nov 11 2003 David Walluck <david@anti-microsoft.org> 0:2.1.2-3jpp
- /usr/bin/mozilla is now required by eclipse-ui and not eclipse-platform
- make libswt2 required by motif and gtk subpackages
- disable motif by default (unsupported)
- motif and gtk related files are now fully separated from other packages

* Mon Nov 10 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.1.2-2jpp
- Don't use the Mandrake-specific %%mklibname macro.
- Update freedesktop.org desktop entry categories.
- Try to look up the QT dir in portable fashion.
- Refactor refactor-rename patch into two due to spaces in pathnames.
- Fix $RPM_OPT_FLAGS handling.
- Untabify specfile.

* Sat Nov 08 2003 David Walluck <david@anti-microsoft.org> 0:2.1.2-1jpp
- 2.1.2

* Thu Nov 06 2003 David Walluck <david@anti-microsoft.org> 0:2.1.1-4jpp
- use versioned dirs
- add pde, javac, and motif subpackages and remove sdk subpackage
- patches from Debian
- fail build on error
- add libswt (GTK, Motif) packages

* Sun Sep 21 2003 David Walluck <david@anti-microsoft.org> 0:2.1.1-3jpp
- apply new patch for non-working rename action from Michael Reinsch
- build for Mandrake 9.2 with Sun JDK 1.4.2

* Thu Aug 21 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.1.1-2jpp
- Include missed plugins: org.eclipse.ui.versioncheck (platform),
  org.eclipse.pde.source (sdk).  Thanks to Markus Härnvi for the heads up.

* Sun Jun 29 2003 Michael Reinsch <mr@uue.org> 0:2.1.1-1jpp
- patch for non-working rename action
- eclipse 2.1.1
- Ville's comments: patch not applied, it didn't fix the problem completely.
  Still built with Sun's 1.3.1.08.

* Sun Jun  8 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.1.0-4jpp
- Use xmlParserAPIs.jar that comes with Eclipse instead of xml-commons-apis:
  <http://developer.java.sun.com/developer/bugParade/bugs/4749727.html>

* Sun Jun  1 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:2.1.0-3jpp
- Rebuild with Sun's 1.3.1_08 to work around Eclipse Java 1.4.x build bug:
  <https://bugs.eclipse.org/bugs/show_bug.cgi?id=37846>
- Drop %%{release} from subpackage interdependencies in order to make it
  possible to do partial subpackage-only updates in the future.
- Make legacymenu conflict with redhat-menus.
- Add icon symlink in %%{_datadir}/pixmaps.

* Mon Apr 21 2003 David Walluck <david@anti-microsoft.org> 0:2.1.0-2jpp
- fix mdkmenu
- add Distribution and Vendor tags

* Thu Apr 03 2003 David Walluck <david@anti-microsoft.org> 0:2.1.0-1jpp
- 2.1
- add %{name}-make-ld.patch to work around problems building on Mandrake 9.1
- add Mandrake 9.1 comments to BuildRequires

* Wed Mar 26 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 0:2.1.0-0.rc3b.3jpp
- Rebuilt for JPackage 1.5.

* Tue Mar 25 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 0:2.1.0-0.rc3b.2jpp
- Add java.library.path and -Xms64M to default config.
- Don't use "-dev bin" by default.
- Use X-JPackage instead of X-Red-Hat-Extra in standard menu entry.
- Fix MDK menu entry title and summary.

* Mon Mar 24 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 0:2.1.0-0.rc3b.1jpp
- Update to 2.1.0 RC3b.
- Spec file and build cleanups, mostly from David Walluck.
- No longer requires csh.
- Made *.so in the gtk and platform packages executable.
- The %%{_libdir}/%{name} directory is now owned by the platform package.

* Fri Mar 14 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 2.1.0-0.rc2.2jpp
- Include a couple of platform files missing from the previous build.
- Remove bogus files from platform, ftp-webdav and sdk file lists.
- Abort with error if the file lists refer to nonexistent files.

* Sun Mar  9 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 2.1.0-0.rc2.1jpp
- Update to 2.1.0 RC2.
- Merge David Walluck's packaging work.
- Use JPackage lucene.
- Don't include Motif stuff.

* Thu Mar  6 2003 Ville Skyttä <jpackage-discuss at zarb.org> - 2.1.0-0.rc1.0jpp
- First try at packaging.