%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define debug_package %{nil} # Select what subpackages to build. %define build_mlvirsh 1 %define build_mlvirtmanager 0 %define build_virt_top 1 %define build_virt_df 0 %define build_full_featured_virt_top 1 Name: ocaml-libvirt Version: 0.3.3.0 Release: 2%{?dist} Summary: OCaml binding for libvirt Group: Development/Libraries License: LGPLv2+ URL: http://et.redhat.com/~rjones/ocaml-libvirt/ Source0: http://et.redhat.com/~rjones/ocaml-libvirt/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExcludeArch: ppc64 # Note for people building from this spec file: # These BR's can be found in Fedora development, or here: # http://www.annexia.org/tmp/ocaml/ BuildRequires: ocaml >= 3.10.0-7 BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-extlib-devel %if %build_mlvirtmanager BuildRequires: ocaml-lablgtk-devel %endif %if %build_virt_top BuildRequires: ocaml-curses-devel %if %build_full_featured_virt_top BuildRequires: ocaml-xml-light-devel BuildRequires: ocaml-csv-devel BuildRequires: ocaml-calendar-devel %endif %endif BuildRequires: libvirt-devel >= 0.2.1 BuildRequires: perl BuildRequires: gawk %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 OCaml binding for libvirt. %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}. %if %build_mlvirsh %package -n mlvirsh Summary: OCaml virsh utility Group: Applications/Emulators License: GPLv2+ %description -n mlvirsh OCaml virtualization shell. %endif %if %build_mlvirtmanager %package -n mlvirtmanager Summary: OCaml virtualization graphical utility Group: Applications/Emulators License: GPLv2+ %description -n mlvirtmanager OCaml virtualization graphical utility. %endif %if %build_virt_top %package -n virt-top Summary: Utility like top(1) for displaying virtualization stats Group: Applications/Emulators License: GPLv2+ %description -n virt-top virt-top is a 'top(1)'-like utility for showing stats of virtualized domains. Many keys and command line options are the same as for ordinary 'top'. It uses libvirt so it is capable of showing stats across a variety of different virtualization systems. %endif %if %build_virt_df %package -n virt-df Summary: Utility like df(1) for displaying disk space in guests Group: Applications/Emulators License: GPLv2+ %description -n virt-df virt-df is a 'df(1)'-like utility for display disk space in guests. It uses libvirt so it is capable of showing stats across a variety of different virtualization systems. %endif %prep %setup -q ./configure --libdir=%{_libdir} --prefix=%{_prefix} %build make all doc %if %opt make opt strip libvirt/dllmllibvirt.so %if %build_mlvirsh strip mlvirsh/mlvirsh.opt %endif %if %build_mlvirtmanager strip mlvirtmanager/mlvirtmanager.opt %endif %if %build_virt_top strip virt-top/virt-top.opt %endif %if %build_virt_df strip virt-top/virt-df.opt %endif %endif %install # These rules work if the library uses 'ocamlfind install' to install itself. rm -rf $RPM_BUILD_ROOT export DESTDIR=$RPM_BUILD_ROOT export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs mkdir -p $RPM_BUILD_ROOT%{_bindir} make install %if %build_virt_top # Install virt-top manpage by hand for now. mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 install -m 0644 virt-top/virt-top.1 $RPM_BUILD_ROOT%{_mandir}/man1 gzip $RPM_BUILD_ROOT%{_mandir}/man1/virt-top.1 %endif %if !%build_mlvirsh rm -f $RPM_BUILD_ROOT%{_bindir}/mlvirsh %endif %if !%build_mlvirtmanager rm -f $RPM_BUILD_ROOT%{_bindir}/mlvirtmanager %endif %if !%build_virt_top rm -f $RPM_BUILD_ROOT%{_bindir}/virt-top %endif %if !%build_virt_df rm -f $RPM_BUILD_ROOT%{_bindir}/virt-df %endif %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc COPYING.LIB README ChangeLog %{_libdir}/ocaml/libvirt %if %opt %exclude %{_libdir}/ocaml/libvirt/*.a %exclude %{_libdir}/ocaml/libvirt/*.cmxa %exclude %{_libdir}/ocaml/libvirt/*.cmx %endif %exclude %{_libdir}/ocaml/libvirt/*.mli %{_libdir}/ocaml/stublibs/*.so %{_libdir}/ocaml/stublibs/*.so.owner %files devel %defattr(-,root,root,-) %doc COPYING.LIB README TODO.libvirt ChangeLog html/* %if %opt %{_libdir}/ocaml/libvirt/*.a %{_libdir}/ocaml/libvirt/*.cmxa %{_libdir}/ocaml/libvirt/*.cmx %endif %{_libdir}/ocaml/libvirt/*.mli %if %build_mlvirsh %files -n mlvirsh %defattr(-,root,root,-) %doc COPYING README ChangeLog %{_bindir}/mlvirsh %endif %if %build_mlvirtmanager %files -n mlvirtmanager %defattr(-,root,root,-) %doc COPYING README ChangeLog %{_bindir}/mlvirtmanager %endif %if %build_virt_top %files -n virt-top %defattr(-,root,root,-) %doc COPYING README TODO.virt-top ChangeLog %{_bindir}/virt-top %{_mandir}/man1/*.1.gz %endif %if %build_virt_df %files -n virt-df %defattr(-,root,root,-) %doc COPYING README ChangeLog %{_bindir}/virt-df %endif %changelog * Fri Oct 19 2007 Richard W.M. Jones - 0.3.3.0-2 - Mistake: BR is ocaml-calendar-devel. * Fri Oct 19 2007 Richard W.M. Jones - 0.3.3.0-1 - New upstream release 0.3.3.0. - Added support for virt-df, but disabled it by default. - +BR ocaml-calendar. * Mon Sep 24 2007 Richard W.M. Jones - 0.3.2.8-1 - New upstream release 0.3.2.8. * Thu Sep 20 2007 Richard W.M. Jones - 0.3.2.7-1 - New upstream release 0.3.2.7. - Ship the upstream ChangeLog file. * Thu Sep 6 2007 Richard W.M. Jones - 0.3.2.6-2 - Force dependency on ocaml >= 3.10.0-7 which has fixed requires/provides scripts. * Thu Sep 6 2007 Richard W.M. Jones - 0.3.2.6-1 - New upstream version 0.3.2.6. * Wed Aug 29 2007 Richard W.M. Jones - 0.3.2.5-1 - New upstream version 0.3.2.5. - Keep TODO out of the main package, but add (renamed) TODO.libvirt and TODO.virt-top to the devel and virt-top packages respectively. - Add BR gawk. * Thu Aug 23 2007 Richard W.M. Jones - 0.3.2.4-1 - New upstream version 0.3.2.4. * Thu Aug 23 2007 Richard W.M. Jones - 0.3.2.3-2 - build_* macros so we can choose what subpackages to build. * Thu Aug 23 2007 Richard W.M. Jones - 0.3.2.3-1 - Upstream version 0.3.2.3. - Add missing BR libvirt-devel. * Wed Aug 22 2007 Richard W.M. Jones - 0.3.2.2-1 - Upstream version 0.3.2.2. * Wed Aug 22 2007 Richard W.M. Jones - 0.3.2.1-2 - Fix unclosed if-statement in spec file. * Wed Aug 22 2007 Richard W.M. Jones - 0.3.2.1-1 - Upstream version 0.3.2.1. - Put HTML documentation in -devel package. * Mon Aug 6 2007 Richard W.M. Jones - 0.3.1.2-1 - Initial RPM release.