Blob Blame History Raw
# Copyright (c) 2000-2005, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#For fedora, we want a native gcj compilation
%define _with_gcj_support 1
#Fedora currently does not support maven
%define _without_maven 1

%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}

# If you don't want to build with maven, and use straight ant instead,
# give rpmbuild option '--without maven'

%define with_maven %{!?_without_maven:1}%{?_without_maven:0}
%define without_maven %{?_without_maven:1}%{!?_without_maven:0}

%define section free

Name:           bcel
Version:        5.1
Release:        7jpp_2fc
Epoch:          0
Summary:        Byte Code Engineering Library
License:        Apache Software License
Source0:        bcel-5.1-src-RHCLEAN.tar.gz
# svn export https://svn.apache.org/repos/asf/jakarta/bcel/tags/BCEL_5_1
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        bcel-5.1-jpp-depmap.xml
Source5:        jakarta-site2.tar.gz

Patch0:         bcel-5.1-build.patch
Patch1:         bcel-5.1-project_xml.patch
URL:            http://jakarta.apache.org/%{name}/
Group:          Development/Libraries/Java
Requires:       regexp
BuildRequires:  ant
%if %{with_maven}
BuildRequires:  maven >= 0:1.1
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%endif
#excalibur-avalong-logkit should be used once Maven is supported in Fedora
BuildRequires: avalon-logkit
#BuildRequires:  excalibur-avalon-logkit
BuildRequires:  jakarta-commons-collections
BuildRequires:  jdom
BuildRequires:  velocity
BuildRequires:  regexp
BuildRequires:  jpackage-utils >= 0:1.6
BuildRequires:  werken.xpath
BuildRequires:  ant-apache-regexp
%if ! %{gcj_support}
BuildArch:      noarch
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot

%if %{gcj_support}
BuildRequires:		java-gcj-compat-devel
Requires(post):		java-gcj-compat
Requires(postun):	java-gcj-compat
%endif

%description
The Byte Code Engineering Library (formerly known as JavaClass) is
intended to give users a convenient possibility to analyze, create, and
manipulate (binary) Java class files (those ending with .class). Classes
are represented by objects which contain all the symbolic information of
the given class: methods, fields and byte code instructions, in
particular.  Such objects can be read from an existing file, be
transformed by a program (e.g. a class loader at run-time) and dumped to
a file again. An even more interesting application is the creation of
classes from scratch at run-time. The Byte Code Engineering Library
(BCEL) may be also useful if you want to learn about the Java Virtual
Machine (JVM) and the format of Java .class files.  BCEL is already
being used successfully in several projects such as compilers,
optimizers, obsfuscators and analysis tools, the most popular probably
being the Xalan XSLT processor at Apache.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation

%description javadoc
%{summary}.

%package manual
Summary:        Manual for %{name}
Group:          Development/Libraries/Java

%description manual
%{summary}.

%package demo
Summary:        Examples for %{name}
Group:          Development/Libraries/Java

%description demo
%{summary}.

#%prep
#cat <<EOT
#
#                If you dont want to build with maven,
#                give rpmbuild option '--without maven'
#
#EOT

%setup -q -n BCEL_5_1
# remove all binary libs
#find . -name "*.jar" -exec rm -f {} \;
for j in $(find . -name "*.jar"); do
    mv $j $j.no
done
gzip -dc %{SOURCE5} | tar xf -
mkdir jakarta-site2/lib
pushd jakarta-site2/lib/
  build-jar-repository -s -p . jdom
  build-jar-repository -s -p . velocity
  build-jar-repository -s -p . commons-collections
  build-jar-repository -s -p . avalon-logkit
  build-jar-repository -s -p . werken.xpath
popd
pushd lib
  ln -sf $(build-classpath regexp) Regexp.jar
popd
%patch0 -p1
%patch1 -b .sav

# very broken build
perl -p -i -e 's| depends=\"examples\"||g;' build.xml
touch manifest.txt

%build
%if %{with_maven}
export DEPCAT=$(pwd)/bcel-5.1-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    /usr/bin/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon $DEPCAT %{SOURCE2} > bcel-5.1-depmap.new.xml

for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    /usr/bin/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done

export MAVEN_HOME_LOCAL=$(pwd)/.maven

maven \
        -Dmaven.repo.remote=file:/usr/share/maven/repository \
        -Dmaven.home.local=${MAVEN_HOME_LOCAL} \
        jar:jar javadoc:generate xdoc:transform
%else
ant 	-Dbuild.dest=build/classes -Dbuild.dir=build \
	-Ddocs.src=xdocs -Djakarta.site2=jakarta-site2 -Djdom.jar=jdom.jar \
	compile jar apidocs xdocs
%endif

