# The GMP package in Fedora does a full autoreconf; the purpose of doing so is # not documented in the spec file or in the commit logs, but it is probably a # reasonable choice for forward-compatibility given the upstream updates # rarely and the library is very platform-dependent. %bcond_without autoreconf Name: mpir Version: 3.0.0 %global so_version_c 23 %global so_version_cxx 8 Release: %autorelease Summary: Highly optimised library for bignum arithmetic # Various portions of the source are licensed under: # • LGPLv3+ # • LGPLv2+ # • LGPLv3+ or GPLv2+ # • BSD # For a breakdown of the licensing of various source files, see # PACKAGE-LICENSING. The resulting effective license is LGPLv3+. License: LGPLv3+ URL: https://mpir.org/ Source0: https://mpir.org/%{name}-%{version}.tar.bz2 Source1: PACKAGE-LICENSING # Fix broken configure test compromised by LTO Patch0: mpir-config.patch # Preserve debug information from assembly routines; see also # gmp-6.0.0-debuginfo.patch in the GMP package Patch1: mpir-3.0.0-debuginfo.patch # Upstream non-ASCII source files are currently encoded in a mixture of UTF-8 # and ISO-8859-1. This patch standardizes on UTF-8, except files in the # mpir.net directory. See https://github.com/wbhart/mpir/pull/291. Patch2: https://github.com/wbhart/mpir/pull/291.patch %if %{with autoreconf} BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool # According to GMP spec file, autoreconf on arm needs: BuildRequires: perl-Carp %endif # For updated config.guess/config.sub with aarch64 support: BuildRequires: gnulib-devel BuildRequires: make BuildRequires: gcc BuildRequires: m4 %ifarch x86_64 %ix86 BuildRequires: yasm %endif %description MPIR is a highly optimised library for bignum arithmetic forked from the GMP bignum library. It is written in assembly language and C. It is community maintained via the GitHub repositories of William Hart (Linux/OSX) and Brian Gladman (Windows). There are currently no curators for other platforms. MPIR is assembly optimised for various x86-64 CPUs. It is designed to be threadsafe. %package c++ Summary: Bindings for using mpir in C++ applications Requires: %{name}%{?_isa} = %{version}-%{release} BuildRequires: gcc-c++ %description c++ Bindings for using mpir in C++ applications %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Provides: %{name}-c++-devel%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package doc Summary: Documentation for %{name} License: LGPLv3+ and LGPLv2+ and GFDL BuildRequires: texinfo-tex BuildRequires: tex(latex) %description doc Documentation for %{name}. %prep %autosetup -p1 # Update config.guess/config.sub for aarch64 support, bringing in other updated # build-aux scripts while we are at it: for script in compile config.guess config.sub install-sh do cp -vp "%{_datadir}/gnulib/build-aux/${script}" ./ done cp -vp %{_datadir}/gnulib/build-aux/texinfo.tex ./doc/ cp -vp '%{SOURCE1}' . %build %if %{with autoreconf} autoreconf -ifv %endif # Keep the assembler from producing an executable stack; this is an important # hardening step. CCAS='gcc -c -Wa,--noexecstack'; export CCAS %ifarch ppc64le # MPIR mistakes ppc64le for big-endian PowerPC. Force it to use the generic # implementation instead so we do not have to exclude the architecture. See # https://trac.sagemath.org/ticket/19704. ABI='mode64'; export ABI MPN_PATH='generic'; export MPN_PATH %endif %configure \ --disable-static \ --enable-fat \ %ifnarch x86_64 %ix86 --with-yasm=%{_bindir}/false \ %endif --enable-cxx # Get rid of undesirable hardcoded rpaths; work around libtool reordering # -Wl,--as-needed after all the libraries. # # https://docs.fedoraproject.org/en-US/packaging-guidelines/#_removing_rpath sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ -e 's|CC="\(g.*\)"|CC="\1 -Wl,--as-needed"|' \ -i libtool %make_build # Build PDF and HTML docs from the texinfo docs. texi2pdf --output ./doc/mpir.pdf ./doc/mpir.texi texi2any --output ./doc/html --html ./doc/mpir.texi %install %make_install rm -vf \ %{buildroot}%{_infodir}/dir \ %{buildroot}%{_libdir}/libmpir.la \ %{buildroot}%{_libdir}/libmpirxx.la # Manually install documentation (except info pages, already installed) install -d %{buildroot}%{_pkgdocdir} cp -vrp ./doc/devel ./doc/html %{buildroot}%{_pkgdocdir}/ install -m 0644 -t %{buildroot}%{_pkgdocdir} \ AUTHORS ChangeLog NEWS README \ doc/isa_abi_headache \ doc/mpir.pdf %check env LD_LIBRARY_PATH="${PWD}/.libs" %make_build check %files %license COPYING %license COPYING.LIB %license PACKAGE-LICENSING %{_libdir}/libmpir.so.%{so_version_c} %{_libdir}/libmpir.so.%{so_version_c}.* %files c++ %{_libdir}/libmpirxx.so.%{so_version_cxx} %{_libdir}/libmpirxx.so.%{so_version_cxx}.* %files devel %{_includedir}/mpir.h %{_libdir}/libmpir.so %{_includedir}/mpirxx.h %{_libdir}/libmpirxx.so %files doc %license COPYING %license COPYING.LIB %license PACKAGE-LICENSING %{_infodir}/mpir.info* %dir %{_pkgdocdir} %{_pkgdocdir}/AUTHORS %{_pkgdocdir}/ChangeLog %{_pkgdocdir}/NEWS %{_pkgdocdir}/README %{_pkgdocdir}/mpir.pdf %{_pkgdocdir}/devel %{_pkgdocdir}/html %{_pkgdocdir}/isa_abi_headache %changelog %autochangelog