gmp/gmp.spec
2024-02-11 18:07:50 +08:00

129 lines
3.5 KiB
RPMSpec

#
# spec file for package gmp
#
# Copyright (c) 2022-2023 ZhuningOS
#
Name: gmp
Version: 6.1.2
Release: 4.9.1
Summary: The GNU MP Library
License: GPL-3.0-or-later AND (LGPL-3.0-or-later OR GPL-2.0-or-later)
Group: System/Libraries
URL: https://gmplib.org/
Source0: https://gmplib.org/download/%{name}/%{name}-%{version}.tar.xz
Source1: https://gmplib.org/download/%{name}/%{name}-%{version}.tar.xz.sig
Source2: %{name}.keyring
Source3: baselibs.conf
Patch0: gmp-noexec.diff
Patch1: gmp-6.1.2-conftest.patch
Patch2: gmp-6.2.1-CVE-2021-43618.patch
BuildRequires: fipscheck
BuildRequires: gcc-c++
BuildRequires: m4
BuildRequires: xz
%description
A library for calculating huge numbers (integer and floating point).
%package -n libgmp10
Summary: Shared library for the GNU MP Library
License: LGPL-3.0-or-later OR GPL-2.0-or-later
Group: System/Libraries
%description -n libgmp10
A library for calculating huge numbers (integer and floating point).
%package -n libgmpxx4
Summary: C++ bindings for the GNU MP Library
License: LGPL-3.0-or-later OR GPL-2.0-or-later
Group: System/Libraries
Requires: libgmp10 >= %{version}
%description -n libgmpxx4
A library for calculating huge numbers (integer and floating point).
This package contains C++ bindings
C++ bindings for the GNU MP Library.
%package devel
Summary: Include Files and Libraries for Development with the GNU MP Library
Group: Development/Languages/C and C++
License: GPL-3.0-or-later AND (LGPL-3.0-or-later OR GPL-2.0-or-later)
Requires: libgmp10 = %{version}
Requires: libgmpxx4 = %{version}
Requires(pre): %{install_info_prereq}
Requires(preun): %{install_info_prereq}
%description devel
These libraries are needed to develop programs which calculate with
huge numbers (integer and floating point).
%prep
%setup -q
%patch0
%patch1
%patch2 -p1
%build
export CFLAGS="%{optflags} -fexceptions"
%configure \
--enable-cxx \
--enable-fat
make %{?_smp_mflags}
%check
# do not disable "make check", FIX THE BUGS!
make %{?_smp_mflags} check
%install
%make_install
rm %{buildroot}%{_libdir}/libgmp.la
rm %{buildroot}%{_libdir}/libgmpxx.la
rm %{buildroot}%{_libdir}/libgmpxx.a
# the hmac hashes:
#
# this is a hack that re-defines the __os_install_post macro
# for a simple reason: the macro strips the binaries and thereby
# invalidates a HMAC that may have been created earlier.
# solution: create the hashes _after_ the macro runs.
#
# this shows up earlier because otherwise the %expand of
# the macro is too late.
# remark: This is the same as running
# openssl dgst -sha256 -hmac 'orboDeJITITejsirpADONivirpUkvarP'
%{expand:%%global __os_install_post {%__os_install_post
%{_bindir}/fipshmac %{buildroot}%{_libdir}/libgmp.so.10
}}
%post -n libgmp10 -p /sbin/ldconfig
%post -n libgmpxx4 -p /sbin/ldconfig
%postun -n libgmp10 -p /sbin/ldconfig
%postun -n libgmpxx4 -p /sbin/ldconfig
%post devel
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%preun devel
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info%{ext_info}
%files -n libgmp10
%license COPYING*
%{_libdir}/libgmp.so.10*
%{_libdir}/.libgmp.so.10.hmac
%files -n libgmpxx4
%{_libdir}/libgmpxx.so.4*
%files devel
%doc AUTHORS README NEWS
%doc demos
%{_infodir}/gmp.info*%{ext_info}
%{_libdir}/libgmp.a
%{_libdir}/libgmp.so
%{_libdir}/libgmpxx.so
%{_includedir}/gmp.h
%{_includedir}/gmpxx.h
%changelog