Files
perl-Math-GMP/perl-Math-GMP.spec
2025-08-12 18:15:19 +02:00

86 lines
2.7 KiB
RPMSpec

#
# spec file for package perl-Math-GMP
#
# 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-GMP
Name: perl-Math-GMP
Version: 2.250.0
Release: 0
# 2.25 -> normalize -> 2.250.0
%define cpan_version 2.25
License: LGPL-2.1-or-later
Summary: High speed arbitrary size integer math
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Alien::GMP) >= 1.80.0
Provides: perl(Math::GMP) = %{version}
%undefine __perllib_provides
%{perl_requires}
# MANUAL BEGIN
BuildRequires: gmp-devel
# MANUAL END
%description
Math::GMP was designed to be a drop-in replacement both for Math::BigInt
and for regular integer arithmetic. Unlike BigInt, though, Math::GMP uses
the GNU gmp library for all of its calculations, as opposed to straight
Perl functions. This can result in speed improvements.
The downside is that this module requires a C compiler to install -- a
small tradeoff in most cases. Also, this module is not 100% compatible with
Math::BigInt.
A Math::GMP object can be used just as a normal numeric scalar would be --
the module overloads most of the normal arithmetic operators to provide as
seamless an interface as possible. However, if you need a perfect
interface, you can do the following:
use Math::GMP qw(:constant);
$n = 2 ** (256 * 1024);
print "n is $n\n";
This would fail without the ':constant' since Perl would use normal doubles
to compute the 250,000 bit number, and thereby overflow it into
meaninglessness (smaller exponents yield less accurate data due to floating
point rounding).
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%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 README.md
%license COPYING.LIB LICENSE
%changelog