File rhino.spec of Package rhino

# spec file for package rhino
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
# 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

%define section         free
%define cvs_version     1_7R3

Name:           rhino
Version:        1.7R3
Release:        0
Summary:        JavaScript for Java
License:        MPL-1.1 or GPL-2.0+
Group:          Development/Libraries/Java

# wget{cvs_version}.zip
# unzip -q rhino%{cvs_version}.zip
# find rhino%{cvs_version}/ -name '*jar' | xargs rm -rf
# tar -czf rhino%{cvs_version}-suse.tar.gz rhino%{cvs_version}/
Source0:        rhino%{cvs_version}-suse.tar.gz
Source2:        rhino.script
Source3:        rhino-debugger.script
Source4:        rhino-idswitch.script
Source5:        rhino-jsc.script
Source6:        rhino-js.pom
Source7:        rhino.pom
Source8:        rhino-component-info.xml

Patch0:         rhino-build.patch
# Add OSGi metadata from Eclipse Orbit project
# Rip out of MANIFEST.MF included in this JAR:
Patch1:         %{name}-addOrbitManifest.patch
Patch2:         %{name}-1.7R3-crosslink.patch
Patch3:         rhino-288467.patch
#PATCH-FIX-OPENSUSE: allow build under gcj
Patch100:       rhino-1.7-gcj.patch

BuildRequires:  ant
BuildRequires:  bea-stax-api
BuildRequires:  java-1_5_0-gcj-compat-devel
BuildRequires:  javapackages-tools
BuildRequires:  jline
#BuildRequires:  xerces-j2-bootstrap
#!BuildIgnore:  xerces-j2-bootstrap
BuildRequires:  xmlbeans-mini
#!BuildIgnore:  xerces-j2 xml-commons xml-commons-apis xml-commons-resolver
#!BuildIgnore:  antlr antlr-java
#!BuildIgnore:  xml-commons-jaxp-1.3-apis
#!BuildIgnore:  java-1_6_0-openjdk java-1_6_0-openjdk-devel
#!BuildIgnore:  java-1_7_0-openjdk java-1_7_0-openjdk-devel

Requires:       bea-stax-api
Requires:       jline
Requires:       xmlbeans

BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Rhino is an open-source implementation of JavaScript written entirely
in Java. It is typically embedded into Java applications to provide
scripting to end users.

%package demo
Summary:        JavaScript for Java
Group:          Development/Libraries/Java

%description demo
Rhino is an open-source implementation of JavaScript written entirely
in Java. It is typically embedded into Java applications to provide
scripting to end users.

# % setup -q -n %{name}%{cvs_version} -a 100
%setup -q -n %{name}%{cvs_version}

# Fix build
sed -i -e '/.*<get.*src=.*>$/d' build.xml testsrc/build.xml \
       toolsrc/org/mozilla/javascript/tools/debugger/build.xml xmlimplsrc/build.xml

# Fix manifest
sed -i -e '/^Class-Path:.*$/d' src/manifest

# Add jpp release info to version
sed -i -e 's|^implementation.version: Rhino .* release .* \${}|implementation.version: Rhino %{version} release %{release} \${}|'

%setup -q -n %{name}%{cvs_version}
%patch0 -p0 -b .build
%patch1 -p1 -b .fixManifest
%patch2 -p1 -b .crosslink
%patch3 -p0 -b .sav3
%patch100 -p0 -b .gjc

export CLASSPATH=$(build-classpath jline)
export OPT_JAR_LIST=:
%{ant} -v -d \
    -Dxbean.jar=$(build-classpath xmlbeans/xbean | cut -d ':' -f 1) \
    -Djsr173.jar=$(build-classpath bea-stax-api) \
    deepclean jar copy-all 

pushd examples
export CLASSPATH=../build/%{name}%{cvs_version}/js.jar:$(build-classpath xmlbeans/xbean 2>/dev/null)
javac -C *.java
jar cvf ../build/%{name}%{cvs_version}/%{name}-examples.jar *.class


# jars
mkdir -p %{buildroot}%{_javadir}
cp -a build/%{name}%{cvs_version}/js.jar %{buildroot}%{_javadir}
ln -s js.jar %{buildroot}%{_javadir}/%{name}.jar

# scripts
mkdir -p %{buildroot}%{_bindir}
install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/%{name}
install -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/%{name}-debugger
install -m 0755 %{SOURCE4} %{buildroot}%{_bindir}/%{name}-idswitch
install -m 0755 %{SOURCE5} %{buildroot}%{_bindir}/%{name}-jsc

# examples
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -a examples/* %{buildroot}%{_datadir}/%{name}
cp -a build/%{name}%{cvs_version}/%{name}-examples.jar %{buildroot}%{_javadir}/%{name}-examples.jar

# poms
mkdir -p %{buildroot}%{_mavenpomdir}

cp -a %{SOURCE6} %{buildroot}%{_mavenpomdir}/JPP-js.pom
cp -a %{SOURCE7} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_maven_depmap JPP-js.pom js.jar

%{__rm} -rf %{buildroot}

%doc LICENSE.txt
%attr(0755,root,root) %{_bindir}/%{name}
%attr(0755,root,root) %{_bindir}/%{name}-debugger
%attr(0755,root,root) %{_bindir}/%{name}-idswitch
%attr(0755,root,root) %{_bindir}/%{name}-jsc
%config %{_mavendepmapfragdir}

%files demo

openSUSE Build Service is sponsored by