%bcond_without zstd

%define	name	avfs
%define	version	1.1.5
%define	release	0%{?dist}.1sunshine

Summary:	Enables programs to look inside archived/compressed files, access remote files
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	GPLv2 and LGPLv2
Group:		Applications/Archiving
URL:		http://sourceforge.net/projects/avf
Source0:	http://downloads.sourceforge.net/avf/%{name}-%{version}.tar.bz2
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Buildrequires:	gcc
Buildrequires:	make
Buildrequires:	fuse-devel >= 2.6.0
Buildrequires:	perl-devel
Buildrequires:	zlib-devel
Buildrequires:	bzip2-devel
Buildrequires:	xz-devel
Buildrequires:	neon-devel >= 0.27.0
%{?with_zstd:BuildRequires:  libzstd-devel}

%description
AVFS is a system, which enables all programs to look inside archived
or compressed files, or access remote files without recompiling the
programs or changing the kernel.

At the moment it supports floppies, tar and gzip files, zip, bzip2, ar
and rar files, ftp sessions, http, webdav, rsh/rcp, ssh/scp. Quite a
few other handlers are implemented with the Midnight Commander's
external FS.

%package libs
Summary:   Libraries for applications using %{name}
License:   LGPLv2
Group:     Development/Libraries
Requires:  %{name} = %{version}-%{release}

%description libs
Libraries for applications using %{name}

%package devel
Summary:   Development libraries and header files for %{name}
License:   LGPLv2
Group:     Development/Libraries
Requires:  %{name}-libs = %{version}-%{release}

%description devel
Development libraries and header files for %{name}

%prep
%setup -q

%build
%configure --enable-fuse --with-system-zlib --with-system-bzlib --with-xz \
%{?with_zstd:--with-zstd}

make

%install
make install DESTDIR=%{buildroot}
rm -rf %{buildroot}%{_libdir}/*.*a
rm -rf doc/Makefil*

%clean
rm -rf %{buildroot}

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%{!?_licensedir:%global license %%doc}
%files
%license COPYING
%doc AUTHORS ChangeLog NEWS README TODO doc/
%{_bindir}/avfsd
%{_bindir}/davpass
%{_bindir}/ftppass
%{_bindir}/mountavfs
%{_bindir}/umountavfs

%files libs
%license COPYING.LIB
%{_libdir}/%{name}/
%{_libdir}/*.so.*

%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_bindir}/avfs-config

%changelog
* Wed Jun 07 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.5-0.1sunshine
- update to 1.1.5

* Tue Apr 13 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.4-0.2sunshine
- BR: gcc, make
- drop Requires: perl
- use the %%license macro, and provide a fallback
- more explicit about licenses (only the library is LGPL)

* Tue Apr 13 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.4-0.1sunshine
- update to 1.1.4
- list binaries explicitly
- place avfs-config in devel package
- BR: neon-devel for DAV support
- BR: libzstd-devel (unless disabled)

* Mon Aug 31 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.3-0.1sunshine
- update to 1.1.3

* Tue Apr 28 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.2-0.1sunshine
- update to 1.1.2
- fix Source0 URI
- drop %%defattr
- package libs in a separate package

* Wed Feb 12 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 1.1.1-0.1sunshine
- update to 1.1.1
- clean up SPEC slightly
- simplify Source URL
- package .pc file

* Wed Jan 06 2016 Moritz Barsnick <moritz+rpm@barsnick.net> 1.0.3-0.1sunshine
- update to 1.0.3
- drop Requires: fuse
- make BR: fuse-devel versioned
- force build with liblzma (xz)

* Tue Apr 08 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 1.0.1-0.2sunshine
- build with system zlib and bzip2, and add BRs for their -devel packages
- BR xz-devel for liblzma
- fix duplicate packaging of headers
- don't own include dir
- don't package static libraries (bz #436612)

* Thu Jun 14 2012 Moritz Barsnick <moritz+rpm@barsnick.net> 1.0.1-0.1sunshine
- update to 1.0.1
- use bz2 compressed source
- drop glibs related BR/Requires, it's default on Fedora

* Tue Jul 19 2011 J. Krebs <rpm_speedy@yahoo.com> - 1.0.0-1
- New version.

* Fri Oct 08 2008 J. Krebs <rpm_speedy@yahoo.com> - 0.9.9-1
- New version.

* Wed Aug 06 2008 J. Krebs <rpm_speedy@yahoo.com> - 0.9.8-2
- Added libdir to configure for build under x86_64.

* Sat Nov 10 2007 J. Krebs <rpm_speedy@yahoo.com> - 0.9.8-1
- Initial build.