sci-mathematics/sympow: add 2.023.7

Closes: https://bugs.gentoo.org/940248
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
This commit is contained in:
Michael Orlitzky
2024-11-03 21:45:03 -05:00
parent 720b7d2138
commit 7471ec1644
4 changed files with 188 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST sympow-v2.023.6.tar.gz 68142 BLAKE2B accff25cb1da5b6935a91179fa399d76148709be54bbd434c0dc6143e88e9cd0f0a3cd96c683da3214366a29d6d0dbb7236d2623ef3f9322b6d4d54c6bad9882 SHA512 efe3b09fff0629e136b029ea615aa09ac1a4f225c06636d653ac921c7de01bf75e2b392a138c3c1af92f2b4f889f5949beeeba5b6e5e6b49e02c605bb9c16ceb
DIST sympow-v2.023.7.tar.bz2 61652 BLAKE2B 1800ec8ae3f95e24c4bfe097d13586f0bb781cef15e41539c3cb67f85ad9830c38a9bde8ae3290c6696332e55f698fc153f96575561979be2264baa6857af9ec SHA512 7df4a038aa69acc989ef07085462ed2efb848b95c4515871809033a02ae649936eda83d68cac83366466d597b370b963eb14d1f1c8389fa0089d0063e299955f

View File

@@ -0,0 +1,53 @@
From b59b1fd567007d2565b708426c83221189c6d939 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Sun, 3 Nov 2024 21:22:32 -0500
Subject: [PATCH] Configure: fix "last resort" flag logic
Towards the end of ./Configure, there is a "last resort" attempt to
add -ffloat-store and -O0 to the user's CFLAGS to make the program
config/fpubits succeed. But the logic is wrong: the try_add_CFLAG()
function always appends the given flag to CFLAGS, even if it builds a
broken config/fpubits with it. If config/fpubits is failing for some
other reason (like on a non-x86 architecture), the end result is that
both -ffloat-store and -O0 will be added to the user's CFLAGS, even
though they don't help.
To fix this, the loop has been rewritten to attempt -ffloat-store
only, and to revert the user's CFLAGS afterwards if adding that flag
did not materially improve the situation. The -O0 flag is no longer
tried because it should have no effect on the number of FPU bits.
---
Configure | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/Configure b/Configure
index 066d415..0733d88 100755
--- a/Configure
+++ b/Configure
@@ -148,12 +148,17 @@ for FLAG in '-DISOC99_FENV' '-DFPUCONTROLH' '-Dx86'; do
try_add_CFLAG $FLAG && break
done
-# Some flags to try as last resort. These hurt performance, so only add
-# them if needed.
-for FLAG in '' '-ffloat-store' '-O0'; do
- # Stop the loop if the FPU precision already is 53 bits
- try_add_CFLAG $FLAG && break
-done
+# Try to add -ffloat-store as a last resort, but only retain it if it
+# makes config/fpubits succeed. We run try_add_CFLAG() once beforehand
+# with no additional flags in case the last call to it resulted in a
+# broken config/fpubits.
+try_add_CFLAG ''
+if ! config/fpubits; then
+ _SAVED_CFLAGS="${CFLAGS}"
+ if ! try_add_CFLAG -ffloat-store; then
+ CFLAGS="${_SAVED_CFLAGS}"
+ fi
+fi
# Check the actual FPU precision with our new flags.
CC_ARGS="$ORIGINALCFLAGS -O3 $CFLAGS config/fpubits1.c config/fpubits2.c fpu.c -o config/fpubits"
--
2.47.0

View File

