# Copyright (c) 2000-2008, 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.
#
%define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%bcond_with maven
%define _with_gcj_support 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}}}
%define section free
Name: qdox
Version: 1.6.1
Release: 7.2%{?dist}
Epoch: 0
Summary: Extract class/interface/method definitions from sources
License: ASL 2.0
URL: http://qdox.codehaus.org/
Group: Development/Libraries/Java
# svn co https://svn.codehaus.org/qdox/tags/QDOX_1_6_1/qdox
# tar czvf qdox-1.6.1-src.tar.gz qdox
Source0: qdox-1.6.1-src.tar.gz
Source1: pom-maven2jpp-depcat.xsl
Source2: pom-maven2jpp-newdepmap.xsl
Source3: pom-maven2jpp-mapdeps.xsl
Source4: qdox-1.6-jpp-depmap.xml
Source5: qdox-LocatedDef.java
Source6: qdox-build.xml
Patch0: qdox-1.6.1-byaccj.patch
Patch1: qdox-1.6.1-jflex.patch
Patch2: qdox-1.6.1-test.patch
BuildRequires: jpackage-utils >= 0:1.6
%if %with maven
BuildRequires: maven >= 0:1.1
BuildRequires: maven-plugins-base
BuildRequires: maven-plugin-license
BuildRequires: maven-plugin-test
BuildRequires: maven-plugin-xdoc
BuildRequires: saxon
BuildRequires: saxon-scripts
BuildRequires: jmock >= 0:1.0
BuildRequires: mockobjects >= 0:0.09
%endif
BuildRequires: ant >= 0:1.6
BuildRequires: ant-junit >= 0:1.6
BuildRequires: junit >= 0:3.8.1
BuildRequires: byaccj
BuildRequires: java_cup
BuildRequires: jflex
%if ! %{gcj_support}
BuildArch: noarch
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
%endif
%description
QDox is a high speed, small footprint parser
for extracting class/interface/method definitions
from source files complete with JavaDoc @tags.
It is designed to be used by active code
generators or documentation tools.
%package javadoc
Summary: Javadoc for %{name}
Group: Development/Documentation
%description javadoc
%{summary}.
%prep
%setup -q -n %{name}
chmod -Rf a+rX,u+w,g-w,o-w bootstrap
rm -r bootstrap
%patch0 -p1
%patch1 -p1
%patch2 -p1
cp -p %{SOURCE5} src/java/com/thoughtworks/qdox/parser/structs/LocatedDef.java
sed -e "s/@VERSION@/%{version}/g" %{SOURCE6} > build.xml
rm src/test/com/thoughtworks/qdox/directorywalker/DirectoryScannerTest.java \
src/test/com/thoughtworks/qdox/parser/MockBuilder.java \
src/test/com/thoughtworks/qdox/parser/MockLexer.java \
src/test/com/thoughtworks/qdox/JavaDocBuilderTest.java \
src/test/com/thoughtworks/qdox/parser/ParserTest.java
%build
%if %with maven
export DEPCAT=$(pwd)/qdox-1.6-depcat.new.xml
echo '' > $DEPCAT
echo '' >> $DEPCAT
for p in $(find . -name project.xml); do
pushd $(dirname $p)
%{_bindir}/saxon project.xml %{SOURCE1} >> $DEPCAT
popd
done
echo >> $DEPCAT
echo '' >> $DEPCAT
%{_bindir}/saxon $DEPCAT %{SOURCE2} > qdox-1.6-depmap.new.xml
for p in $(find . -name project.xml); do
pushd $(dirname $p)
cp project.xml project.xml.orig
%{_bindir}/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
popd
done
export MAVEN_HOME_LOCAL=$(pwd)/.maven
export CLASSPATH=$(build-classpath junit)
maven \
-Dmaven.repo.remote=file:/usr/share/maven-1.0/repository \
-Dmaven.home.local=$MAVEN_HOME_LOCAL \
-Dqdox.byaccj.executable=byaccj \
jar javadoc
%else
export OPT_JAR_LIST="junit ant/ant-junit"
mkdir -p target/src/java/com/thoughtworks/qdox/parser/impl
export CLASSPATH=`pwd`/target/classes:`pwd`/target/test-classes:$(build-classpath java_cup jflex junit)
%{java} JFlex.Main \
-d src/java/com/thoughtworks/qdox/parser/impl \
src/grammar/lexer.flex
pushd target
%{_bindir}/byaccj \
-Jnorun \
-Jnoconstruct \
-Jclass=Parser \
-Jsemantic=Value \
-Jpackage=com.thoughtworks.qdox.parser.impl \
../src/grammar/parser.y
popd
mv target/Parser.java src/java/com/thoughtworks/qdox/parser/impl
ant -Dbuild.sysclasspath=only jar javadoc
%endif
%install
rm -rf $RPM_BUILD_ROOT
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p target/%{name}-%{version}.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if %{gcj_support}
%post
if [ -x %{_bindir}/rebuild-gcj-db ]
then
%{_bindir}/rebuild-gcj-db
fi
%postun
if [ -x %{_bindir}/rebuild-gcj-db ]
then
%{_bindir}/rebuild-gcj-db
fi
%endif
%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-%{version}.jar
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-%{version}.jar.*
%endif
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
%changelog
* Sun Jul 26 2009 Fedora Release Engineering - 0:1.6.1-7.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering - 0:1.6.1-6.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Fri Oct 24 2008 David Walluck 0:1.6.1-5.2
- Fedora-specific: enable GCJ support
* Fri Oct 24 2008 David Walluck 0:1.6.1-5.1
- Fedora-specific: remove repolib
- Fedora-specific: use java_cup not java-cup
- Fedora-specific: don't use jmock
* Tue Jul 29 2008 David Walluck 0:1.6.1-5
- remove bootstrap binaries
- patch build for newer jflex
- patch build to disable failing tests on JDK6
- BuildRequires: jmock
- fix version in ant build.xml
- fix location of byaccj and jflex output files
- fix apidoc location
- correctly set CLASSPATH and OPT_JAR_LIST
* Mon Jul 28 2008 David Walluck 0:1.6.1-4
- fix jflex part of build
- GCJ fixes
- fix javadoc Requires
* Sat Jul 26 2008 David Walluck 0:1.6.1-3
- build without maven
- fix repolib permissions
* Thu May 29 2008 David Walluck 0:1.6.1-2.jpp5
- remove spurious gnu-crypto dependency
- fix empty scriptlets
- fix License
- use %%{_bindir}
* Fri Apr 18 2008 David Walluck 0:1.6.1-1jpp.ep1.5
- patch for byaccj
- place junit on CLASSPATH
- remove javadoc scriptlets
* Thu Mar 22 2007 Vivek Lakshmanan 0:1.6.1-1jpp.ep1.4
- Rebuild with fixed component-info.xml
* Thu Mar 22 2007 Vivek Lakshmanan 0:1.6.1-1jpp.ep1.3
- Add repository.jboss.com as a prefix for repodir
* Thu Mar 22 2007 Fernando Nasser 0:1.6.1-1jpp.ep1.2
- Add repolib subpackage
* Thu Mar 22 2007 Fernando Nasser 0:1.6.1-1jpp.ep1.1
- Merge with upstream for upgrade
* Fri Mar 16 2007 Fernando Nasser 0:1.6.1-1jpp
- Upgrade to 1.6.1
* Fri Feb 23 2007 Ralph Apel 0:1.5-3jpp
- Add option to build without maven
- Omit tests when building without maven
- Add gcj_support option
* Tue Feb 21 2006 Fernando Nasser - 0:1.5-2jpp_1rh
- First Red Hat build
* Mon Feb 20 2006 Ralph Apel - 0:1.5-2jpp
- Rebuild for JPP-1.7, adapting to maven-1.1
* Wed Nov 16 2005 Ralph Apel - 0:1.5-1jpp
- Upgrade to 1.5
- Build is now done with maven and requires jflex and byaccj
* Wed Aug 25 2004 Fernando Nasser - 0:1.4-3jpp
- Rebuild with Ant 1.6.2
* Fri Aug 06 2004 Ralph Apel - 0:1.4-2jpp
- Upgrade to ant-1.6.X
* Mon Jun 07 2004 Ralph Apel - 0:1.4-1jpp
- Upgrade to 1.4
- Drop Requires: mockobjects (Build/Test only)
* Tue Feb 24 2004 Ralph Apel - 0:1.3-1jpp
- First JPackage release