File bsh.spec of Package bsh

# spec file for package bsh (Version 1.3.0)
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# 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

# norootforbuild
# icecream 0

Name:           bsh
%define name		bsh
%define Name		BeanShell
%define version		1.3.0
%define fversion	1.3.0
%define release		6jpp
%define section		free
Version:        1.3.0
Release:        340
Summary:        Lightweight Scripting for Java
License:        LGPL v2.1 or later
Source0:        %{name}-%{fversion}-src.tar.bz2
Source1:        bsh-1.3.0.pom
Source2:        bsh-bsf-1.3.0.pom
Patch0:         %{name}-build.patch
Patch2:         %{name}-java14compat.patch
BuildRequires:  ant-trax
BuildRequires:  bsf
BuildRequires:  perl
BuildRequires:  jpackage-utils >= 1.7.2
BuildRequires:  java-devel
BuildRequires:  servletapi5
BuildRequires:  fdupes
BuildRequires:  xalan-j2
PreReq:         coreutils
Requires:       bsf
Requires:       jpackage-utils >= 1.5
Group:          Development/Libraries/Java
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BeanShell is a small, free, embeddable Java source interpreter with
object scripting language features written in Java. BeanShell executes
standard Java statements and expressions in addition to obvious
scripting commands and syntax. BeanShell supports scripted objects as
simple method closures like those in Perl and JavaScript(tm). You can
use BeanShell interactively for Java experimentation and debugging or
as a simple scripting engine for your applications. In short: BeanShell
is dynamically interpreted Java, plus some useful stuff. Another way to
describe it is to say that in many ways BeanShell is to Java as Tcl/Tk
is to C: BeanShell is embeddable--you can call BeanShell from your Java
applications to execute Java code dynamically at runtime or to provide
scripting extensibility for your applications. Alternatively, you can
call your Java applications and objects from BeanShell, working with
Java objects and APIs dynamically. Because BeanShell is written in Java
and runs in the same space as your application, you can freely pass
references to "real live" objects into scripts and return them as

%package manual
License:        LGPL v2.1 or later
Summary:        Manual for bsh
Group:          Development/Libraries/Java

%description manual
BeanShell is a small, free, embeddable, Java source interpreter with
object scripting language features, written in Java.

This package contains the manual for BeanShell.

%package javadoc
License:        LGPL v2.1 or later
PreReq:         coreutils
Summary:        Javadoc for bsh
Group:          Development/Libraries/Java

%description javadoc
BeanShell is a small, free, embeddable, Java source interpreter with
object scripting language features, written in Java.

This package contains the javadoc documentation for BeanShell.

%package demo
License:        LGPL v2.1 or later
Summary:        Demonstration and sample files for bsh
Group:          Development/Libraries/Java
AutoReqProv:    no
Requires:       %{name} = %{version}
Requires:       coreutils

%description demo
BeanShell is a small, free, embeddable, Java source interpreter with
object scripting language features, written in Java.

This package contains sample and demonstration files for BeanShell.

%setup -q -n %{Name}
%patch0 -p1
find . -name "*.jar" -exec rm -f {} \;
# remove all CVS files
for dir in `find . -type d -name CVS`; do rm -rf $dir; done
for file in `find . -type f -name .cvsignore`; do rm -rf $file; done
# fix permissions
find . -type 'f' | xargs chmod 0644

mkdir -p lib
export CLASSPATH=$(build-classpath bsf servletapi5 xalan-j2)
ant dist
(cd docs/faq && ant)
(cd docs/manual && ant)

# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/%{name}-%{version}.jar \
install -m 644 dist/%{name}-bsf-%{version}.jar \
install -m 644 dist/%{name}-classpath-%{version}.jar \
install -m 644 dist/%{name}-commands-%{version}.jar \
install -m 644 dist/%{name}-core-%{version}.jar \
install -m 644 dist/%{name}-reflect-%{version}.jar \
install -m 644 dist/%{name}-util-%{version}.jar \
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
%add_to_maven_depmap %{name} %{name} %{version} JPP %{name}
%add_to_maven_depmap %{name} %{name}-bsf %{version} JPP %{name}-bsf
# poms
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE1} \
install -pm 644 %{SOURCE2} \
# manual
find docs -name ".cvswrappers" -exec rm -f {} \;
find docs -name "*.xml" -exec rm -f {} \;
find docs -name "*.xsl" -exec rm -f {} \;
find docs -name "*.log" -exec rm -f {} \;
(cd docs/manual && mv html/* .)
(cd docs/manual && rm -rf html)
(cd docs/manual && rm -rf xsl)
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
# demo
for i in `find tests -name \*.bsh`; do
  perl -p -i -e 's,^\n?#!(/(usr/)?bin/java bsh\.Interpreter|/bin/sh),#!/usr/bin/env %{_bindir}/%{name},' $i
  if head -1 $i | grep '#!/usr/bin/env %{_bindir}/%{name}' >/dev/null; then
    chmod 755 $i
chmod 755 tests/Template
cat > one << EOF
cat tests/Interactive/reload/one >> one
cat one > tests/Interactive/reload/one
rm one
cat > two << EOF
cat tests/Interactive/reload/two >> two
cat two > tests/Interactive/reload/two
rm two
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -pr tests $RPM_BUILD_ROOT%{_datadir}/%{name}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/webapps
install -m 644 dist/bshservlet.war $RPM_BUILD_ROOT%{_datadir}/%{name}/webapps
install -m 644 dist/bshservlet-wbsh.war $RPM_BUILD_ROOT%{_datadir}/%{name}/webapps
# scripts
install -d $RPM_BUILD_ROOT%{_bindir}
cat > $RPM_BUILD_ROOT%{_bindir}/%{name} << EOF
# %{name} script
# JPackage Project (
# Source functions library
. %{_datadir}/java-utils/java-functions
# Source system prefs
if [ -f %{_sysconfdir}/%{name}.conf ] ; then
  . %{_sysconfdir}/%{name}.conf
# Source user prefs
if [ -f \$HOME/.%{name}rc ] ; then
  . \$HOME/.%{name}rc
# Configuration
if [ -n "\$BSH_DEBUG" ]; then
#if [ -f /usr/lib/ ]; then
#  BASE_FLAGS="$BASE_FLAGS -Djava.library.path=/usr/lib"
#  BASE_FLAGS="\$BASE_FLAGS -Dbsh.console.readlinelib=GnuReadline"
#  BASE_JARS="\$BASE_JARS libreadline-java.jar"
# Set parameters
set_classpath \$BASE_JARS
set_flags \$BASE_FLAGS
set_options \$BASE_OPTIONS
# Let's start
run "\$@"
cat > $RPM_BUILD_ROOT%{_bindir}/%{name}doc << EOF
#!/usr/bin/env %{_bindir}/%{name}
cat scripts/bshdoc.bsh >> $RPM_BUILD_ROOT%{_bindir}/%{name}doc
%fdupes ${RPM_BUILD_ROOT}/usr


%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
    rm -f %{_javadocdir}/%{name}



%doc src/Changes.html src/License.txt src/README.txt
%attr(0755,root,root) %{_bindir}/%{name}
%attr(0755,root,root) %{_bindir}/%{name}doc
%dir %{_datadir}/%{name}
%exclude %{_datadir}/%{name}/tests

%files manual
%doc docs/*

%files javadoc

%files demo
%doc tests/README.txt tests/Interactive/README

* Wed Mar 25 2009
- added xalan-j2 to BuildRequires and CLASSPATH to fix build
* Wed Mar 05 2008
- merged with jpackage-1.7
  - added maven poms
  - build with servletapi
* Mon Sep 25 2006
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
* Wed Jan 25 2006
- converted neededforbuild to BuildRequires
* Wed Jul 27 2005
- Adjustments in the spec file.
* Wed Jul 20 2005
- Current version 1.3.0 from
* Wed Sep 15 2004
- Fix Requires of bsh-demo
* Mon Sep 06 2004
- Initial package created with version 1.3.0
openSUSE Build Service is sponsored by