···11diff --git a/src/sage/env.py b/src/sage/env.py
22-index 1ddfc7cfb9..45033d6328 100644
22+index 2908f5d04f..81dfd75c0d 100644
33--- a/src/sage/env.py
44+++ b/src/sage/env.py
55-@@ -203,97 +203,13 @@ var('ARB_LIBRARY', 'arb')
66- var('SAGE_BANNER', '')
77- var('SAGE_IMPORTALL', 'yes')
55+@@ -218,93 +218,12 @@ NTL_LIBDIR = var("NTL_LIBDIR")
66+ SAGE_BANNER = var("SAGE_BANNER", "")
77+ SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
8899-
1010--def _get_shared_lib_filename(libname, *additional_libnames):
1010+-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
1111- """
1212- Return the full path to a shared library file installed in
1313- ``$SAGE_LOCAL/lib`` or the directories associated with the
···2525- For distributions like Debian that use a multiarch layout, we also try the
2626- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
2727-
2828-- This returns ``None`` if the file does not exist.
2828+- This returns ``None`` if no matching library file could be found.
2929-
3030- EXAMPLES::
3131-
3232- sage: import sys
3333- sage: from fnmatch import fnmatch
3434-- sage: from sage.env import _get_shared_lib_filename
3535-- sage: lib_filename = _get_shared_lib_filename("Singular",
3636-- ....: "singular-Singular")
3434+- sage: from sage.env import _get_shared_lib_path
3535+- sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
3736- sage: if sys.platform == 'cygwin':
3837- ....: pattern = "*/cygSingular-*.dll"
3938- ....: elif sys.platform == 'darwin':
4040-- ....: pattern = "*/libSingular.dylib"
3939+- ....: pattern = "*/libSingular-*.dylib"
4140- ....: else:
4242-- ....: pattern = "*/lib*Singular.so"
4343-- sage: fnmatch(lib_filename, pattern)
4141+- ....: pattern = "*/lib*Singular-*.so"
4242+- sage: fnmatch(str(lib_filename), pattern)
4443- True
4545-- sage: _get_shared_lib_filename("an_absurd_lib") is None
4444+- sage: _get_shared_lib_path("an_absurd_lib") is None
4645- True
4746- """
4847-
4949-- for libname in (libname,) + additional_libnames:
4848+- for libname in libnames:
4949+- search_directories: List[Path] = []
5050+- patterns: List[str] = []
5051- if sys.platform == 'cygwin':
5151-- # Later down we take the last matching DLL found, so search
5252-- # SAGE_LOCAL second so that it takes precedence
5353-- bindirs = [
5454-- sysconfig.get_config_var('BINDIR'),
5555-- os.path.join(SAGE_LOCAL, 'bin')
5252+- # Later down we take the first matching DLL found, so search
5353+- # SAGE_LOCAL first so that it takes precedence
5454+- search_directories = [
5555+- Path(SAGE_LOCAL) / 'bin',
5656+- Path(sysconfig.get_config_var('BINDIR')),
5657- ]
5757-- pats = ['cyg{}.dll'.format(libname), 'cyg{}-*.dll'.format(libname)]
5858-- filenames = []
5959-- for bindir in bindirs:
6060-- for pat in pats:
6161-- filenames += glob.glob(os.path.join(bindir, pat))
6262--
6363-- # Note: This is not very robust, since if there are multi DLL
5858+- # Note: The following is not very robust, since if there are multible
6459- # versions for the same library this just selects one more or less
6565-- # at arbitrary. However, practically speaking, on Cygwin, there
6060+- # at arbitrary. However, practically speaking, on Cygwin, there
6661- # will only ever be one version
6767-- if filenames:
6868-- return filenames[-1]
6262+- patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
6963- else:
7064- if sys.platform == 'darwin':
7165- ext = 'dylib'
7266- else:
7367- ext = 'so'
7468-
7575-- libdirs = [
7676-- os.path.join(SAGE_LOCAL, 'lib'),
7777-- sysconfig.get_config_var('LIBDIR')
7878-- ]
7979-- multilib = sysconfig.get_config_var('MULTILIB')
8080-- if multilib:
8181-- libdirs.insert(1, os.path.join(libdirs[0], multilib))
6969+- search_directories = [Path(SAGE_LOCAL) / 'lib']
7070+- libdir = sysconfig.get_config_var('LIBDIR')
7171+- if libdir is not None:
7272+- libdir = Path(libdir)
7373+- search_directories.append(libdir)
8274-
8383-- for libdir in libdirs:
8484-- basename = 'lib{}.{}'.format(libname, ext)
8585-- filename = os.path.join(libdir, basename)
8686-- if os.path.exists(filename):
8787-- return filename
7575+- multiarchlib = sysconfig.get_config_var('MULTIARCH')
7676+- if multiarchlib is not None:
7777+- search_directories.append(libdir / multiarchlib),
7878+-
7979+- patterns = [f'lib{libname}.{ext}']
8080+-
8181+- for directory in search_directories:
8282+- for pattern in patterns:
8383+- path = next(directory.glob(pattern), None)
8484+- if path is not None:
8585+- return str(path.resolve())
8886-
8987- # Just return None if no files were found
9088- return None
9191--
9289-
9390 # locate singular shared object
9491 # On Debian it's libsingular-Singular so try that as well
9595--SINGULAR_SO = _get_shared_lib_filename('Singular', 'singular-Singular')
9696-+SINGULAR_SO = '/default'
9797- var('SINGULAR_SO', SINGULAR_SO)
9292+-SINGULAR_SO = var("SINGULAR_SO", _get_shared_lib_path("Singular", "singular-Singular"))
9393++SINGULAR_SO = var("SINGULAR_SO", '/default')
98949995 # locate libgap shared object
100100--GAP_SO= _get_shared_lib_filename('gap','')
101101-+GAP_SO = '/default'
102102- var('GAP_SO', GAP_SO)
9696+-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
9797++GAP_SO = var("GAP_SO", '/default')
1039810499 # post process
100100+ if ' ' in DOT_SAGE:
···22, lib
33, writeTextFile
44, sagelib
55+, sage_docbuild
56, env-locations
67, gfortran
78, bash
···191192 # for find_library
192193 export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
193194 '';
194194-} // {
195195- lib = sagelib; # equivalent of `passthru`, which `writeTextFile` doesn't support
195195+} // { # equivalent of `passthru`, which `writeTextFile` doesn't support
196196+ lib = sagelib;
197197+ docbuild = sage_docbuild;
196198}
+14-138
pkgs/applications/science/math/sage/sage-src.nix
···2424 );
2525in
2626stdenv.mkDerivation rec {
2727- version = "9.2";
2727+ version = "9.3.rc4";
2828 pname = "sage-src";
29293030 src = fetchFromGitHub {
3131 owner = "sagemath";
3232 repo = "sage";
3333 rev = version;
3434- sha256 = "103j8d5x6szl9fxaz0dvdi4y47q1af9h9y5hmjh2xayi62qmp5ql";
3434+ sha256 = "sha256-LDY07By2j6JagkgT9zeDJ93+m2/oXXEnDRTDzmR8ftk=";
3535 };
36363737 # Patches needed because of particularities of nix or the way this is packaged.
···5353 # Parallelize docubuild using subprocesses, fixing an isolation issue. See
5454 # https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
5555 ./patches/sphinx-docbuild-subprocesses.patch
5656-5757- # Register sorted dict pprinter earlier (https://trac.sagemath.org/ticket/31053)
5858- (fetchSageDiff {
5959- base = "9.3.beta4";
6060- name = "register-pretty-printer-earlier.patch";
6161- rev = "d658230ce06ca19f4a3b3a4576297ee82f2d2151";
6262- sha256 = "sha256-9mPUV7K5PoLDH2vVaYaOfvDLDpmxU0Aj7m/eaXYotDs=";
6363- })
6456 ];
65576658 # Since sage unfortunately does not release bugfix releases, packagers must
···7062 # To help debug the transient error in
7163 # https://trac.sagemath.org/ticket/23087 when it next occurs.
7264 ./patches/configurationpy-error-verbose.patch
7373-7474- # fix intermittent errors in Sage 9.2's psage.py (this patch is
7575- # already included in Sage 9.3): https://trac.sagemath.org/ticket/30730
7676- (fetchSageDiff {
7777- base = "9.2.rc2";
7878- name = "fix-psage-is-locked.patch";
7979- rev = "75df605f216ddc7b6ca719be942d666b241520e9";
8080- sha256 = "0g9pl1wbb3sgs26d3bvv70cpa77sfskylv4kd255y1794f1fgk4q";
8181- })
8282-8383- # fix intermittent errors in sagespawn.pyx: https://trac.sagemath.org/ticket/31052
8484- (fetchSageDiff {
8585- base = "9.2";
8686- name = "sagespawn-implicit-casting.patch";
8787- rev = "2959ac792ebd6107fe87c9af1541083de5ba02d6";
8888- sha256 = "sha256-bWIpEGir9Kawak5CJegBMNcHm/CqhWmdru+emeSsvO0=";
8989- })
9090-9191- # fix intermittent errors in doctest/test.py: https://trac.sagemath.org/ticket/26912
9292- (fetchSageDiff {
9393- base = "9.3.beta8";
9494- name = "set-cysignals-crash-ndebug.patch";
9595- rev = "ca5257a5d0f32efc9f8f07e126020856270b1a18";
9696- sha256 = "sha256-KViw63xE3O0eUiOYzoxNrr4NL+csql9GPJLDJCf/EZs=";
9797- })
9865 ];
996610067 # Patches needed because of package updates. We could just pin the versions of
···1117811279 # ignore a deprecation warning for usage of `cmp` in the attrs library in the doctests
11380 ./patches/ignore-cmp-deprecation.patch
114114-115115- # adapt sage's Image class to pillow 8.0.1 (https://trac.sagemath.org/ticket/30971)
116116- (fetchSageDiff {
117117- base = "9.3.beta2";
118118- name = "pillow-8.0.1-update.patch";
119119- rev = "f05f2d0aac9c4b5abe68105cee2cc7f2c8461847";
120120- sha256 = "sha256-uY2UlgSd5hhOUUukB4Xc3Gjy0/e7p/qyq9jdvz10IOs=";
121121- })
122122-123123- # don't use deprecated numpy type aliases (https://trac.sagemath.org/ticket/31364)
124124- (fetchSageDiff {
125125- base = "9.3.beta7";
126126- name = "dont-use-deprecated-numpy-type-aliases.patch";
127127- rev = "dfdef60515d4a4269e82d91280f76a7fdf10bf97";
128128- sha256 = "sha256-77/3LkT5J7DQN8IPlGJKB6ZcJPaF7xwje06JNns+0AE=";
129129- })
130130-131131- # fix test output with sympy 1.7 (https://trac.sagemath.org/ticket/30985)
132132- ./patches/sympy-1.7-update.patch
133133-134134- # workaround until we use sage's fork of threejs, which contains a "version" file
135135- ./patches/dont-grep-threejs-version-from-minified-js.patch
136136-137137- # updated eclib output has punctuation changes and tidier whitespace
138138- ./patches/eclib-20210223-test-formatting.patch
139139-140140- # upgrade arb to 2.18.1 (https://trac.sagemath.org/ticket/28623)
141141- (fetchSageDiff {
142142- base = "9.3.beta3";
143143- name = "arb-2.18.1-update.patch";
144144- rev = "0c9c4ed35c2eaf34ae0d19387c07b7f460e4abce";
145145- sha256 = "sha256-CjOJIsyyVCziAfvE6pWSihPO35IZMcY2/taXAsqhPLY=";
146146- })
147147-148148- # giac 1.6.0-47 update (https://trac.sagemath.org/ticket/30537)
149149- (fetchSageDiff {
150150- base = "9.3.beta7";
151151- name = "giac-1.6.0-47-update.patch";
152152- rev = "f05720bf63dfaf33a4e3b6d3ed2c2c0ec46b5d31";
153153- sha256 = "sha256-gDUq+84eXd5GxLBWUSI61GMJpBF2KX4LBVOt3mS1NF8=";
154154- })
155155-156156- # Make gcd/lcm interact better with pari and gmpy2 (https://trac.sagemath.org/ticket/30849)
157157- # needed for pari 2.13.1 update, which we will do in the future
158158- (fetchSageDiff {
159159- base = "9.3.beta0";
160160- name = "make-gcd-lcm-interact-better-with-pari-and-gmpy2.patch";
161161- rev = "75c1516f0abb9e6f8c335e38e4031f6ef674ed30";
162162- sha256 = "sha256-RukkieIZcXNrju904H2oyGKdtpdE+9vNzvyjN2IBNg0=";
163163- })
164164-165165- # cypari 2.1.2 update (https://trac.sagemath.org/ticket/31029)
166166- (fetchSageDiff {
167167- base = "9.3.beta3";
168168- name = "cypari-2.1.2-update.patch";
169169- rev = "b9aadfd08e81d74ca7c229bb80eb853b592887d0";
170170- sha256 = "sha256-eKaMy7kpu+YKdL8bPStgocxBCTfc2Z/10RrGy2LENFw=";
171171- })
17281 ];
1738217483 patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
1758417685 postPatch = ''
177177- # make sure shebangs etc are fixed, but sage-python23 still works
178178- find . -type f -exec sed \
179179- -e 's/sage-python23/python3/g' \
180180- -i {} \;
181181-182182- echo '#!${runtimeShell}
183183- python3 "$@"' > build/bin/sage-python23
184184-18586 # Make sure sage can at least be imported without setting any environment
18687 # variables. It won't be close to feature complete though.
18788 sed -i \
188188- "s|var('SAGE_ROOT'.*|var('SAGE_ROOT', '$out')|" \
8989+ "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
18990 src/sage/env.py
19091191191- # Do not use sage-env-config (generated by ./configure).
192192- # Instead variables are set manually.
193193- echo '# do nothing' > src/bin/sage-env-config
194194- '';
195195-196196- # Test src/doc/en/reference/spkg/conf.py will fail if
197197- # src/doc/en/reference/spkg/index.rst is not generated. It is
198198- # generated by src/doc/bootstrap, so I've copied the relevant part
199199- # here. An alternative would be to create an empty
200200- # src/doc/en/reference/spkg/index.rst file.
201201- configurePhase = ''
202202- OUTPUT_DIR="src/doc/en/reference/spkg"
203203- mkdir -p "$OUTPUT_DIR"
204204- OUTPUT_INDEX="$OUTPUT_DIR"/index.rst
205205- cat > "$OUTPUT_INDEX" <<EOF
9292+ # src/doc/en/reference/spkg/conf.py expects index.rst in its directory,
9393+ # a list of external packages in the sage distribution (build/pkgs)
9494+ # generated by the bootstrap script (which we don't run). this is not
9595+ # relevant for other distributions, so remove it.
9696+ rm src/doc/en/reference/spkg/conf.py
9797+ sed -i "/spkg/d" src/doc/en/reference/index.rst
20698207207- External Packages
208208- =================
209209-210210- .. toctree::
211211- :maxdepth: 1
212212-213213- EOF
214214- for PKG_SCRIPTS in build/pkgs/*; do
215215- if [ -d "$PKG_SCRIPTS" ]; then
216216- PKG_BASE=$(basename "$PKG_SCRIPTS")
217217- if [ -f "$PKG_SCRIPTS"/SPKG.rst ]; then
218218- # Instead of just copying, we may want to call
219219- # a version of sage-spkg-info to format extra information.
220220- cp "$PKG_SCRIPTS"/SPKG.rst "$OUTPUT_DIR"/$PKG_BASE.rst
221221- echo >> "$OUTPUT_INDEX" " $PKG_BASE"
222222- fi
223223- fi
224224- done
225225- cat >> "$OUTPUT_INDEX" <<EOF
226226- .. include:: ../footer.txt
227227- EOF
9999+ # the bootstrap script also generates installation instructions for
100100+ # arch, debian, fedora, cygwin and homebrew using data from build/pkgs.
101101+ # we don't run the bootstrap script, so disable including the generated
102102+ # files. docbuilding fails otherwise.
103103+ sed -i "/literalinclude/d" src/doc/en/installation/source.rst
228104 '';
229105230106 buildPhase = "# do nothing";
···11-{ stdenv, fetchurl, gmp, bison, perl, ncurses, readline, coreutils, pkg-config
11+{ stdenv, fetchFromGitHub, gmp, bison, perl, ncurses, readline, coreutils, pkg-config
22, lib
33, fetchpatch
44, autoreconfHook
55+, sharutils
56, file
67, flint
78, ntl
89, cddlib
99-, enableFactory ? true
1010+, gfan
1111+, lrcalc
1212+, doxygen
1313+, graphviz
1414+# upstream generates docs with texinfo 4. later versions of texinfo
1515+# use letters instead of numbers for post-appendix chapters, and we
1616+# want it to match the upstream format because sage depends on it.
1717+, texinfo4
1818+, texlive
1919+, enableDocs ? true
1020, enableGfanlib ? true
1121}:
12221323stdenv.mkDerivation rec {
1424 pname = "singular";
1515- version = "4.1.1p2";
2525+ version = "4.2.0p2";
2626+2727+ # since the tarball does not contain tests or documentation (and
2828+ # there is no separate tests tarball for 4.2.0), we fetch from
2929+ # GitHub.
3030+ src = fetchFromGitHub {
3131+ owner = "Singular";
3232+ repo = "Singular";
16331717- src = let
1818- # singular sorts its tarballs in directories by base release (without patch version)
1919- # for example 4.1.1p1 will be in the directory 4-1-1
2020- baseVersion = builtins.head (lib.splitString "p" version);
2121- urlVersion = builtins.replaceStrings [ "." ] [ "-" ] baseVersion;
2222- in
2323- fetchurl {
2424- url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${urlVersion}/singular-${version}.tar.gz";
2525- sha256 = "07x9kri8vl4galik7lr6pscq3c51n8570pyw64i7gbj0m706f7wf";
3434+ # 4.2.0p2 is not tagged, but the tarball matches commit
3535+ # 6f68939ddf612d96e3caaaaa8275f77613ac1da8. the commit below has
3636+ # two extra fixes.
3737+ rev = "3cda50c00a849455efa2502e56596955491a353a";
3838+ sha256 = "sha256-OizPhGE6L2LTOrKfeDdDB6BSdvYkDVXvbbYjV14hnHM=";
3939+4040+ # if a release is tagged it will be in the format below.
4141+ # rev = "Release${lib.replaceStrings ["."] ["-"] version}";
4242+4343+ # the repository's .gitattributes file contains the lines "/Tst/
4444+ # export-ignore" and "/doc/ export-ignore" so some directories are
4545+ # not included in the tarball downloaded by fetchzip. setting
4646+ # fetchSubmodules works around this by using fetchgit instead of
4747+ # fetchzip.
4848+ fetchSubmodules = true;
2649 };
27505151+ patches = [
5252+ # add aarch64 support to cpu-check.m4. copied from redhat.
5353+ ./redhat-aarch64.patch
5454+5555+ # vspace causes hangs in modstd and other libraries on aarch64
5656+ ./disable-vspace-on-aarch64.patch
5757+5858+ # the newest version of ax-prog-cc-for-build.m4 seems to trigger
5959+ # linker errors. see
6060+ # https://github.com/alsa-project/alsa-firmware/issues/3 for a
6161+ # related issue.
6262+ ./use-older-ax-prog-cc-for-build.patch
6363+ ] ++ lib.optionals enableDocs [
6464+ # singular supports building without 4ti2, bertini, normaliz or
6565+ # topcom just fine, but the docbuilding does not skip manual pages
6666+ # tagged as depending on those binaries (probably a bug in
6767+ # doc2tex.pl::HandleLib, since it seems to ignore "-exclude"
6868+ # argumens). skip them manually.
6969+ ./disable-docs-for-optional-unpackaged-deps.patch
7070+ ];
7171+2872 configureFlags = [
2973 "--with-ntl=${ntl}"
3030- ] ++ lib.optionals enableFactory [
3131- "--enable-factory"
7474+ "--disable-pyobject-module"
7575+ ] ++ lib.optionals enableDocs [
7676+ "--enable-doc-build"
3277 ] ++ lib.optionals enableGfanlib [
3378 "--enable-gfanlib"
3479 ];
35803636- postUnpack = ''
8181+ prePatch = ''
8282+ # don't let the tests depend on `hostname`
8383+ substituteInPlace Tst/regress.cmd --replace 'mysystem_catch("hostname")' 'nix_test_runner'
8484+3785 patchShebangs .
8686+ '' + lib.optionalString enableDocs ''
8787+ # work around encoding problem
8888+ sed -i -e 's/\xb7/@cdot{}/g' doc/decodegb.doc
3889 '';
3939-4040- patches = [
4141- # NTL error handler was introduced in the library part, preventing users of
4242- # the library from implementing their own error handling
4343- # https://www.singular.uni-kl.de/forum/viewtopic.php?t=2769
4444- (fetchpatch {
4545- name = "move_error_handler_out_of_libsingular.patch";
4646- # rebased version of https://github.com/Singular/Sources/commit/502cf86d0bb2a96715be6764774b64a69c1ca34c.patch
4747- url = "https://git.sagemath.org/sage.git/plain/build/pkgs/singular/patches/singular-ntl-error-handler.patch?h=50b9ae2fd233c30860e1cbb3e63a26f2cc10560a";
4848- sha256 = "0vgh4m9zn1kjl0br68n04j4nmn5i1igfn28cph0chnwf7dvr9194";
4949- })
5050- ];
51905291 # For reference (last checked on commit 75f460d):
5353- # https://github.com/Singular/Sources/blob/spielwiese/doc/Building-Singular-from-source.md
5454- # https://github.com/Singular/Sources/blob/spielwiese/doc/external-packages-dynamic-modules.md
9292+ # https://github.com/Singular/Singular/blob/spielwiese/doc/Building-Singular-from-source.md
9393+ # https://github.com/Singular/Singular/blob/spielwiese/doc/external-packages-dynamic-modules.md
5594 buildInputs = [
5695 # necessary
5796 gmp
···6099 readline
61100 ntl
62101 flint
102102+ lrcalc
103103+ gfan
63104 ] ++ lib.optionals enableGfanlib [
64105 cddlib
65106 ];
···68109 perl
69110 pkg-config
70111 autoreconfHook
112112+ sharutils # needed for regress.cmd install checks
113113+ ] ++ lib.optionals enableDocs [
114114+ doxygen
115115+ graphviz
116116+ texinfo4
117117+ texlive.combined.scheme-small
71118 ];
7211973120 preAutoreconf = ''
···85132 # do nothing
86133 '';
87134135135+ doCheck = true; # very basic checks, does not test any libraries
136136+88137 installPhase = ''
89138 mkdir -p "$out"
90139 cp -r Singular/LIB "$out/lib"
91140 make install
9292-141141+ '' + lib.optionalString enableDocs ''
142142+ # Sage uses singular.hlp (which is not in the tarball)
143143+ mkdir -p $out/share/info
144144+ cp doc/singular.hlp $out/share/info
145145+ '' + ''
93146 # Make sure patchelf picks up the right libraries
94147 rm -rf libpolys factory resources omalloc Singular
95148 '';
96149150150+ # singular tests are a bit complicated, see
151151+ # https://github.com/Singular/Singular/tree/spielwiese/Tst
152152+ # https://www.singular.uni-kl.de/forum/viewtopic.php&t=2773
153153+ testsToRun = [
154154+ "Old/universal.lst"
155155+ "Buch/buch.lst"
156156+ "Plural/short.lst"
157157+ "Old/factor.tst"
158158+ ] ++ lib.optionals enableGfanlib [
159159+ # tests that require gfanlib
160160+ "Short/ok_s.lst"
161161+ ];
162162+97163 # simple test to make sure singular starts and finds its libraries
98164 doInstallCheck = true;
99165 installCheckPhase = ''
166166+ # Very basic sanity check to make sure singular starts and finds its libraries.
167167+ # This is redundant with the below tests. It is only kept because the singular test
168168+ # runner is a bit complicated. In case we decide to give up those tests in the future,
169169+ # this will still be useful. It takes barely any time.
100170 "$out/bin/Singular" -c 'LIB "freegb.lib"; exit;'
101171 if [ $? -ne 0 ]; then
102172 echo >&2 "Error loading the freegb library in Singular."
103173 exit 1
104174 fi
175175+176176+ # Run the test suite
177177+ cd Tst
178178+ perl ./regress.cmd \
179179+ -s "$out/bin/Singular" \
180180+ ${lib.concatStringsSep " " (map lib.escapeShellArg testsToRun)} \
181181+ 2>"$TMPDIR/out-err.log"
182182+183183+ # unfortunately regress.cmd always returns exit code 0, so check stderr
184184+ # https://www.singular.uni-kl.de/forum/viewtopic.php&t=2773
185185+ if [[ -s "$TMPDIR/out-err.log" ]]; then
186186+ cat "$TMPDIR/out-err.log"
187187+ exit 1
188188+ fi
189189+190190+ echo "Exit status $?"
105191 '';
106192107193 enableParallelBuilding = true;
···110196 description = "A CAS for polynomial computations";
111197 maintainers = teams.sage.members;
112198 # 32 bit x86 fails with some link error: `undefined reference to `__divmoddi4@GCC_7.0.0'`
199199+ # https://www.singular.uni-kl.de:8002/trac/ticket/837
113200 platforms = subtractLists platforms.i686 platforms.unix;
114201 license = licenses.gpl3; # Or GPLv2 at your option - but not GPLv4
115202 homepage = "http://www.singular.uni-kl.de";
···11+diff --git a/m4/cpu-check.m4 b/m4/cpu-check.m4
22+index 3cf0a7f08..12bb926ac 100644
33+--- a/m4/cpu-check.m4
44++++ b/m4/cpu-check.m4
55+@@ -37,6 +37,18 @@ if test "$ac_cv_singcpuname" = ppc; then
66+ AC_DEFINE(SI_CPU_PPC,1,"PPC")
77+ AC_SUBST(SI_CPU_PPC)
88+ fi
99++if test "$ac_cv_singcpuname" = arm -o "$ac_cv_singcpuname" = armel; then
1010++ AC_DEFINE(SI_CPU_ARM,1,"ARM")
1111++ AC_SUBST(SI_CPU_ARM)
1212++fi
1313++if test "$ac_cv_singcpuname" = aarch64; then
1414++ AC_DEFINE(SI_CPU_AARCH64,1,"AARCH64")
1515++ AC_SUBST(SI_CPU_AARCH64)
1616++fi
1717++if test "$ac_cv_singcpuname" = s390; then
1818++ AC_DEFINE(SI_CPU_S390,1,"S390")
1919++ AC_SUBST(SI_CPU_S390)
2020++fi
2121+2222+ # UNAME and PATH
2323+ AC_MSG_CHECKING(uname for Singular)
2424+@@ -65,6 +77,14 @@ dnl testet on: ppc_Linux, 740/750 PowerMac G3, 512k L2 cache
2525+ [powerpc*|ppc*], [AC_DEFINE(HAVE_GENERIC_MULT,1,multiplication is fast on the cpu: a*b is with mod otherwise using tables of logartihms)],
2626+ dnl the following settings seems to be better on arm processors
2727+ [arm*], [],
2828++dnl FIXME: need to run some tests
2929++ [aarch64*], [
3030++ AC_DEFINE(HAVE_MULT_MOD,1,multiplication is fast on the cpu: a*b is with mod otherwise using tables of logartihms)
3131++ AC_DEFINE(HAVE_GENERIC_ADD,1,use branch for addition in Z/p otherwise it uses a generic add)
3232++ AC_DEFINE(HAVE_DIV_MOD,1,division using extend euclidian algorithm otherwise using tables of logartihms)
3333++ ],
3434++dnl FIXME: need to run some tests
3535++ [s390*], [AC_DEFINE(HAVE_GENERIC_ADD,1,use branch for addition in Z/p otherwise it uses a generic add)],
3636+ []
3737+ )
3838+