From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1528802-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 3F7D7158008
	for <garchives@archives.gentoo.org>; Wed, 14 Jun 2023 11:15:58 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 78FEAE0849;
	Wed, 14 Jun 2023 11:15:57 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5E61FE0849
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Jun 2023 11:15:57 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6D075335DAF
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Jun 2023 11:15:56 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 99752A66
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Jun 2023 11:15:54 +0000 (UTC)
From: "Michael Orlitzky" <mjo@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michael Orlitzky" <mjo@gentoo.org>
Message-ID: <1686741271.9ed8c182abf1232c57446017da57b24c4351a34c.mjo@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/ntl/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-libs/ntl/ntl-11.5.1-r4.ebuild
X-VCS-Directories: dev-libs/ntl/
X-VCS-Committer: mjo
X-VCS-Committer-Name: Michael Orlitzky
X-VCS-Revision: 9ed8c182abf1232c57446017da57b24c4351a34c
X-VCS-Branch: master
Date: Wed, 14 Jun 2023 11:15:54 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: b146c156-b7c2-4d9d-a628-91ee9274cb6b
X-Archives-Hash: b0334ecc99ed788ec444de7962b768d4

commit:     9ed8c182abf1232c57446017da57b24c4351a34c
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 14 06:26:26 2023 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Jun 14 11:14:31 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ed8c182

dev-libs/ntl: another AVX FFT build fix, this time on amd64.

Even on amd64, detection of the CPU features needed for AVX FFT can
fail. In particular, it can fail when -march=native is absent from
CXXFLAGS. Since the upstream documentation calls the AVX FFT
experimental, we disable it entirely. We also bring back NATIVE=on,
which should somewhat hide the CXXFLAGS issue until it can be addressed
upstream.

Closes: https://bugs.gentoo.org/815775
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 dev-libs/ntl/ntl-11.5.1-r4.ebuild | 91 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/dev-libs/ntl/ntl-11.5.1-r4.ebuild b/dev-libs/ntl/ntl-11.5.1-r4.ebuild
new file mode 100644
index 000000000000..a7373655ffa1
--- /dev/null
+++ b/dev-libs/ntl/ntl-11.5.1-r4.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs gnuconfig
+
+DESCRIPTION="High-performance and portable C++ number theory library"
+HOMEPAGE="https://www.shoup.net/ntl/ https://github.com/libntl/ntl"
+SRC_URI="https://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="LGPL-2.1+"
+SLOT="0/44"
+KEYWORDS="~amd64 ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="doc threads"
+
+BDEPEND="dev-lang/perl"
+DEPEND="dev-libs/gmp:0=
+	dev-libs/gf2x
+	threads? ( >=dev-libs/gf2x-1.2 )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P}/src"
+
+DOCS=( "${WORKDIR}/${P}"/README )
+
+src_unpack() {
+	default
+	gnuconfig_update "${S}/libtool-origin/"
+}
+
+src_configure() {
+	# The DoConfig script builds its own libtool, but doesn't
+	# really try to set up the build environment (bug 718892).
+	export CC="$(tc-getCC)"
+	export CXX="$(tc-getCXX)"
+
+	# Currently the build system can build a static library or both
+	# static and shared libraries, but not only shared libraries. The
+	# name NTL_GMP_LIP is *not* a typo.
+	#
+	# We have left NTL_ENABLE_AVX_FFT unconditionally disabled: NTL's
+	# AVX2 detection can fail even when the CPU supports it (bug
+	# 815775), and moreover, can fail due to CXXFLAGS. When that
+	# happens, and if we try to use the AVX FFT, the build fails.
+	# Finally, doc/config.txt says, "this is experimental at moment, and
+	# may lead to worse performance." So we are probably not missing out
+	# on much.
+	#
+	# The NATIVE=on option adds "-march=native" to CXXFLAGS and should
+	# not be enabled on Gentoo, but is currently necessary for NTL's CPU
+	# feature detection to work (bug 815775). See the upstream issue,
+	#
+	#  https://github.com/libntl/ntl/issues/22
+	#
+	perl DoConfig \
+		PREFIX="${EPREFIX}"/usr \
+		LIBDIR="${EPREFIX}"/usr/$(get_libdir) \
+		CXXFLAGS="${CXXFLAGS}" \
+		CPPFLAGS="${CPPFLAGS}" \
+		LDFLAGS="${LDFLAGS}" \
+		CXX="$(tc-getCXX)" \
+		AR="$(tc-getAR)" \
+		RANLIB="$(tc-getRANLIB)" \
+		SHARED=on \
+		NTL_GMP_LIP=on \
+		NTL_GF2X_LIB=on \
+		NTL_THREADS=$(usex threads on off) \
+		NTL_ENABLE_AVX_FFT=off \
+		NATIVE=on \
+		|| die "DoConfig failed"
+
+	if use doc; then
+		DOCS+=( "${WORKDIR}/${P}"/doc/*.txt )
+		HTML_DOCS=( "${WORKDIR}/${P}"/doc/*.html "${WORKDIR}/${P}"/doc/*.gif )
+	fi
+
+	# 780534 - Required for rlibtool so it can find the generated libtool
+	ln -sf libtool-build/libtool . || die
+}
+
+src_install() {
+	default
+	find "${ED}" -name '*.la' -delete || die
+
+	# Use rm -f because the static archive may not be created when
+	# using (for example) slibtool-shared.
+	rm -f "${ED}/usr/$(get_libdir)"/libntl.a || die
+
+	rm -r "${ED}"/usr/share/doc/NTL || die
+}