diff --git a/srcpkgs/gfan/patches/cstdint.patch b/srcpkgs/gfan/patches/cstdint.patch new file mode 100644 index 00000000000..d6ebed9eddc --- /dev/null +++ b/srcpkgs/gfan/patches/cstdint.patch @@ -0,0 +1,14 @@ +Description: Include for std::int64_t +Author: Doug Torrance +Last-Update: 2024-07-28 + +--- a/src/gfanlib_z.h ++++ b/src/gfanlib_z.h +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #define OLD 1 + #if OLD + #include "gmp.h" diff --git a/srcpkgs/gfan/patches/fix-build.patch b/srcpkgs/gfan/patches/fix-build.patch new file mode 100644 index 00000000000..f8276d04abc --- /dev/null +++ b/srcpkgs/gfan/patches/fix-build.patch @@ -0,0 +1,13 @@ +diff -ru gfan0.7.orig/src/gfanlib_circuittableint.h gfan0.7/src/gfanlib_circuittableint.h +--- gfan0.7.orig/src/gfanlib_circuittableint.h 2024-08-15 22:42:58.870553297 +0200 ++++ gfan0.7/src/gfanlib_circuittableint.h 2024-08-15 22:44:11.891350667 +0200 +@@ -591,7 +591,8 @@ + ret=min; + + { +- auto ret2=CircuitTableIntPOD((s.v*denominatorDivisor.multiplicativeInverse)*boundA.v); ++ CircuitTableIntPOD ret2; ++ ret2.v=(s.v*denominatorDivisor.multiplicativeInverse)*boundA.v; + ret2=MIN(ret2.v,-ret2.v); + return ret2; + if(ret.v!=ret2.v) diff --git a/srcpkgs/gfan/patches/fix-int64-for-32bit-archs.patch b/srcpkgs/gfan/patches/fix-int64-for-32bit-archs.patch deleted file mode 100644 index c642e32c224..00000000000 --- a/srcpkgs/gfan/patches/fix-int64-for-32bit-archs.patch +++ /dev/null @@ -1,18 +0,0 @@ -patch typedef for `int64` which causes hang in `0602ResultantFanProjection` - -cf: -https://github.com/void-linux/void-packages/pull/34182 -https://trac.sagemath.org/ticket/32088 -https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=905300 - ---- a/src/vektor.h 2017-06-20 11:47:37.000000000 -0300 -+++ b/src/vektor.h 2021-11-21 18:28:43.384750825 -0300 -@@ -10,7 +10,7 @@ - - using namespace std; - --typedef signed long int int64; -+typedef int64_t int64; - - void outOfRange(int i, int n); - diff --git a/srcpkgs/gfan/patches/int128.patch b/srcpkgs/gfan/patches/int128.patch new file mode 100644 index 00000000000..949b322a43b --- /dev/null +++ b/srcpkgs/gfan/patches/int128.patch @@ -0,0 +1,225 @@ +Description: Use 128-bit integers from Abseil when not available natively. +Author: Doug Torrance +Last-Update: 2024-10-24 + +--- a/src/gfanlib_circuittableint.h ++++ b/src/gfanlib_circuittableint.h +@@ -17,6 +17,12 @@ + #include + #include "gfanlib_frequencytable.h" + ++#ifndef __SIZEOF_INT128__ ++#include ++typedef absl::int128 __int128_t; ++typedef absl::uint128 __uint128_t; ++#endif ++ + namespace gfan{ + + +@@ -25,7 +31,8 @@ + template struct MyMakeUnsigned; + template <> struct MyMakeUnsigned{typedef unsigned int type;}; + template <> struct MyMakeUnsigned{typedef unsigned long int type;}; +- template <> struct MyMakeUnsigned<__int128>{typedef unsigned __int128 type;}; ++ template <> struct MyMakeUnsigned{typedef unsigned long long int type;}; ++ template <> struct MyMakeUnsigned<__int128_t>{typedef __uint128_t type;}; + + class MVMachineIntegerOverflow: public std::exception + { +@@ -92,6 +99,15 @@ + return s.str(); + } + ++#ifndef __SIZEOF_INT128__ ++static std::string toStr(long int b) ++{ ++ std::stringstream s; ++ s<(lo_)), ++ hi(hi_) ++ { ++ } ++ my256s(__uint128_t lo_,__int128_t hi_): ++ lo(static_cast<__int128_t>(lo_)), ++ hi(hi_) ++ { ++ } ++ my256s(__int128_t lo_,__uint128_t hi_): ++ lo(lo_), ++ hi(static_cast<__int128_t>(hi_)) ++ { ++ } ++#endif + my256s operator+(my256s b) + { + __uint128_t newLo=lo+b.lo; +@@ -165,7 +198,7 @@ + my256s temp(~lo,~hi); + return temp+my256s(1,0); + } +- explicit operator __int128()const ++ explicit operator __int128_t()const + { + return lo; + } +@@ -213,12 +246,23 @@ + { + return ((__int128_t)a)*((__int128_t)b); + } ++static long long int extMul(long long int a, long long int b) ++{ ++ return a * b; ++} + + static __uint128_t unsignedProd64(uint64_t x,uint64_t y) + { + return __uint128_t(x)*__uint128_t(y); + } + ++#ifndef __SIZEOF_INT128__ ++static __uint128_t unsignedProd64(__uint128_t x,__uint128_t y) ++{ ++ return x * y; ++} ++#endif ++ + static my256u unsignedProd128(__uint128_t x,__uint128_t y) + { + my256s a(unsignedProd64(x,y),0); +@@ -302,7 +346,7 @@ + friend CircuitTableIntPOD operator*(CircuitTableIntPOD const &a, CircuitTableIntPOD const &b){CircuitTableIntPOD ret;ret.v=a.v*b.v;return ret;} + friend CircuitTableIntPOD operator/(CircuitTableIntPOD const &a, CircuitTableIntPOD const &b){CircuitTableIntPOD ret;ret.v=a.v/b.v;return ret;}//This is used very few times. Should we require this be an exact division? + public: +- static const word halfBound{(word{1}<<(std::numeric_limits::digits/2-2))-1}; ++ static constexpr word halfBound{(word{1}<<(std::numeric_limits::digits/2-2))-1}; + // In the code products of CircuitTableIntPOD objects are summed. To avoid overflows one of the factors must "fit in half" and the "number of summands" may not exceed a certain number. The bounds are specified in the following functions: + bool fitsInHalf()const{return v>-halfBound && v(v);}//WHAT SHOULD HAPPEN TO THIS FUNCTION? + friend std::ostream &operator<<(std::ostream &f, CircuitTableIntPOD const &a){f<extend();t+=extendedMultiplication(a,b);*this=t.castToSingle();return *this;} +@@ -546,8 +590,8 @@ + int D=std::numeric_limits::digits; + if(D==0){D=127;}//fixes bug in gcc-8.1 + bool doesOverflow=(((word)t.v)==(word{1}<<(D-1)));// What is the purpose of this line. Do we really want to subtract 1? That seems wrong since word is signed. Look at comment below +- longword min64=0; +- longword max64=0; ++ longword min64=static_cast(0); ++ longword max64=static_cast(0); + for(int i=0;i::digits; + if(D==0){D=127;}//fixes bug in gcc-8.1 + bool doesOverflow=false;//(((word)t.v)==(word{1}<<(D-1)));// What is the purpose of this line? t is not defined. Do we really want to subtract 1? That seems wrong since word is signed. Look at comment below +- longword min64=0; +- longword max64=0; ++ longword min64=static_cast(0); ++ longword max64=static_cast(0); + for(int i=0;i=0x7fffffffffffffff || -v>=0x7fffffffffffffff) throw MVMachineIntegerOverflow; + CircuitTableIntPOD ret; +- ret.v=v; ++ ret.v=static_cast(v); + return ret; + } + +@@ -746,7 +789,7 @@ + // DANGER !!! + //if(v>=0x7fffffffffffffffffffffffffffffff || -v>=0x7fffffffffffffffffffffffffffffff) throw MVMachineIntegerOverflow; + CircuitTableIntPOD ret; +- ret.v=__int128(v); ++ ret.v=__int128_t(v); + return ret; + } + +@@ -784,6 +827,7 @@ + CircuitTableInt128()noexcept{v=0;} + CircuitTableInt128(CircuitTableInt128POD const &m){v=m.v;} + CircuitTableInt128(__int128_t val){v=val;} ++ CircuitTableInt128(int val){v=val;} + CircuitTableInt128(std::string const&s){ + int64_t proxy; + std::istringstream a(s); a>>proxy; +--- a/src/app_test.cpp ++++ b/src/app_test.cpp +@@ -764,10 +764,10 @@ + + + { +- __int128 t=0; +- __int128 A=2; +- __int128 s=-4; +- __int128 B=1; ++ __int128_t t=0; ++ __int128_t A=2; ++ __int128_t s=-4; ++ __int128_t B=1; + B=(B<<127)+3; + std::cerr<<"---B\n"; + std::cerr<(M.getHeight()+1,M.getHeight()+1+M.getWidth(),mr); + combinedMatrix.setSubMatrix(0,M.getHeight()+1,M.getHeight(),getWidth(),M); +- for(int i=0;i(1); ++ for(int i=M.getHeight()+1;i(1); + // Matrix M2=M; + // M2.appendRow(Vector::allOnes(M2.getWidth())); + // combinedMatrix=combineLeftRight(M2.identity(M.getHeight()+1),M2,mr); +@@ -347,7 +347,7 @@ + } + assert(inBasis.size()==getWidth()); + for(int i=0;i(1); + computeRowBounds(); + } + Tableau(Tableau const &a, MR *mr=get_default_resource()): diff --git a/srcpkgs/gfan/patches/make_tests_return_error.patch b/srcpkgs/gfan/patches/make_tests_return_error.patch new file mode 100644 index 00000000000..90db055a27e --- /dev/null +++ b/srcpkgs/gfan/patches/make_tests_return_error.patch @@ -0,0 +1,25 @@ +Description: Nonzero return code if tests fail +Origin: https://git.sagemath.org/sage.git/commit/build/pkgs/gfan/patches/maketestsreturnerror.patch?h=develop&id=4ad830c4cbb10ce81d49eb92cbd3b1be2df31e7b +Forwarded: yes +Last-Update: 2020-11-13 + +--- a/src/app_test.cpp ++++ b/src/app_test.cpp +@@ -1414,6 +1414,9 @@ + failed.push_back(i->folder); + } + cout<<"\n"; ++ cout<<"Number of successful tests "<folder); - } - cout<<"\n"; -+ cout<<"Number of succesful tests "<