mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-04 00:08:36 +03:00
sci-libs/taucs: add 2.2.1, port to C23, fix musl build.
Fixes problem with breaking handwritten makefile and config generator that uses mkdir to test for OS (Windows/Linux) Also fixes other build problems with GCC-15 Correcting ebuild to work on musl system was unpleasant and it looks ugly. Such is life with horrible, hand-written makefile generator Closes: https://bugs.gentoo.org/886467 Closes: https://bugs.gentoo.org/898294 Closes: https://bugs.gentoo.org/832812 Closes: https://bugs.gentoo.org/898296 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Closes: https://github.com/gentoo/gentoo/pull/40691 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -1 +1,2 @@
|
||||
DIST taucs-2.2.1.tar.gz 1594127 BLAKE2B 426f5a6f919415480a14d231233214d4e560ecfb257b67751fc26ce0897acab504ee50d0dd074dd99c9c0b74c1bcad2c2f88e8a9708107a5c2dfe52d452eba02 SHA512 727f05a7ea89cb74893905b17571ae9275db283e0fbe1d5538dfd72c0f9ed1a47325b1845b1e8b381793a513b4b538b35d503f5dbb63db222e1b01fd1169f1e9
|
||||
DIST taucs-2.2.tgz 1573863 BLAKE2B 21cf7479d7ce1f27678431e0d3dcaea1b3f8b11071b44651207791d6980bf5be0ed51cab7915f9e8da88d5da777c0f03a8d058e2ac8881e0d0b244ddfd796f5c SHA512 d8652de2da343dfd19c4278ac99313bcb577d976decdd3bd3875f0c9576832605b787feaef916eb4e82f22907c8bd029125c2ae56c827639e4d535ad62f20fcf
|
||||
|
||||
36
sci-libs/taucs/files/taucs-2.2-missing-include.patch
Normal file
36
sci-libs/taucs/files/taucs-2.2-missing-include.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
I don't know why he uses number of arguments to distinguish if
|
||||
it's windows or not. Add correct header, section off wrong
|
||||
mkdirs on Windows
|
||||
https://bugs.gentoo.org/898294
|
||||
--- a/configurator/taucs_config.c
|
||||
+++ b/configurator/taucs_config.c
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <sys/stat.h>
|
||||
|
||||
#include "taucs_structure.h"
|
||||
|
||||
@@ -242,8 +242,10 @@
|
||||
sprintf(name,"%s%c%s", configdir,pathsep,ostype);
|
||||
|
||||
if (win32) {
|
||||
+#if defined _WIN32 || defined __CYGWIN__
|
||||
mkdir(configdir);
|
||||
mkdir(name);
|
||||
+#endif
|
||||
}
|
||||
else {
|
||||
mkdir(configdir,0777);
|
||||
@@ -301,8 +303,10 @@
|
||||
sprintf(name,"%s%c%s", configdir,pathsep,ostype);
|
||||
|
||||
if (win32) {
|
||||
+#if defined _WIN32 || defined __CYGWIN__
|
||||
mkdir(configdir);
|
||||
mkdir(name);
|
||||
+#endif
|
||||
}
|
||||
else {
|
||||
mkdir(configdir,0777);
|
||||
120
sci-libs/taucs/files/taucs-2.2.1-C23.patch
Normal file
120
sci-libs/taucs/files/taucs-2.2.1-C23.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
Port to C23. Various problems without the bug
|
||||
found in bumping package version
|
||||
--- a/src/taucs_ccs_ooc_llt.c
|
||||
+++ b/src/taucs_ccs_ooc_llt.c
|
||||
@@ -281,7 +281,7 @@
|
||||
int do_order,
|
||||
int ipostorder[],
|
||||
double given_mem,
|
||||
- void (*sn_struct_handler)(),
|
||||
+ void (*sn_struct_handler)(void* argument, int sn, int sn_up_size, int* sn_struct_ptr[]),
|
||||
void* sn_struct_handler_arg
|
||||
)
|
||||
{
|
||||
@@ -455,7 +455,7 @@
|
||||
int do_order,
|
||||
int do_column_to_sn_map,
|
||||
double given_mem,
|
||||
- void (*sn_struct_handler)(),
|
||||
+ void (*sn_struct_handler)(void* argument, int sn, int sn_up_size, int* sn_struct_ptr[]),
|
||||
void* sn_struct_handler_arg
|
||||
)
|
||||
{
|
||||
--- a/src/taucs_vaidya.c
|
||||
+++ b/src/taucs_vaidya.c
|
||||
@@ -3046,7 +3046,7 @@
|
||||
int row, col;
|
||||
int *pi1 = 0; /* warning */
|
||||
double x, y, min, max, not;
|
||||
- byte bool=1;
|
||||
+ byte Bool=1;
|
||||
edge *p,*dummy, *pe ,*max_pe;
|
||||
int count = 0;
|
||||
|
||||
@@ -3116,18 +3116,18 @@
|
||||
|
||||
for(minrho=1;minrho<maxdist;minrho++)
|
||||
{
|
||||
- bool = 1;
|
||||
+ Bool = 1;
|
||||
for(k=0;k<min(j,classes);k++)
|
||||
{
|
||||
if ((double)(findrho[(minrho+1)*classes+k]-findrho[minrho*classes+k]) > (findrho[minrho*classes+k])/x)
|
||||
- bool = 0;
|
||||
+ Bool = 0;
|
||||
}
|
||||
- if (bool)
|
||||
+ if (Bool)
|
||||
goto afterr;
|
||||
}
|
||||
|
||||
afterr:
|
||||
- if (bool)
|
||||
+ if (Bool)
|
||||
{
|
||||
for(i=0;i<n;i++)
|
||||
if ((d[i] <= minrho) && (d[i] != -1) )
|
||||
--- a/progs/direct.c
|
||||
+++ b/progs/direct.c
|
||||
@@ -691,7 +691,6 @@
|
||||
/***********************************************************/
|
||||
|
||||
if (A->flags & TAUCS_SINGLE) {
|
||||
- float snrm2_();
|
||||
int one = 1;
|
||||
|
||||
NormErr = 0.0;
|
||||
@@ -704,7 +703,6 @@
|
||||
}
|
||||
|
||||
if (A->flags & TAUCS_DOUBLE) {
|
||||
- double dnrm2_();
|
||||
int one = 1;
|
||||
|
||||
NormErr = 0.0;
|
||||
@@ -718,7 +716,6 @@
|
||||
|
||||
#ifdef TAUCS_CONFIG_DCOMPLEX
|
||||
if (A->flags & TAUCS_DCOMPLEX) {
|
||||
- double dznrm2_();
|
||||
int one = 1;
|
||||
double* pX = (double*) Xz;
|
||||
double* pNX = (double*) NXz;
|
||||
--- a/progs/direct_coverage.c
|
||||
+++ b/progs/direct_coverage.c
|
||||
@@ -729,7 +729,6 @@
|
||||
/***********************************************************/
|
||||
|
||||
if (A->flags & TAUCS_SINGLE) {
|
||||
- float snrm2_();
|
||||
int one = 1;
|
||||
|
||||
NormErr = 0.0;
|
||||
@@ -742,7 +741,6 @@
|
||||
}
|
||||
|
||||
if (A->flags & TAUCS_DOUBLE) {
|
||||
- double dnrm2_();
|
||||
int one = 1;
|
||||
|
||||
NormErr = 0.0;
|
||||
@@ -755,7 +753,6 @@
|
||||
}
|
||||
|
||||
if (A->flags & TAUCS_DCOMPLEX) {
|
||||
- double dznrm2_();
|
||||
int one = 1;
|
||||
double* pX = (double*) Xz;
|
||||
double* pNX = (double*) NXz;
|
||||
diff '--color=auto' -ur taucs-2.2.1.old/progs/test_cilk_snmf.c taucs-2.2.1/progs/test_cilk_snmf.c
|
||||
--- taucs-2.2.1.old/progs/test_cilk_snmf.c 2025-02-21 22:18:08.370013676 +0400
|
||||
+++ taucs-2.2.1/progs/test_cilk_snmf.c 2025-02-21 22:18:37.175471226 +0400
|
||||
@@ -27,8 +27,6 @@
|
||||
#define my_dnrm2 dnrm2
|
||||
#endif
|
||||
|
||||
-double my_dnrm2();
|
||||
-
|
||||
int main()
|
||||
{
|
||||
int xyz = 30;
|
||||
@@ -0,0 +1,24 @@
|
||||
There may be more actions needed, before that memory was unallocated
|
||||
and nullptrs were dereferenced.
|
||||
--- a/progs/test_cilk_snmf.c
|
||||
+++ b/progs/test_cilk_snmf.c
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
Xd =(double*)malloc((A->n)*sizeof(double));
|
||||
for(i=0; i<A->n; i++) (Xd)[i]=(float)((double)random()/RAND_MAX);
|
||||
+ Bd =(double*)malloc((A->n)*sizeof(double));
|
||||
taucs_ccs_times_vec(A,Xd,Bd);
|
||||
|
||||
taucs_ccs_order(A,&perm,&invperm,"metis");
|
||||
@@ -74,8 +75,11 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ PBd =(double*)malloc((A->n)*sizeof(double));
|
||||
taucs_vec_permute(A->n,A->flags,Bd,PBd,perm);
|
||||
+ NXd =(double*)malloc((A->n)*sizeof(double));
|
||||
taucs_supernodal_solve_llt(L,PBd,NXd); /* direct solver */
|
||||
+ PXd =(double*)malloc((A->n)*sizeof(double));
|
||||
taucs_vec_ipermute(A->n,A->flags,PXd,NXd,perm);
|
||||
|
||||
{
|
||||
@@ -25,4 +25,7 @@
|
||||
* Multilevel-Support-Graph Preconditioners.
|
||||
* Utility Routines
|
||||
</longdescription>
|
||||
<upstream>
|
||||
<remote-id type="github">sivantoledo/taucs</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
|
||||
84
sci-libs/taucs/taucs-2.2.1.ebuild
Normal file
84
sci-libs/taucs/taucs-2.2.1.ebuild
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit fortran-2 toolchain-funcs
|
||||
|
||||
DESCRIPTION="C library of sparse linear solvers"
|
||||
HOMEPAGE="https://github.com/sivantoledo/taucs/"
|
||||
SRC_URI="https://github.com/sivantoledo/taucs/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="LGPL-2.1"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
|
||||
IUSE="doc"
|
||||
RESTRICT="test"
|
||||
|
||||
RDEPEND="
|
||||
sci-libs/metis
|
||||
virtual/blas
|
||||
virtual/lapack"
|
||||
DEPEND="${RDEPEND}"
|
||||
BDEPEND="virtual/pkgconfig"
|
||||
|
||||
PATCHES=(
|
||||
# bug 725588
|
||||
"${FILESDIR}"/${PN}-2.2-respect-ar.patch
|
||||
"${FILESDIR}"/${PN}-2.2-missing-include.patch
|
||||
"${FILESDIR}"/${P}-C23.patch
|
||||
"${FILESDIR}"/${P}-allocate-memory-in-test.patch
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
cat > config/linux_shared.mk <<-EOF || die
|
||||
AR=$(tc-getAR)
|
||||
FC=$(tc-getFC)
|
||||
CC=$(tc-getCC)
|
||||
LD=$(tc-getFC)
|
||||
RANLIB=$(tc-getRANLIB)
|
||||
CFLAGS=${CFLAGS} -fPIC
|
||||
FFLAGS=${FFLAGS} -fPIC
|
||||
LDFLAGS=${LDFLAGS} -fPIC
|
||||
LIBBLAS=$($(tc-getPKG_CONFIG) --libs blas)
|
||||
LIBLAPACK=$($(tc-getPKG_CONFIG) --libs lapack)
|
||||
LIBMETIS=$($(tc-getPKG_CONFIG) --libs metis)
|
||||
LIBF77=
|
||||
EOF
|
||||
# no cat <<EOF because -o has a trailing space
|
||||
cp config/linux.mk config/linux-musl.mk
|
||||
cp config/linux_shared.mk config/linux-musl_shared.mk
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# not autotools configure. Uses difference in mkdir signature
|
||||
# between windows and linux to recognize system.
|
||||
CC="$(tc-getCC)" ./configure variant=_shared || die
|
||||
emake
|
||||
|
||||
cd lib/linux$(usev elibc_musl -musl)_shared || die
|
||||
$(tc-getFC) ${LDFLAGS} -shared -Wl,-soname=libtaucs.so.1 \
|
||||
-Wl,--whole-archive libtaucs.a -Wl,--no-whole-archive \
|
||||
$($(tc-getPKG_CONFIG) --libs blas lapack metis) \
|
||||
-o libtaucs.so.1.0.0 \
|
||||
|| die "shared lib linking failed"
|
||||
}
|
||||
|
||||
src_test() {
|
||||
LD_LIBRARY_PATH=lib/linux$(usev elibc_musl -musl)_shared \
|
||||
./testscript variant=_shared || die "compile test failed"
|
||||
if grep -q FAILED testscript.log; then
|
||||
eerror "Test failed. See ${S}/testscript.log"
|
||||
die "test failed"
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
ln -s libtaucs.so.1.0.0 lib/linux$(usev elibc_musl -musl)_shared/libtaucs.so.1 || die
|
||||
ln -s libtaucs.so.1 lib/linux$(usev elibc_musl -musl)_shared/libtaucs.so || die
|
||||
dolib.so lib/linux$(usev elibc_musl -musl)_shared/libtaucs.so*
|
||||
|
||||
doheader build/*/*.h src/*.h
|
||||
|
||||
use doc && dodoc doc/*.pdf
|
||||
}
|
||||
Reference in New Issue
Block a user