#
# spec file for package libnfs
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2015 Bjørn Lie, Bryne, Norway.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define sover   13

Name:           libnfs
Version:        4.0.0
Release:        1.3
Summary:        Client library for accessing NFS shares over a network
License:        LGPL-2.1-or-later AND BSD-2-Clause AND GPL-3.0-or-later
Group:          Productivity/Networking/NFS
URL:            https://github.com/sahlberg/libnfs
Source0:        %{url}/archive/libnfs-%{version}.tar.gz

BuildRequires:  autoconf
BuildRequires:  libtool
BuildRequires:  pkgconfig

%description
Package contains a library of functions for accessing NFSv2 and
NFSv3 servers from user space. It provides a low-level,
asynchronous RPC library for accessing NFS protocols, an
asynchronous library with POSIX-like VFS functions, and a
synchronous library with POSIX-like VFS functions.

%package -n libnfs%{sover}
Summary:        Client library for accessing NFS shares over a network
Group:          Productivity/Networking/NFS

%description -n libnfs%{sover}
Package contains a library of functions for accessing NFSv2 and
NFSv3 servers from user space. It provides a low-level,
asynchronous RPC library for accessing NFS protocols, an
asynchronous library with POSIX-like VFS functions, and a
synchronous library with POSIX-like VFS functions.

%package devel
Summary:        Development files for libnfs
Group:          Development/Languages/C and C++
Requires:       libnfs%{sover} = %{version}-%{release}

%description devel
The libnfs-devel package contains libraries and header files for
developing applications that use libnfs.

%package -n utils-libnfs
Summary:        Utilities for accessing NFS servers
# Handle libnfs from packman, which contained both binaries and lib
Group:          Productivity/Networking/NFS
Provides:       libnfs = %{version}-%{release}
Obsoletes:      libnfs < %{version}-%{release}

%description -n utils-libnfs
The utils-libnfs package contains simple client programs for
accessing NFS servers using libnfs.

%prep
%autosetup -p1 -n %{name}-%{name}-%{version}

%build
autoreconf -fiv
%configure \
	--disable-static \
	--disable-examples \
	--enable-utils \
	%{nil}
%make_build

%install
%make_install
find %{buildroot} -type f -name "*.la" -delete -print

%post -n libnfs%{sover} -p /sbin/ldconfig
%postun -n libnfs%{sover} -p /sbin/ldconfig

%files -n libnfs%{sover}
%license COPYING LICENCE-LGPL-2.1.txt LICENCE-BSD.txt LICENCE-GPL-3.txt
%doc README
%{_libdir}/libnfs.so.*

%files devel
%{_libdir}/libnfs.so
%{_includedir}/nfsc/
%{_libdir}/pkgconfig/libnfs.pc

%files -n utils-libnfs
%{_bindir}/nfs-*
%{_mandir}/man1/nfs-*.1%{?ext_man}

%changelog
* Wed Jul 24 2019 Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 4.0.0:
  + Fix the versioning in makerpms.sh.
  + Fix some compile issues in the test programs.
  + NFSv3: skip commit on close if the file has not been written
    to.
  + Add nfs_umount() to NFSv3.
  + Add nfs_statvfs64().
  + Fix invalid shift of pid_t when generating rpc->xid.
  + Compile fixes for Mac OSX.
  + Fix for dup2() on Windows.
  + NFSv4 fix for directory handling.
  + Improvements to configure/building.
- Bump sover to 13 following upstream.
- Use modern macros.
- Pass explicit --enable-utils to configure, ensure we build the
  utils.
* Thu Nov  8 2018 Luigi Baldoni <aloisio@gmx.com>
- Update to version 3.0.0
  * NFSv4 support.
  * lockf() support (NFSv4 only).
  * fcntl() support for locking (NFSv4 only).
  * Add CMake support.
  * URL arguments to select NFS version.
  * URL argument to set nfsport. This allows NFSv4 to work for
    servers without portmapper support.
  * URL argument to set he mount port.
  * NFSv4: use getpwnam to map NFSv4 (Ganesha) when passing
    uid/gid as a user/group name insead of as a uid/gid.
  * Added nfs-fh: a simle utility to print the filehandle for a
    nfs file.
  * Add a new open2() function that takes a mode argument.
  * Add a testsuite for libnfs.
- Spec cleanup
* Tue Oct 17 2017 zaitor@opensuse.org
- Update to version 2.0.0:
  + Bug fixes:
  - Fix NULL pointer crash in nfs_link().
  - Clamp read/write size for servers (Ganesha) that offer very
    large io sizes instead of failing to connect to the export.
  - Tell the server to commit all data to stable storage when we
    close files.
  - Double free fix: don't call rpc_free_pdu() after
    rpc_queue_pdu() failure.
  - Fix for memory leak in rpc_allocate_*().
  - Abort the mount process correctly if MOUNT/MNT returns error
    or is cancelled.
  - Fix memory leak in error path in nfs_create_2_cb().
  - Fix leak of rpc->inbuf if we destroy the context while we
    have still PDUs in flight.
  + New features:
  - Add O_NOFOLLOW support for nfs_open().
  - Add a new mkdir2 command that also takes a mode argument.
  - Add a new readlink2 command that avoids having to preallocate
    the buffer.
  - Add support for RPC timeouts for both the sync and async
    interfaces.
  - Use SOCK_CLOEXEC for the sockets.
  - Make rpc_set{g|u}id() public.
  - Performance optimization: socket: Batch pdu read in
    rpc_read_from_socket.
  - Low level support for NFSv4 some and examples.
  - Support for building RPC servers.
- Bump soname to 11 following upstream changes.
- Stop passing disable-werror to configure, no longer needed.
* Fri Mar 10 2017 zaitor@opensuse.org
- Update to version 1.11.0:
  + Reduce the number of memory allocations in the ZDR layer.
  + Check both seconds and nanoseconds field when validating dir
    cache.
  + Invalidate the dir cache immediately if we do something that
    would cause it to become stale, such as adding/removing objects
    from the cache.
  + Add options to enable/disable dir caching.
  + Discard readahead cache on [p]write and truncate.
  + Android fixes.
  + Windows fixes.
  + Support timeouts for sync functions.
  + Add an internal pagecache.
  + Add nfs_rewinddir(), nfs_seekdir() and nfs_telldir().
  + Fix crash in nfs_truncate().
  + Fix segfault that can trigger if we rpc_disconnect() during the
    mount.
  + Add support to bind to a specific interface (linux only).
- Pass --disable-werror to configure, needed after glibc 2.25
  update.
* Sun Aug  7 2016 olaf@aepfle.de
- Add also Release to really obsolete libnfs
* Sat Jul 23 2016 olaf@aepfle.de
- Obsolete libnfs from PMBS
* Fri Apr 22 2016 zaitor@opensuse.org
- Inital packaging, version 1.10.0.