Blob Blame History Raw
# -*- RPM-SPEC -*-

%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 ppc64
%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

%define eclipse_base    /usr/share/eclipse

Summary: C and C++ development environment for Eclipse
Name: eclipse-cdt
Version: 2.0
Release: 5
Copyright: Common Public License Version 0.5 <http://www.eclipse.org/legal/cpl-v05.html>
Group: Development/Tools
URL: http://www.eclipse.org
Requires: ctags gdb make eclipse-platform

# Note that the Eclipse CDT project does not distribute a real .tar.gz
# file.  Instead, you must build it by hand.  The way to do this is to
# check out org.eclipse.cdt.releng.  Edit maps/cdt.map to refer to the
# tag appropriate to the release.  Then run the "fetch" target to
# fetch everything.  You will also have to fetch the tests; I had to
# edit the top-level build.xml to make this happen (adding "testing"
# to the fetch target).  Finally, package this up, such that the tar
# file unpacks a new "org.eclipse.cdt.releng" directory with all the
# contents.  See the java command in %%build to see how to invoke
# things in the releng build.xml.
#
# Note also that there was a typo in a CDT map file, where "ecilpse"
# was used instead of "eclipse".  You have to fix this sort of bug
# while fetching -- once before fetching, then update all the files
# that were created during the fetch as well, and fetch again.
# Without iterating this to a fixed point, you'll be left with a
# package that tries to fetch bits of itself from cvs during the
# build.
Source0: %{name}-testsIncluded-2.0-final.tar.gz
Source1: %{name}-rhdocs-r20040720.tar.gz
Patch0: %{name}-build-tests-patch
Patch1: %{name}-no-cvs-patch
Patch2: %{name}-debug-build-patch
Patch3: %{name}-ui-libhover-patch

BuildRequires: jpackage-utils >= 0:1.5
BuildRequires: gtk2-devel
BuildRequires: glib2-devel
BuildRequires: gnome-vfs2-devel
BuildRequires: desktop-file-utils
BuildRequires: eclipse-platform
BuildRequires: eclipse-jdt
BuildRequires: eclipse-pde
BuildRequires: libswt3-gtk2
BuildRequires: eclipse-gtk2

BuildRoot: %{_tmppath}/%{name}-buildroot
ExclusiveArch:		i386 ia64 ppc

%description
The eclipse-cdt package contains Eclipse features and plugins that are
useful for C and C++ development.

%prep
%setup -q -c 
pushd "org.eclipse.cdt.releng"
%patch0 -p0
popd
%patch1 -p0
%patch2 -p0
pushd "org.eclipse.cdt.releng"
%patch3 -p0
popd

# Upstream CVS includes random .so files.  Let's remove them now.
# We actually remove the entire "os" directory since otherwise
# we wind up with some empty directories that we don't want.
rm -r org.eclipse.cdt.releng/results/plugins/org.eclipse.cdt.core.linux/os

# Overwrite eclipse.org documentation with our own
pushd org.eclipse.cdt.releng/results/plugins
/usr/bin/gzip -dc %{SOURCE1} | tar -xf -
popd

%build
export JAVA_HOME=%{java_home}
export PATH=%{java_bin}:/usr/bin:$PATH

# See comments in the script to understand this.
/bin/sh -x %{eclipse_base}/buildscripts/copy-platform SDK %{eclipse_base}
SDK=$(cd SDK >/dev/null && pwd)


mkdir home
homedir=$(cd home > /dev/null && pwd)

cd org.eclipse.cdt.releng

pushd results/plugins/org.eclipse.cdt.core.linux/library
make JAVA_HOME="%{java_home}" ARCH=%{eclipse_arch} CC='gcc -D_GNU_SOURCE'
popd

