# This file is automatically generated from rhash.spec.in
%define version @VERSION@
%define make %{?__make}%{!?__make:make}

# major is the part of the shared library name after the .so
%define major 0

%if 0%{?mgaversion:1}
%define libname     %mklibname rhash %{major}
%define devlibname  %mklibname -d rhash
%define opensll_dev libopenssl1.0.0-devel
%else
%define libname     librhash%{major}
%define devlibname  rhash-devel
%define opensll_dev openssl-devel
%endif

Summary:        Utility for computing hash sums and creating magnet links.
Name:           rhash
Version:        %{version}
Release:        1%{?dist}
License:        MIT
%if 0%{?suse_version}
Group:          Productivity/File utilities
%else
Group:          Applications/File
%endif
Vendor:         Novosibirsk, Animegorodok
Packager:       Aleksey Kravchenko
URL:            http://rhash.sourceforge.net/
Source:         http://downloads.sourceforge.net/rhash/rhash-%{version}-src.tar.gz
BuildRoot:      %{_builddir}/%{name}-%{version}-root
BuildRequires:  gcc, %{opensll_dev}
%description
RHash is a console utility for calculation and verification of magnet links
and a wide range of hash sums like CRC32, MD4, MD5, SHA1, SHA256, SHA512,
AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160,
HAS-160, EDON-R, Whirlpool and Snefru.
Hash sums are used to ensure and verify integrity of large volumes of data
for a long-term storing or transferring.

Features:
 * Output in a predefined (SFV, BSD-like) or a user-defined format.
 * Calculation of Magnet links.
 * Ability to process directories recursively.
 * Updating hash files (adding hash sums of files missing in the hash file).
 * Portability: the program works the same on Linux, *BSD or Windows.

# LibRHash shared library, contains librhash.so.[major] only
%package -n %{libname}
Summary:        LibRHash shared library
Group:          System/Libraries
Provides:       librhash = %{version}-%{release}
%description -n %{libname}
LibRHash is a professional, portable, thread-safe C library for computing
a wide variety of hash sums, such as CRC32, MD4, MD5, SHA1, SHA256, SHA512,
AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160,
HAS-160, EDON-R, Whirlpool and Snefru.
Hash sums are used to ensure and verify integrity of large volumes of data
for a long-term storing or transferring.

%package -n %{devlibname}
Summary:        Headers and static library for LibRHash
Group:          Development/C
Requires:       %{libname} = %{version}
#(!) MANDATORY
Provides:       librhash-devel = %{version}-%{release}
%description -n %{devlibname}
LibRHash is a professional, portable, thread-safe C library for computing
a wide variety of hash sums, such as CRC32, MD4, MD5, SHA1, SHA256, SHA512,
AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R 34.11-94, RIPEMD-160,
HAS-160, EDON-R, Whirlpool and Snefru.
Hash sums are used to ensure and verify integrity of large volumes of data
for a long-term storing or transferring.

%prep
%setup

%build
./configure --enable-openssl-runtime --disable-gettext --enable-lib-static \
  --prefix=/usr --sysconfdir=/etc --mandir="%{_mandir}" --libdir="%{_libdir}" \
  --extra-cflags="$RPM_OPT_FLAGS"
%{make}

%check
%{make} test

%install
%{make} install install-lib-so-link DESTDIR="$RPM_BUILD_ROOT"

%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
%doc ChangeLog COPYING README
/usr/bin/*
/etc/rhashrc
%{_mandir}/man1/

%files -n %{devlibname}
%defattr(-,root,root)
%{_libdir}/librhash.a
%{_libdir}/librhash.so
%{_includedir}/*.h

%files -n %{libname}
%defattr(-,root,root)
%doc COPYING README ChangeLog
%{_libdir}/librhash.so.%{major}

%post   -n %{libname}
ldconfig

%postun -n %{libname}
ldconfig

%changelog
