packages java-rhino.spec
      Pages: < 1 >  DOWNLOAD      
%define        pkgver       1_7R2-RC4
%define        buildver     1_7R2
%define        api_version  1.7
%define        javahome     %{_jvmdir}/jdk
Name:          java-rhino
Version:       1.7rc4
Release:       3mamba
Summary:       Rhino - JavaScript for Java
Group:         Development/Libraries/Java
Vendor:        openmamba
Distribution:  openmamba
Packager:      Silvan Calarco <silvan.calarco@...>
URL:           http://www.mozilla.org/rhino/
Source0:       ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino%{pkgver}.zip
#Source1:      http://java.sun.com/products/jfc/tsc/articles/treetable2/downloads/src.zip
Source2:       java-rhino.script
Patch0:        java-rhino-1.7R2-RC3-disabledebuggertool.patch
Patch1:        java-rhino-1_7R2pre-build.patch
License:       GPL, MPL 1.1
BuildRequires: apache-ant
%if "%{stage1}" != "1"
BuildRequires: apache-xmlbeans
BuildRequires: java-backport-util-concurrent
BuildRequires: java-bea-stax-api
BuildRequires: java-retrotranslator
%endif
BuildRequires: jpackage-utils
%if "%{stage1}" != "1"
Requires:      apache-xmlbeans
%endif
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%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
Group:          Documentation
Summary:        Examples for %{name}

%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.

This package contains examples for %{name}.

#%package        manual
#Group:          Documentation
#Summary:        Manual for %{name}

#%description    manual
#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.

#This package contains documentation for %{name}.

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

%description    javadoc
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.

This package contains javadoc for %{name}.


%prep
%setup -q -n rhino1_7R2 
%patch1 -p1
%patch0 -b .sav

for j in $(find . -name "*.jar"); do
	mv $j ${j}.no
done

perl -pi -e 's|.*<get.*src=.*>\n||' build.xml testsrc/build.xml toolsrc/org/mozilla/javascript/tools/debugger/build.xml xmlimplsrc/build.xml

#install -D -p -m 644 %{S;1} toolsrc/org/mozilla/javascript/tools/debugger/downloaded/swingExSrc.zip

perl -pi -e 's|^Class-Path:.*\n||g' src/manifest

perl -pi -e 's|^implementation.version: Rhino .* release .* \${implementation.date}|implementation.version: Rhino %{version} release %{release} \${implementation.date}|' build.properties

cp -pr toolsrc/org/mozilla/javascript/tools src/org/mozilla/javascript
cp -pr xmlimplsrc/org/mozilla/javascript/xmlimpl src/org/mozilla/javascript

%build
#:<< EOF
export JAVA_HOME=%javahome
%if "%{stage1}" != "1"
export CLASSPATH=$(build-classpath bea-stax-api backport-util-concurrent retrotranslator-runtime retrotranslator-transformer)
%endif
ant  \
  -Dxbean.jar=$(build-classpath xmlbeans/xbean) \
  -Djsr173.jar=$(build-classpath bea-stax-api) \
  deepclean jar smalljar copy-all javadoc

#EOF

pushd examples
  mkdir -p target/classes
  export CLASSPATH=../build/rhino%{buildver}/js.jar:$(build-classpath xmlbeans/xbean)
  %javahome/bin/javac -d target/classes `find . -name '*.java'`
  %javahome/bin/jar cf ../build/rhino%{buildver}/rhino-examples-%{api_version}.jar target/classes
popd

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

mkdir -p %{buildroot}%{_javadir}
install -pm 644 build/rhino%{buildver}/js.jar \
  %{buildroot}%{_javadir}/rhino-%{api_version}.jar
install -pm 644 build/rhino%{buildver}/smalljs.jar\
  %{buildroot}%{_javadir}/rhino-small-%{api_version}.jar

install -pm 644 build/rhino%{buildver}/rhino-examples-%{api_version}.jar \
  %{buildroot}%{_javadir}/rhino-examples-%{api_version}.jar

(
  cd %{buildroot}%{_javadir}
  ln -s rhino-%{api_version}.jar js-%{api_version}.jar
  ln -s rhino-small-%{api_version}.jar smalljs-%{api_version}.jar
)

(
  cd %{buildroot}%{_javadir}
  for jar in *-%{api_version}*; do
    ln -s ${jar} `echo $jar| sed "s|-%{api_version}||g"`
  done
)

mkdir -p %{buildroot}%{_javadocdir}/rhino-%{version}
cp -a build/rhino%{buildver}/javadoc/* %{buildroot}%{_javadocdir}/rhino-%{version}
ln -s rhino-%{version} %{buildroot}%{_javadocdir}/rhino
find %{buildroot}%{_javadocdir}/rhino-%{version} -type f -name '*.html' | %{_bindir}/xargs %{__perl} -pi -e 's/\r$//g'

mkdir -p  %{buildroot}%{_bindir}
install -m 755 %{S:2} %{buildroot}%{_bindir}/rhino

mkdir -p %{buildroot}%{_datadir}/rhino-%{version}
cp -a build/rhino%{buildver}/examples/* %{buildroot}%{_datadir}/rhino-%{version}

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

%files
%defattr(-,root,root)
%{_bindir}/rhino
%{_javadir}/js-%{api_version}.jar
%{_javadir}/js.jar
%{_javadir}/rhino-%{api_version}.jar
%{_javadir}/rhino.jar
%{_javadir}/rhino-small-%{api_version}.jar
%{_javadir}/rhino-small.jar
%{_javadir}/smalljs-%{api_version}.jar
%{_javadir}/smalljs.jar
%doc LICENSE.txt

%files demo
%defattr(-,root,root)
%{_javadir}/rhino-examples-%{api_version}.jar
%{_javadir}/rhino-examples.jar
%{_datadir}/rhino-%{version}

#%files manual
#%defattr(-,root,root)
#%doc build/rhino%{buildver}/docs/*

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

%changelog
* Fri Mar 25 2011 gil <puntogil@...> 1.7rc4-3mamba
- rebuilt with java-openjdk support

* Fri Aug 21 2009 gil <puntogil@...> 1.7rc4-2mamba
- update to 1.7rc4

* Sun Feb 22 2009 gil <puntogil@...> 1.7-1mamba
- package created by autospec