File csync.spec of Package csync

#
# spec file for package csync
#
# Copyright (c) 2021 SUSE LLC
#
# 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/
#


Name:           csync
Version:        0.50.0
Release:        0
Summary:        A user level bidirectional client only file synchronizer
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Other
URL:            https://www.csync.org/
Source0:        %{name}-%{version}.tar.bz2
Source1:        baselibs.conf
# PATCH-FIX-OPENSUSE fix-cmake-on-pre-12.patch
Patch0:         fix-cmake-on-pre-12.patch
Patch1:         csync_log.h.patch
# PATCH-FIX-OPENSUSE fix-missing-const.patch
Patch2:         fix-missing-const.patch
# PATCH-FIX-OPENSUSE csync-libssh.patch -- Detect newer libssh versions; hacked patch
Patch3:         csync-libssh.patch
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  libsmbclient-devel
BuildRequires:  libssh-devel
BuildRequires:  pkgconfig
%if 0%{?suse_version}
BuildRequires:  sqlite3-devel
%else
BuildRequires:  sqlite-devel
%endif

%description
csync is an implementation of a file synchronizer which provides the
feature of roaming home directories for Linux clients. csync makes use
of libsmbclient in Samba/Windows environments.

%package -n libcsync0
Summary:        A user level bidirectional client only file synchronizer
License:        LGPL-2.1-or-later
Group:          System/Libraries
%if 0%{?suse_version} > 1030
Recommends:     libcsync-plugin-sftp
Recommends:     libcsync-plugin-smb
%endif

%description -n libcsync0
csync is an implementation of a file synchronizer which provides the
feature of roaming home directories for Linux clients. csync makes use
of libsmbclient in Samba/Windows environments.

%package -n libcsync-plugin-smb
Summary:        SMB plugin for csync
License:        GPL-2.0-or-later
Group:          System/Libraries
Requires:       libcsync0 = %{version}

%description -n libcsync-plugin-smb
This plug-in allows applications using csync to synchronize with a
Samba or Windows server.

%package -n libcsync-plugin-sftp
Summary:        A user level bidirectional client only file synchronizer
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Other
Requires:       libcsync0 = %{version}

%description -n libcsync-plugin-sftp
csync is an implementation of a file synchronizer which provides the
feature of roaming home directories for Linux clients. csync makes use
of libsmbclient in Samba/Windows environments.

%if 0%{?suse_version} >= 1200
%package -n libcsync-plugin-owncloud
Summary:        Owncloud plugin for csync
License:        GPL-2.0-or-later
Group:          System/Libraries
BuildRequires:  libneon-devel
Requires:       libcsync0 = %{version}

%description -n libcsync-plugin-owncloud
This plug-in allows applications using csync to synchronize with Owncloud.
%endif

%package -n libcsync-devel
Summary:        Development files for csync
License:        GPL-2.0-or-later
Group:          Development/Libraries/C and C++
Requires:       libcsync0 = %{version}

%description -n libcsync-devel
The libcsync-devel package contains the static libraries and header
files needed for development with csync.

%package -n libcsync-devel-doc
Summary:        Developer documentation for csync
License:        GPL-2.0-or-later
Group:          Development/Languages/C and C++

%description -n libcsync-devel-doc
The libcsync-devel-doc package provides documentation for csync
development.

%package -n libcsync-doc
Summary:        User documentation for csync
License:        GPL-2.0-or-later
Group:          Development/Languages/C and C++

%description -n libcsync-doc
The libcsync-doc package provides user documentation for csync.

%prep
%setup -q
%if 0%{?suse_version} < 1200
%patch -P 0 -p1
%endif
%patch -P 1 -p1
%patch -P 2 -p1
if [ -f %{_includedir}/libssh/libssh_version.h ]; then
%patch -P 3 -p1
fi

%build
if test ! -e "build"; then
  mkdir build
fi
pushd build
export LDFLAGS="-pie"
# FIXME: you should use the %%cmake macros
cmake \
  -DCMAKE_C_FLAGS:STRING="%{optflags}" \
  -DCMAKE_CXX_FLAGS:STRING="%{optflags}" \
  -DCMAKE_SKIP_RPATH=ON \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DSYSCONF_INSTALL_DIR=%{_sysconfdir} \
%if "%{_lib}" == "lib64"
  -DLIB_SUFFIX=64 \
%endif
  %{_builddir}/%{name}-%{version}
%make_build
%make_build doc
popd

%install
pushd build
%if 0%{?suse_version}
%make_install
%else
%make_install
%endif
popd

%post -n libcsync0 -p /sbin/ldconfig
%postun -n libcsync0 -p /sbin/ldconfig

%files
%{_bindir}/csync
%{_mandir}/man?/csync.*

%files -n libcsync0
%license COPYING
%doc AUTHORS INSTALL README
%dir %{_sysconfdir}/csync
%config(noreplace) %{_sysconfdir}/csync/csync.conf
%config(noreplace) %{_sysconfdir}/csync/csync_exclude.conf
%{_libdir}/libcsync.so.*
%dir %{_libdir}/csync-0

%files -n libcsync-plugin-smb
%{_libdir}/csync-0/csync_smb.so

%files -n libcsync-plugin-sftp
%{_libdir}/csync-0/csync_sftp.so

%if 0%{?suse_version} >= 1200
%files -n libcsync-plugin-owncloud
%{_libdir}/csync-0/csync_owncloud.so
%endif

%files -n libcsync-devel
%{_includedir}/csync
%{_libdir}/libcsync.so

%files -n libcsync-devel-doc
%doc build/doc/html

%files -n libcsync-doc
%{_datadir}/doc/csync

%changelog
openSUSE Build Service is sponsored by