%define bootstrap 1 %define ecj_bin 1 %define gcj_support 1 %define gccsuffix 4.3 %if %{bootstrap} %define gcj_support 0 %endif # Redefine %jar so we don't need a jdk to build %define jar %{_bindir}/gjar%{gccsuffix} Summary: Eclipse Compiler for Java Name: ecj-bootstrap Version: 3.2.2 Release: %mkrel 1.5 Epoch: 0 URL: http://www.eclipse.org/ Source0: ftp://ftp.cse.buffalo.edu/pub/Eclipse/eclipse/downloads/drops/R-3.2.2-200702121330/ecjsrc.zip Source1: compilejdtcorewithjavac.xml Source2: compilejdtcore.xml License: CPL Group: Development/Java BuildRoot: %{_tmppath}/%{name}-%{version}-root %if !%{bootstrap} BuildRequires: ant %endif BuildRequires: gcc%{gccsuffix}-java BuildRequires: java-rpmbuild BuildRequires: zip # (anssi) bootstrap compiler should not be proposed: #Provides: eclipse-ecj Conflicts: eclipse-ecj %if !%{ecj_bin} %if !%{gcj_support} BuildArch: noarch %endif %endif %description Ecj is the Java bytecode compiler of the Eclipse Project. %prep %setup -q -c -T %{__install} -D -m 644 %{SOURCE0} jdtcoresrc/src/ecj.zip %if !%{bootstrap} %{__install} -D -m 644 %{SOURCE1} jdtcoresrc/compilejdtcorewithjavac.xml %{__install} -D -m 644 %{SOURCE2} jdtcoresrc/compilejdtcore.xml %{__perl} -pi -e 's/verbose="true"/verbose="\${javacVerbose}"/' jdtcoresrc/compilejdtcorewithjavac.xml jdtcoresrc/compilejdtcore.xml %endif %build # Bootstrapping is 3 parts: # 1. Build ecj with gcj -C # 2. Build ecj with gcj-built ecj ("javac") using ant # 3. Re-build ecj with output of 2 using ant ## 1. Build ecj with gcj -C # Unzip the "stable compiler" source into a temp dir and build it. # Note: we don't want to build the CompilerAdapter. %{__mkdir_p} ecj-bootstrap-tmp %{__unzip} -qq -d ecj-bootstrap-tmp jdtcoresrc/src/ecj.zip %{__rm} ecj-bootstrap-tmp/org/eclipse/jdt/core/JDTCompilerAdapter.java export CLASSPATH= pushd ecj-bootstrap-tmp for f in `%{_bindir}/find . -type f -name '*.java' | /bin/cut -c 3-`; do %{_bindir}/gcj%{gccsuffix} -Wno-deprecated -I. -C $f done # (anssi) asterisk added to workaround apparent gjar bug (GCC #32516) %{_bindir}/find * -name '*.class' -or -name '*.properties' -or -name '*.rsc' | %{_bindir}/xargs -t %{jar} cf ../ecj-bootstrap.jar popd # Delete our modified ecj and restore the backup %{__rm} -r ecj-bootstrap-tmp %if !%{bootstrap} %if %{gcj_support} ## 2. Build ecj CLASSPATH=$ORIGCLASSPATH export CLASSPATH=ecj-bootstrap.jar:$ORIGCLASSPATH export OPT_JAR_LIST=: %{ant} -buildfile jdtcoresrc/compilejdtcorewithjavac.xml \ -DjavacFailOnError=true \ -DjavacVerbose=false %{__rm} ecj-bootstrap.jar ## 3. Use this ecj to rebuild itself export CLASSPATH=`pwd`/jdtcoresrc/ecj.jar:$ORIGCLASSPATH %{ant} -buildfile jdtcoresrc/compilejdtcore.xml \ -DjavacFailOnError=true \ -DjavacVerbose=false %endif # gcj_support %else %{__mv} ecj-bootstrap.jar ecj.jar %endif # !bootstrap %install %{__rm} -rf %{buildroot} %{__install} -D -m 644 ecj.jar %{buildroot}%{_javadir}/eclipse-ecj.jar (cd %{buildroot}%{_javadir} && %{__ln_s} eclipse-ecj.jar jdtcore.jar) (cd %{buildroot}%{_javadir} && %{__ln_s} eclipse-ecj.jar ecj.jar) %if %{gcj_support} %{_bindir}/aot-compile-rpm %endif %if %{ecj_bin} # Build and install ecj binary %{__mkdir_p} %{buildroot}%{_bindir} %if %{gcj_support} pushd %{buildroot}%{_libdir}/gcj/%{name} %{_bindir}/gcj%{gccsuffix} -g -O2 --main=org.eclipse.jdt.internal.compiler.batch.Main \ -Wl,-R,%{_libdir}/gcj/%{name} \ eclipse-ecj.jar.so -o \ %{buildroot}%{_bindir}/ecj popd %else pushd %{buildroot}%{_javadir} # (anssi) added -findirect-dispatch to prevent build failure: %{_bindir}/gcj%{gccsuffix} -g -O2 --main=org.eclipse.jdt.internal.compiler.batch.Main \ -Wl,-R,%{_javadir} -findirect-dispatch \ eclipse-ecj.jar -o %{buildroot}%{_bindir}/ecj popd %endif %{__chmod} a+x %{buildroot}%{_bindir}/ecj %endif %clean %{__rm} -rf %{buildroot} %files %defattr(0644,root,root,0755) %if %{ecj_bin} %attr(0755,root,root) %{_bindir}/ecj %endif %{_javadir}/ecj.jar %{_javadir}/eclipse-ecj.jar %{_javadir}/jdtcore.jar %if %{gcj_support} %dir %{_libdir}/gcj/%{name} %attr(-,root,root) %{_libdir}/gcj/%{name}/* %endif %changelog * Sun Dec 16 2007 Anssi Hannula <anssi@mandriva.org> 3.2.2-1.5mdv2008.1 + Revision: 120876 - buildrequire java-rpmbuild, i.e. build with icedtea on x86(_64) * Tue Jun 26 2007 Anssi Hannula <anssi@mandriva.org> 0:3.2.2-1.4mdv2008.0 + Revision: 44576 - add asterisk to produce valid jar file (workarounds gcc #32516) * Tue Jun 26 2007 Anssi Hannula <anssi@mandriva.org> 0:3.2.2-1.3mdv2008.0 + Revision: 44389 - do not require specific gcc version - do not require gcc-java at runtime * Tue Jun 26 2007 Anssi Hannula <anssi@mandriva.org> 0:3.2.2-1.2mdv2008.0 + Revision: 44383 - use -findirect-dispatch when building with ecj_bin without gcj_support - enable bootstrap - build with gcc4.3 - do not provide eclipse-ecj * Wed Apr 25 2007 David Walluck <walluck@mandriva.org> 0:3.2.2-1.1mdv2008.0 + Revision: 18096 - add ecj.jar symlink for JPackage compatibility * Sun Mar 11 2007 David Walluck <walluck@mandriva.org> 0:3.2.2-1mdv2007.1 + Revision: 141198 - 3.2.2 * Fri Dec 15 2006 David Walluck <walluck@mandriva.org> 0:3.2.1-2mdv2007.1 + Revision: 97416 - leave bootstrap undefined, but use ecj-bootstrap name - 3.2.1 - Import ecj-bootstrap * Tue Jul 18 2006 David Walluck <walluck@mandriva.org> 0:3.2.0-2mdv2007.0 - add jdtcore symlink for tomcat5 * Mon Jul 10 2006 David Walluck <walluck@mandriva.org> 0:3.2.0-1mdv2007.0 - 3.2.0 * Thu Jun 01 2006 David Walluck <walluck@mandriva.org> 0:3.1.2-1mdv2007.0 - 3.1.2 - rebuild for libgcj.so.7 * Wed Sep 07 2005 David Walluck <walluck@mandriva.org> 0:3.1-0.m6.14.6mdk - fix bootstrap name * Wed Sep 07 2005 David Walluck <walluck@mandriva.org> 0:3.1-0.m6.14.5mdk - fix bootstrap * Thu Aug 04 2005 David Walluck <walluck@mandriva.org> 0:3.1-0.M6.14.4mdk - sync with eclipse ecj * Sun Jun 26 2005 Christiaan Welvaart <cjw@daneel.dyndns.org> 0:3.1-0.M6.14.3mdk - gcc 4.0.1 * Sat Jun 11 2005 David Walluck <walluck@mandriva.org> 0:3.1-0.M6.14.2mdk - rename jar - add eclipse binary * Thu May 05 2005 David Walluck <walluck@mandriva.org> 0:3.1-0.M6.14.1mdk - release * Mon Mar 07 2005 Andrew Overholt <overholt@redhat.com> 1:3.1.0.M4.9 - Don't build for ppc or ia64. * Sun Feb 20 2005 Andrew Overholt <overholt@redhat.com> 1:3.1.0.M4.6 - Upgrade back to 3.1M4. - Don't build for i386 and x86_64. - Provide eclipse-ecj until we can deprecate this package. * Fri Jan 14 2005 Andrew Overholt <overholt@redhat.com> 3.1.0.M4.4 - build for all but x86 * Thu Jan 13 2005 Andrew Overholt <overholt@redhat.com> 3.1.0.M4.3 - build for ppc exclusively * Wed Jan 12 2005 Andrew Overholt <overholt@redhat.com> 3.1.0.M4.2 - Add RPM_OPT_FLAGS workaround. * Tue Jan 11 2005 Andrew Overholt <overholt@redhat.com> 3.1.0.M4.1 - New version. * Tue Sep 28 2004 Gary Benson <gbenson@redhat.com> 2.1.3-5 - Rebuild with new katana. * Fri Jul 23 2004 Gary Benson <gbenson@redhat.com> 2.1.3-4 - Build without bootstrap-ant. - Split out lib-org-eclipse-jdt-internal-compiler.so. * Wed Jul 07 2004 Gary Benson <gbenson@redhat.com> 2.1.3-3 - Fix ecj-devel's dependencies. * Thu Jun 10 2004 Gary Benson <gbenson@redhat.com> 2.1.3-2 - Work around an optimiser failure somewhere in ecj or gcj (#125613). * Sat May 29 2004 Gary Benson <gbenson@redhat.com> - Build with katana. * Tue May 25 2004 Gary Benson <gbenson@redhat.com> 2.1.3-1 - Initial Red Hat Linux build. * Tue May 25 2004 Gary Benson <gbenson@redhat.com> - Upgraded to latest version.