%define _gnupg_ver		1.4.0
%define _libgpg_error_ver	1.4

%define _unpackaged_files_terminate_build 1

Summary:	GPGME - GnuPG Made Easy
Summary(ja):	GPGME - GnuPG Made Easy
Name:		gpgme
Version:	1.15.1
Release:	1%{?_dist_release}
Group:		system
Vendor:		Project Vine
Distribution:	Vine Linux

License:	LGPL
URL:		https://gnupg.org/software/gpgme/index.html
Source:		https://gnupg.org/ftp/gcrypt/gpgme/%{name}-%{version}.tar.bz2

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	gnupg >= %{_gnupg_ver}
BuildRequires:	libgpg-error-devel >= %{_libgpg_error_ver}
BuildRequires:	libassuan-devel >= 2.0.2
BuildRequires:	chrpath
BuildRequires:	swig
BuildRequires:	python-devel
BuildRequires:	python-setuptools
BuildRequires:	python-rpm-macros
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-rpm-macros

Requires:	gnupg >= %{_gnupg_ver}
Requires:	libgpg-error >= %{_libgpg_error_ver}

Obsoletes:	gpgme10
Provides:	gpgme10

%description
GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier
for applications. It provides a High-Level Crypto API for encryption,
decryption, signing, signature verification and key management. Currently it
uses GnuPG as it's backend but the API isn't restricted to this engine; in
fact it is planned to add other backends to it.

%description -l ja
GnuPG Made Easy (GPGME) は、アプリケーションがより簡単に GnuPG にアクセスでき
るように設計されたライブラリです。暗号化や復号、署名、署名の検証、鍵の管理の
ための高レベルの暗号 API を提供します。
現在のところ、バックエンドとして GnuPG を使用しますが、API はこのエンジンに限
定されません。実際、他のバックエンドを追加することが計画されています。


%package devel
Summary:	GnuPG Made Easy (GPGME) Header files and libraries for development
Summary(ja):	GnuPG Made Easy (GPGME) 開発用ヘッダーファイル・ライブラリ
Group:		programming
Requires:	%{name} = %{version}
Requires:	libgpg-error-devel >= 0.5
Requires:	libassuan-devel >= 2.0.2
Requires(post):	install-info
Requires(preun): install-info
Obsoletes:	%{name} < 0.3.16-0vl2
Obsoletes:	gpgme10-devel
Provides:	gpgme10-devel

%description devel
GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG easier
for applications.

Install this package if you want to develop applications that will use the
gpgme library.

%description -l ja devel
GnuPG Made Easy (GPGME) は、アプリケーションがより簡単に GnuPG にアクセスでき
るように設計されたライブラリです。

GPGME ライブラリを使用するアプリケーションを開発するのであれば、このパッケー
ジをインストールしてください。


%package -n python-gpg
Summary:        %{name} bindings for Python 2
Group:		programming
%{?python_provide:%python_provide python2-gpg}
Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}

%description -n python-gpg
%{summary}.


%package -n python3-gpg
Summary:        %{name} bindings for Python 3
Group:		programming
%{?python_provide:%python_provide python3-gpg}
Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}

%description -n python3-gpg
%{summary}.


%prep
%setup -q


%build
%configure --disable-gpgsm-test
%__make

%install
%__rm -rf %{buildroot}
%{makeinstall}

