File xerces-j2-bootstrap.spec of Package xerces-j2

#
# spec file for package xerces-j2-bootstrap (Version 2.8.1)
#
# Copyright (c) 2010 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:           xerces-j2-bootstrap
Url:            http://xml.apache.org/xerces2-j/
BuildRequires:  antlr-bootstrap fastjar java-1_4_2-gcj-compat-devel unzip xml-commons-apis-bootstrap xml-commons-resolver-bootstrap xml-commons-which-bootstrap zip
#!BuildIgnore:  antlr antlr-java
%if %{?!suse_version:1}0
%if %{?!mandriva_release:1}0
BuildRequires:  chkconfig
%endif
%else
BuildRequires:  update-alternatives
%endif
%define       xerces_version_cvs 2_8_1
%define       real_name xerces-j2
Summary:        Java XML parser
Group:          Development/Libraries/Java
Version:        2.8.1
Release:        246
Requires:       xml-commons-which-bootstrap
Requires:       xml-commons-apis-bootstrap
Requires:       xml-commons-resolver-bootstrap
License:        Apache Software License ..
Group:          Development/Libraries/Java
AutoReqProv:    on
Source0:        Xerces-J-src.%{version}.tar.bz2
Patch0:         xerces-j2-gcj-switch-constants-bug.patch
Patch1:         xerces-build.patch
#PATCH-FIX-UPSTREAM bnc#530717
#http://svn.apache.org/viewvc?view=rev&revision=787352
Patch3:         xerces-j2-parsing.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#BuildArchitectures: noarch
#ExclusiveArch: %ix86
BuildArch:      noarch
Provides:       xerces-j2

%description
Welcome to the future! Xerces2 is the next generation of high
performance, fully compliant XML parsers in the Apache Xerces family.
This new version of Xerces introduces the Xerces Native Interface
(XNI), a complete framework for building parser components and
configurations that is extremely modular and easy to program.

The Apache Xerces2 parser is the reference implementation of XNI but
other parser components, configurations, and parsers can be written
using the Xerces Native Interface. For complete design and
implementation documents, refer to the XNI Manual.

Xerces 2 is a fully conforming XML Schema processor. For more
information, refer to the XML Schema page.

Xerces 2 also provides a partial implementation of Document Object
Model Level 3 Core, Load and Save and Abstract Schemas [deprecated]
Working Drafts. For more information, refer to the DOM Level 3
Implementation page.



%prep
#<<< package descriptions end
#>>> %prep
%setup -n xerces-%{xerces_version_cvs}
%patch0
%patch1
%patch3 -p1 -b .parsing
#<<<
#>>> %build 

%build 
#>>> some useful functions ... used throughout bootstrap packages
# variables:
TARGET_DIR=`pwd`
CLASSPATH_ORIG="$CLASSPATH"
LIB_GCJ="`ls %{_javadir}/libgcj-*.jar`"
export GC_MAXIMUM_HEAP_SIZE="134217728"
#>>> delete binary file and files not needed
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 $$file
  echo with classpath: $COMPILE_CLASSPATH_PATH
  export CLASSPATH=$COMPILE_CLASSPATH_PATH
  for file in `find . -name "*.java"`
  do
    echo -e "$COMPILER_COMMAND $file ... \c"
    $COMPILER_COMMAND $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="javac -C "
#<<< end functions
delBinaryFiles
#>>> xerces-j2
pushd src
compileFiles
mkJar %{name}
delBinaryFiles
popd
#<<< xerces end
#<<<
#>>> %install

%install
#>>> ant
export NO_BRP_CHECK_BYTECODE_VERSION=true
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp %{name}.jar $RPM_BUILD_ROOT/%{_javadir}/
#<<<
#<<< install end

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

%files
%defattr(-,root,root)   
#%dir %{_javadir}
%{_javadir}/%{name}.jar
#<<<
# vim:fdm=marker:foldmarker=#>>>,#<<<:foldcolumn=6:

%changelog
openSUSE Build Service is sponsored by