--- /dev/null
+*~
+
+nbdkit-1.*
+nbdkit-1.*.tar.gz
+*.rpm
+
+/BUILDROOT
+/x86_64
--- /dev/null
+# nbdkit-plugin-vddk
+# Copyright (C) 2013-2017 Richard W.M. Jones.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# See README.
+
+# You must set this to the directory where you downloaded VDDK.
+# NB. DO NOT PUT A TRAILING ‘/’ or you will get the error
+# ‘canonicalization unexpectedly shrank by one character’ on RHEL 7.
+VDDK_DIR := $(HOME)/tmp/vddk/vmware-vix-disklib-distrib
+
+PWD := $(shell pwd)
+VERSION := $(shell grep ^Version: nbdkit-plugin-vddk.spec | awk '{print $$2}')
+
+all: check-tools check-vddk check-source
+ rpmbuild -ba \
+ --define "_topdir $(PWD)" \
+ --define "_builddir $(PWD)" \
+ --define "_rpmdir $(PWD)" \
+ --define "_sourcedir $(PWD)" \
+ --define "_specdir $(PWD)" \
+ --define "_srcrpmdir $(PWD)" \
+ --define "vddkdir $(VDDK_DIR)" \
+ nbdkit-plugin-vddk.spec
+
+check-tools:
+ @if ! rpmbuild --help >/dev/null 2>&1; then echo "‘rpmbuild’ not installed or not working. Install the ‘rpm-build’ package."; exit 1; fi
+ @if ! wget --help >/dev/null 2>&1; then echo "‘wget’ not installed or not working. Install the ‘wget’ package."; exit 1; fi
+
+check-vddk:
+ @if ! [ -d $(VDDK_DIR) ] || ! [ -d $(VDDK_DIR)/include ]; then echo -e "You must download VDDK and edit the Makefile to point $$(VDDK_DIR) to the\nlocation where you unpacked VDDK."; exit 1; fi
+
+check-source: nbdkit-$(VERSION).tar.gz
+
+nbdkit-$(VERSION).tar.gz:
+ rm -rf $@ $@-t
+ wget -O $@-t http://libguestfs.org/download/nbdkit/$@
+ mv $@-t $@
+
+clean:
+ rm -f *~
+ rm -f *.src.rpm
+ rm -rf x86_64
+ rm -rf BUILDROOT
--- /dev/null
+This repository contains a sources allowing you to build the nbdkit
+VDDK plugin as an RPM.
+
+Note that you will need VDDK, downloaded from VMware's website:
+
+ https://www.vmware.com/support/developer/vddk/
+
+and unpacked into some directory. You must edit ‘Makefile’ and make
+the ‘VDDK_DIR’ variable point to the directory where you unpacked
+VDDK.
+
+To build the RPM just type ‘make’. (If you have missing dependencies
+then make will give an error, so fix the problem and run make again.)
--- /dev/null
+# This is overridden when we call rpmbuild in the Makefile so you
+# don't need to set it here (unless you are not using the Makefile).
+#global vddkdir /some/path
+
+# The minimum version of nbdkit that we can build/install with.
+%global minimum_version 1.1.2
+
+
+Name: nbdkit-plugin-vddk
+# NB: The Version field is parsed out of this file by Makefile, so it
+# can only be a simple number. Also it must correspond to an nbdkit
+# released version (ideally the latest version).
+Version: 1.1.16
+Release: 1%{?dist}
+
+Summary: VDDK plugin for nbdkit
+License: BSD
+
+Source0: nbdkit-%{version}.tar.gz
+
+BuildRequires: nbdkit-devel >= %{minimum_version}
+
+Requires: nbdkit >= %{minimum_version}
+
+# Make sure the final package doesn't actually depend on the
+# VDDK library.
+%global __requires_exclude .*libvixDiskLib\\.so.*
+
+
+%description
+This package contains the VDDK plugin for nbdkit.
+NB: it does not contain VDDK itself. You have to download that
+separately yourself.
+
+
+%prep
+%setup -q -n nbdkit-%{version}
+%configure \
+ --disable-perl \
+ --disable-python \
+ --disable-ocaml \
+ --disable-ruby \
+ --without-curl \
+ --without-libvirt \
+ --without-zlib \
+ --without-liblzma \
+ --without-libguestfs \
+ --with-vddk=%{vddkdir}
+
+
+%build
+# Note we're only building the plugin, and we want to build it
+# against the installed nbdkit.
+pushd plugins/vddk
+make %{_smp_mflags}
+popd
+
+
+%install
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/nbdkit/plugins
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
+pushd plugins/vddk
+%make_install
+popd
+
+# Kill libtool files with fire.
+find $RPM_BUILD_ROOT -name '*.la' -delete
+
+
+%files
+%{_libdir}/nbdkit/plugins/nbdkit-vddk-plugin.so
+%{_mandir}/man1/nbdkit-vddk-plugin.1*
+
+
+%changelog
+* Tue Aug 08 2017 Richard W.M. Jones <rjones@redhat.com> - 5-2
+- Bump and rebuild.
+
+* Tue Aug 8 2017 Richard W.M. Jones <rjones@redhat.com> - 5-1
+- Add new macro ocaml_native_profiling.
+
+* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
+* Tue Nov 8 2016 Richard W.M. Jones <rjones@redhat.com> - 4-1
+- s390x is now a native architecture with OCaml 4.04 in Fedora >= 26.
+- Add riscv64 as a native arch using out of tree backend.
+
+* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Fri May 2 2014 Richard W.M. Jones <rjones@redhat.com> - 2-1
+- Move macros to _rpmconfigdir (RHBZ#1093528).
+
+* Tue Apr 22 2014 Richard W.M. Jones <rjones@redhat.com> - 1-1
+- New package.