File ecj-bootstrap.spec of Package eclipse-archdep

#
# spec file for package ecj-bootstrap (Version 0.755)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           ecj-bootstrap
BuildRequires:  fastjar gcc-gij gcc-java libgcj-devel unzip zip
%define         eclipse_version 3.4
%define         jarname eclipse-ecj
License:        Other uncritical OpenSource License
Group:          Development/Libraries/Java
AutoReqProv:    on
Summary:        Eclipse Java Compiler
Version:        0.755
Release:        167
Url:            http//www.eclipse.org
Group:          Development/Libraries/Java
Source0:        eclipse-sourceBuild-srcIncluded-%{eclipse_version}.tar.bz2
Source1:        manifest.ecj
#Source2:        strange-mandriva-bug.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#BuildArchitectures: noarch
#ExclusiveArch: %ix86
BuildArch:      noarch
Provides:       eclipse-ecj = %{eclipse_version}

%description
This is the Eclipse Java Compiler, which is used in the
java-1_4_2-gcj-compat-devel package



%prep 
#<<< package descriptions end 
#>>> %prep
%setup -c -T ecj-bootstrap
tar -jxf %{SOURCE0} 
#<<<
#>>> %build 

%build 
#>>> some useful functions ... used throughout bootstrap packages
TARGET_DIR=`pwd`
CLASSPATH_ORIG="$CLASSPATH"
LIB_GCJ="`ls %{_javadir}/libgcj-*.jar`"
#>>> delete binary file and files not needed
TARGET_DIR=`pwd`
function delBinaryFiles() {
  set +x
  echo deleting binary files ...
  for file in `find . -name "*.class" -o -name "*.jar" -o -name "*DELETED-BY-PACKAGER*"` 
  do 
    rm -rf $file
  done
  set -x
}
#<<<
#>>> make a string with all jar files found in target folder that can be used for a classpath string
# string is saved in JAR_CLASSPATH
function mkTargetClasspath() {
  set +x
  JAR_CLASSPATH=""
  for file in `find %{_javadir} -name "*.jar"`
  do
    JAR_CLASSPATH=$file:$JAR_CLASSPATH
  done
  set -x
}
#<<<
#>>> compiles all *.java file in the current directory tree
# uses mkTargetClasspath for CLASSPATH  variable
# uses LIB_GCJ for CLASSPATH
function compileFiles() {
  mkTargetClasspath
  set +x
  COMPILE_CLASSPATH_PATH=.:${JAR_CLASSPATH}
  echo using: $COMPILER_COMMAND $COMPILE_CLASSPATH_PATH $$file
  export LANG=en_US
  find . -name "*.java" -exec $COMPILER_COMMAND $COMPILE_CLASSPATH_PATH {} +
#  for file in `find . -name "*.java"`
#  do
#    echo -e "$COMPILER_COMMAND $COMPILE_CLASSPATH_PATH $file ... \c"
#    $COMPILER_COMMAND $COMPILE_CLASSPATH_PATH $file
#    # check for errors
#    if [ $? != 0 ]
#    then
#      echo ERROR
#      exit 1;
#    fi
#    echo done
#  done
  set -x
}
#<<<
#>>> make jar archive
# PARAM#1: name of jar archive (without .jar suffix)
# uses $TARGET_DIR to move created jar to
function mkJar() {
  find  -name "version.txt" -or -name "*.class" -or -name "*.properties" -or -name "*.rsc" -or -name "*manifest*" |\
      xargs /usr/bin/fastjar -m manifest.* -cf ${1}.jar ;
  mv ${1}.jar $TARGET_DIR
}
#<<<
COMPILER_COMMAND="gij -jar %{_javadir}/%{jarname}.jar -cp  "
#<<< end functions
delBinaryFiles
#>>> ecj compiler 
# we do this twice ... so let's create a function:
function compileEcj() {
  pushd jdtcoresrc/src
  mkdir tmp
  cd tmp
  unzip ../ecj.zip
  # we have to delete the following class ... it needs ant to compile ... it will be left in later
  rm ./org/eclipse/jdt/core/JDTCompilerAdapter.java
  # copy the manifest ...
  cp %{SOURCE1} .
  # Mandriva does not compile without problems ...
  # /me ducks: 
#  %if %{?mandriva_release:1}0
#    if [ $1 = "stage1" ]
#    then
#      cat %{SOURCE2} | patch -p0
#    fi
#  %endif
  compileFiles
  mkJar %{jarname}
  cd ..
  rm -r tmp
  popd
}
# compile with gcj
COMPILER_COMMAND="gcj  -Wno-deprecated -findirect-dispatch -Bsymbolic -C --classpath "
compileEcj stage1
# compile with ecj
COMPILER_COMMAND="gij -jar $TARGET_DIR/%{jarname}.jar -cp  "
compileEcj stage2
#>>> wrapper script
# wrapper script to call ecj:
# ecj script:
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cat >>$RPM_BUILD_ROOT/%{_bindir}/ecj<<EOF
#!/bin/bash
# remove double bootclasspath entries:
BOOTCLASSPATH=""
BOOTCLASSPATH=\$(find %{_javadir} -name "libgcj*.jar" -print | tr "\n" ":"):\$(find %{_javadir}/ -name "glibj*.jar" -print | tr "\n" ":")
OPTIONS=""
while [ \$# -gt 0 ]
do
  if [ \$1 = "-bootclasspath" ]
  then
    BOOTCLASSPATH=\$2:\$BOOTCLASSPATH
    shift
    shift
    continue
  fi
  OPTIONS="\$OPTIONS \$1"
  shift
done
GIJ_EXECUTABLE=\$(ls /usr/bin/gij* | tail -n1)
if [ -e /usr/bin/java ]
then
  exec /usr/bin/java -jar %{_javadir}/%{jarname}.jar -bootclasspath \$BOOTCLASSPATH \$OPTIONS
elif [ -e /usr/bin/cacao ]
then
  exec /usr/bin/cacao -jar %{_javadir}/%{jarname}.jar -bootclasspath \$BOOTCLASSPATH \$OPTIONS
elif [ -e  ]
then
  exec \$GIJ_EXECUTABLE -jar %{_javadir}/%{jarname}.jar -bootclasspath \$BOOTCLASSPATH \$OPTIONS
else
  echo "no java vm found :("
  exit -1
fi
EOF
#<<< wrapper script
# build a jar with a correct manifest
#mkdir manifest-tmp
#pushd manifest-tmp
#/usr/bin/fastjar -xf $TARGET_DIR/%{jarname}.jar
#rm -r META-INF
#/usr/bin/fastjar -m %{SOURCE1} -cf ../%{jarname}.jar *
#popd
#
#<<< ecj compiler end
#<<<
#>>> install

%install
mkdir -p $RPM_BUILD_ROOT/%{_javadir}
cp %{jarname}.jar $RPM_BUILD_ROOT/%{_javadir}
ln -sf %{_javadir}/%{jarname}.jar $RPM_BUILD_ROOT/%{_javadir}/jdtcore.jar
#<<< install end

%clean
rm -rf $RPM_BUILD_ROOT 
#>>> files

%files
%defattr(-,root,root)   
%{_javadir}/*
%attr(0755,root,root) %{_bindir}/*
#<<<
# vim:fdm=marker:foldmarker=#>>>,#<<<:foldcolumn=6:foldlevel=42:

%changelog
* Mon Jul 02 2007 dbornkessel@suse.de
- updated to sources contained in eclipse 3.3 final version
* Wed May 30 2007 dbornkessel@suse.de
- renamed package and sub-packages to eclipse-archdep-*; the eclipse-* packages are now noarch packges
- split eclipse-platform in eclipse-archdep-platform and eclipse-archdep-platform-commons
- moved arch dependent files to %%{_libdir}/eclipse
- update to 3.3RC2 (Europa)
* Tue Nov 21 2006 dbornkessel@suse.de
- adjusted x86_64 build to function with updated jpackage-utils package
* Wed Nov 15 2006 dbornkessel@suse.de
- correct wrong file lists (Bug #220245)
* Sat Nov 11 2006 aj@suse.de
- Fix permissions of doc files.
* Thu Sep 28 2006 dbornkessel@suse.de
- update to version 3.2.1
- delete redundant BuildRequires
* Mon Sep 18 2006 dbornkessel@suse.de
- added ecj-bootstrap spec
* Thu Jul 27 2006 dbornkessel@suse.de
- builds now on i386, ppc, x86_64 and ia64
* Wed Jul 05 2006 dbornkessel@suse.de
- enabled x86_64 and ia64 builds
* Fri Mar 10 2006 dbornkessel@suse.de
- enabled ppc build
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 18 2006 dbornkessel@suse.de
- update to 3.1.1
* Thu Sep 29 2005 dmueller@suse.de
- add norootforbuild
* Tue Aug 23 2005 skh@suse.de
- let eclipse require eclipse-gtk2 so that there's never only
  the README installed [#106699]
* Tue Aug 09 2005 hvogel@suse.de
- make eclipse binary executeable again [Bug #102675]
* Fri Aug 05 2005 skh@suse.de
- update to 3.1 final
- clean up specfile
* Tue Apr 19 2005 mmj@suse.de
- NULL terminate functions that are supposed to be NULL terminated
* Mon Feb 21 2005 skh@suse.de
- update to version 3.0.1
* Tue Sep 28 2004 skh@suse.de
- Improved Provides: of eclipse-platform to enable update from old
  eclipse package and fix #46308
* Mon Sep 20 2004 ro@suse.de
- added main package containing only a readme
* Thu Sep 16 2004 skh@suse.de
- Remove bogus Requires: lucene
* Sat Sep 11 2004 skh@suse.de
- update to 3.0 (i386 only for now)
- use JPackage package layout, splitting into the following
  subpackages:
  - eclipse-platform
  - eclipse-gtk2
  - eclipse-jdt
  - eclipse-source
  - eclipse-pde
  - eclipse-scripts
  - libswt3-gtk2
* Thu Jul 08 2004 skh@suse.de
- Remove java2 and add BEAJava2 to neededforbuild to fix build
  (#42849)
- source setJava from eclipse wrapper script if no java in $PATH
* Thu May 13 2004 skh@suse.de
- update to version 2.1.3
* Fri Apr 23 2004 skh@suse.de
- Allow SWT to use deprecated gtk functions until a real fix is
  available from the eclipse project.
* Mon Mar 15 2004 skh@suse.de
- Really fix #34496 (not only create the needed file, but also
  install it...)
- Removed eclipse.desktop file from sources, all done automagically
  now by the %%suse_update_desktop_file macro.
* Tue Feb 17 2004 skh@suse.de
- use gnome2-devel-packages in neededforbuild
- Replace buggy wrapper script with a better one (#34496)
- Fixed problem with correct generation of local workspace
  configuration ("Completing install..." only once now, not every
  time eclipse is started, #34496)
* Mon Feb 16 2004 skh@suse.de
- update to version 2.1.2
* Thu Feb 12 2004 ro@suse.de
- added gconf2 to neededforbuild
* Sat Jan 10 2004 adrian@suse.de
- build as user
* Thu Oct 16 2003 skh@suse.de
- fix build (use libbonobo instead of bonobo-activation)
* Tue Sep 02 2003 skh@suse.de
- fix LD_LIBRARY_PATH in wrapper script
* Mon Sep 01 2003 adrian@suse.de
- add Categories
* Mon Sep 01 2003 skh@suse.de
- added .desktop file and icon
* Sat Aug 23 2003 ro@suse.de
- jakarta-ant was renamed to apache-ant
* Mon Aug 18 2003 skh@suse.de
- fix build with non-SUN javas
- be a bigpack
* Wed Jul 30 2003 ro@suse.de
- fix build (help to find glib in /opt/gnome)
* Mon Jul 28 2003 skh@suse.de
- initial package
openSUSE Build Service is sponsored by