Fix javadoc generation

- Update to current packaging guidelines
This commit is contained in:
Mikolaj Izdebski 2013-06-20 15:42:52 +02:00
parent 414e118d6a
commit 153df2d7e9

View File

@ -1,41 +1,12 @@
# 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.
#
%bcond_with bootstrap
Summary: Fast Scanner Generator
Name: jflex
Version: 1.4.3
Release: 14%{?dist}
Release: 15%{?dist}
Epoch: 0
License: GPL+
URL: http://jflex.de/
Group: Development/Libraries
# ./clean-tarball.sh
Source0: %{name}-%{version}-clean.tar.gz
Source1: http://repo2.maven.org/maven2/de/jflex/jflex/1.4.3/jflex-1.4.3.pom
@ -46,6 +17,9 @@ Source4: %{name}.1
Patch0: jflex-build_xml.patch
Patch1: jflex-junit-incompatibility.patch
# Build-require itself except in bootstrapping mode
%{!?with_bootstrap:BuildRequires: jflex}
BuildRequires: jpackage-utils >= 0:1.5
BuildRequires: ant
BuildRequires: emacs
@ -60,22 +34,20 @@ BuildArch: noarch
%description
JFlex is a lexical analyzer generator (also known as scanner
generator) for Java(tm), written in Java(tm). It is also a
rewrite of the very useful tool JLex which was developed by
Elliot Berk at Princeton University. As Vern Paxson states
for his C/C++ tool flex: They do not share any code though.
JFlex is designed to work together with the LALR parser
generator CUP by Scott Hudson, and the Java modification of
Berkeley Yacc BYacc/J by Bob Jamison. It can also be used
together with other parser generators like ANTLR or as a
generator) for Java, written in Java. It is also a rewrite of the
very useful tool JLex which was developed by Elliot Berk at Princeton
University. As Vern Paxson states for his C/C++ tool flex: They do
not share any code though. JFlex is designed to work together with
the LALR parser generator CUP by Scott Hudson, and the Java
modification of Berkeley Yacc BYacc/J by Bob Jamison. It can also be
used together with other parser generators like ANTLR or as a
standalone tool.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation
Summary: API documentation for %{name}
%description javadoc
%{summary}.
This package provides %{summary}.
%prep
%setup -q
@ -88,56 +60,55 @@ Group: Documentation
%build
pushd src
%if %{with bootstrap}
# intial build using the autogenerated sym.java LexParse.java and LexScan.java
# these are created by the jflex ant task which needs to be built first
CLASSPATH=%{_javadir}/junit.jar:%{_javadir}/java_cup.jar ant jar-bootstrap
export CLASSPATH=$(build-classpath junit java_cup)
ant jar-bootstrap
# now that the JFlex.jar has been build we can use jflex ant tasks
# removing the generated files and rebuilding using the JFlex.jar
CLASSPATH=%{_javadir}/junit.jar:%{_javadir}/java_cup.jar:../lib/JFlex.jar ant genclean libclean jar
export CLASSPATH=${CLASSPATH}:../lib/JFlex.jar
%else
export CLASSPATH=$(build-classpath junit java_cup jflex)
%endif
# clean tarball doesn't contain java_cup sources thus javadoc generation
# will return 1 (missing symbols)
javadoc -sourcepath . -d ../api JFlex || :
ant genclean libclean jar
javadoc -sourcepath . -d ../api JFlex
popd
# Compile Emacs jflex-mode source
%{_emacs_bytecompile} lib/jflex-mode.el
%install
install -d -m 755 %{buildroot}%{_javadir}
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
install -d -m 755 %{buildroot}%{_mandir}/man1
install -d -m 755 %{buildroot}%{_emacs_sitelispdir}/%{name}
install -d -m 755 %{buildroot}%{_datadir}/pixmaps
# jars
mkdir -p %{buildroot}%{_javadir}
cp -p lib/JFlex.jar %{buildroot}%{_javadir}/%{name}.jar
(cd %{buildroot}%{_javadir} && ln -sf %{name}.jar JFlex.jar)
install -p -m 644 lib/JFlex.jar %{buildroot}%{_javadir}/%{name}.jar
ln -sf %{name}.jar %{buildroot}%{_javadir}/JFlex.jar
# poms
install -d -m 755 %{buildroot}%{_mavenpomdir}
# pom
install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_maven_depmap
# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr api/* %{buildroot}%{_javadocdir}/%{name}
# docs
mkdir -p %{buildroot}%{_docdir}/%{name}-%{version}
cp -p doc/* %{buildroot}%{_docdir}/%{name}-%{version}
cp -p COPYRIGHT %{buildroot}%{_docdir}/%{name}-%{version}
# wrapper script for direct execution
%jpackage_script JFlex.Main "" "" jflex:java_cup jflex true
# manpage
install -dm 755 %{buildroot}%{_mandir}/man1
install -pm 644 %{SOURCE4} %{buildroot}%{_mandir}/man1
install -p -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1
# .desktop + icons
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE2}
install -Dpm 644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/%{name}.png
install -p -m 644 %{SOURCE3} %{buildroot}%{_datadir}/pixmaps/%{name}.png
# Emacs files
install -d -m 755 %{buildroot}%{_emacs_sitelispdir}/%{name}
install -p -m 644 lib/jflex-mode.el %{buildroot}%{_emacs_sitelispdir}/%{name}
install -p -m 644 lib/jflex-mode.elc %{buildroot}%{_emacs_sitelispdir}/%{name}
@ -146,12 +117,10 @@ install -p -m 644 lib/jflex-mode.elc %{buildroot}%{_emacs_sitelispdir}/%{name}
[ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \
rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || :
%files
%doc %{_docdir}/%{name}-%{version}
%{_javadir}/%{name}.jar
%files -f .mfiles
%doc doc
%doc COPYRIGHT
%{_javadir}/JFlex.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1.gz
%{_datadir}/applications/%{name}.desktop
@ -164,6 +133,10 @@ rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || :
%changelog
* Thu Jun 20 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 0:1.4.3-15
- Fix javadoc generation
- Update to current packaging guidelines
* Thu Jun 20 2013 Michal Srb <msrb@redhat.com> - 0:1.4.3-14
- Build from clean tarball
- Install license file with javadoc package