File dar.spec of Package dar

#
# spec file for package dar
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           dar
Version:        2.3.10
Release:        0
Summary:        Backup and Restore Application
License:        SUSE-GPL-2.0+-with-openssl-exception
Group:          System/Filesystems
Url:            http://dar.linux.free.fr/
Source0:        %{name}-%{version}.tar.bz2
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0:         %{name}.diff
# PATCH-FIX-OPENSUSE dar-DARWIN.patch dimstar@opensuse.org -- Something goes wrong in the build and the installed config.h is corrupted (due to grep DAR, which also matches DARWIN, but the #endif is not matched. Patch in this form not suitable for upstream.
Patch1:         dar-DARWIN.patch
Patch2:         dar-fix-move-op-clash.diff
BuildRequires:  e2fsprogs-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gettext-tools
BuildRequires:  libattr-devel
BuildRequires:  libbz2-devel
BuildRequires:  libtool
BuildRequires:  openssl-devel
BuildRequires:  pkg-config
BuildRequires:  zlib-devel
Recommends:     par
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Dar (Disk Archive) is a hardware-independent backup solution. Dar uses
catalogs (unlike tar),which it makes it possible to extract a single
file without having to read the entire archive. It is also possible to
create incremental backups. Dar archives can also be created or used
with the libdar library (for example, with KDar, a KDE application).
This package contains the command line tools and documentation.

%package -n libdar4
Summary:        Backup and Restore Application
Group:          System/Libraries
# We recommend the -lang pack from the library, as the lib itself is also gettextized. The main pack does
# not need the Recommends, as it requires the lib anyway (thus indirectyl Recommends the -lang package).
Recommends:     %{name}-lang
Provides:       libdar = 2.3.10
Obsoletes:      libdar < 2.3.10
# Package renamed to libdar4, according the shared library policy (2012-07-06) during openSUSE 12.2 cycle.
Provides:       libdar-4 = %{version}
Obsoletes:      libdar-4 < %{version}

%description -n libdar4
Dar stands for Disk ARchive and is a hardware independent backup
solution. Dar uses catalogs (unlike tar), so it is possible to extract
a single file without having to read the whole archive, and it is also
possible to create incremental backups.

Dar archives can also be created, or used, via the libdar library (for
example with KDar, a KDE application).

This package contains the library used by Dar and KDar.

%package -n libdar-devel
Summary:        Backup and Restore Application
Group:          Development/Languages/C and C++
Requires:       glibc-devel
Requires:       libattr-devel
Requires:       libbz2-devel
Requires:       libdar4 = %{version}
Requires:       openssl-devel
Requires:       zlib-devel

%description -n libdar-devel
Dar stands for Disk ARchive and is a hardware independent backup
solution. Dar uses catalogs (unlike tar), so it is possible to extract
a single file without having to read the whole archive, and it is also
possible to create incremental backups.

Dar archives can also be created, or used, via the libdar library (with
KDar, a KDE application, for example).

This package contains the library used by Dar and KDar.

%lang_package
%prep
%setup -q
%patch0
%patch1 -p1
%patch2 -p1

%build
autoreconf -f -i -v
export CXXFLAGS="$CXXFLAGS -std=gnu++11"
%configure --with-pic --datadir=%_defaultdocdir \
    --disable-static \
    --enable-largefile \
    --disable-dar-static
make %{?_smp_mflags}

%install
%make_install
find %{buildroot}%{_libdir} -name '*.la' -delete -print

# Move the sample scripts to the correct location (otherwise rpmlint will error due to these scripts having execute perms)
mkdir %{buildroot}/%_defaultdocdir/%{name}/examples/
mv %{buildroot}/%_defaultdocdir/%{name}/samples/* %{buildroot}/%_defaultdocdir/%{name}/examples
%fdupes %{buildroot}%{_defaultdocdir}/%{name}
rm -rf %{buildroot}/usr/share/doc/*
%find_lang %{name}

%post -n libdar4 -p /sbin/ldconfig

%postun -n libdar4 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS TODO ChangeLog
%{_bindir}/*
%{_mandir}/man1/*

%files lang -f %{name}.lang

%files -n libdar4
%defattr(-,root,root)
%{_libdir}/libdar.so.*

%files -n libdar-devel
%defattr(-,root,root)
%{_includedir}/%{name}/
%{_libdir}/libdar.so
%{_libdir}/pkgconfig/libdar*.pc

%changelog