dev-libs/gmp: Sync with gentoo

It's from gentoo commit 5c888a952dc942822d48a87fae24d36146b9fa87.
This commit is contained in:
Krzesimir Nowak 2021-11-03 18:14:57 +01:00
parent b81a34abde
commit 694dec7ff8
8 changed files with 53 additions and 294 deletions

View File

@ -1,3 +1,2 @@
DIST gmp-4.3.2.tar.bz2 1897483 BLAKE2B 0efecd60c7a585f94ec8cbee77541d409c8e3bdeabaca09f7971560fb0fd504ae8e405256913acbef1434146868885c98068ff59efec92c92fdb73b853cf9396 SHA512 2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf DIST gmp-6.2.1.tar.xz 2027316 BLAKE2B c0d85f175392a50cfa01bc6b0a312b235946ad8b4f6f84f6dabd33d7a6f2cc75c9b0e1e33057be07750bfa0145b7c4cf3b6188a5be6ca9d7271ec2276c84ebcb SHA512 c99be0950a1d05a0297d65641dd35b75b74466f7bf03c9e8a99895a3b2f9a0856cd17887738fa51cf7499781b65c049769271cbcb77d057d2e9f1ec52e07dd84
DIST gmp-6.1.2.tar.xz 1946336 BLAKE2B 2a864e80799471037a71c10d871f9782c37fe3a0a1734872e90f14a874ecd6551099d67b2ebd07f82a43b0522249a6b46e79952db11a278f87ca8013198f7604 SHA512 9f098281c0593b76ee174b722936952671fab1dae353ce3ed436a31fe2bc9d542eca752353f6645b7077c1f395ab4fdd355c58e08e2a801368f1375690eee2c6 DIST gmp-man-6.2.1.pdf 827583 BLAKE2B 9aa25457a3c488e37cc7d54d825253ab749a3780919570579b319cf607001de50b212ca387b70213abcc5ab428b4525bdb9cd8ae932798a2d7928da98ce3f353 SHA512 f2d9d02e97975355ef490e921fedc94fb7687c3661eec8fa2e94a1622b6e59b17b3879eb3ec1f2df8edac100f727175144d107f4c49c602b773c43bc9e91dbcb
DIST gmp-man-6.1.2.pdf 825720 BLAKE2B b96340da5f534353b140b361fc1ff74757168024e8039d97a0ed1f14d874ff5fbc50abae2ff3505adc51d72e4acf2882ae6ca6405ae37b594f7b248e1ca05247 SHA512 85de10b2c03f7381881c3e95aa7fc53d8e018115028496ffbb5a79ab4967106c69ed7e97a5e434e6bb39752498aade8c2caa7cf77a8942b7ffd9150368a0d9c3

View File

@ -1,20 +0,0 @@
fixed executable stack
http://bugs.gentoo.org/115038
--- gmp-4.1.4/configure
+++ gmp-4.1.4/configure
@@ -21689,6 +21689,13 @@
fi
echo "')" >> $gmp_configm4
echo "define(\`__CONFIG_M4_INCLUDED__')" >> $gmp_configm4
+# Gentoo hack
+case $host_os in
+ *linux*)
+ echo '.section .note.GNU-stack,"",%progbits' >> $gmp_configm4
+ echo '.previous' >> $gmp_configm4
+ ;;
+esac
# Create Makefiles
# FIXME: Upcoming version of autoconf/automake may not like broken lines.

View File

@ -1,68 +0,0 @@
stolen from SuSE
--- configure.in
+++ configure.in
@@ -1050,6 +1050,9 @@
;;
+ s390x-*-*)
+ path="s390x" ;;
+
# IBM s/370 and similar
[s3[6-9]0*-*-*])
gcc_cflags="-O2 $fomit_frame_pointer"
--- configure
+++ configure
@@ -1050,6 +1050,9 @@
;;
+ s390x-*-*)
+ path="s390x" ;;
+
# IBM s/370 and similar
s3[6-9]0*-*-*)
gcc_cflags="-O2 $fomit_frame_pointer"
--- mpn/s390/gmp-mparam.h
+++ mpn/s390/gmp-mparam.h
@@ -20,7 +20,8 @@
MA 02110-1301, USA. */
-/* BITS_PER_MP_LIMB etc generated by configure */
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generated by tuneup.c, 2001-12-03, gcc 2.95 */
--- mpn/s390x/gmp-mparam.h
+++ mpn/s390x/gmp-mparam.h
@@ -0,0 +1,27 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+#define BITS_PER_LONGINT 64
+#define BITS_PER_INT 32
+#define BITS_PER_SHORTINT 16
+#define BITS_PER_CHAR 8

