822a4c4
%global _hardened_build 1
822a4c4
822a4c4
Name:           nbdkit
822a4c4
Version:        1.0.0
822a4c4
Release:        4%{?dist}
822a4c4
Summary:        NBD server
822a4c4
822a4c4
License:        BSD
822a4c4
URL:            https://github.com/libguestfs/nbdkit
822a4c4
Source0:        http://libguestfs.org/download/nbdkit/%{name}-%{version}.tar.gz
822a4c4
822a4c4
BuildRequires:  /usr/bin/pod2man
822a4c4
BuildRequires:  libvirt-devel
822a4c4
BuildRequires:  xz-devel
822a4c4
BuildRequires:  zlib-devel
822a4c4
822a4c4
822a4c4
%description
822a4c4
NBD is a protocol for accessing block devices (hard disks and
822a4c4
disk-like things) over the network.
822a4c4
822a4c4
'nbdkit' is a toolkit for creating NBD servers.
822a4c4
822a4c4
The key features are:
822a4c4
822a4c4
* Multithreaded NBD server written in C with good performance.
822a4c4
822a4c4
* Well-documented, simple plugin API with a stable ABI guarantee.
822a4c4
  Let's you export "unconventional" block devices easily.
822a4c4
822a4c4
* Liberal license (BSD) allows nbdkit to be linked to proprietary
822a4c4
  libraries or included in proprietary code.
822a4c4
822a4c4
You probably want to install one of more plugins (%{name}-plugin-*).
822a4c4
822a4c4
To develop plugins, install the %{name}-devel package and start by
822a4c4
reading the nbdkit(1) and nbdkit-plugin(3) manual pages.
822a4c4
822a4c4
822a4c4
%package plugin-examples
822a4c4
Summary:        Example plugins for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description plugin-examples
822a4c4
This package contains example plugins for %{name}.
822a4c4
822a4c4
822a4c4
%package plugin-file
822a4c4
Summary:        File serving plugin for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description plugin-file
822a4c4
This package is a file serving plugin for %{name}.
822a4c4
822a4c4
822a4c4
%package plugin-gzip
822a4c4
Summary:        GZip file serving plugin for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description plugin-gzip
822a4c4
This package is a gzip file serving plugin for %{name}.
822a4c4
822a4c4
822a4c4
%package plugin-libvirt
822a4c4
Summary:        Libvirt plugin for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description plugin-libvirt
822a4c4
This package is a libvirt plugin for %{name}.  It lets you access
822a4c4
libvirt guest disks readonly.  It is implemented using the libvirt
822a4c4
virDomainBlockPeek API.
822a4c4
822a4c4
822a4c4
%package plugin-xz
822a4c4
Summary:        XZ file serving plugin for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description plugin-xz
822a4c4
This package is a xz file serving plugin for %{name}.
822a4c4
822a4c4
822a4c4
%package devel
822a4c4
Summary:        Development files and documentation for %{name}
822a4c4
License:        BSD
822a4c4
822a4c4
Requires:       %{name}%{?_isa} = %{version}-%{release}
822a4c4
822a4c4
822a4c4
%description devel
822a4c4
This package contains development files and documentation
822a4c4
for %{name}.  Install this package if you want to develop
822a4c4
plugins for %{name}.
822a4c4
822a4c4
822a4c4
%prep
822a4c4
%setup -q
822a4c4
822a4c4
822a4c4
%build
822a4c4
# Force immediate binding for hardened build for plugins.
822a4c4
# https://bugzilla.redhat.com/show_bug.cgi?id=977446#c13
822a4c4
export LDFLAGS="$LDFLAGS -Wl,-z,now"
822a4c4
%configure --disable-static
822a4c4
make %{?_smp_mflags}
822a4c4
822a4c4
822a4c4
%install
822a4c4
%make_install
822a4c4
822a4c4
# Delete libtool crap.
822a4c4
find $RPM_BUILD_ROOT -name '*.la' -delete
822a4c4
822a4c4
822a4c4
%files
822a4c4
%doc LICENSE README
822a4c4
%{_sbindir}/nbdkit
822a4c4
%dir %{_libdir}/%{name}
822a4c4
%dir %{_libdir}/%{name}/plugins
822a4c4
%{_mandir}/man1/nbdkit.1*
822a4c4
822a4c4
822a4c4
%files plugin-examples
822a4c4
%doc LICENSE README
822a4c4
%{_libdir}/%{name}/plugins/nbdkit-example*-plugin.so
822a4c4
%{_mandir}/man1/nbdkit-example*-plugin.1*
822a4c4
822a4c4
822a4c4
%files plugin-file
822a4c4
%doc LICENSE README
822a4c4
%{_libdir}/%{name}/plugins/nbdkit-file-plugin.so
822a4c4
%{_mandir}/man1/nbdkit-file-plugin.1*
822a4c4
822a4c4
822a4c4
%files plugin-gzip
822a4c4
%doc LICENSE README
822a4c4
%{_libdir}/%{name}/plugins/nbdkit-gzip-plugin.so
822a4c4
%{_mandir}/man1/nbdkit-gzip-plugin.1*
822a4c4
822a4c4
822a4c4
%files plugin-libvirt
822a4c4
%doc LICENSE README
822a4c4
%{_libdir}/%{name}/plugins/nbdkit-libvirt-plugin.so
822a4c4
%{_mandir}/man1/nbdkit-libvirt-plugin.1*
822a4c4
822a4c4
822a4c4
%files plugin-xz
822a4c4
%doc LICENSE README
822a4c4
%{_libdir}/%{name}/plugins/nbdkit-xz-plugin.so
822a4c4
%{_mandir}/man1/nbdkit-xz-plugin.1*
822a4c4
822a4c4
822a4c4
%files devel
822a4c4
%doc LICENSE README TODO
822a4c4
# Include the source of the example plugins in the documentation.
822a4c4
%doc plugins/example*/*.c
822a4c4
%{_includedir}/nbdkit-plugin.h
822a4c4
%{_mandir}/man3/nbdkit-plugin.3*
822a4c4
822a4c4
822a4c4
%changelog
822a4c4
* Mon Jun 24 2013 Richard W.M. Jones <rjones@redhat.com> - 1.0.0-4
822a4c4
- Initial release.