packages java-jawk.spec
      Pages: < 1 >  DOWNLOAD      
Name:          java-jawk
Version:       1.02
Release:       1mamba
Summary:       AWK for Java
Group:         Development/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      gil <puntogil@...>
URL:           http://jawk.sourceforge.net/
# http://mesh.dl.sourceforge.net/project/jawk/jawk/1.02/jawk_src.1_02.jar
Source0:       jawk_src.%{version}.tar.gz
Source1:       java-jawk-%{version}.pom
Source2:       java-jawk-jrt-%{version}.pom
License:       GPL
BuildRequires: apache-ant
BuildRequires: jakarta-bcel
BuildRequires: jpackage-utils
Requires:      jakarta-bcel
Requires:      jpackage-utils
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
Jawk is the implementation of AWK in Java. Jawk parses, analyzes, and
interprets and/or compiles AWK scripts. Compilation is targetted for the
JVM.

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

%description javadoc
Jawk - AWK for Java.

This package contains javadoc for %{name}.

%prep
%setup -q -n jawk_src.1_02
mkdir -p target/classes
mkdir -p target/apidocs
mkdir -p src
mv *.java src/

%build
export JAVA_HOME=/usr/lib/jvm/jdk-sun
export CLASSPATH=target/classes:$(build-classpath bcel)
$JAVA_HOME/bin/javac -d target/classes `find src -name '*.java'`
for c in $(find target/classes/ -name "*.class" | grep -v '\$'); do
   d=$(dirname $c)
   s=$(echo $d | sed -e 's/\/classes\//\/apisrc\//')
   mkdir -p $s
   f=$(basename $c)
   j=$(echo $f | sed -e 's/\.class/\.java/')
   [ -f src/$j ] && cp src/$j $s
done

$JAVA_HOME/bin/javadoc -d target/apidocs \
  -encoding iso-8859-1 \
  -sourcepath target/apisrc org.jawk org.jawk.backend org.jawk.ext org.jawk.frontend org.jawk.intermediate org.jawk.jrt org.jawk.util

pushd target/classes
  $JAVA_HOME/bin/jar cf ../jawk-%{version}.jar *
  $JAVA_HOME/bin/jar cf ../jawk-jrt-%{version}.jar org/jawk/ext/* org/jawk/jrt/* org/jawk/util/AwkParameters.class
popd

%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

mkdir -p %{buildroot}%{_javadir}/
mkdir -p %{buildroot}%{_datadir}/maven2/poms

install -pm 644 target/jawk-%{version}.jar \
	%{buildroot}%{_javadir}/jawk-%{version}.jar

install -pm 644 target/jawk-jrt-%{version}.jar \
	%{buildroot}%{_javadir}/jawk-jrt-%{version}.jar

%add_to_maven_depmap jawk jawk %{version} JPP jawk
%add_to_maven_depmap jawk jrt %{ext_version} JPP jawk-jrt
install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/maven2/poms/JPP-jawk.pom
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/maven2/poms/JPP-jawk-jrt.pom

(
	cd %{buildroot}%{_javadir}/
	for jar in *-%{version}*; do
		ln -sf ${jar} ${jar/-%{version}/}
	done
)

mkdir -p %{buildroot}%{_javadocdir}/jawk-%{version}
cp -pr target/apidocs/* %{buildroot}%{_javadocdir}/jawk-%{version}
ln -sf jawk-%{version} %{buildroot}%{_javadocdir}/jawk

%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(-,root,root)
%{_javadir}/jawk-%{version}.jar
%{_javadir}/jawk.jar
%{_javadir}/jawk-jrt-%{version}.jar
%{_javadir}/jawk-jrt.jar
%{_datadir}/maven2/poms
%{_mavendepmapfragdir}

%files javadoc
%defattr(-,root,root)
%{_javadocdir}/jawk-%{version}
%{_javadocdir}/jawk

%changelog
* Fri Dec 10 2010 gil <puntogil@...> 1.02-1mamba
- package created by autospec