%global commit a117eec8de7ed7249871da73dcc350283ce72069
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global gitdate 20190302
%global usegit 0
%global rel_extra 4

Name: smbnetfs
Summary: A FUSE filesystem to access Samba (SMB) shares and workgroups
Version: 0.6.3
%if 0%{usegit} > 0
Release: 1.%{gitdate}.git%{shortcommit}%{dist}.%{rel_extra}sunshine
Source0: https://sourceforge.net/code-snapshots/git/s/sm/%{name}/git.git/%{name}-git-%{commit}.zip
%else
Release: 0%{dist}.%{rel_extra}sunshine
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
%endif
URL: http://sourceforge.net/projects/%{name}/
Group: System Environment/Base
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: gcc
BuildRequires: pkgconfig
BuildRequires: glib2-devel >= 2.18
Requires: glib2 >= 2.18
BuildRequires: fuse-devel >= 2.6
Requires: fuse-libs >= 2.6
%if 0%{?fedora} >= 13
BuildRequires: libsmbclient-devel >= 3.5
Requires: libsmbclient >= 3.5
BuildRequires: libgnome-keyring-devel >= 2.28
%else
BuildRequires: libsmbclient-devel >= 3.0.20
Requires: libsmbclient >= 3.0.20
%endif

# lower the glib2 requirement in configure{,.ac}
Patch0: smbnetfs-0.6.1-glib218.patch
# don't actually require libsmbclient >= 3.5
Patch1: smbnetfs-0.6.1-libsmbclient.patch
# rebuild configure
BuildRequires: automake autoconf

License: GPLv2

%description
SMBNetFS is a Linux/FreeBSD FUSE filesystem that allows you to use a Samba
(SMB)/Microsoft network in the same manner as the network neighborhood in
Microsoft Windows.

%prep
%if 0%{usegit} > 0
%setup -q -n %{name}-git-%{commit}
%else
%setup -q
%endif
%patch -P 0 -p1 -b .glib2
%if 0%{?fedora} < 13
%patch -P 1 -p1 -b .libsmbclient
%endif

%build
# rebuild configure due to patch0
./autogen.sh
%configure
make %{?_smp_mflags}

%install
# make install would also install conf and docs into %{_sharedir}/doc
make install-exec DESTDIR=%{buildroot}
# explicitly install man page
install -d %{buildroot}%{_mandir}/man1
install -p -m644 debian/smbnetfs.1 %{buildroot}%{_mandir}/man1/
# explicitly install configuration
install -d %{buildroot}%{_datadir}/%{name}/conf-example
install -p -m644 conf/* %{buildroot}%{_datadir}/%{name}/conf-example/

%files
# INSTALL has some interesting info as well
%doc README AUTHORS TODO ChangeLog doc/*
%{!?_licensedir:%global license %%doc}
%license COPYING
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
%{_datadir}/%{name}

%changelog
* Sun Nov 10 2024 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.3-0.4sunshine
- add BR: make
- use non-deprecated %%patch macro syntax
- drop obsoleted macros, sections and tags

* Thu Apr 20 2023 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.3-0.3sunshine
- rebuild

* Tue Feb 02 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.3-0.2sunshine
- install the newly provided man page

* Tue Feb 02 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.3-0.1sunshine
- update to 0.6.3
- drop gnome-keyring dependencies

* Thu Apr 09 2020 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.2-0.2sunshine
- update to 0.6.2 proper (no apparent changes)
- bump release, git versioning breaks updates otherwise

* Wed Sep 25 2019 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.2-0.1sunshine
- update to 0.6.2 (via a git commit, as this version is neither tagged
  in git nor provided as a package)
- reduce the glib version patch to configure.ac, configure is rebuilt
  here anyway
- drop the xattr patch, it's upstream
- drop the nanoseconds patch, a different fix is upstream

* Tue Jan 15 2019 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.1-0.5sunshine
- add a patch for issues due to incorrect nanoseconds

* Tue Jul 17 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.1-0.4sunshine
- add BR: gcc

* Wed Apr 18 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.1-0.3sunshine
- fix the libsmbclient version check (EPEL wasn't seeing any requirement
  at all)

* Wed Apr 18 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.1-0.2sunshine
- add a patch to drop use of attr/xattr.h

* Wed Apr 18 2018 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.1-0.1sunshine
- update to 0.6.1
- rebase glib218 patch
- add a patch to drop the libsmbclient version check (i.e. >= 3.5), applied
  only for older Fedoras; no idea what the effect is
- drop use of obsoleted macros
- move COPYING under the %%license tag
- add a fallback for the %%license macro

* Mon Jan 12 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.0-0.2sunshine
- glib-2.18 instead of 2.14
- explicitly enable or disable gnome-keyring, to force package build failure
  if not found, or to not use it if found
- BR gnome-keyring-devel needs to be BR libgnome-keyring-devel from F13 on
  (using this as pkgconfig(gnome-keyring-1) can't be versioned)

* Mon Jan 12 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 0.6.0-0.1sunshine
- update to 0.6.0
- add versioned BR and R for glib2, but add a patch to lower the requirement
  to glib-2.14 (builds fine)

* Sun Aug 10 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.5.3b-0.3sunshine
- trigger rebuild for updated libsmbclient in F19/F20 (the binary complains)

* Sat Apr 05 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.5.3b-0.2sunshine
- drop BR libiconv-devel

* Sat Mar 15 2014 Moritz Barsnick <moritz+rpm@barsnick.net> 0.5.3b-0.1sunshine
- update to 0.5.3b

* Fri Apr 29 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.5.3a-0.1sunshine
- initial RPM