%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %global debug_package %{nil} %global __provides_exclude_from ^%{_libdir}/ocaml/stublibs/.*\.so$ Name: js-of-ocaml Version: 1.0.9 Release: 1%{?dist} Summary: An OCaml to Javascript compiler License: LGPLv2+ with exceptions URL: http://ocsigen.org/js_of_ocaml Source0: http://ocsigen.org/download/js_of_ocaml-%{version}.tar.gz # Allow examples to be built with the distro packaged js-of-ocaml Source1: Makefile.common.js-of-ocaml.examples BuildRequires: ocaml BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-camlp4-devel BuildRequires: ocaml-lwt >= 2.3.0 BuildRequires: chrpath ExclusiveArch: %{ocaml_arches} %description js_of_ocaml is a compiler of OCaml byte-code to JavaScript. It makes it possible to run OCaml programs in a web browser. Its key features are the following: * the whole language, and most of the standard library are supported; * the generated code can be used with any web server and browser; * you can use a standard installation of OCaml to compile your programs. In particular, you do not have to recompile a library to use it with Js_of_ocaml. You just have to link your program with a specific library to interface with the browser APIs. %package doc Summary: User manual and other documentation for %{name} Group: Development/Libraries BuildArch: noarch License: (LGPLv2+ with exceptions) and GPLv2+ and WTFPL %description doc The %{name}-doc package contains the user manual, API reference and examples for %{name}. %prep %setup -q -n js_of_ocaml-%{version} %build make %install export DESTDIR=$RPM_BUILD_ROOT export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs D=$RPM_BUILD_ROOT%{_libdir}/ocaml/js_of_ocaml mkdir -p $D cp -p lib/META \ lib/*.{cmi,cma,a,mli} \ lib/syntax/pa_js.cmo \ runtime/runtime.js \ $D mkdir -p $RPM_BUILD_ROOT%{_bindir} cp -p compiler/js_of_ocaml $RPM_BUILD_ROOT%{_bindir}/ cp -p lib/dlljs_of_ocaml.so $OCAMLFIND_DESTDIR/stublibs/ strip $OCAMLFIND_DESTDIR/stublibs/dll*.so chrpath --delete $OCAMLFIND_DESTDIR/stublibs/dll*.so # NB. Do NOT strip the binaries and prevent prelink from stripping them too. # (https://bugzilla.redhat.com/show_bug.cgi?id=435559) mkdir -p $RPM_BUILD_ROOT/etc/prelink.conf.d echo '-b /usr/bin/js_of_ocaml' > $RPM_BUILD_ROOT/etc/prelink.conf.d/js-of-ocaml.conf # docs find examples '(' -name '*.cmi' -or -name '*.cmo' -or -name '*.byte' -or -name '.depend' ')' -exec rm '{}' ';' # Replacing Makefile.common allows the user to build the examples cp -p %{SOURCE1} examples/Makefile.common %files %doc LICENSE README %{_libdir}/ocaml/js_of_ocaml/ %{_libdir}/ocaml/stublibs/*.so %{_bindir}/js_of_ocaml %config(noreplace) /etc/prelink.conf.d/js-of-ocaml.conf %files doc %doc LICENSE README examples doc/api-html doc/manual-aux doc/manual-wiki %changelog * Tue Dec 13 2011 Scott Tsai <scottt.tw@gmail.com> 1.0.9-1 - Initial RPM release.