%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define debug_package %{nil} # Works with 3.10.0 and 3.10.1 %define ocaml_major 3.10 %define ocaml_minor 1 %define java_version 1.6.0 %define pkgversion 1.0-beta Name: ocaml-ocamljava Version: 1.0_beta Release: 2%{?dist} Summary: Libraries and programs for interfacing OCaml and Java/JVM Group: Development/Libraries License: GPLv3 and LGPLv3 and QPL URL: http://ocamljava.x9c.fr/ Source0: http://barista.x9c.fr/distrib/barista-%{pkgversion}.tar.gz Source1: http://cadmium.x9c.fr/distrib/cadmium-%{pkgversion}.tar.gz # http://cadmium.x9c.fr/distrib/cadmiumdbm-%{pkgversion}.tar.gz # http://cadmium.x9c.fr/distrib/cadmiumswixml-%{pkgversion}.tar.gz # http://cadmium.x9c.fr/distrib/cadmiumservlet-%{pkgversion}.tar.gz Source2: http://cafesterol.x9c.fr/distrib/cafesterol-%{pkgversion}.tar.gz Source3: http://nickel.x9c.fr/distrib/nickel-%{pkgversion}.tar.gz Source4: http://ocamlscripting.x9c.fr/distrib/ocamlscripting-%{pkgversion}.tar.gz Source5: http://caml.inria.fr/distrib/ocaml-%{ocaml_major}/ocaml-%{ocaml_major}.%{ocaml_minor}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ocaml = %{ocaml_major}.%{ocaml_minor} BuildRequires: ocaml-camomile-devel BuildRequires: ocaml-zip-devel BuildRequires: java-%{java_version}-openjdk-devel BuildRequires: ant BuildRequires: ant-contrib BuildRequires: ant-nodeps BuildRequires: ant-apache-regexp BuildRequires: chrpath Requires: ocaml = %{ocaml_major}.%{ocaml_minor} #Requires: java-%{java_version}-openjdk #%define _use_internal_dependency_generator 0 #%define __find_requires /usr/lib/rpm/ocaml-find-requires.sh #%define __find_provides /usr/lib/rpm/ocaml-find-provides.sh %description The goal of the OCaml-Java project is to allow seamless integration of Objective Caml and Java. Objective Caml is a very good language but it sometimes lacks the library for a given task. On the other hand, Java is a weaker language but benefits from a tremendous community, and this manpower is able to deliver libraries for almost any task. It would thus be useful to be able to write a program in Objective Caml that use some Java libraries. This is the goal of the OCaml-Java project. In its current release (%{pkgversion}), the project provides a new Objective Caml compiler ocamljava that is the Java counterpart of ocamlc/ocamlopt. Although still alpha, the project already exhibits good compatibility with the original implementation: all language constructs are supported, the standard library is fully supported (even marshalling, lexing, and parsing), and among other libraries only labltk is unsupported (this means that bigarray, dbm, dynlink, graph, num, str, unix, as well as threads are supported). ocamljava is even able to build a working ocamlc.jar file that is the Java-compiled version of the ocamlc compiler. Subprojects of OCaml-Java are: * the Barista project (Java class file manipulation); * the Cadmium project (runtime support, implementation of primitives); * the Cafesterol project (ocamljava compiler); * the Nickel project (Java/Objective Caml bridge generator); * the OCamlScripting project (scripting engine for Java). %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and signature files for developing applications that use %{name}. %package doc Summary: Documentation files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description doc The %{name}-doc package contains documentation for developing applications that use %{name}. %prep # Unpack everything. Our build directory will look like this: # ocaml-ocamljava-%{version}/ # barista-%{pkgversion}/ # cadmium-%{pkgversion}/ # ... # ocaml-%{ocaml_major}.%{ocaml_minor}/ # # http://www.rpm.org/max-rpm/s1-rpm-inside-macros.html # Barista %setup -q -c # Cadmium %setup -q -T -D -a 1 # Cafesterol %setup -q -T -D -a 2 # Nickel %setup -q -T -D -a 3 # OCamlScripting %setup -q -T -D -a 4 # OCaml sources %setup -q -T -D -a 5 # Cafesterol now overwrites parts of the OCaml sources. # http://ocamljava.x9c.fr/wiki/doku.php?id=cafesterol pushd ocaml-%{ocaml_major}.%{ocaml_minor} cp -r ../cafesterol-%{pkgversion}/src/* . popd # Pull out the documentation. mkdir doc pdf for pkg in barista cadmium cafesterol nickel ocamlscripting; do for file in README VERSION CHANGES COPYING COPYING.LESSER; do if [ -f $pkg-%{pkgversion}/$file ]; then cp $pkg-%{pkgversion}/$file doc/$file-$pkg fi done cp $pkg-%{pkgversion}/doc/*.pdf pdf/ done %build # Build barista (OCaml library for manipulating Java class files). pushd barista-%{pkgversion} barista_bindir=`pwd`/bin make all \ PATH_OCAML_BIN=/usr/bin \ OCAML_COMPILE_FLAGS='-w Ael -I $(PATH_SRC) -I +zip -I +camomile' strip bin/barista.opt chrpath --delete bin/barista.opt popd # Build ocamljava (cafesterol) which requires barista. pushd ocaml-%{ocaml_major}.%{ocaml_minor} ocaml_dir=`pwd` CFLAGS="$RPM_OPT_FLAGS" \ ./configure \ -bindir %{_bindir} \ -libdir %{_libdir}/ocaml \ -x11lib %{_libdir} \ -x11include %{_includedir} \ -mandir %{_mandir}/man1 make world export LD_LIBRARY_PATH=%{_libdir}/ocaml/stublibs make -f Makefile.cafesterol \ OCAMLC="ocamlc -I $barista_bindir -I +camomile" \ OCAMLOPT="ocamlopt -I $barista_bindir -I +camomile" \ INCLUDES="-I utils -I parsing -I typing -I bytecomp -I asmcomp -I javacomp -I driver -I toplevel -I +zip -I $barista_bindir -I +camomile" strip ocamljava.opt chrpath --delete ocamljava.opt popd # Build cadmium (runtime support, primitives) pushd cadmium-%{pkgversion} make all \ PATH_OCAML_BIN=%{_bindir} \ PATH_OCAML_LIB=%{_libdir}/ocaml/caml \ OCAMLJAVA="$ocaml_dir/ocamljava -I $ocaml_dir/stdlib" # Build cadmium.jar (Java library). ant deploy popd %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_bindir} mkdir -p $RPM_BUILD_ROOT/%{_libdir}/ocaml mkdir -p $RPM_BUILD_ROOT/%{_libdir}/ocaml/barista mkdir -p $RPM_BUILD_ROOT/%{_libdir}/ocaml/cadmium mkdir -p $RPM_BUILD_ROOT/%{_libdir}/ocaml/stublibs mkdir -p $RPM_BUILD_ROOT/%{_mandir} touch $RPM_BUILD_ROOT/%{_libdir}/ocaml/ld.conf # Install barista. pushd barista-%{pkgversion} make install-all \ INSTALL_DIR=$RPM_BUILD_ROOT/%{_libdir}/ocaml/barista \ INSTALL_DIR_EXEC=$RPM_BUILD_ROOT/%{_bindir} popd # Install ocamljava and libraries (cafesterol) pushd ocaml-%{ocaml_major}.%{ocaml_minor} make -f Makefile.cafesterol install \ BINDIR=$RPM_BUILD_ROOT/%{_bindir} \ LIBDIR=$RPM_BUILD_ROOT/%{_libdir}/ocaml \ STUBLIBDIR=$RPM_BUILD_ROOT/%{_libdir}/ocaml/stublibs \ MANDIR=$RPM_BUILD_ROOT/%{_mandir} # Delete *.cmi, *.mli files, they're the same as the base OCaml package. rm $RPM_BUILD_ROOT/%{_libdir}/ocaml/*.cmi rm $RPM_BUILD_ROOT/%{_libdir}/ocaml/*.mli popd # Install cadmium. pushd cadmium-%{pkgversion} make install INSTALL_DIR=$RPM_BUILD_ROOT/%{_libdir}/ocaml/cadmium install -m 0644 deploy/ocamlrun.jar $RPM_BUILD_ROOT/%{_libdir}/ocaml popd rm -f $RPM_BUILD_ROOT/%{_libdir}/ocaml/ld.conf %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc doc/* %{_bindir}/* %{_libdir}/ocaml/*.cmj %{_libdir}/ocaml/*.cmja %{_libdir}/ocaml/*.jar %{_libdir}/ocaml/barista %if %opt %exclude %{_libdir}/ocaml/barista/*.a %exclude %{_libdir}/ocaml/barista/*.cmxa %exclude %{_libdir}/ocaml/barista/*.cmx %endif %{_libdir}/ocaml/cadmium %if %opt %exclude %{_libdir}/ocaml/cadmium/*.a %exclude %{_libdir}/ocaml/cadmium/*.cmxa %exclude %{_libdir}/ocaml/cadmium/*.cmx %endif %exclude %{_libdir}/ocaml/cadmium/*.mli %files devel %defattr(-,root,root,-) %doc doc/COPYING* %if %opt %{_libdir}/ocaml/barista/*.a %{_libdir}/ocaml/barista/*.cmxa %{_libdir}/ocaml/barista/*.cmx %{_libdir}/ocaml/cadmium/*.a %{_libdir}/ocaml/cadmium/*.cmxa %{_libdir}/ocaml/cadmium/*.cmx %endif %{_libdir}/ocaml/cadmium/*.mli %files doc %defattr(-,root,root,-) %doc pdf/* %changelog * Wed Mar 5 2008 Richard W.M. Jones - 1.0_beta-2 - Remove ExcludeArch ppc64. * Tue Mar 4 2008 Richard W.M. Jones - 1.0_beta-1 - New upstream release 1.0-beta. * Fri Feb 29 2008 Richard W.M. Jones - 1.0_alpha-2 - Build and install cadmium.jar. - Added BR ant. * Fri Feb 22 2008 Richard W.M. Jones - 1.0_alpha-1 - Initial RPM release.