Possible fix for #66810, #66822.
authorKarl Trygve Kalleberg <karltk@gentoo.org>
Sat, 9 Oct 2004 21:39:58 +0000 (21:39 +0000)
committerKarl Trygve Kalleberg <karltk@gentoo.org>
Sat, 9 Oct 2004 21:39:58 +0000 (21:39 +0000)
dev-util/eclipse-sdk/ChangeLog
dev-util/eclipse-sdk/Manifest
dev-util/eclipse-sdk/eclipse-sdk-3.0.1-r1.ebuild

index fc340c077a02d1c184cfea394b2bd0a186e7ac8c..b6a4e3d029909a1471ccab22de2eaad680803aea 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for dev-util/eclipse-sdk
 # Copyright 2003-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/eclipse-sdk/ChangeLog,v 1.66 2004/10/07 17:07:50 karltk Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/eclipse-sdk/ChangeLog,v 1.67 2004/10/09 21:39:58 karltk Exp $
+
+  09 Oct 2004; Karl Trygve Kalleberg <karltk@gentoo.org>
+  eclipse-sdk-3.0.1-r1.ebuild: 
+  Rewrote and cleaned up a bit. Hopefully fixes #66810, #66822.
 
 *eclipse-sdk-3.0.1-r1 (07 Oct 2004)
 
index a93ddd5ddb04ec518605f9e4d9e721d1df90cfcb..d50704e0db16e36456a1fb33f3b7cc2f03e04a5b 100644 (file)
@@ -2,9 +2,9 @@ MD5 72c647b7fb61acb5f2197480a18c3691 eclipse-sdk-3.0.1.ebuild 11876
 MD5 dd291d4c0877638b7b4d263444fab68f eclipse-sdk-3.0.0-r3.ebuild 12074
 MD5 0a5769650d0426952026be3b479480ed eclipse-sdk-2.1.3-r3.ebuild 9061
 MD5 59b1c127562221294c69eb2ac3f976ca eclipse-sdk-2.1.3-r5.ebuild 9686
-MD5 15a1e55d4a1adcea5951726f024e8ae4 eclipse-sdk-3.0.1-r1.ebuild 13461
+MD5 7763704e014832adc84579eb33786699 eclipse-sdk-3.0.1-r1.ebuild 13985
 MD5 3b77ea6dd08b71b83872d31d9d79e1ab eclipse-sdk-3.1_pre1.ebuild 12127
-MD5 3ed24f81ad4203cdd9bdf1d977cea46b ChangeLog 13205
+MD5 759312e151ae66405562733eb5b9bfcf ChangeLog 13359
 MD5 9cc8d5162e981d7b7fc1ef9fa1ac0e65 metadata.xml 919
 MD5 ab0f6620b4767e065bd533b06245b0fc files/01-distribute_ant_target-2.1.patch 1103
 MD5 6c2995197ef0a038015ffff1dee7ac72 files/00-refactor_rename.patch 59577
index 0362b90934d71ee5629b2ecb3542e9369ed69051..46671469471f53a410368e12417db4e527c72f96 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-util/eclipse-sdk/eclipse-sdk-3.0.1-r1.ebuild,v 1.1 2004/10/07 17:07:50 karltk Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-util/eclipse-sdk/eclipse-sdk-3.0.1-r1.ebuild,v 1.2 2004/10/09 21:39:58 karltk Exp $
 
 inherit eutils java-utils
 
