diff --git a/eclipse-pdebuild.sh b/eclipse-pdebuild.sh new file mode 100755 index 0000000..820d4ac --- /dev/null +++ b/eclipse-pdebuild.sh @@ -0,0 +1,208 @@ +#!/bin/bash + +# args: [-f ] [-d ] [-a ] [-j ] [-v] [-D] + +function usage { +cat << _EOF_ +usage: $0 [] + +Use PDE Build to build Eclipse features + +Optional arguments: + -h Show this help message + -f Feature ID to build + -d Plugin dependencies in addition to Eclipse SDK + (space-separated, names on which to glob features and plugins) + -a Additional build arguments (ex. -DjavacSource=1.5) + -j VM arguments (ex. -DJ2SE-1.5=%{_jvmdir}/java/jre/lib/rt.jar) + -v Be verbose + -D Debug platform itself (passes -consolelog -debug to Eclipse) +_EOF_ +} + +function copyPlatform { + # This seems silly but I was running into issues with empty strings + # counting as arguments to copy-platform -- overholt, 2008-03 + if [ -z $dependencies ]; then + if [ $verbose -eq 1 ]; then + echo "/bin/sh -x $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse" + /bin/sh -x $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse + else + echo "/bin/sh $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse" + /bin/sh $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse + fi + else + if [ $verbose -eq 1 ]; then + echo "/bin/sh -x $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies" + /bin/sh -x $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies + else + echo "/bin/sh $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies" + /bin/sh $datadir/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies + fi + fi +} + +function findFeatureId { + # We can determine the feature ID if we have only one + numFeatures=$(find $sourceDir -name feature.xml | wc -l) + if [ $numFeatures -ne 1 ]; then + #echo "# features found = $numFeatures" + echo "Cannot determine feature ID. Please specify with -f." + usage + exit 1 + fi + + featureXml=$(find $sourceDir -name feature.xml) + + # Taken from Ben Konrath's package-build + # make an ant build files to extract the id from the feature.xml + buildFile=$buildDir/findFeatureForRPM-tmp-build.xml + + echo " + + + + + + " > $buildFile + + featureId=$(ant -Dbasedir=$sourceDir -f $buildFile 2>&1 | grep echo | cut --delimiter=' ' -f 7) + rm $buildFile +} + +sourceDir=$PWD +buildDir=$PWD/build +SDK=$buildDir/SDK +homeDir=$buildDir/home +libdir=`rpm --eval "%{_libdir}"` +datadir=`rpm --eval "%{_datadir}"` +pdeBuildDir=$datadir/eclipse/plugins/org.eclipse.pde.build + +featureId= +dependencies= +additionalArgs= +vmArgs= +verbose=0 +dryRun=0 +debugPlatform=0 + +# See above. r = dry run (used for testing) +while getopts “hf:d:a:j:vrD” OPTION +do + case $OPTION in + h) + usage + exit + ;; + f) + featureId=$OPTARG + ;; + d) + dependencies=$OPTARG + ;; + a) + additionalArgs=$OPTARG + ;; + j) + vmArgs=$OPTARG + ;; + v) + verbose=1 + ;; + r) + dryRun=1 + ;; + D) + debugPlatform=1 + ;; + ?) + usage + exit + ;; + esac +done + +echo "mkdir -p $buildDir" +if [ $dryRun -ne 1 ]; then + mkdir -p $buildDir +fi + +# Eclipse may try to write to the building user's home directory so we create a +# temporary one for use by the build. +echo "mkdir -p $homeDir" +if [ $dryRun -ne 1 ]; then + mkdir -p $homeDir +fi + +if [ -z $featureId ]; then + findFeatureId +fi + +if [ -z $featureId ]; then + echo "Cannot determine feature ID. Please specify with -f." + usage + exit 1 +fi + +echo "Building feature = $featureId." + +if [ -z "$dependencies" ]; then + if [ $verbose -eq 1 ]; then + echo "Assuming no dependencies except Eclipse SDK." + fi +fi + +# Symlink the SDK and dependencies for build +if [ -z "$dependencies" ]; then + echo "Symlinking SDK into $SDK directory." +else + echo "Symlinking SDK and \"$dependencies\" into $SDK directory." +fi +if [ $dryRun -ne 1 ]; then + copyPlatform +fi + +if [ $debugPlatform -eq 1 ]; then + debugPlatformArgs="-debug -consolelog" +fi + +echo +echo "Starting build:" + +echo " +java -cp $SDK/startup.jar \ +-Dosgi.sharedConfiguration.area=$libdir/eclipse/configuration \ +org.eclipse.core.launcher.Main \ +-application org.eclipse.ant.core.antRunner \ +$debugPlatformArgs \ +-Dtype=feature \ +-Did=$featureId \ +-DbaseLocation=$SDK \ +-DsourceDirectory=$sourceDir \ +-DbuildDirectory=$buildDir \ +-Dbuilder=$datadir/eclipse/plugins/org.eclipse.pde.build/templates/package-build \ +$additionalArgs \ +-f $pdeBuildDir/scripts/build.xml \ +-vmargs \ +-Duser.home=$homeDir \ +$vmArgs +" + +if [ $dryRun -ne 1 ]; then + java -cp $SDK/startup.jar \ + -Dosgi.sharedConfiguration.area=$libdir/eclipse/configuration \ + org.eclipse.core.launcher.Main \ + -application org.eclipse.ant.core.antRunner \ + $debugPlatformArgs \ + -Dtype=feature \ + -Did=$featureId \ + -DbaseLocation=$SDK \ + -DsourceDirectory=$sourceDir \ + -DbuildDirectory=$buildDir \ + -Dbuilder=$datadir/eclipse/plugins/org.eclipse.pde.build/templates/package-build \ + $additionalArgs \ + -f $pdeBuildDir/scripts/build.xml \ + -vmargs \ + -Duser.home=$homeDir \ + $vmArgs +fi diff --git a/eclipse.spec b/eclipse.spec index 0274e75..be4f851 100644 --- a/eclipse.spec +++ b/eclipse.spec @@ -19,7 +19,7 @@ Epoch: 1 Summary: An open, extensible IDE Name: eclipse Version: %{eclipse_majmin}.%{eclipse_micro} -Release: 17%{?dist} +Release: 18%{?dist} License: Eclipse Public License Group: Text Editors/Integrated Development Environments (IDE) URL: http://www.eclipse.org/ @@ -48,6 +48,8 @@ Source19: %{name}-filenamepatterns.txt # tar cjf eclipse-fileinitializerapp.tar.bz2 equinox-incubator/ # (generated 2006-11-01 18:48 UTC) Source20: %{name}-fileinitializerapp.tar.bz2 +# Script to wrap PDE Build calls for bundle builds +Source21: %{name}-pdebuild.sh # This needs to go upstream Patch3: %{name}-libupdatebuild2.patch @@ -307,6 +309,8 @@ Requires(postun): %{name}-pde-runtime = %{epoch}:%{version}-%{release} Requires(post): java-gcj-compat >= 1.0.64 Requires(postun): java-gcj-compat >= 1.0.64 %endif +# For PDE Build wrapper script +Requires: bash %description pde Eclipse Plugin Development Environment. This package is required for @@ -974,6 +978,10 @@ sed --in-place "s:startup.jar:%{_datadir}/%{name}/startup.jar:" \ install -p -D -m0755 %{SOURCE18} $RPM_BUILD_ROOT%{_bindir}/ecj sed --in-place "s:@JAVADIR@:%{_javadir}:" $RPM_BUILD_ROOT%{_bindir}/ecj +# Install the PDE Build wrapper script. +install -p -D -m0755 %{SOURCE21} \ + $RPM_BUILD_ROOT%{_datadir}/%{name}/pdebuild + # A sanity check. desktop-file-validate %{SOURCE2} @@ -1570,6 +1578,7 @@ fi %{_datadir}/%{name}/features/org.eclipse.sdk_* %{_datadir}/%{name}/features/org.eclipse.pde_* %{_datadir}/%{name}/features/org.eclipse.pde.source_* +%{_datadir}/%{name}/pdebuild %{_libdir}/%{name}/plugins/org.eclipse.pde.doc.user_* %{_datadir}/%{name}/plugins/org.eclipse.pde.build_* %{_datadir}/%{name}/plugins/org.eclipse.pde.build @@ -1622,6 +1631,10 @@ fi %endif %changelog +* Mon Mar 31 2008 Andrew Overholt 3.3.1.1-18 +- Add PDE Build wrapper script (%%{_datadir}/eclipse/pdebuild) for + packaging guidelines. + * Mon Mar 03 2008 Andrew Overholt 3.3.1.1-17 - Mark eclipse.ini as %%config.