View File

@ -0,0 +1,20 @@
configure.ac decides whether udiv_w_sdiv.c fallback is needed
based on $CHOST value (without $CFLAGS). longlong.h relies
on compiler macros (relies on $CFLAGS implicitly).
That leads to use of undefined macros. The workaround makes
udiv_w_sdiv.c a no-on for -mzarch.
https://bugs.gentoo.org/761310
--- a/mpn/generic/udiv_w_sdiv.c
+++ b/mpn/generic/udiv_w_sdiv.c
@@ -1,3 +1,4 @@
+#if !defined(__zarch__)
/* mpn_udiv_w_sdiv -- implement udiv_qrnnd on machines with only signed
division.
@@ -139,3 +140,4 @@ mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
*rp = r;
return q;
}
+#endif

View File

@ -1,66 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# this ebuild is only for the libgmp.so.3 ABI SONAME
EAPI="5"
inherit eutils libtool toolchain-funcs multilib-minimal
DESCRIPTION="Library for arbitrary-precision arithmetic on different type of numbers"
HOMEPAGE="https://gmplib.org/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
LICENSE="LGPL-3"
SLOT="3"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
IUSE=""
DEPEND="sys-devel/m4"
RDEPEND=""
src_prepare() {
epatch "${FILESDIR}"/${PN}-4.1.4-noexecstack.patch
epatch "${FILESDIR}"/${PN}-4.2.1-s390.diff
# note: we cannot run autotools here as gcc depends on this package
elibtoolize
# GMP uses the "ABI" env var during configure as does Gentoo (econf).
# So, to avoid patching the source constantly, wrap things up.
mv configure configure.wrapped || die
cat <<-\EOF > configure
#!/bin/sh
exec env ABI="${GMPABI}" "$0.wrapped" "$@"
EOF
chmod a+rx configure
}
multilib_src_configure() {
# Because of our 32-bit userland, 1.0 is the only HPPA ABI that works
# https://gmplib.org/manual/ABI-and-ISA.html#ABI-and-ISA (bug #344613)
if [[ ${CHOST} == hppa2.0-* ]] ; then
GMPABI="1.0"
fi
# ABI mappings (needs all architectures supported)
case ${ABI} in
32|x86) GMPABI=32;;
64|amd64|n64) GMPABI=64;;
[onx]32) GMPABI=${ABI};;
esac
export GMPABI
tc-export CC
ECONF_SOURCE="${S}" econf \
--localstatedir=/var/state/gmp \
--disable-mpfr \
--disable-mpbsd \
--disable-static \
--disable-cxx
}
multilib_src_install() {
emake DESTDIR="${D}" install-libLTLIBRARIES
rm "${D}"/usr/*/libgmp.{la,so} || die
}

View File