%install
# jars
%__mkdir_p %{buildroot}%{_javadir}
%if %{with_maven}
%__install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
%else
%__install -m 644 build/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
%endif
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do %__ln_s ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
# javadoc
%__mkdir_p %{buildroot}%{_javadocdir}/%{name}-%{version}
%if %{with_maven}
%__cp -pr target/docs/apidocs/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%__rm -rf target/docs/apidocs
%else
%__cp -pr docs/api/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%__rm -rf docs/api
%endif
# samples
%__mkdir_p %{buildroot}%{_datadir}/%{name}-%{version}
%__cp -pr examples/* %{buildroot}%{_datadir}/%{name}-%{version}
# manual
%__mkdir_p %{buildroot}%{_docdir}/%{name}-%{version}
%if %{with_maven}
%__cp -pr target/docs/* %{buildroot}%{_docdir}/%{name}-%{version}
%else
%__cp -pr docs/* %{buildroot}%{_docdir}/%{name}-%{version}
%endif

%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%clean
%__rm -rf %{buildroot}

%post javadoc
%__rm -f %{_javadocdir}/%{name}
%__ln_s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
    %__rm -f %{_javadocdir}/%{name}
fi

%post
%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%postun
%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt 
%{_javadir}/*

%if %{gcj_support}
%attr(-,root,root) %{_libdir}/gcj/%{name}/bcel-5.1.jar.*
%endif

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}

%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}

%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}-%{version}

# -----------------------------------------------------------------------------

%changelog
* Thu Jul 20 2006 Matt Wringe <mwringe at redhat.com> 0:5.1-7jpp_2fc
- rebuild

* Thu Jul 20 2006 Matt Wringe <mwringe at redhat.com> 0:5.1-7jpp_1fc
- Merged with upstream version
- set to build with Ant instead of Maven

* Thu Jul 20 2006 Matt Wringe <mwringe at redhat.com> 0:5.1-7jpp
- Add missing BR werken.xpath and ant-apache-regexp
- Added conditional native compilation
- Changed spec file encoding from ISO-8859-1 to UTF-8 

* Tue Apr 11 2006 Ralph Apel <r.apel@r-apel.de> 0:5.1-6jpp
- First JPP-1.7 release
- Use tidyed sources from svn
- Add resources to build the manual
- Add examples to -demo subpackage
- Build with maven by default
- Add option to build with straight ant

* Fri Nov 19 2004 David Walluck <david@jpackage.org> 0:5.1-5jpp
- rebuild to fix packager

* Sat Nov 06 2004 David Walluck <david@jpackage.org> 0:5.1-4jpp
- rebuild with javac 1.4.2

* Sat Oct 16 2004 David Walluck <david@jpackage.org> 0:5.1-3jpp
- rebuild for JPackage 1.6

* Fri Aug 20 2004 Ralph Apel <r.apel at r-apel.de> 0:5.1-2jpp
- Build with ant-1.6.2

* Sun May 11 2003 David Walluck <david@anti-microsoft.org> 0:5.1-1jpp
- 5.1
- update for JPackage 1.5

* Mon Mar 24 2003 Nicolas Mailhot <Nicolas.Mailhot (at) JPackage.org> - 5.0-6jpp
- For jpackage-utils 1.5

* Tue Feb 25 2003 Ville Skyttä <ville.skytta at iki.fi> - 5.0-5jpp
- Rebuild to get docdir right on modern distros.
- Fix License tag and source file perms.
- Built with IBM's 1.3.1SR3 (doesn't build with Sun's 1.4.1_01).

* Tue Jun 11 2002 Henri Gomez <hgomez@slib.fr> 5.0-4jpp
- use sed instead of bash 2.x extension in link area to make spec compatible
  with distro using bash 1.1x

* Tue May 07 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 5.0-3jpp 
- vendor, distribution, group tags

* Wed Jan 23 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 5.0-2jpp 
- section macro
- no dependencies for manual and javadoc package

* Tue Jan 22 2002 Henri Gomez <hgomez@slib.fr> 5.0-1jpp
- bcel is now a jakarta apache project
- dependency on jakarta-regexp instead of gnu.regexp 
- created manual package

* Sat Dec 8 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 4.4.1-2jpp
- javadoc into javadoc package
- Requires: and BuildRequires: gnu.regexp

* Wed Nov 21 2001 Christian Zoffoli <czoffoli@littlepenguin.org> 4.4.1-1jpp
- removed packager tag
- new jpp extension
- 4.4.1

* Thu Oct 11 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 4.4.0-2jpp
- first unified release
- used lower case for name
- used original tarball
- s/jPackage/JPackage

* Mon Aug 27 2001 Guillaume Rousse <guillomovitch@users.sourceforge.net> 4.4.0-1mdk
- first Mandrake release