Blob Blame History Raw
# Enable JSON support
%bcond_without perl_CryptX_enables_json
# Run optional test
%bcond_without perl_CryptX_enables_optional_test

Name:           perl-CryptX
Version:        0.053
Release:        3%{?dist}
Summary:        Cryptographic toolkit
# Other file:   GPL+ or Artistic
## Unbundled
# src/ltc/hashes/blake2s.c: CC0 or OpenSSL or ASL 2.0
# src/ltc/stream/rc4/rc4.c: Public Domain
# src/ltm/bncore.c:         Public Domain
License:        GPL+ or Artistic
URL:            http://search.cpan.org/dist/CryptX/
Source0:        http://search.cpan.org/CPAN/authors/id/M/MI/MIK/CryptX-%{version}.tar.gz
# Unbundle libtomcrypt,
# libtomcrypt-1.8.1 is missing features needed by CryptX.
# CryptX-0.057 is incompatible with libtomcrypt-1.8.1, it requires
# <https://github.com/libtom/libtomcrypt/commit/79f553c9b76cea00b635044ff3d5c5a1112b12ce>
# to be merged into libtomcrypt.
Patch0:         CryptX-0.053-Disable-ECC-and-unbundle-libtomcrypt.patch
# Validate decode_b58b input properly, in upstream 0.058
Patch1:         CryptX-0.053-bug-decode_b58b-invalid-input.patch
BuildRequires:  findutils
BuildRequires:  gcc
BuildRequires:  libtomcrypt-devel
BuildRequires:  libtommath-devel
BuildRequires:  make
BuildRequires:  perl-devel
BuildRequires:  perl-generators
BuildRequires:  perl-interpreter
BuildRequires:  perl(Config)
BuildRequires:  perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires:  perl(strict)
BuildRequires:  perl(warnings)
# Run-time:
BuildRequires:  perl(base)
BuildRequires:  perl(Carp)
BuildRequires:  perl(Exporter)
BuildRequires:  perl(overload)
BuildRequires:  perl(Scalar::Util)
BuildRequires:  perl(XSLoader)
# Optional run-time:
%if %{with perl_CryptX_enables_json}
# Cpanel::JSON::XS or JSON::XS or JSON::PP
BuildRequires:  perl(Cpanel::JSON::XS)
%endif
# Tests:
BuildRequires:  perl(Data::Dumper)
BuildRequires:  perl(Test)
BuildRequires:  perl(Test::More)
%if %{with perl_CryptX_enables_optional_test}
# Optional tests:
BuildRequires:  perl(File::Find)
BuildRequires:  perl(Math::BigFloat) >= 1.999715
BuildRequires:  perl(Math::BigInt)
BuildRequires:  perl(Storable) >= 2.0
BuildRequires:  perl(Test::Pod)
%endif
Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%if %{with perl_CryptX_enables_json}
# Cpanel::JSON::XS or JSON::XS or JSON::PP
Recommends:     perl(Cpanel::JSON::XS)
%endif

%description
This Perl library provides a cryptography based on LibTomCrypt library.

ECC support is disabled because it's not yet fully supported by LibTomCrypt.

%prep
%setup -q -n CryptX-%{version}
# Unbundle libtomcrypt and libtommath
%patch0 -p1
rm -rf ./src
%patch1 -p1

%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}

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

%check
make test

%files
%license LICENSE
%doc Changes README.md
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/Crypt
%{perl_vendorarch}/CryptX.pm
%{perl_vendorarch}/Math
%{_mandir}/man3/*

%changelog
* Thu Mar  1 2018 Florian Weimer <fweimer@redhat.com> - 0.053-3
- Rebuild with new redhat-rpm-config/perl build flags

* Wed Feb 28 2018 Petr Pisar <ppisar@redhat.com> - 0.053-2
- Validate decode_b58b input properly

* Thu Feb 15 2018 Petr Pisar <ppisar@redhat.com> 0.053-1
- Specfile autogenerated by cpanspec 1.78.