java -cp $SDK/startup.jar \
    -Duser.home=$homedir \
     org.eclipse.core.launcher.Main \
    -application org.eclipse.ant.core.antRunner \
    -DjavacFailOnError=true \
    -DdontUnzip=true \
    -DbaseLocation=$SDK \
    -Dpde.build.scripts=$SDK/plugins/org.eclipse.pde.build_3.0.0/scripts \
    -DdontFetchAnything=true

# Build the tests.  Note that we don't install them later.
java -cp $SDK/startup.jar \
    -Duser.home=$homedir \
     org.eclipse.core.launcher.Main \
    -application org.eclipse.ant.core.antRunner test \
    -DjavacFailOnError=true \
    -DdontUnzip=true \
    -DbaseLocation=$SDK \
    -Dpde.build.scripts=$SDK/plugins/org.eclipse.pde.build_3.0.0/scripts \
    -DdontFetchAnything=true

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/%{eclipse_base}

for file in $(pwd)/org.eclipse.cdt.releng/results/I.*/*.zip; do
  case $file in
    *-linux.gtk* | *.make-* | *.managedbuilder-*)
      # The ".." is needed since the zip files contain "eclipse/foo".
      (cd $RPM_BUILD_ROOT/%{eclipse_base}/.. && unzip -qq -o $file)
      ;;
  esac
done

# We move the libraries to libdir, leaving symlinks behind.  And since
# zip doesn't preserve file permissions, we must also mark all the .so
# files as executable.
(
cd $RPM_BUILD_ROOT
find ./%{eclipse_base} -name '*.so' -print |
while read sofile; do
  newname=$(echo "$sofile" | sed -e 's,^./%{eclipse_base},%{_libdir}/eclipse,')
  mkdir -p ./$(dirname "$newname")
  mv $sofile ./$newname
  ln -s $newname $sofile
done
)

%clean 
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%{eclipse_base}/features/org.eclipse.cdt*
%{eclipse_base}/plugins/org.eclipse.cdt*
%attr(0755,root,root) %{_libdir}/eclipse/plugins/org.eclipse.cdt*

%changelog
* Wed Jul 21 2004 Tom Tromey <tromey@redhat.com> 2.0-5
- Make .so files executable

* Wed Jul 21 2004 Chris Moller <cmoller@redhat.com> 2.0-4
- Add texthover

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

* Fri Jul 16 2004 Tom Tromey <tromey@redhat.com> 2.0-3
- Make platform symlink tree before building

* Fri Jul 16 2004 Jeremy Handcock <handcock@redhat.com> 2.0-3
- Add Red Hat-specific documentation
- Use `name' macro in source and patch names
- Correct BuildRequires to eclipse-platform

* Tue Jul 13 2004 Jeremy Handcock <handcock@redhat.com> 2.0-2
- Don't require ant
- Prevent possible `build' section overload

* Mon Jul 12 2004 Tom Tromey <tromey@redhat.com> 2.0-2
- Document source fetching process
- Update to CDT 2.0 final
- Set -D_GNU_SOURCE when building

* Fri Jul  9 2004 Tom Tromey <tromey@redhat.com> 2.0-2
- Don't define prefix
- Don't require pango

* Fri Jul  9 2004 Jeremy Handcock <handcock@redhat.com> 2.0-2
- Update sources to include tests from upstream
- Add new build patch for CDT tests
- Build CDT tests, but don't install them

* Thu Jul  8 2004 Tom Tromey <tromey@redhat.com> 2.0-1
- Removed unused patch

* Thu Jul  8 2004 Jeremy Handcock <handcock@redhat.com> 2.0-1
- Revert previous patch; don't unset javacVerbose

* Thu Jul  8 2004 Jeremy Handcock <handcock@redhat.com> 2.0-1
- Unset javacVerbose

* Tue Jun 15 2004 Tom Tromey <tromey@redhat.com> 2.0-1
- Updated to 2.0 M8

* Mon Jan 19 2004 Tom Tromey <tromey@redhat.com> 1.2.1-1
- Initial version