rhino/rhino.spec

171 lines
5.5 KiB
RPMSpec
Raw Normal View History

#
# 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 http://bugs.opensuse.org/
#
%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
Url: http://www.mozilla.org/rhino/
# wget ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino%{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:
# http://www.eclipse.org/downloads/download.php?r=1&file=/tools/orbit/downloads/drops/R20110523182458/repository/plugins/org.mozilla.javascript_1.7.2.v201005080400.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
%description
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.
%prep
# % 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.date}|implementation.version: Rhino %{version} release %{release} \${implementation.date}|' build.properties
%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
%build
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
popd
%install
# 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
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(0644,root,root,0755)
%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
%{_javadir}/*.jar
%{_mavenpomdir}/*
%config %{_mavendepmapfragdir}
%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}
%changelog