# remove unneeded files
%__rm -rf %{buildroot}%{_datadir}/common-lisp
%__rm -f %{buildroot}%{_libdir}/*.la
%__rm -f %{buildroot}%{_infodir}/dir

chrpath -d %{buildroot}%{_bindir}/%{name}-tool
chrpath -d %{buildroot}%{_libdir}/lib%{name}*.so*

# autofoo installs useless stuff for uninstall
rm -vf %{buildroot}%{python2_sitelib}/gpg/install_files.txt
rm -vf %{buildroot}%{python3_sitelib}/gpg/install_files.txt


%clean
%__rm -rf %{buildroot}


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

%triggerun -- %{name} < 0.3.16-0vl2
/sbin/install-info --delete %{_infodir}/gpgme.info.gz %{_infodir}/dir

%post devel
/sbin/install-info %{_infodir}/gpgme.info.gz %{_infodir}/dir

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

%triggerpostun devel -- %{name} < 0.3.16-0vl2, gpgme10-devel
/sbin/install-info %{_infodir}/gpgme.info.gz %{_infodir}/dir


%files
%defattr(-,root,root)
%license COPYING*
%doc AUTHORS ChangeLog NEWS README* THANKS TODO VERSION
%{_bindir}/gpgme-json
%{_libdir}/libgpgme*.so.*

%files devel
%defattr(-,root,root)
%{_bindir}/gpgme-config
%{_bindir}/gpgme-tool
%{_libdir}/libgpgme*.so
%{_libdir}/cmake/*
%{_libdir}/pkgconfig/*
%{_datadir}/aclocal/gpgme.m4
%{_includedir}/*
%{_infodir}/*

%files -n python-gpg
%doc lang/python/README
%{python_sitearch}/gpg-*.egg-info
%{python_sitearch}/gpg/

%files -n python3-gpg
%doc lang/python/README
%{python3_sitearch}/gpg-*.egg-info
%{python3_sitearch}/gpg/

%changelog
* Thu Feb 11 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.15.1-1
- new upstream release.

* Sun Aug 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.14.0-1
- new upstream release.

* Thu Mar 26 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.13.1-1
- new upstream release.

* Fri Nov 30 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.12.0-2
- enabled python{2,3} bindings.

* Mon Nov 05 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.12.0-1
- new upstream release.

* Fri Jul 11 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.3-1
- new upstream release.

* Tue Apr  5 2011 IWAI, Masaharu <iwai@alib.jp> 1.3.0-1
- new upstream release
- add BuildRequires: libassuan-devel >= 2
- add Requires: libassuan-devel >= 2 for devel subpackage
- update GnuPG min version

* Sun Aug 15 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.8-1
- new upstream release

* Fri Sep 26 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.4-2vl5
- removed *.la
- spec in utf-8

* Fri Aug 15 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.4-1vl5
- applied new versioning policy

* Fri Mar 09 2007 KAZUKI SHIMURA <kazukipma.ccnw.ne.jp> 1.1.4-0vl1
- upstream release
- add new macros: %%_gnupg_ver, %%_libgpg_error_ver
- update %%_gnupg_ver to 1.3.0
- update %%_libgpg_error_ver to 1.4

* Tue Sep 27 2005 KAZUKI SHIMURA <kazukipma.ccnw.ne.jp> 1.0.3-0vl1
- upstream release

* Sat Mar 12 2005 KAZUKI SHIMURA <kazukipma.ccnw.ne.jp> 1.0.2-0vl3
- add Obsoletes/Provides: gpgme10{,-devel}

* Sun Feb 13 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.2-0vl2
- fix spec file's encoding from iso-2022-jp to euc-jp
- add PreReq: ldconfig
- add PreReq: install-info (devel)
- change group to System Environment/Libraries (main)
- add poor Japanese description

* Tue Feb 01 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.2-0vl1
- upstream release
- change license from GPL to LGPL
- update {Build,}Requires for GnuPG (>= 1.2.2)
- add (Build)Requires: libgpg-error(-devel) >= 0.5
- add docs
- run ldconfig at post/postun
- separate devel package
  - Requires: libgpg-error-devel
  - Obsoletes: gpgme <= 0.3.16

* Sun Apr 25 2004 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.3.16-0vl1
- update to 0.3.16
- s/Copyright/License/
- update URL

* Fri Mar  7 2003 IWAI Masaharu <iwai@alib.jp> 0.3.15-0vl1
- update to 0.3.15
- update {Build,}Requires for GnuPG

* Mon Sep 23 2002 IWAI Masaharu <iwai@alib.jp> 0.3.11-0vl1
- update to 0.3.11
- added {Build,}Requires: gnupg = 1.0.7
- added info files
- added %%post and %%preun section for info files
- fixed %%install section (executing rm command)

* Thu May 24 2001 Daisuke SUZUKI <daisuke@linux.or.jp> 0.2.1-0vl1
- initial release