@ -1,111 +0,0 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="5"
inherit flag-o-matic eutils libtool multilib-minimal
MY_PV=${PV/_p*}
MY_PV=${MY_PV/_/-}
MY_P=${PN}-${MY_PV}
PLEVEL=${PV/*p}
DESCRIPTION="Library for arbitrary-precision arithmetic on different type of numbers"
HOMEPAGE="https://gmplib.org/"
SRC_URI="ftp://ftp.gmplib.org/pub/${MY_P}/${MY_P}.tar.xz
mirror://gnu/${PN}/${MY_P}.tar.xz
doc? ( https://gmplib.org/${PN}-man-${MY_PV}.pdf )"
LICENSE="|| ( LGPL-3+ GPL-2+ )"
# The subslot reflects the C & C++ SONAMEs.
SLOT="0/10.4"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="+asm doc cxx static-libs"
DEPEND="sys-devel/m4
app-arch/xz-utils"
RDEPEND=""
S=${WORKDIR}/${MY_P%a}
DOCS=( AUTHORS ChangeLog NEWS README doc/configuration doc/isa_abi_headache )
HTML_DOCS=( doc )
MULTILIB_WRAPPED_HEADERS=( /usr/include/gmp.h )
src_prepare() {
[[ -d ${FILESDIR}/${PV} ]] && EPATCH_SUFFIX="diff" EPATCH_FORCE="yes" epatch "${FILESDIR}"/${PV}
# note: we cannot run autotools here as gcc depends on this package
elibtoolize
epatch "${FILESDIR}"/${PN}-6.1.0-noexecstack-detect.patch
# https://bugs.gentoo.org/536894
if [[ ${CHOST} == *-darwin* ]] ; then
epatch "${FILESDIR}"/${PN}-6.1.2-gcc-apple-4.0.1.patch
fi
# GMP uses the "ABI" env var during configure as does Gentoo (econf).
# So, to avoid patching the source constantly, wrap things up.
mv configure configure.wrapped || die
cat <<-\EOF > configure
#!/usr/bin/env sh
exec env ABI="${GMPABI}" "$0.wrapped" "$@"
EOF
# Patches to original configure might have lost the +x bit.
chmod a+rx configure{,.wrapped}
epatch_user
}
multilib_src_configure() {
# Because of our 32-bit userland, 1.0 is the only HPPA ABI that works
# https://gmplib.org/manual/ABI-and-ISA.html#ABI-and-ISA (bug #344613)
if [[ ${CHOST} == hppa2.0-* ]] ; then
GMPABI="1.0"
fi
# ABI mappings (needs all architectures supported)
case ${ABI} in
32|x86) GMPABI=32;;
64|amd64|n64) GMPABI=64;;
[onx]32) GMPABI=${ABI};;
esac
export GMPABI
#367719
if [[ ${CHOST} == *-mint* ]]; then
filter-flags -O?
fi
tc-export CC
ECONF_SOURCE="${S}" econf \
--localstatedir="${EPREFIX}"/var/state/gmp \
--enable-shared \
$(use_enable asm assembly) \
$(use_enable cxx) \
$(use_enable static-libs static)
}
multilib_src_compile() {
emake
}
multilib_src_test() {
emake check
}
multilib_src_install() {
emake DESTDIR="${D}" install
# should be a standalone lib
rm -f "${ED}"/usr/$(get_libdir)/libgmp.la
# this requires libgmp
local la="${ED}/usr/$(get_libdir)/libgmpxx.la"
use static-libs \
&& sed -i 's:/[^ ]*/libgmp.la:-lgmp:' "${la}" \
|| rm -f "${la}"
}
multilib_src_install_all() {
einstalldocs
use doc && cp "${DISTDIR}"/gmp-man-${MY_PV}.pdf "${ED}"/usr/share/doc/${PF}/
}

View File

