%define pkgname Crypt-OpenSSL-X509
%define filelist %{pkgname}-%{version}-filelist
%define NVR %{pkgname}-%{version}-%{release}
%define maketest 1

Name:      perl-Crypt-OpenSSL-X509
Summary:   Crypt-OpenSSL-X509 - Perl extension to OpenSSL's X509 API.
Version:   1.812
Release:   1%{?_dist_release}
Vendor:    Project Vine
Distribution: Vine Linux
Packager:  tomop
License:   Artistic
Group:     Development/Libraries
URL:       http://www.cpan.org
buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
Source:    http://search.cpan.org//CPAN/authors/id/D/DA/DANIEL/Crypt-OpenSSL-X509-%{version}.tar.gz
Requires:  perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

BuildRequires:  openssl-devel
BuildRequires:  perl(inc::Module::Install)
BuildRequires:  perl(lib)
BuildRequires:  perl-Module-Install
# will fail till removal of old perl-Crypt-OpenSSL-X509.
%if 0
BuildRequires:  perl(Module::Install::AutoInstall)
BuildRequires:  perl(Module::Install::Compiler)
BuildRequires:  perl(Module::Install::External)
BuildRequires:  perl(Module::Install::Makefile)
BuildRequires:  perl(Module::Install::Metadata)
BuildRequires:  perl(Module::Install::WriteAll)
%endif

%description
This implement a large majority of OpenSSL's useful X509 API.

  The email() method supports both certificates where the
  subject is of the form:
  "... CN=Firstname lastname/emailAddress=user@domain", and also
  certificates where there is a X509v3 Extension of the form
  "X509v3 Subject Alternative Name: email=user@domain".

%prep
%setup -q -n %{pkgname}-%{version} 
chmod -R u+w %{_builddir}/%{pkgname}-%{version}
# Remove bundled modules
rm -rf ./inc

%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}

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

make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -delete
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*

%check
make test

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

%files
%defattr(-,root,root)
%doc Changes README TODO
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/Crypt/
%{_mandir}/man3/*

%changelog
* Sun May 19 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.812-1
- new upstream release.
- rebuilt with perl-5.26.

* Sun Nov 18 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.811-1
- new upstream release.

* Mon May  9 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.806-1
- new upstream release.

* Mon Jul  7 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.804-1
- Initial build.