@@ -33,44 +33,17 @@ DEPEND="${RDEPEND}
        app-arch/zip"
 
 pkg_setup() {
-       if use ppc; then
-               ewarn "This package needs 1 gig Ram on PPC !"
-       fi
+
+       check-ram
 
        java-utils_setup-vm
 
-       # karltk: refactor, put in java-pkg.eclass?
-       local version="$(java-config --java-version | grep 'java version' | sed -r 's/java version \"(.*)\"/\1/')"
-       local ver_rx="([0-9]+)\.([0-9]+)\.([0-9]+)(.*)"
-       local major=$(echo ${version} | sed -r "s/${ver_rx}/\1/")
-       local minor=$(echo ${version} | sed -r "s/${ver_rx}/\2/")
-       local patch=$(echo ${version} | sed -r "s/${ver_rx}/\3/")
-       local extra=$(echo ${version} | sed -r "s/${ver_rx}/\4/")
-
-       if [ ${major} -ge 1 ] && [ ${minor} -gt 4 ] ; then
-               einfo "Detected JDK is sufficient to compile Eclipse (${version} >= 1.4.2)"
-       elif [ ${major} -ge 1 ] && [ ${minor} -ge 4 ] && [ ${patch} -ge 2 ] ; then
-               einfo "Detected JDK is sufficient to compile Eclipse (${version} >= 1.4.2)"
-       else
-               die "Detected JDK (${version}) is too old to compile Eclipse, need at least 1.4.2!"
-       fi
+       java-utils_ensure-vm-version-ge 1 4 2
 
-       if ${use_gtk} && use mozilla ; then
-               if [ -f ${ROOT}/usr/lib/mozilla/libgtkembedmoz.so ] ; then
-                       einfo "Compiling against net-www/mozilla"
-                       mozilla_dir=/usr/lib/mozilla
-               elif [ -f ${ROOT}/usr/lib/MozillaFirefox/libgtkembedmoz.so ] ; then
-                       einfo "Compiling against net-www/mozilla-firefox"
-                       mozilla_dir=/usr/lib/MozillaFirefox
-               else
-                       eerror "You need either Mozilla, compiled against gtk+ v2.0 or newer"
-                       eerror "To merge it, do USE=\"gtk2\" emerge mozilla."
-                       eerror "Otherwise, remove \"mozilla\" from use flags"
-                       die "Need Mozilla compiled with gtk+-2.0 support"
-               fi
-       fi
+       ${use_gtk} && use mozilla && detect-mozilla
+
+       setup-dir-vars
 
-       set_dirs
        use gtk && use_gtk='true' || use_gtk='false'
        use motif && use_motif='true' || use_motif='false'
 
@@ -79,9 +52,146 @@ pkg_setup() {
 
        # If neither enabled, default to gtk+
        ${use_gtk} || ${use_motif} || use_gtk='true'
+
+       # If both enabled, use gtk+ only
+       ${use_gtk} && ${use_motif} && use_motif='false'
+
+       einfo "Compiling gtk+ frontend  : ${use_gtk}"
+       einfo "Compiling Motif frontend : ${use_motif}"
+
+}
+
+src_unpack() {
+       mkdir ${S}
+       cd ${S}
+       unpack ${MY_A} || die "Could not unpack ${MY_A}"
+
+       epatch ${FILESDIR}/03-motif-java1.5-build.patch
+
+       einfo "Setting up virtual machine"
+       java-utils_setup-vm
+
+       einfo "Patching build.xmls"
+       process-build-xmls
+
+       einfo "Cleaning out prebuilt code"
+       clean-prebuilt-code
+
+       einfo "Patching gtk+ frontend"
+       patch-gtk-frontend
+
+       einfo "Patching Motif frontend"
+       patch-motif-frontend
+
+       einfo "Set build version in Help->About"
+       find -type f -name about.mappings -exec sed -e "s/@build@/Gentoo Linux ${PF}/" -i \{\} \;
 }
 
-set_dirs() {
+src_compile() {
+
+       # karltk: this should be handled by the java-pkg eclass in setup-vm 
+       addwrite "/proc/self/maps"
+       addwrite "/proc/cpuinfo"
+       addwrite "/dev/random"
+
+       # Figure out correct boot classpath
+       # karltk: this should be handled by the java-pkg eclass in setup-vm
+       if [ ! -z "`java-config --java-version | grep IBM`" ] ; then
+               # IBM JRE
+               ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/core.jar:$(java-config --jdk-home)/jre/lib/xml.jar:$(java-config --jdk-home)/jre/lib/graphics.jar"
+       else
+               # Sun derived JREs (Blackdown, Sun)
+               ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/rt.jar"
+       fi
+
+       export ANT_OPTS=-Xmx768m
+
+       einfo "Building resources.core plugin"
+       cd ${S}/${core_src_dir}
+       make JDK_INCLUDE="`java-config -O`/include -I`java-config -O`/include/linux" || die "Failed to build resource.core plugin"
+       mkdir -p ${S}/"${core_dest_dir}"
+       mv *.so ${S}/"${core_dest_dir}"
+       cd ${S}
+
+       # Compile all Java code
+       ${use_gtk} && build-gtk-java compile
+       ${use_motif} && build-motif-java compile
+
+       # Build selected native frontend code
+       ${use_gtk} && build-gtk-native
+       ${use_motif} && build-motif-native
+
+       # Install all Java code
+       ${use_gtk} && build-gtk-java install
+       ${use_motif} && motif-build-java install
+
+       create-desktop-entry
+}
+
+src_install() {
+       eclipse_dir="/usr/lib/eclipse-${SLOT}"
+
+       dodir /usr/lib
+
+       einfo "Installing features and plugins"
+       if ${use_gtk} ; then
+               [ -f result/linux-gtk-${ARCH}-sdk.zip ] || die "gtk zip bundle was not build properly!"
+               unzip -o -q result/linux-gtk-${ARCH}-sdk.zip -d ${D}/usr/lib
+       fi
+       if ${use_motif} ; then
+               [ -f result/linux-motif-${ARCH}-sdk.zip ] || die "motif zip bundle was not build properly!"
+               unzip -o -q result/linux-motif-${ARCH}-sdk.zip -d ${D}/usr/lib
+       fi
+
+       mv ${D}/usr/lib/eclipse ${D}/${eclipse_dir}
+
+       insinto ${eclipse_dir}
+
+       # Install launchers and native code
+       exeinto ${eclipse_dir}
+       if ${use_gtk} ; then
+               einfo "Installing eclipse-gtk binary"
+               doexe plugins/platform-launcher/library/gtk/eclipse-gtk \
+                       || die "Failed to install eclipse-gtk"
+       fi
+       if ${use_motif} ; then
+               einfo "Installing eclipse-motif binary"
+               doexe plugins/platform-launcher/library/motif/eclipse-motif \
+                       || die "Failed to install eclipse-motif"
+       fi
+
+       doins plugins/org.eclipse.platform/{startup.jar,splash.bmp}
+
+       # Install startup script
+       exeinto /usr/bin
+       doexe ${FILESDIR}/eclipse-${SLOT}
+
+       install-desktop-entry
+
+       doman ${FILESDIR}/eclipse.1
+}
+
+# -----------------------------------------------------------------------------
+#  Helper functions
+# -----------------------------------------------------------------------------
+
+function detect-mozilla()
+{
+       if [ -f ${ROOT}/usr/lib/mozilla/libgtkembedmoz.so ] ; then
+               einfo "Compiling against net-www/mozilla"
+               mozilla_dir=/usr/lib/mozilla
+       elif [ -f ${ROOT}/usr/lib/MozillaFirefox/libgtkembedmoz.so ] ; then
+               einfo "Compiling against net-www/mozilla-firefox"
+               mozilla_dir=/usr/lib/MozillaFirefox
+       else
+               eerror "You need either Mozilla, compiled against gtk+ v2.0 or newer"
+               eerror "To merge it, do USE=\"gtk2\" emerge mozilla."
+               eerror "Otherwise, remove \"mozilla\" from use flags"
+               die "Need Mozilla compiled with gtk+-2.x support"
+       fi
+}
+
+function setup-dir-vars() {
        gtk_launcher_src_dir="plugins/platform-launcher/library/gtk"
        motif_launch_src_dir="plugins/platform-launcher/library/motif"
        gtk_swt_src_dir="plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library"
@@ -89,7 +199,7 @@ set_dirs() {
 
        core_src_dir="plugins/org.eclipse.core.resources.linux/src"
 
-       case $ARCH in
+       case ${ARCH} in
                sparc)
                        gtk_swt_dest_dir="plugins/org.eclipse.swt.gtk/os/solaris/sparc"
                        motif_swt_dest_dir="plugins/org.eclipse.swt.motif/os/solaris/sparc"
@@ -113,14 +223,7 @@ set_dirs() {
        esac
 }
 
-src_unpack() {
-       mkdir ${S}
-       cd ${S}
-       unpack ${MY_A} || die "Could not unpack ${MY_A}"
-
-       epatch ${FILESDIR}/03-motif-java1.5-build.patch
-
-       java-utils_setup-vm
+function process-build-xmls() {
 
        # Turn off verbose mode and on errors in all build.xml files
        for x in $(find . -type f -name "build.xml") ; do
@@ -128,21 +231,16 @@ src_unpack() {
                        -e 's/failonerror="[^"]+"/failonerror="true"/' \
                        -e 's/verbose="[^"]+"/verbose="false"/' $x
        done
+}
 
-       # Clean up all pre-built code
-       ant -q -DinstallWs=gtk -DinstallOs=linux clean
-       ant -q -DinstallWs=motif -DinstallOs=linux clean
-       find ${S} -name '*.so' -exec rm -f {} \;
-       find ${S} -name '*.so.*' -exec rm -f {} \;
-       find ${S} -type f -name 'eclipse' -exec rm {} \;
-       rm -f eclipse
+function patch-gtk-frontend() {
 
        # Move around some source code that should have been handled by the build system
-       cd ${S}/"${gtk_swt_src_dir}" || die "Directory ${gtk_swt_src_dir} not found"
-       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* .
-       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Mozilla/common/library/* .
-       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Program/gnome/library/* .
-       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ AWT/gtk/library/* .
+       local m="Failed to move native files for SWT gtk+"
+       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
+       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Mozilla/common/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
+       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ Program/gnome/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
+       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT\ AWT/gtk/library/* ${S}/"${gtk_swt_src_dir}" || die ${m}
 
        if use gnome ; then
            gnome_lib=`pkg-config --libs gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0 | sed -e "s:-pthread:-lpthread:" -e "s:-Wl,--export:--export:"`
@@ -165,10 +263,13 @@ src_unpack() {
                -e "s:-L\$(MOZILLA_HOME)/lib -lembed_base_s:-L${mozilla_dir} -lgtkembedmoz:" \
                -e "s:MOZILLACFLAGS = -O:MOZILLACFLAGS = -O -fPIC:" \
                -e "s:\$(JAVA_HOME)/jre/bin:\$(JAVA_HOME)/jre/lib/i386:" \
-               -i make_gtk.mak
+               -i ${S}/"${gtk_swt_src_dir}"/make_gtk.mak || die "Failed to modify make_gtk.mak"
 
-       cd ${S}/"${motif_swt_src_dir}"
-       cp ${S}/plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* .
+}
+
+function patch-motif-frontend()
+{
+       cp plugins/org.eclipse.swt/Eclipse\ SWT/common/library/* "${motif_swt_src_dir}"
        sed -e "s:/bluebird/teamswt/swt-builddir/IBMJava2-141:$JAVA_HOME:" \
                -e "s:/bluebird/teamswt/swt-builddir/motif21:/usr/X11R6:" \
                -e "s:/usr/lib/qt-3.1:/usr/qt/3:" \
@@ -178,24 +279,76 @@ src_unpack() {
                -e "s:-I\$(JAVA_HOME)\t:-I\$(JAVA_HOME)/include -I\$(JAVA_HOME)/include/linux:" \
                -e "s:-L\$(MOZILLA_HOME)/lib -lembed_base_s:-L\$(MOZILLA_HOME):" \
                -e "s:-L\$(JAVA_HOME)/jre/bin:-L\$(JAVA_HOME)/jre/lib/i386:" \
-               -i make_linux.mak
+               -i "${motif_swt_src_dir}"/make_linux.mak || die "Failed to modify Motfit make_linux.mak"
+}
 
-       cd ${S}
-       find -type f -name about.mappings -exec sed -e "s/@build@/Gentoo Linux ${PF}/" -i \{\} \;
+
+function create-desktop-entry() {
+
+       cat ${FILESDIR}/eclipse-${SLOT}.desktop | \
+               sed -e "s/@PV@/${PV}/" \
+               > eclipse-${SLOT}.desktop || die "Failed to create desktop entry"
+}
+
+function build-gtk-java() {
+       local target=${1}
+
+       einfo "Building GTK+ frontend (${target}) -- see compilelog.txt for details"
+       ant -q -q  \
+               -buildfile build.xml \
+               -DinstallOs=linux \
+               -DinstallWs=gtk \
+               -DinstallArch=$ARCH \
+               ${ant_extra_opts} ${target} \
+               || die "Failed to ${target} Java code (gtk+)"
+}
+
+function build-motif-java() {
+       local target=${1}
+
+       einfo "Building Motif frontend (${target}) -- see compilelog.txt for details"
+       ant -q -q  \
+               -buildfile build.xml \
+               -DcollPlace="eclipse-${SLOT}" \
+               -DinstallOs=linux \
+               -DinstallWs=motif \
+               -DinstallArch=$ARCH \
+               ${ant_extra_opts} ${target} \
+               || die "Failed to ${target} java code (Motif)"
+}
+
+function install-desktop-entry() {
+
+       # Install GNOME .desktop file
+       if use gnome ; then
+               insinto /usr/share/gnome/apps/Development
+               doins eclipse-${SLOT}.desktop
+       fi
+
+       # Install KDE .desktop file
+       if use kde ; then
+               for x in /usr/kde/* ; do
+                       insinto ${x}/share/applnk/Applications/
+                       doins eclipse-${SLOT}.desktop
+               done
+       fi
 }
 
-build_gtk_frontend() {
+function build-gtk-native() {
 
        einfo "Building gtk+ SWT"
 
        # kludge to allow patches to applied at unpack, but correct compilation
-       if (( $ARCH=="amd64" )) ; then
+       if [ ${ARCH} == "amd64" ] ; then
                gtk_swt_src_dir="plugins/org.eclipse.swt.gtk64/src/Eclipse SWT PI/gtk/library"
        fi
 
+       # Perpare destination directory
+       mkdir -p ${S}/"${gtk_swt_dest_dir}"
+
        # Build the eclipse gtk binary
        cd ${S}/plugins/platform-launcher/library/gtk
-       case $ARCH in
+       case ${ARCH} in
                sparc|x86|ppc)
                        tcsh -f build.csh -output eclipse-gtk -arch $ARCH || die "Failed to build eclipse-gtk"
                        ;;
@@ -205,9 +358,8 @@ build_gtk_frontend() {
        esac
 
 
-
        cd ${S}/"${gtk_swt_src_dir}"
-       case $ARCH in
+       case ${ARCH} in
                sparc|x86|ppc)
                        bash ./build.sh make_swt || die "Failed to build platform-independent SWT support"
                        bash ./build.sh make_atk || die "Failed to build atk support"
@@ -220,7 +372,7 @@ build_gtk_frontend() {
 
        if use gnome ; then
                einfo "Building GNOME VFS support"
-               case $ARCH in
+               case ${ARCH} in
                        sparc|x86|ppc)
                                bash ./build.sh make_gnome || die "Failed to build GNOME VFS support"
                                ;;
@@ -243,11 +395,15 @@ build_gtk_frontend() {
        fi
 
        # move the *.so files to the right path so eclipse can find them
-       mkdir -p ${S}/"${gtk_swt_dest_dir}"
+       # karltk: do this incrementally at each step above, with || die
        mv *.so ${S}/"${gtk_swt_dest_dir}"
+       cd ${S}
 }
 
-build_motif_frontend() {
+function build-motif-native() {
+
+       # Prepare destination directory
+       mkdir -p ${S}/"${motif_swt_dest_dir}"
 
        # Build eclipse motif binary
        cd ${S}/plugins/platform-launcher/library/motif
@@ -261,145 +417,38 @@ build_motif_frontend() {
        fi
 
        # move the *.so files to the right path so eclipse can find them
-       mkdir -p ${S}/"${motif_swt_dest_dir}"
+       # karltk: do this incrementally at each step above, with || die
        mv *.so ${S}/"${motif_swt_dest_dir}"
-}
-
-src_compile() {
-
-       addwrite "/proc/self/maps"
-       addwrite "/proc/cpuinfo"
-       addwrite "/dev/random"
-
-       # Figure out correct boot classpath
-       if [ ! -z "`java-config --java-version | grep IBM`" ] ; then
-               # IBM JRE
-               ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/core.jar:$(java-config --jdk-home)/jre/lib/xml.jar:$(java-config --jdk-home)/jre/lib/graphics.jar"
-       else
-               # Sun derived JREs (Blackdown, Sun)
-               ant_extra_opts="-Dbootclasspath=$(java-config --jdk-home)/jre/lib/rt.jar"
-       fi
-
-       export ANT_OPTS=-Xmx768m
-
-       einfo "Building resources.core plugin"
-       cd ${S}/${core_src_dir}
-       make JDK_INCLUDE="`java-config -O`/include -I`java-config -O`/include/linux" || die "Failed to build resource.core plugin"
-       mkdir -p ${S}/"${core_dest_dir}"
-       mv *.so ${S}/"${core_dest_dir}"
-
        cd ${S}
-
-       # Build all java code -- default to gtk if neither of gtk, motif,
-       # kde are set
-       if ( ${use_gtk} || ! ( ${use_gtk} || ${use_motif} || use kde ) ); then
-               einfo "Building GTK+ frontend -- see compilelog.txt for details"
-               ant -q -q  \
-                       -buildfile build.xml \
-                       -DinstallOs=linux \
-                       -DinstallWs=gtk \
-                       -DinstallArch=$ARCH \
-                       ${ant_extra_opts} compile \
-                       || die "Failed to compile java code (gtk+)"
-       fi
-       if ${use_motif} ; then
-               einfo "Building Motif frontend -- see compilelog.txt for details"
-               ant -q -q  \
-                       -buildfile build.xml \
-                       -DcollPlace="eclipse-${SLOT}" \
-                       -DinstallOs=linux \
-                       -DinstallWs=motif \
-                       -DinstallArch=$ARCH \
-                       ${ant_extra_opts} compile \
-                       || die "Failed to compile java code (Motif)"
-       fi
-
-       # Build selected frontends
-       ${use_gtk} && build_gtk_frontend
-
-       cd ${S}
-       # Build all java code -- default to gtk if neither of gtk, motif,
-       # kde are set
-       if ( ${use_gtk} || ! ( ${use_gtk} || ${use_motif} || use kde ) ); then
-               einfo "Installing GTK+ frontend -- see compilelog.txt for details"
-               ant -q -q  \
-                       -buildfile build.xml \
-                       -DinstallOs=linux \
-                       -DinstallWs=gtk \
-                       -DinstallArch=$ARCH \
-                       ${ant_extra_opts} install \
-                       || die "Failed to compile java code (gtk+)"
-       fi
-       if ${use_motif} ; then
-               einfo "Installing  Motif frontend -- see compilelog.txt for details"
-               ant -q -q  \
-                       -buildfile build.xml \
-                       -DcollPlace="eclipse-${SLOT}" \
-                       -DinstallOs=linux \
-                       -DinstallWs=motif \
-                       -DinstallArch=$ARCH \
-                       ${ant_extra_opts} install \
-                       || die "Failed to compile java code (Motif)"
-       fi
-
-       ${use_motif} && build_motif_frontend
-
-       cat ${FILESDIR}/eclipse-${SLOT}.desktop | \
-               sed -e "s/@PV@/${PV}/" \
-               > eclipse-${SLOT}.desktop
 }
 
-src_install() {
-       eclipse_dir="/usr/lib/eclipse-${SLOT}"
 
-       dodir /usr/lib
 
-       einfo "Installing features and plugins"
-       if ${use_gtk} ; then
-               [ -f result/linux-gtk-${ARCH}-sdk.zip ] || die "gtk zip bundle was not build properly!"
-               unzip -o -q result/linux-gtk-${ARCH}-sdk.zip -d ${D}/usr/lib
-       fi
-       if ${use_motif} ; then
-               [ -f result/linux-motif-${ARCH}-sdk.zip ] || die "motif zip bundle was not build properly!"
-               unzip -o -q result/linux-motif-${ARCH}-sdk.zip -d ${D}/usr/lib
-       fi
-
-       mv ${D}/usr/lib/eclipse ${D}/${eclipse_dir}
-
-       insinto ${eclipse_dir}
-
-       # Install launchers and native code
-       exeinto ${eclipse_dir}
-       if ${use_gtk} ; then
-               einfo "Installing eclipse-gtk binary"
-               doexe plugins/platform-launcher/library/gtk/eclipse-gtk \
-                       || die "Failed to install eclipse-gtk"
-       fi
-       if ${use_motif} ; then
-               einfo "Installing eclipse-motif binary"
-               doexe plugins/platform-launcher/library/motif/eclipse-motif \
-                       || die "Failed to install eclipse-motif"
-       fi
+function clean-prebuilt-code() {
 
-       doins plugins/org.eclipse.platform/{startup.jar,splash.bmp}
+       # Clean up all pre-built code
+       ant -q -DinstallWs=gtk -DinstallOs=linux clean
+       ant -q -DinstallWs=motif -DinstallOs=linux clean
+       find ${S} -name '*.so' -exec rm -f {} \;
+       find ${S} -name '*.so.*' -exec rm -f {} \;
+       find ${S} -type f -name 'eclipse' -exec rm {} \;
+       rm -f eclipse
 
-       # Install startup script
-       exeinto /usr/bin
-       doexe ${FILESDIR}/eclipse-${SLOT}
+}
 
-       # Install GNOME .desktop file
-       if use gnome ; then
-               insinto /usr/share/gnome/apps/Development
-               doins eclipse-${SLOT}.desktop
-       fi
+function get-memory-total() {
+       cat /proc/meminfo | grep MemTotal | sed -r "s/[^0-9]*([0-9]+).*/\1/"
+}
 
-       # Install KDE .desktop file
-       if use kde ; then
-               for x in /usr/kde/* ; do
-                       insinto ${x}/share/applnk/Applications/
-                       doins eclipse-${SLOT}.desktop
-               done
-       fi
+function check-ram() {
 
-       doman ${FILESDIR}/eclipse.1
+       local mem=$(get-memory-total)
+       [ $(get-memory-total) -lt 775669 ] &&
+               (
+               echo
+               ewarn "To build Eclipse, at least 768MB of RAM is recommended."
+               ewarn "Your machine has less RAM. Continuing anyway."
+               echo
+       )
 }
+