%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define debug_package %{nil} Name: ocaml-perl4caml Version: 0.9.5 Release: 1%{?dist} Summary: OCaml library for calling Perl libraries and code Group: Development/Libraries License: LGPLv2+ with exceptions URL: http://merjis.com/developers/perl4caml Source0: http://merjis.com/_file/perl4caml-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExcludeArch: ppc64 BuildRequires: ocaml >= 3.10.0 BuildRequires: ocaml-ocamldoc BuildRequires: perl >= 5.8 BuildRequires: perl-ExtUtils-Embed BuildRequires: chrpath # Perl4caml provides type-safe wrappers for these Perl modules: #Requires: perl-Date-Calc ##Requires: perl-Date-Format ##Requires: perl-Date-Parse ##Requires: perl-Net-Google ##Requires: perl-HTML-Element #Requires: perl-HTML-Parser #Requires: perl-HTML-Tree #Requires: perl-libwww-perl #Requires: perl-Template-Toolkit #Requires: perl-URI #Requires: perl-WWW-Mechanize %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 Perl4caml allows you to use Perl code within Objective CAML (OCaml), thus neatly side-stepping the (old) problem with OCaml which was that it lacked a comprehensive set of libraries. Well now you can use any part of CPAN in your OCaml code. %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}. %prep %setup -q -n perl4caml-%{version} find -name .cvsignore -exec rm {} \; %build make EXTRA_EXTRA_CFLAGS="$RPM_OPT_FLAGS" rm -f examples/*.{cmi,cmo,cmx,o,bc,opt} %check # This fails if perl4caml is installed. The bytecode programs # load dllperl4caml.so from OCaml's stublibs, instead of the # one we just built. Since dllperl4caml.so in stublibs # (wrongly) lacks an rpath for libperl.so, it won't find # libperl.so in the obscure directory where it resides. # Monkeying around with LD_LIBRARY_PATH doesn't help because # ocamlrun uses $libdir/ocaml/ld.conf to find directories # containing the stublibs. make test ||: %install rm -rf $RPM_BUILD_ROOT export DESTDIR=$RPM_BUILD_ROOT mkdir -p $DESTDIR/%{_libdir}/ocaml/stublibs make install strip $DESTDIR/%{_libdir}/ocaml/stublibs/dll*.so # Deleting the rpath in this shared library is wrong because # it means it can't find libperl.so, but Fedora policy requires # us to do it ... chrpath --delete $DESTDIR/%{_libdir}/ocaml/stublibs/dll*.so %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc COPYING.LIB %{_libdir}/ocaml/perl %if %opt %exclude %{_libdir}/ocaml/perl/*.a %exclude %{_libdir}/ocaml/perl/*.cmxa %endif %exclude %{_libdir}/ocaml/perl/*.mli %exclude %{_libdir}/ocaml/perl/*.ml %{_libdir}/ocaml/stublibs/*.so %files devel %defattr(-,root,root,-) %doc COPYING.LIB AUTHORS doc/* examples html README %if %opt %{_libdir}/ocaml/perl/*.a %{_libdir}/ocaml/perl/*.cmxa %endif %{_libdir}/ocaml/perl/*.mli %{_libdir}/ocaml/perl/*.ml %changelog * Sat Mar 1 2008 Richard W.M. Jones - 0.9.5-1 - New upstream release 0.9.5. - Clarify license is LGPLv2+ with exceptions - Remove excessive BuildRequires - Perl modules not needed for building. - Pass RPM C flags to the make. - 'make test' fails where perl4caml is already installed. * Sat Feb 23 2008 Richard W.M. Jones - 0.9.4-1 - Initial RPM release.