@ -1,29 +1,30 @@
# Copyright 1999-2018 Gentoo Foundation # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=7
inherit flag-o-matic eutils libtool multilib-minimal inherit flag-o-matic libtool multilib-minimal toolchain-funcs
MY_PV=${PV/_p*} MY_PV=${PV/_p*}
MY_PV=${MY_PV/_/-} MY_PV=${MY_PV/_/-}
MANUAL_PV=${MY_PV}
MANUAL_PV=6.2.1
MY_P=${PN}-${MY_PV} MY_P=${PN}-${MY_PV}
PLEVEL=${PV/*p} PLEVEL=${PV/*p}
DESCRIPTION="Library for arbitrary-precision arithmetic on different type of numbers" DESCRIPTION="Library for arbitrary-precision arithmetic on different type of numbers"
HOMEPAGE="https://gmplib.org/" HOMEPAGE="https://gmplib.org/"
SRC_URI="ftp://ftp.gmplib.org/pub/${MY_P}/${MY_P}.tar.xz SRC_URI="ftp://ftp.gmplib.org/pub/${MY_P}/${MY_P}.tar.xz
mirror://gnu/${PN}/${MY_P}.tar.xz mirror://gnu/${PN}/${MY_P}.tar.xz
doc? ( https://gmplib.org/${PN}-man-${MY_PV}.pdf )" doc? ( https://gmplib.org/${PN}-man-${MANUAL_PV}.pdf )"
LICENSE="|| ( LGPL-3+ GPL-2+ )" LICENSE="|| ( LGPL-3+ GPL-2+ )"
# The subslot reflects the C & C++ SONAMEs. # The subslot reflects the C & C++ SONAMEs.
SLOT="0/10.4" SLOT="0/10.4"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="+asm doc cxx static-libs" IUSE="+asm doc +cxx pic static-libs"
DEPEND="sys-devel/m4 BDEPEND="sys-devel/m4
app-arch/xz-utils" app-arch/xz-utils"
RDEPEND=""
S=${WORKDIR}/${MY_P%a} S=${WORKDIR}/${MY_P%a}
@ -33,15 +34,16 @@ MULTILIB_WRAPPED_HEADERS=( /usr/include/gmp.h )
PATCHES=( PATCHES=(
"${FILESDIR}"/${PN}-6.1.0-noexecstack-detect.patch "${FILESDIR}"/${PN}-6.1.0-noexecstack-detect.patch
"${FILESDIR}"/${PN}-6.2.1-no-zarch.patch
) )
src_prepare() { src_prepare() {
default default
# note: we cannot run autotools here as gcc depends on this package # We cannot run autotools here as gcc depends on this package
elibtoolize elibtoolize
# https://bugs.gentoo.org/536894 # bug #536894
if [[ ${CHOST} == *-darwin* ]] ; then if [[ ${CHOST} == *-darwin* ]] ; then
eapply "${FILESDIR}"/${PN}-6.1.2-gcc-apple-4.0.1.patch eapply "${FILESDIR}"/${PN}-6.1.2-gcc-apple-4.0.1.patch
fi fi
@ -53,6 +55,7 @@ src_prepare() {
#!/usr/bin/env sh #!/usr/bin/env sh
exec env ABI="${GMPABI}" "$0.wrapped" "$@" exec env ABI="${GMPABI}" "$0.wrapped" "$@"
EOF EOF
# Patches to original configure might have lost the +x bit. # Patches to original configure might have lost the +x bit.
chmod a+rx configure{,.wrapped} || die chmod a+rx configure{,.wrapped} || die
} }
@ -72,41 +75,39 @@ multilib_src_configure() {
esac esac
export GMPABI export GMPABI
#367719 # bug #367719
if [[ ${CHOST} == *-mint* ]]; then if [[ ${CHOST} == *-mint* ]]; then
filter-flags -O? filter-flags -O?
fi fi
tc-export CC tc-export CC
# --with-pic forces static libraries to be built as PIC
# and without TEXTRELs. musl does not support TEXTRELs: bug #707332
ECONF_SOURCE="${S}" econf \ ECONF_SOURCE="${S}" econf \
CC_FOR_BUILD="$(tc-getBUILD_CC)" \
--localstatedir="${EPREFIX}"/var/state/gmp \ --localstatedir="${EPREFIX}"/var/state/gmp \
--enable-shared \ --enable-shared \
$(use_enable asm assembly) \ $(use_enable asm assembly) \
$(use_enable cxx) \ $(use_enable cxx) \
$(use pic && echo --with-pic) \
$(use_enable static-libs static) $(use_enable static-libs static)
} }
multilib_src_compile() {
emake
}
multilib_src_test() {
emake check
}
multilib_src_install() { multilib_src_install() {
emake DESTDIR="${D}" install emake DESTDIR="${D}" install
# should be a standalone lib # Should be a standalone lib
rm -f "${ED}"/usr/$(get_libdir)/libgmp.la rm -f "${ED}"/usr/$(get_libdir)/libgmp.la
# this requires libgmp
# This requires libgmp
local la="${ED}/usr/$(get_libdir)/libgmpxx.la" local la="${ED}/usr/$(get_libdir)/libgmpxx.la"
use static-libs \ if ! use static-libs ; then
&& sed -i 's:/[^ ]*/libgmp.la:-lgmp:' "${la}" \ rm -f "${la}"
|| rm -f "${la}" fi
} }
multilib_src_install_all() { multilib_src_install_all() {
einstalldocs einstalldocs
use doc && cp "${DISTDIR}"/gmp-man-${MY_PV}.pdf "${ED}"/usr/share/doc/${PF}/ use doc && cp "${DISTDIR}"/gmp-man-${MANUAL_PV}.pdf "${ED}"/usr/share/doc/${PF}/
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<maintainer type="project"> <maintainer type="project">
<email>toolchain@gentoo.org</email> <email>toolchain@gentoo.org</email>
@ -7,5 +7,9 @@
</maintainer> </maintainer>
<use> <use>
<flag name="asm">Enable use of hand optimized assembly routines (faster execution)</flag> <flag name="asm">Enable use of hand optimized assembly routines (faster execution)</flag>
<flag name="pic">Force static libraries to be built as PIC to avoid TEXTRELs.</flag>
</use> </use>
<upstream>
<remote-id type="cpe">cpe:/a:gmplib:gmp</remote-id>
</upstream>
</pkgmetadata> </pkgmetadata>