Files
perl-Math-Prime-Util/perl-Math-Prime-Util.spec
2025-08-12 18:15:21 +02:00

112 lines
4.5 KiB
RPMSpec

#
# spec file for package perl-Math-Prime-Util
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name Math-Prime-Util
Name: perl-Math-Prime-Util
Version: 0.730.0
Release: 0
# 0.73 -> normalize -> 0.730.0
%define cpan_version 0.73
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Utilities related to prime numbers, including fast sieves and factoring
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/D/DA/DANAJ/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Math::BigFloat) >= 1.59
BuildRequires: perl(Math::BigInt) >= 1.88
BuildRequires: perl(Math::Prime::Util::GMP) >= 0.500
BuildRequires: perl(bignum) >= 0.22
Requires: perl(Math::BigFloat) >= 1.59
Requires: perl(Math::BigInt) >= 1.88
Requires: perl(Math::Prime::Util::GMP) >= 0.500
Provides: perl(Math::Prime::Util) = %{version}
Provides: perl(Math::Prime::Util::ChaCha) = %{version}
Provides: perl(Math::Prime::Util::Entropy) = %{version}
Provides: perl(Math::Prime::Util::MemFree) = %{version}
Provides: perl(Math::Prime::Util::PP) = %{version}
Provides: perl(Math::Prime::Util::PrimeArray) = %{version}
Provides: perl(Math::Prime::Util::PrimeIterator) = %{version}
Provides: perl(ntheory) = %{version}
%undefine __perllib_provides
Recommends: perl(Digest::SHA) >= 5.87
Recommends: perl(Math::BigInt::GMP)
Recommends: perl(Math::Prime::Util::GMP) >= 0.510
%{perl_requires}
%description
A module for number theory in Perl. This includes prime sieving, primality
tests, primality proofs, integer factoring, counts / bounds /
approximations for primes, nth primes, and twin primes, random prime
generation, and much more.
This module is the fastest on CPAN for almost all operations it supports.
This includes Math::Prime::XS, Math::Prime::FastSieve, Math::Factor::XS,
Math::Prime::TiedArray, Math::Big::Factors, Math::Factoring, and
Math::Primality (when the GMP module is available). For numbers in the
10-20 digit range, it is often orders of magnitude faster. Typically it is
faster than Math::Pari for 64-bit operations.
All operations support both Perl UV's (32-bit or 64-bit) and bignums. If
you want high performance with big numbers (larger than Perl's native
32-bit or 64-bit size), you should install Math::Prime::Util::GMP and
Math::BigInt::GMP. This will be a recurring theme throughout this
documentation -- while all bignum operations are supported in pure Perl,
most methods will be much slower than the C+GMP alternative.
The module is thread-safe and allows concurrency between Perl threads while
still sharing a prime cache. It is not itself multi-threaded. See the
Limitations section if you are using Win32 and threads in your program.
Also note that Math::Pari is not thread-safe (and will crash as soon as it
is loaded in threads), so if you use Math::BigInt::Pari rather than
Math::BigInt::GMP or the default backend, things will go pear-shaped.
Two scripts are also included and installed by default:
* primes.pl displays primes between start and end values or expressions, with
many options for filtering (e.g. twin, safe, circular, good, lucky, etc.).
Use '--help' to see all the options.
* factor.pl operates similar to the GNU 'factor' program. It supports bigint
and expression inputs.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes examples README TODO
%license LICENSE
%changelog