@@ -0,0 +1,89 @@
From 4bbc2ec941fcca8525af30964e8683498b65de62 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Sun, 3 Nov 2024 20:32:28 -0500
Subject: [PATCH 1/2] Configure: replace `which foo` by $(command -v foo)
The POSIX "command -v" is a more portable way to get the path to an
executable than "which". The latter is non-standard and typically
requires an extra package to be installed. Similarly, $(bar) is a
superior alternative to `bar`. Unless you have a shell from the 1980s,
both are portable, but the $() syntax is much more amenable to nesting
and quoting.
References:
* https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/command.html
* http://mywiki.wooledge.org/BashFAQ/082
---
Configure | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/Configure b/Configure
index 53b556e..a08fe08 100755
--- a/Configure
+++ b/Configure
@@ -12,7 +12,7 @@ VARPREFIX=${VARPREFIX:-"/var"}
FILE="Makefile.new"
CONFIG="config.h"
-RM=`which \rm`
+RM=$(command -v rm)
if [ -z "$RM" ];
then
echo "**ERROR**: Could not find rm"; exit;
@@ -25,19 +25,19 @@ echo "#define VARPREFIX \"$VARPREFIX\"" >> $CONFIG
echo "#define VERSION \"$VERSION\"" >> $CONFIG
echo "VERSION = $VERSION" >> $FILE
-GREP=`which \grep`
+GREP=$(command -v grep)
if [ -z "$GREP" ];
then
echo "*WARNING*: Could not find grep --- will not be able to build new_data"
fi
-GP=`which \gp`
+GP=$(command -v gp)
if [ -z "$GP" ];
then
echo "*WARNING*: Could not find gp --- will not be able to build new_data"
fi
-SED=`which \sed` && echo "SED = $SED" >> $FILE
+SED=$(command -v sed) && echo "SED = $SED" >> $FILE
if [ -z "$SED" ];
then
echo "*WARNING*: Could not find sed --- will not be able to build new_data"
@@ -75,7 +75,7 @@ export CC
##echo "**ERROR**: Could not find uname"; exit;
##fi
-HELP2MAN=`which \help2man` && echo "HELP2MAN = $HELP2MAN" >> $FILE
+HELP2MAN=$(command -v help2man) && echo "HELP2MAN = $HELP2MAN" >> $FILE
if [ -z "$HELP2MAN" ];
then
echo "**ERROR**: Could not find help2man"; exit;
@@ -284,17 +284,17 @@ df="datafiles"
echo "DATAFILES = $df/*M.txt $df/*S.txt $df/param_data" >> $FILE
echo "RM = $RM" >> $FILE
-CP=`which \cp` && echo "CP = $CP" >> $FILE
+CP=$(command -v cp) && echo "CP = $CP" >> $FILE
if [ -z "$CP" ];
then
echo "**ERROR**: Could not find cp"; exit;
fi
-MKDIR=`which \mkdir` && echo "MKDIR = $MKDIR" >> $FILE
+MKDIR=$(command -v mkdir) && echo "MKDIR = $MKDIR" >> $FILE
if [ -z "$MKDIR" ];
then
echo "**ERROR**: Could not find mkdir"; exit;
fi
-TOUCH=`which \touch` && echo "TOUCH = $TOUCH" >> $FILE
+TOUCH=$(command -v touch) && echo "TOUCH = $TOUCH" >> $FILE
if [ -z "$TOUCH" ];
then
echo "**ERROR**: Could not find touch"; exit;
--
2.47.0

View File

@@ -0,0 +1,45 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
DESCRIPTION="Symmetric power elliptic curve L-functions"
HOMEPAGE="https://gitlab.com/rezozer/forks/sympow/"
SRC_URI="https://gitlab.com/rezozer/forks/sympow/-/archive/v${PV}/${PN}-v${PV}.tar.bz2"
S="${WORKDIR}/${PN}-v${PV}"
LICENSE="Sympow-BSD"
SLOT="0"
KEYWORDS="~amd64 ~riscv"
# Pari is used at build time to generate data.
BDEPEND="sys-apps/help2man
sci-mathematics/pari"
RDEPEND="sci-mathematics/pari"
PATCHES=(
"${FILESDIR}/sympow-2.023.6-dont-force-O3.patch"
"${FILESDIR}/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch"
"${FILESDIR}/${P}-no-which.patch"
"${FILESDIR}/${P}-more-cflag-care.patch"
)
DOCS=( HISTORY README.md )
src_configure() {
export ADDBINPATH=yes
export PREFIX="${EPREFIX}/usr"
# This location still won't be writable, but we can at least add
# the EPREFIX that belongs there. Sympow uses $HOME/.sympow as a
# fallback (what we want) when its first attempt doesn't work.
export VARPREFIX="${EPREFIX}/var"
./Configure || die
}
src_compile() {
emake CC="$(tc-getCC)" all
}