From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C1761158086 for ; Sat, 30 Oct 2021 19:37:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DB4D9E0839; Sat, 30 Oct 2021 19:37:51 +0000 (UTC) Received: from smtp.gentoo.org (mail.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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B92A3E0839 for ; Sat, 30 Oct 2021 19:37:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 467FF3433B9 for ; Sat, 30 Oct 2021 19:37:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8C22C1A2 for ; Sat, 30 Oct 2021 19:37:47 +0000 (UTC) From: "Alessandro Barbieri" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alessandro Barbieri" Message-ID: <1635622664.eb546c52164f64a28f7747a6aa4d2337eb135c5d.Alessandro-Barbieri@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-libs/saclib/, sci-libs/saclib/files/ X-VCS-Repository: repo/proj/guru X-VCS-Files: sci-libs/saclib/files/makefile.patch sci-libs/saclib/files/qepcad-compat.patch sci-libs/saclib/saclib-2.2.8.ebuild X-VCS-Directories: sci-libs/saclib/files/ sci-libs/saclib/ X-VCS-Committer: Alessandro-Barbieri X-VCS-Committer-Name: Alessandro Barbieri X-VCS-Revision: eb546c52164f64a28f7747a6aa4d2337eb135c5d X-VCS-Branch: dev Date: Sat, 30 Oct 2021 19:37:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c973a11c-b9a6-4f19-92f1-ac7e9e05a1b5 X-Archives-Hash: 9c00bad18829e15fdb179330776a4afe commit: eb546c52164f64a28f7747a6aa4d2337eb135c5d Author: Alessandro Barbieri gmail com> AuthorDate: Sat Oct 30 19:25:29 2021 +0000 Commit: Alessandro Barbieri gmail com> CommitDate: Sat Oct 30 19:37:44 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=eb546c52 sci-libs/saclib: add stuff from qepcad bundled saclib to saclib Signed-off-by: Alessandro Barbieri gmail.com> sci-libs/saclib/files/makefile.patch | 12 +- sci-libs/saclib/files/qepcad-compat.patch | 228 ++++++++++++++++++++++++++++++ sci-libs/saclib/saclib-2.2.8.ebuild | 9 +- 3 files changed, 239 insertions(+), 10 deletions(-) diff --git a/sci-libs/saclib/files/makefile.patch b/sci-libs/saclib/files/makefile.patch index bc49d0b62..e77576ccb 100644 --- a/sci-libs/saclib/files/makefile.patch +++ b/sci-libs/saclib/files/makefile.patch @@ -1,6 +1,5 @@ -diff -ur a/bin/mklib b/bin/mklib ---- a/bin/mklib 2018-01-30 22:09:32.000000000 +0100 -+++ b/bin/mklib 2020-04-28 21:03:24.823472623 +0200 +--- a/bin/mklib ++++ b/bin/mklib @@ -2,31 +2,17 @@ # USAGE: @@ -77,9 +76,8 @@ diff -ur a/bin/mklib b/bin/mklib popd >/dev/null pushd >/dev/null $saclib/lib/objo make CC=$CC "SACFLAG=" EXTENSION=o -diff -ur a/bin/mkmake b/bin/mkmake ---- a/bin/mkmake 2018-01-30 22:09:32.000000000 +0100 -+++ b/bin/mkmake 2020-04-28 21:29:02.709088176 +0200 +--- a/bin/mkmake ++++ b/bin/mkmake @@ -25,20 +25,16 @@ # E.g. if is -g and is d, the library will be # compiled with the debug option set and the library name will be @@ -126,7 +124,7 @@ diff -ur a/bin/mkmake b/bin/mkmake -# ${AR} ts ${TARGET} -# Use "ranlib" if your system's "ar" does not have the option "s". - ${RANLIB} ${TARGET} -+ $(CC) ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4} -fPIC -shared ${CFLAGS} -o $@ ${LDFLAGS} -Wl,-soname,${FULLLIBNAME} ++ $(CXX) ${OBJS1} ${OBJS2a} ${OBJS2b} ${OBJS3} ${OBJS4} ${saclib}/src/gcword.cc -I${saclib}/include -I${saclib}/src -fPIC -shared ${CXXFLAGS} -o $@ ${LDFLAGS} -Wl,-soname,${FULLLIBNAME} @echo "Created '${TARGET}'." EOF diff --git a/sci-libs/saclib/files/qepcad-compat.patch b/sci-libs/saclib/files/qepcad-compat.patch new file mode 100644 index 000000000..ab4700d1f --- /dev/null +++ b/sci-libs/saclib/files/qepcad-compat.patch @@ -0,0 +1,228 @@ +--- saclib2.2.8-orig/src/FAIL.c ++++ saclib2.2.8/src/FAIL.c +@@ -1,7 +1,10 @@ + /*====================================================================== + FAIL(algName,msg,...) + +-Failure handler. ++Failure handler. ++** REDEFINED FOR QEPCAD! QepcadB needs to, potentially, kill some child ++** processes. That's what this adds. A better long-term solution is to ++** change Saclib's FAIL to add an analogue to "atexit". + + Inputs + algName : the name of the algorithm which called this algorithm. +@@ -20,12 +23,13 @@ + #ifdef __STDC__ + void FAIL(const char *algName, const char *msg,...) + #else +-void FAIL(algName,msg) __noreturn ++void FAIL(algName,msg) + const char *algName; + const char *msg; + #endif + { + va_list argPtr; ++ // extern int strcmp(); + + Step1: /* Basic message. */ + SWRITE("\n\n"); +@@ -187,10 +191,16 @@ + goto Abort; + } + ++ /* TIMEOUT */ ++ if (!strcmp(algName,"TIMEOUT")) { ++ goto Exit; ++ } ++ + Abort: /* Prepare for abort. */ + SWRITE("\n\nNow the FAIL handler is aborting the program ...\n"); + va_end(argPtr); +- abort(); ++ //abort(); ++ exit(2); + + Exit: /* Prepare for exit. */ + SWRITE("\n\nNow the FAIL handler is exiting the program ...\n"); +--- saclib2.2.8-orig/src/GCSI.c ++++ saclib2.2.8/src/GCSI.c +@@ -16,17 +16,19 @@ + occurs. + ======================================================================*/ + #include "saclib.h" ++extern void gcw_MARK(); + + void GCSI(s,EACSTACK) + Word s; + char *EACSTACK; + { +- Word I,L,N,N1,Np,Np1,T,T1,c,inc; ++ Word I,L,N,N1,Np,Np1,T,T1,c,**i,j,inc; + char *a; +- /* hide I,L,N,N1,Np,Np1,T,T1,c,inc,a; */ ++ GCArray *v; ++ /* hide I,L,N,N1,Np,Np1,T,T1,c,i,j,inc,a,v; */ + + Step1: /* Setup. */ +- if (GCM == 1) { ++ if (GCM == 1) { + SWRITE("\nThe "); GWRITE(GCC+1); + SWRITE("--th garbage collection....\n"); + } +@@ -48,17 +50,8 @@ + L = I; + } + +-/* Step3: /\* Mark the global variables. *\/ */ +-/* L = GCGLOBALS; */ +-/* while (L != NIL) { */ +-/* c = *(PTRFIRST(L)); */ +-/* if ((ISLIST(c) || ISGCA(c)) && !ISNIL(c)) MARK(c); */ +-/* #if __WORDSIZE == 64 */ +-/* L = -RED(L); L = -RED(L); L = -RED(L); L = -RED(L); */ +-/* #else /\* Assumes 32-bit pointers. *\/ */ +-/* L = -RED(L); L = -RED(L); */ +-/* #endif */ +-/* } */ ++Step3b: /* Mark the GCWord variables. */ ++ gcw_MARK(); + + Step4: /* Mark the cells accessible from the system stack. */ + if (((BACSTACK - EACSTACK) % s) != 0) +@@ -113,7 +106,7 @@ + + Step8: /* Optional report. */ + if (GCM == 1 || N <= NU / RHO) { +- SWRITE("** "); ++ SWRITE("\n** "); + GWRITE(N); SWRITE(" cells, "); + GWRITE(Np); SWRITE(" arrays in "); + GWRITE(T); SWRITE(" milliseconds.\n"); +--- saclib2.2.8-orig/src/gcword.cc ++++ saclib2.2.8/src/gcword.cc +@@ -0,0 +1,70 @@ ++/*************************************************************** ++*** ++*** gcword.cc ++*** ++*** This file implements the gcw_MARK() function, which is called ++*** by the modified saclib garbage collector in order to account ++*** for saclib Words pointed to by GCWord objects. ++*** ++*** This file implements the gcw_register(p) function, which is ++*** called upon creation and upon destuction of a GCWord object. ++*** Each call adds p, the address of the GCWord, to the vector G, ++*** so that if a given address occurs an odd number of times, it ++*** contains a live GCWord object ... which the garbage collector ++*** needs to consider. ++*** ++*** The clean() function modifies vector G so that an address ++*** appears in G after the call if and only if it appeared an odd ++*** number of times before the call, and no address appears more ++*** than once after the call. ++*** ++*** CWB 5/15/00 ++***************************************************************/ ++#include ++#include ++#include "gcword.h" ++using namespace std; ++ ++extern "C" { ++void gcw_MARK(); ++} ++ ++static vector G; ++static int lim = 10; ++ ++void clean() ++{ ++ //-- a hack to ensure that lim ends up being NU -------------// ++ if (lim < NU) lim = NU; ++ ++ sort(G.begin(),G.end()); ++ ++ //-- compacts sorted array by ignoring double values --------// ++ int i,j,N = G.size()-1; ++ for(i = 0; i < N; i++) ++ if (G[i] == G[i+1]) { ++ G[i] = G[i+1] = 0; ++ i++; } ++ for(i = 0, j = 0; j <= N; j++) ++ if (G[j] != 0) ++ swap(G[i++],G[j]); ++ G.resize(i); ++} ++ ++void gcw_register(Word *p) ++{ ++ G.push_back(p); ++ if (G.size() == lim) ++ clean(); ++} ++ ++void gcw_MARK() ++{ ++ // SWRITE("gcw size is: ");IWRITE(G.size()); SWRITE("\n"); ++ clean(); ++ for(int i = 0; i < G.size(); i++) ++ if (*G[i] > BETA && *G[i] < BETAp && (*G[i] & 1)) ++ MARK(*G[i]); ++ ++ return; ++} +--- saclib2.2.8-orig/src/gcword.h ++++ saclib2.2.8/src/gcword.h +@@ -0,0 +1,51 @@ ++/*************************************************************** ++*** ++*** gcword.h ++*** ++*** This file defines the class GCWord, or "garbage collected ++*** word". It is designed to be used in conjunction with ++*** saclib to provide an easy way to incoporate garbage ++*** collected saclib lists into class definitions and arrays. ++*** It even makes global variables easier to define. ++*** ++*** An object of type GCWord behaves just like a "Word", except ++*** that it is visible to the garbage collector even if it is ++*** a member of some stucture or class or array or is, for any ++*** other reason, not a local variable. Note: garbage ++*** collection may be slowed by the presence of GCWord's! ++*** ++*** CWB 5/15/00 ++***************************************************************/ ++ ++#ifndef _GCW_ ++#define _GCW_ ++ ++ ++extern "C" { ++#include "saclib.h" ++} ++extern void gcw_register(Word *); ++ ++ ++class GCWord ++{ ++public: ++ Word W; ++ ++ //-- Constructors -------------------------------------------// ++ GCWord() { W = 0; gcw_register(&W); } ++ GCWord(const GCWord &X) { W = X.W; gcw_register(&W); } ++ GCWord(const Word &X) { W = X; gcw_register(&W); } ++ ++ //-- Destructor ---------------------------------------------// ++ ~GCWord() { gcw_register(&W); } ++ ++ //-- Assignment ---------------------------------------------// ++ GCWord& operator=(const GCWord& X) { W = X.W; return *this; } ++ GCWord& operator=(const Word& X) { W = X; return *this;} ++ ++ //-- Cast to Word -------------------------------------------// ++ operator Word() const { return W; } ++}; ++ ++#endif diff --git a/sci-libs/saclib/saclib-2.2.8.ebuild b/sci-libs/saclib/saclib-2.2.8.ebuild index 41c5511d1..7810ffc57 100644 --- a/sci-libs/saclib/saclib-2.2.8.ebuild +++ b/sci-libs/saclib/saclib-2.2.8.ebuild @@ -23,7 +23,10 @@ BDEPEND=" app-shells/tcsh " -PATCHES=( "${FILESDIR}/makefile.patch" ) +PATCHES=( + "${FILESDIR}/qepcad-compat.patch" + "${FILESDIR}/makefile.patch" +) DOCS=( doc/saclib.pdf doc/saclocal.dvi doc/desc.doc ) src_prepare() { @@ -35,8 +38,8 @@ src_prepare() { export MINMAJLIBNAME="${MAJLIBNAME}.${MINOR}" export FULLLIBNAME="${MINMAJLIBNAME}.${REVISION}" export saclib="${S}" - tc-export CC - #no main, it's a library + tc-export CC CXX + # no main, it's a library rm src/main.c || die default }