ocaml-libvirt/ocaml-libvirt.spec
Richard W.M. Jones 825599fcd4 Initial import.
2007-08-24 16:35:28 +00:00

225 lines
5.3 KiB
RPMSpec

%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_full_featured_virt_top 1
Name: ocaml-libvirt
Version: 0.3.2.3
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
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
%endif
%endif
BuildRequires: libvirt-devel >= 0.2.1
BuildRequires: perl
%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
%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
%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
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYING.LIB README TODO
%{_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 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
%{_bindir}/mlvirsh
%endif
%if %build_mlvirtmanager
%files -n mlvirtmanager
%defattr(-,root,root,-)
%doc COPYING README
%{_bindir}/mlvirtmanager
%endif
%if %build_virt_top
%files -n virt-top
%defattr(-,root,root,-)
%doc COPYING README
%{_bindir}/virt-top
%{_mandir}/man1/*.1.gz
%endif
%changelog
* Thu Aug 23 2007 Richard W.M. Jones <rjones@redhat.com> - 0.3.2.3-2
- build_* macros so we can choose what subpackages to build.
* Thu Aug 23 2007 Richard W.M. Jones <rjones@redhat.com> - 0.3.2.3-1
- Upstream version 0.3.2.3.
- Add missing BR libvirt-devel.
* Wed Aug 22 2007 Richard W.M. Jones <rjones@redhat.com> - 0.3.2.2-1
- Upstream version 0.3.2.2.
* Wed Aug 22 2007 Richard W.M. Jones <rjones@redhat.com> - 0.3.2.1-2
- Fix unclosed if-statement in spec file.
* Wed Aug 22 2007 Richard W.M. Jones <rjones@redhat.com> - 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 <rjones@redhat.com> - 0.3.1.2-1
- Initial RPM release.