java-bsh/java-bsh.spec

329 lines
9.4 KiB
RPMSpec
Raw Normal View History

%define javahome %{_jvmdir}/jdk
Name: java-bsh
Version: 1.3.0
Release: 7mamba
Summary: Lightweight Scripting for Java
Group: Development/Libraries/Java
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.beanshell.org/
# Source: http://www.beanshell.org/bsh-2.0b4-src.zip broken link
# svn co http://ikayzo.org/svn/beanshell
Source0: http://repository.jboss.com/beanshell/%{version}-brew/src/bsh-%{version}-src.tar.bz2
Source1: java-bsh.png
Source2: java-bsh-desktop.desktop
Source3: java-bsh-1.3.0.pom
Source4: java-bsh-bsf-1.3.0.pom
Source5: java-bsh-1.3.0-bsh-desktop-script
Source6: java-bsh-1.3.0-bsh-script
Patch0: http://repository.jboss.com/beanshell/%{version}-brew/src/bsh-build.patch
Patch1: java-bsh-1.3.0-faq.patch
Patch2: java-bsh-1.3.0-manual.patch
License: LGPL, Sun Public License
BuildRequires: apache-ant
BuildRequires: apache-ant-trax
BuildRequires: desktop-file-utils
%if "%{stage1}" != "1"
BuildRequires: apache-tomcat5-servletapi5
%else
BuildRequires: java-servletapi4
%endif
BuildRequires: jakarta-bsf
BuildRequires: ImageMagick
BuildRequires: java-libreadline
BuildRequires: javacc
BuildRequires: xalan-j2
Requires: jakarta-bsf
Requires: jpackage-utils
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
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 a 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 run-time 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. Since 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 results.
%package javadoc
Group: Documentation
Summary: Javadoc for %{name}
%description javadoc
Lightweight Scripting for Java.
This package contains Javadoc for %{name}.
%package demo
Group: Documentation
Summary: Examples for %{name}
%description demo
Lightweight Scripting for Java.
This package contains demonstrations and samples for %{name}.
%package desktop
Summary: Desktop integraton for %{name}
Group: Development/Tools
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description desktop
Lightweight Scripting for Java.
This package contains a menu entry for %{name}.
%package manual
Group: Documentation
Summary: Manual for %{name}
%description manual
Lightweight Scripting for Java.
This package contains documentation for %{name}.
%prep
%setup -q -n BeanShell
%patch0 -p1
%patch1 -p0
%patch2 -p0
for j in $(find . -name "*.jar"); do
mv $j $j.no
done
for dir in $(find . -type d -name CVS); do
rm -rf $dir
done
for file in $(find . -type d -name .cvsignore) ; do
rm -rf $file
done
for i in backbutton forwardbutton homebutton remoteconsole upbutton; do
chmod 644 docs/images/$i.gif
done
%build
mkdir -p lib
pushd lib
ln -sf $(build-classpath bsf) bsf.jar
%if "%{stage1}" != "1"
ln -sf $(build-classpath servletapi5) servlet.jar
%else
ln -sf $(build-classpath servletapi4) servlet.jar
%endif
ln -sf $(build-classpath javacc) javacc.jar
popd
export JAVA_HOME=%javahome
ant dist
(
cd docs/faq
ant -Dant.build.javac.source=1.4
)
(
cd docs/manual
export CLASSPATH=$(build-classpath xalan-j2 ant/ant-trax)
ant -Dant.build.javac.source=1.4
)
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
mkdir -p %{buildroot}%{_javadir}
install -m 644 dist/bsh-%{version}.jar \
%{buildroot}%{_javadir}/bsh-%{version}.jar
install -m 644 dist/bsh-bsf-%{version}.jar \
%{buildroot}%{_javadir}/bsh-bsf-%{version}.jar
install -m 644 dist/bsh-classpath-%{version}.jar \
%{buildroot}%{_javadir}/bsh-classpath-%{version}.jar
install -m 644 dist/bsh-commands-%{version}.jar \
%{buildroot}%{_javadir}/bsh-commands-%{version}.jar
install -m 644 dist/bsh-core-%{version}.jar \
%{buildroot}%{_javadir}/bsh-core-%{version}.jar
install -m 644 dist/bsh-reflect-%{version}.jar \
%{buildroot}%{_javadir}/bsh-reflect-%{version}.jar
install -m 644 dist/bsh-util-%{version}.jar \
%{buildroot}%{_javadir}/bsh-util-%{version}.jar
(
cd %{buildroot}%{_javadir}
for jar in *-%{version}*; do
ln -sf ${jar} ${jar/-%{version}/}
done
)
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
)
mkdir -p %{buildroot}%{_javadocdir}/bsh-%{version}
cp -pr javadoc/* %{buildroot}%{_javadocdir}/bsh-%{version}
ln -s bsh-%{version} %{buildroot}%{_javadocdir}/bsh
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}/bsh,' $i
if head -1 $i | grep '#!/usr/bin/env %{_bindir}/bsh' >/dev/null; then
chmod 755 $i
fi
done
find . -name "*.bsh" -exec perl -p -i -e 's|/bin/java|%{_bindir}/java|g;' {} \;
sed -i "s|/bin/java|%{_bindir}/java|" tests/Template
mkdir -p %{buildroot}%{_datadir}/bsh/webapps
chmod 755 tests/Template
cat > one << EOF
#!/bin/sh
EOF
cat tests/Interactive/reload/one >> one
cat one > tests/Interactive/reload/one
rm one
cat > two << EOF
#!/bin/sh
EOF
cat tests/Interactive/reload/two >> two
cat two > tests/Interactive/reload/two
rm two
cp -pr tests %{buildroot}%{_datadir}/bsh
install -m 644 dist/bshservlet.war %{buildroot}%{_datadir}/bsh/webapps
install -m 644 dist/bshservlet-wbsh.war %{buildroot}%{_datadir}/bsh/webapps
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/16x16/apps
mkdir -p %{buildroot}%{_datadir}/pixmaps
convert %{SOURCE1} \
%{buildroot}%{_datadir}/icons/hicolor/16x16/apps/bsh.png
convert %{SOURCE1} \
%{buildroot}%{_datadir}/pixmaps/bsh.png
desktop-file-install --vendor=%vendor --mode=644 \
--dir=%{buildroot}%{_datadir}/applications %{SOURCE2}
mkdir -p %{buildroot}%{_datadir}/maven2/poms
install -pm 644 %{SOURCE3} %{buildroot}%{_datadir}/maven2/poms/JPP.bsh.pom
install -pm 644 %{SOURCE4} %{buildroot}%{_datadir}/maven2/poms/JPP.bsh-bsf.pom
%add_to_maven_depmap bsh bsh %{version} JPP bsh
%add_to_maven_depmap bsh bsh-bsf %{version} JPP bsh-bsf
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/bshdoc << EOF
#!/usr/bin/env %{_bindir}/bsh
EOF
cat scripts/bshdoc.bsh >> %{buildroot}%{_bindir}/bshdoc
install -pm 755 %{SOURCE5} %{buildroot}%{_bindir}/bsh-desktop
install -pm 755 %{SOURCE6} %{buildroot}%{_bindir}/bsh
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post desktop
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
%post
%update_maven_depmap
%postun desktop
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ] ; then
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
%postun
%update_maven_depmap
%files
%defattr(-,root,root)
%{_bindir}/bsh
%{_bindir}/bshdoc
%{_javadir}/bsh-%{version}.jar
%{_javadir}/bsh-bsf-%{version}.jar
%{_javadir}/bsh-bsf.jar
%{_javadir}/bsh-classpath-%{version}.jar
%{_javadir}/bsh-classpath.jar
%{_javadir}/bsh-commands-%{version}.jar
%{_javadir}/bsh-commands.jar
%{_javadir}/bsh-core-%{version}.jar
%{_javadir}/bsh-core.jar
%{_javadir}/bsh-reflect-%{version}.jar
%{_javadir}/bsh-reflect.jar
%{_javadir}/bsh-util-%{version}.jar
%{_javadir}/bsh-util.jar
%{_javadir}/bsh.jar
%dir %{_datadir}/bsh
%{_datadir}/bsh/webapps
%{_datadir}/maven2/poms/*
%{_mavendepmapfragdir}
%doc src/Changes.html src/License.txt src/README.txt
%files javadoc
%defattr(-,root,root)
%{_javadocdir}/bsh-%{version}
%{_javadocdir}/bsh
%files demo
%defattr(-,root,root)
%{_datadir}/bsh
%doc tests/README.txt tests/Interactive/README
%files manual
%defattr(-,root,root)
%doc docs/*
%files desktop
%defattr(-,root,root)
%{_bindir}/bsh-desktop
%{_datadir}/applications/*bsh-desktop.desktop
%{_datadir}/icons/hicolor/*x*/apps/bsh.png
%{_datadir}/pixmaps/bsh.png
%changelog
* Mon Mar 28 2011 gil <puntogil@libero.it> 1.3.0-7mamba
- fixed demo rpm warning
* Sun Mar 27 2011 gil <puntogil@libero.it> 1.3.0-6mamba
- rebuilt with java-openjdk support
* Thu Nov 25 2010 gil <puntogil@libero.it> 1.3.0-5mamba
- rebuilt devel
- add new sub package desktop
- fix documentation build
- add %%post %%postun {,desktop} scripts
* Tue Mar 17 2009 gil <puntogil@libero.it> 1.3.0-4mamba
- rebuilt with sun-java 6u20
* Tue Mar 17 2009 gil <puntogil@libero.it> 1.3.0-3mamba
- rebuilt
* Fri Mar 13 2009 gil <puntogil@libero.it> 1.3.0-2mamba
- rebuilt
* Thu Mar 05 2009 gil <puntogil@libero.it> 1.3.0-1mamba
- package created by autospec