jython/jython.spec

242 lines
7.3 KiB
RPMSpec
Raw Normal View History

%define jythonver %(echo %version | cut -d '.' -f -3)
%define javahome %{_jvmdir}/jdk
Name: jython
Version: 2.2.1.svn
Release: 6mamba
Summary: A Java implementation of the Python language
Group: Development/Languages
Vendor: openmamba
Distribution: openmamba
Packager: Automatic Build System <autodist@mambasoft.it>
URL: http://www.jython.org/Project/
# use fetch-jython.sh script to generate the source drop
# sh fetch-jython.sh jython https://jython.svn.sourceforge.net/svnroot Release_2_2_1
Source0: jython-%{version}.tar.bz2
Source1: fetch-jython.sh
Patch0: jython-2.2.1.svn-cachedir.patch
Patch1: jython-2.2.1.svn-nofullbuildpath.patch
License: BSD, Python Software Foundation License
BuildRequires: apache-ant
BuildRequires: apache-tomcat5-servletapi5
BuildRequires: jakarta-oro
BuildRequires: java-gcj-compat
BuildRequires: java-jline
BuildRequires: java-junit3
BuildRequires: java-libreadline
BuildRequires: java-mysql-connector
%if "%{stage1}" != "1"
BuildRequires: java-svnant
%endif
BuildRequires: jpackage-utils
BuildRequires: libht2html
BuildRequires: libpython-devel
BuildRequires: postgresql-jdbc
BuildRequires: python-xml
Requires: apache-tomcat5-servletapi5
Requires: jakarta-oro
Requires: java-libreadline
Requires: java-mysql-connector
Requires: libht2html
Requires: python
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform.
The predecessor to Jython, JPython, is certified as 100% Pure Java. Jython is freely available for both commercial and non-commercial use and is distributed with source code. Jython is complementary to Java and is especially suited for the following tasks: Embedded scripting - Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application. Interactive experimentation - Jython provides an interactive interpreter that can be used to interact with Java packages or with running Java applications. This allows programmers to experiment and debug any Java system using Jython. Rapid application development - Python programs are typically 2-10X shorter than the equivalent Java program.
This translates directly to increased programmer productivity. The seamless interaction between Python and Java allows developers to freely mix the two languages both during development and in shipping products.
%package javadoc
Group: Documentation
Summary: Javadoc for %{name}
%description javadoc
A Java implementation of the Python language.
This package contains API documentation for %{name}.
%package manual
Group: Documentation
Summary: Manual for %{name}
%description manual
A Java implementation of the Python language.
This package contains documentation for %{name}.
%package demo
Group: Documentation
Summary: Demo for %{name}
Requires: %{name} = %{version}-%{release}
%description demo
A Java implementation of the Python language.
This package contains demonstrations and samples for %{name}.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%build
export CLASSPATH=$(build-classpath oro servletapi5 javacc jline mysql-connector-java svnant postgresql-jdbc svn-javahl)
export CLASSPATH=$CLASSPATH:%{_libdir}/libreadline-java/libreadline-java.jar
rm -rf org/apache
perl -p -i -e 's|execon|apply|g' build.xml
ant \
-Dpython.home=%{_bindir} \
-Dht2html.dir=%{_datadir}/ht2html \
-Dpython.lib=./CPythonLib \
-Dpython.exe=%{__python} \
-DPyXmlHome=%{_libdir}/python%pyver \
%if "%{stage1}" != "1"
-Dsvnant.jar.dir=%{_javadir} \
%endif
-Djavahl.dir=%{_javadir} \
-Dtargetver=1.3 \
copy-dist
# remove #! from python files
pushd dist
for f in `find . -name '*.py'`
do
sed --in-place "s:#!\s*/usr.*::" $f
done
popd
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 dist/%{name}.jar \
%{buildroot}%{_javadir}/%{name}-%{jythonver}.jar
pushd %{buildroot}%{_javadir}
for jar in *-%{jythonver}*
do
ln -sf ${jar} ${jar/-%{jythonver}/}
done
popd
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{jythonver}
cp -pr dist/Doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{jythonver}
install -d -m 755 %{buildroot}%{_datadir}/%{name}
find dist/Lib -type d -name test | xargs rm -rf
cp -pr dist/Lib %{buildroot}%{_datadir}/%{name}
cp -pr dist/Tools %{buildroot}%{_datadir}/%{name}
cp -pr dist/Demo %{buildroot}%{_datadir}/%{name}
rm -rf dist/Doc/javadoc
mv dist/Doc %{name}-manual-%{jythonver}
# registry
install -m 644 registry %{buildroot}%{_datadir}/%{name}
# scripts
install -d %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/sh
#
# %{name} script
# JPackage Project (http://jpackage.sourceforge.net)
# Source functions library
. %{_datadir}/java-utils/java-functions
# Source system prefs
if [ -f %{_sysconfdir}/%{name}.conf ] ; then
. %{_sysconfdir}/%{name}.conf
fi
# Source user prefs
if [ -f \$HOME/.%{name}rc ] ; then
. \$HOME/.%{name}rc
fi
# Configuration
MAIN_CLASS=org.python.util.%{name}
BASE_FLAGS=-Dpython.home=%{_datadir}/%{name}
BASE_JARS="%{name} oro servletapi5 mysql-connector-java"
BASE_FLAGS="\$BASE_FLAGS -Dpython.console=org.python.util.ReadlineConsole"
BASE_FLAGS="\$BASE_FLAGS -Djava.library.path=%{_libdir}/libreadline-java"
BASE_FLAGS="\$BASE_FLAGS -Dpython.console.readlinelib=Editline"
# Set parameters
set_jvm
CLASSPATH=$CLASSPATH:%{_libdir}/libreadline-java/libreadline-java.jar
set_classpath \$BASE_JARS
set_flags \$BASE_FLAGS
set_options \$BASE_OPTIONS
# Let's start
run "\$@"
EOF
cat > %{buildroot}%{_bindir}/%{name}c << EOF
#!/bin/sh
#
# %{name}c script
# JPackage Project (http://jpackage.sourceforge.net)
%{_bindir}/%{name} %{_datadir}/%{name}/Tools/%{name}c/%{name}c.py "\$@"
EOF
#%{_bindir}/aot-compile-rpm \
# --exclude %{_datadir}/%{name}/Demo/jreload \
# --exclude %{_datadir}/%{name}/Demo/jreload/example.jar
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/jython
%attr(0755,root,root) %{_bindir}/jythonc
%{_javadir}/jython-%{jythonver}.jar
%{_javadir}/jython.jar
%dir %{_datadir}/jython
%{_datadir}/jython/Lib
%{_datadir}/jython/Tools
%{_datadir}/jython/registry
%doc ACKNOWLEDGMENTS NEWS LICENSE.txt README.txt
%files javadoc
%defattr(-,root,root)
%doc %{_javadocdir}/%{name}-%{jythonver}
%files manual
%defattr(-,root,root)
%doc %{name}-manual-%{jythonver}
%files demo
%defattr(-,root,root)
%doc %{_datadir}/%{name}/Demo
%changelog
* Wed Jul 31 2013 Automatic Build System <autodist@mambasoft.it> 2.2.1.svn-6mamba
- rebuilt
* Mon Mar 28 2011 gil <puntogil@libero.it> 2.2.1.svn-5mamba
- rebuilt with java-gcj-compat support
* Tue May 18 2010 gil <puntogil@libero.it> 2.2.1.svn-4mamba
- rebuilt with sun-java 6u20 and python 2.6
* Mon Jan 04 2010 gil <puntogil@libero.it> 2.2.1.svn-3mamba
- rebuilt with java-mysql-connector java-subversion java-svnant postgresql-jdbc python-xml support
* Mon Mar 09 2009 gil <puntogil@libero.it> 2.2.1.svn-2mamba
- rebuilt with java-servletapi5
* Tue Jan 27 2009 gil <puntogil@libero.it> 2.2.1.svn-1mamba
- package created by autospec