%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
Summary: A cryptographic library based on the code from GnuPG.
Summary(ja): GnuPG のコードをベースとした暗号化ライブラリ
Name: libgcrypt15
Version: 1.5.3
Release: 3%{?_dist_release}
URL: http://www.gnu.org/directory/security/libgcrypt.html
Source0: ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-%{version}.tar.bz2
Source1: ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-%{version}.tar.bz2.sig
License: GPLv2+
Group: System Environment/Libraries

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libgpg-error-devel >= 0.5
Requires: libgpg-error
Requires(post,preun): /sbin/install-info

Vendor: Project Vine
Distribution: Vine Linux

%description
This is a general purpose cryptographic library based on the code from
GnuPG. It provides functions for all cryptograhic building blocks:
symmetric ciphers (AES, DES, Blowfish, CAST5, Twofish, Arcfour), hash
algorithms (MD4, MD5, RIPE-MD160, SHA-1, TIGER-192), MACs (HMAC for
all hash algorithms), public key algorithms (RSA, ElGamal, DSA), large
integer functions, random numbers and a lot of supporting functions.

%package devel
Summary: Development files for libgcrypt
Summary(ja): libgcrypt を使った開発に必要なヘッダやライブラリ
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: libgpg-error-devel

%description devel
Static libraries and header files from libgcrypt.

%package -n compat32-%{name}
Summary: A cryptographic library based on the code from GnuPG.
Summary(ja): GnuPG のコードをベースとした暗号化ライブラリ
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
This is a general purpose cryptographic library based on the code from
GnuPG. It provides functions for all cryptograhic building blocks:
symmetric ciphers (AES, DES, Blowfish, CAST5, Twofish, Arcfour), hash
algorithms (MD4, MD5, RIPE-MD160, SHA-1, TIGER-192), MACs (HMAC for
all hash algorithms), public key algorithms (RSA, ElGamal, DSA), large
integer functions, random numbers and a lot of supporting functions.

%package -n compat32-%{name}-devel
Summary: Development files for libgcrypt
Summary(ja): libgcrypt を使った開発に必要なヘッダやライブラリ
Group: Development/Libraries
Requires: compat32-%{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Requires: compat32-libgpg-error-devel

%description -n compat32-%{name}-devel
Static libraries and header files from libgcrypt.

%prep
%setup -q -n libgcrypt-%{version}

%build
%configure --disable-static
make

%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%makeinstall
rm -f %{buildroot}%{_infodir}/dir

## remove unuse files
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la


%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post devel
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gcrypt.info.gz ||:

%preun devel
if [ $1 = 0 ]; then
    /sbin/install-info --delete %{_infodir}/gcrypt.info.gz %{_infodir}/dir ||:
fi

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README* NEWS
%{_libdir}/*.so.*

%exclude %{_bindir}/*
%exclude %{_includedir}/*
%exclude %{_libdir}/*.so
%exclude %{_datadir}/aclocal/libgcrypt.m4
%exclude %{_infodir}/*

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/*.so.*

%exclude %{_libdir}/*.so
%endif

%changelog
* Wed Jan 15 2014 NAKAMURA Kenta <kenta@vinelinux.org> - 1.5.3-3
- rename package (libgcrypt15)

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.5.3-2
- rebuild with VineSeed environment

* Sat Aug 10 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.3-1
- new upstream release

* Sat Oct 02 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.6-1
- new upstream release

* Sat Jun 27 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.4.3-3
- added compat32 package for x86_64 arch support
- added --disable-static %%configure option

* Thu Sep 25 2008 Shu KONNO <owa@bg.wakwak.com> 1.4.3-2
- removed *.la

* Tue Sep 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.3-1
- new upstream release

* Tue Mar 18 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.0-1vl5
- new upstream release
- used _dist_release macro

* Sat Mar 15 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.0-0vl1
- new upstream release

* Sun Nov 26 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.3-0vl1
- new upstream release
- changed Group to System Environment/Libraries

* Fri Dec 30 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.2.2-0vl1
- new upstream release

* Mon Mar 28 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.2.1-0vl1
- new upstream release
- fix dependencies
  - add BuildRequires: libgpg-error-devel >= 0.5
  - add Requires: libgpg-error
  - add Requires: libgpg-error-devel for devel package

* Tue Nov 30 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.0-0vl1
- new upstream release

* Sun Mar  7 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.1.12-0vl1
- initial build