singular: 4.1.1p2 -> 4.2.0p2

Adds proper tests. Also removes the "enableFactory" option because
singular actually enables factory by default and explicitly disabling it
breaks the build. So the option was never really available.

authored by

Timo Kaufmann and committed by
Masanori Ogino
ceaf48fd 4d56f7c1

+219 -32
+107 -32
pkgs/applications/science/math/singular/default.nix
··· 1 - { stdenv, fetchurl, gmp, bison, perl, ncurses, readline, coreutils, pkg-config 1 + { stdenv, fetchFromGitHub, gmp, bison, perl, ncurses, readline, coreutils, pkg-config 2 2 , lib 3 3 , fetchpatch 4 - , autoreconfHook 4 + , autoreconfHook269 5 + , sharutils 5 6 , file 6 7 , flint 7 8 , ntl 8 9 , cddlib 9 - , enableFactory ? true 10 + , gfan 11 + , lrcalc 12 + , doxygen 13 + , graphviz 14 + # upstream generates docs with texinfo 4. later versions of texinfo 15 + # use letters instead of numbers for post-appendix chapters, and we 16 + # want it to match the upstream format because sage depends on it. 17 + , texinfo4 18 + , texlive 19 + , enableDocs ? true 10 20 , enableGfanlib ? true 11 21 }: 12 22 13 23 stdenv.mkDerivation rec { 14 24 pname = "singular"; 15 - version = "4.1.1p2"; 25 + version = "4.2.0p2"; 26 + 27 + # since the tarball does not contain tests or documentation (and 28 + # there is no separate tests tarball for 4.2.0), we fetch from 29 + # GitHub. 30 + src = fetchFromGitHub { 31 + owner = "Singular"; 32 + repo = "Singular"; 16 33 17 - src = let 18 - # singular sorts its tarballs in directories by base release (without patch version) 19 - # for example 4.1.1p1 will be in the directory 4-1-1 20 - baseVersion = builtins.head (lib.splitString "p" version); 21 - urlVersion = builtins.replaceStrings [ "." ] [ "-" ] baseVersion; 22 - in 23 - fetchurl { 24 - url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${urlVersion}/singular-${version}.tar.gz"; 25 - sha256 = "07x9kri8vl4galik7lr6pscq3c51n8570pyw64i7gbj0m706f7wf"; 34 + # 4.2.0p2 is not tagged, but the tarball matches commit 35 + # 6f68939ddf612d96e3caaaaa8275f77613ac1da8. the commit below has 36 + # two extra fixes. 37 + rev = "3cda50c00a849455efa2502e56596955491a353a"; 38 + sha256 = "sha256-OizPhGE6L2LTOrKfeDdDB6BSdvYkDVXvbbYjV14hnHM="; 39 + 40 + # if a release is tagged it will be in the format below. 41 + # rev = "Release${lib.replaceStrings ["."] ["-"] version}"; 42 + 43 + # the repository's .gitattributes file contains the lines "/Tst/ 44 + # export-ignore" and "/doc/ export-ignore" so some directories are 45 + # not included in the tarball downloaded by fetchzip. setting 46 + # fetchSubmodules works around this by using fetchgit instead of 47 + # fetchzip. 48 + fetchSubmodules = true; 26 49 }; 27 50 51 + patches = lib.optionals enableDocs [ 52 + # singular supports building without 4ti2, bertini, normaliz or 53 + # topcom just fine, but the docbuilding does not skip manual pages 54 + # tagged as depending on those binaries (probably a bug in 55 + # doc2tex.pl::HandleLib, since it seems to ignore "-exclude" 56 + # argumens). skip them manually. 57 + ./disable-docs-for-optional-unpackaged-deps.patch 58 + ]; 59 + 28 60 configureFlags = [ 29 61 "--with-ntl=${ntl}" 30 - ] ++ lib.optionals enableFactory [ 31 - "--enable-factory" 62 + "--disable-pyobject-module" 63 + ] ++ lib.optionals enableDocs [ 64 + "--enable-doc-build" 32 65 ] ++ lib.optionals enableGfanlib [ 33 66 "--enable-gfanlib" 34 67 ]; 35 68 36 - postUnpack = '' 69 + prePatch = '' 70 + # don't let the tests depend on `hostname` 71 + substituteInPlace Tst/regress.cmd --replace 'mysystem_catch("hostname")' 'nix_test_runner' 72 + 37 73 patchShebangs . 74 + '' + lib.optionalString enableDocs '' 75 + # work around encoding problem 76 + sed -i -e 's/\xb7/@cdot{}/g' doc/decodegb.doc 38 77 ''; 39 78 40 - patches = [ 41 - # NTL error handler was introduced in the library part, preventing users of 42 - # the library from implementing their own error handling 43 - # https://www.singular.uni-kl.de/forum/viewtopic.php?t=2769 44 - (fetchpatch { 45 - name = "move_error_handler_out_of_libsingular.patch"; 46 - # rebased version of https://github.com/Singular/Sources/commit/502cf86d0bb2a96715be6764774b64a69c1ca34c.patch 47 - url = "https://git.sagemath.org/sage.git/plain/build/pkgs/singular/patches/singular-ntl-error-handler.patch?h=50b9ae2fd233c30860e1cbb3e63a26f2cc10560a"; 48 - sha256 = "0vgh4m9zn1kjl0br68n04j4nmn5i1igfn28cph0chnwf7dvr9194"; 49 - }) 50 - ]; 51 - 52 79 # For reference (last checked on commit 75f460d): 53 - # https://github.com/Singular/Sources/blob/spielwiese/doc/Building-Singular-from-source.md 54 - # https://github.com/Singular/Sources/blob/spielwiese/doc/external-packages-dynamic-modules.md 80 + # https://github.com/Singular/Singular/blob/spielwiese/doc/Building-Singular-from-source.md 81 + # https://github.com/Singular/Singular/blob/spielwiese/doc/external-packages-dynamic-modules.md 55 82 buildInputs = [ 56 83 # necessary 57 84 gmp ··· 60 87 readline 61 88 ntl 62 89 flint 90 + lrcalc 91 + gfan 63 92 ] ++ lib.optionals enableGfanlib [ 64 93 cddlib 65 94 ]; ··· 67 96 bison 68 97 perl 69 98 pkg-config 70 - autoreconfHook 99 + autoreconfHook269 100 + sharutils # needed for regress.cmd install checks 101 + ] ++ lib.optionals enableDocs [ 102 + doxygen 103 + graphviz 104 + texinfo4 105 + texlive.combined.scheme-small 71 106 ]; 72 107 73 108 preAutoreconf = '' ··· 85 120 # do nothing 86 121 ''; 87 122 123 + doCheck = true; # very basic checks, does not test any libraries 124 + 88 125 installPhase = '' 89 126 mkdir -p "$out" 90 127 cp -r Singular/LIB "$out/lib" 91 128 make install 92 - 129 + '' + lib.optionalString enableDocs '' 130 + # Sage uses singular.hlp (which is not in the tarball) 131 + mkdir -p $out/share/info 132 + cp doc/singular.hlp $out/share/info 133 + '' + '' 93 134 # Make sure patchelf picks up the right libraries 94 135 rm -rf libpolys factory resources omalloc Singular 95 136 ''; 96 137 138 + # singular tests are a bit complicated, see 139 + # https://github.com/Singular/Singular/tree/spielwiese/Tst 140 + # https://www.singular.uni-kl.de/forum/viewtopic.php&t=2773 141 + testsToRun = [ 142 + "Old/universal.lst" 143 + "Buch/buch.lst" 144 + "Plural/short.lst" 145 + "Old/factor.tst" 146 + ] ++ lib.optionals enableGfanlib [ 147 + # tests that require gfanlib 148 + "Short/ok_s.lst" 149 + ]; 150 + 97 151 # simple test to make sure singular starts and finds its libraries 98 152 doInstallCheck = true; 99 153 installCheckPhase = '' 154 + # Very basic sanity check to make sure singular starts and finds its libraries. 155 + # This is redundant with the below tests. It is only kept because the singular test 156 + # runner is a bit complicated. In case we decide to give up those tests in the future, 157 + # this will still be useful. It takes barely any time. 100 158 "$out/bin/Singular" -c 'LIB "freegb.lib"; exit;' 101 159 if [ $? -ne 0 ]; then 102 160 echo >&2 "Error loading the freegb library in Singular." 103 161 exit 1 104 162 fi 163 + 164 + # Run the test suite 165 + cd Tst 166 + perl ./regress.cmd \ 167 + -s "$out/bin/Singular" \ 168 + ${lib.concatStringsSep " " (map lib.escapeShellArg testsToRun)} \ 169 + 2>"$TMPDIR/out-err.log" 170 + 171 + # unfortunately regress.cmd always returns exit code 0, so check stderr 172 + # https://www.singular.uni-kl.de/forum/viewtopic.php&t=2773 173 + if [[ -s "$TMPDIR/out-err.log" ]]; then 174 + cat "$TMPDIR/out-err.log" 175 + exit 1 176 + fi 177 + 178 + echo "Exit status $?" 105 179 ''; 106 180 107 181 enableParallelBuilding = true; ··· 110 184 description = "A CAS for polynomial computations"; 111 185 maintainers = teams.sage.members; 112 186 # 32 bit x86 fails with some link error: `undefined reference to `__divmoddi4@GCC_7.0.0'` 187 + # https://www.singular.uni-kl.de:8002/trac/ticket/837 113 188 platforms = subtractLists platforms.i686 platforms.unix; 114 189 license = licenses.gpl3; # Or GPLv2 at your option - but not GPLv4 115 190 homepage = "http://www.singular.uni-kl.de";
+112
pkgs/applications/science/math/singular/disable-docs-for-optional-unpackaged-deps.patch
··· 1 + commit 9e8b044d982e132cf35a106a1cc0cf7e77b27f7c 2 + Author: Mauricio Collares <mauricio@collares.org> 3 + Date: Thu Apr 15 20:33:21 2021 -0300 4 + 5 + Disable manual sections using optional packages not yet in Nixpkgs 6 + 7 + * normaliz.lib depends on normaliz. 8 + * polymake.lib depends on topcom. 9 + * recover.lib depends on bertini. 10 + * sing4ti2.lib depends on 4ti2. 11 + * tateProdCplxNegGrad.lib uses multigrading.lib, which depends on 4ti2. 12 + 13 + diff --git a/doc/singular.doc b/doc/singular.doc 14 + index 64b969d39..e704f95f0 100644 15 + --- a/doc/singular.doc 16 + +++ b/doc/singular.doc 17 + @@ -407,7 +407,6 @@ LIB "all.lib"; 18 + * nfmodsyz_lib:: Syzygy modules of submodules of free modules over algebraic number fields 19 + * noether_lib:: Noether normalization of an ideal 20 + * normal_lib:: procedure for normalization 21 + -* normaliz_lib:: integral closure, normalization for monomial ideals, toric ideals 22 + * pointid_lib:: factorized lex GB of the vanishing ideal of a set of points 23 + * primdec_lib:: procedures for primary decomposition 24 + * primdecint_lib:: primary decomposition over the integers 25 + @@ -416,7 +415,6 @@ LIB "all.lib"; 26 + * reesclos_lib:: Rees Algebra and integral closure of an ideal 27 + * rstandard_lib:: Janet bases and border bases for ideals 28 + * sagbi_lib:: Subalgebras bases Analogous to Groebner bases for ideals 29 + -* sing4ti2_lib:: interface to program 4ti2 30 + * symodstd_lib:: Groebner bases for symmetric ideals 31 + * toric_lib:: toric ideals 32 + @end menu 33 + @@ -521,10 +519,6 @@ LIB "all.lib"; 34 + @node normal_lib 35 + @subsection normal_lib 36 + @c lib normal.lib 37 + -@c --------------------------------------------------------- 38 + -@node normaliz_lib 39 + -@subsection normaliz_lib 40 + -@c lib normaliz.lib tag:normaliz 41 + @c ---------------------------------------------------------- 42 + @node pointid_lib 43 + @subsection pointid_lib 44 + @@ -558,10 +552,6 @@ LIB "all.lib"; 45 + @subsection sagbi_lib 46 + @c lib sagbi.lib 47 + @c --------------------------------------------------------- 48 + -@node sing4ti2_lib 49 + -@subsection sing4ti2_lib 50 + -@c lib sing4ti2.lib tag:sing4ti2 51 + -@c ---------------------------------------------------------- 52 + @node symodstd_lib 53 + @subsection symodstd_lib 54 + @c lib symodstd.lib 55 + @@ -873,7 +863,6 @@ iniD, reslist, sumlist, dividelist, createlist 56 + * solve_lib:: procedures to solve polynomial systems 57 + * triang_lib:: procedures for decomposing zero-dimensional ideals 58 + * ntsolve_lib:: one real solution of polynomial systems (Newton iteration) 59 + -* recover_lib:: Hybrid numerical/symbolical algorithms 60 + * rootisolation_lib:: real root isolation with intervals 61 + * signcond_lib:: computing realizable sign conditions 62 + * zeroset_lib:: procedures for roots and factorization 63 + @@ -904,10 +893,6 @@ iniD, reslist, sumlist, dividelist, createlist 64 + @subsection ntsolve_lib 65 + @c lib ntsolve.lib 66 + @c --------------------------------------------------------- 67 + -@node recover_lib 68 + -@subsection recover_lib 69 + -@c lib recover.lib tag:bertini 70 + -@c ---------------------------------------------------------- 71 + @node rootisolation_lib 72 + @subsection rootisolation_lib 73 + @c lib rootisolation.lib 74 + @@ -1108,7 +1093,6 @@ but not for serious computations. 75 + * cimonom_lib:: complete intersection for toric ideals 76 + * gfan_lib:: A gfanlib interface for Singular 77 + * gitfan_lib:: Compute GIT-fans 78 + -* polymake_lib:: interface to TOPCOM 79 + * realizationMatroids_lib:: Realizability for Tropical Fan Curves 80 + * tropical_lib:: interface to gfan 81 + * tropicalNewton_lib:: Newton polygons in tropical geometry 82 + @@ -1125,10 +1109,7 @@ but not for serious computations. 83 + @node gitfan_lib 84 + @subsection gitfan_lib 85 + @c lib gitfan.lib 86 + -@c ---------------------------------------------------------- 87 + -@node polymake_lib 88 + -@subsection polymake_lib 89 + -@c lib polymake.lib tag:topcom 90 + + 91 + @c ---------------------------------------------------------- 92 + @node realizationMatroids_lib 93 + @subsection realizationMatroids_lib 94 + @@ -1219,7 +1200,6 @@ Comments should be send to the author of the library directly. 95 + * stanleyreisner_lib:: T1 and T2 for a general Stanley-Reiser ring 96 + * swalk_lib:: Sagbi Walk Conversion Algorithm 97 + * systhreads_lib:: multi-threaded objects 98 + -* tateProdCplxNegGrad_lib:: sheaf cohomology on product of projective spaces 99 + * VecField_lib:: vector fields 100 + @end menu 101 + @c ---------------------------------------------------------- 102 + @@ -1310,10 +1290,6 @@ Todos/Issues: 103 + @subsection systhreads_lib 104 + @c lib systhreads.lib 105 + @c --------------------------------------------------------- 106 + -@node tateProdCplxNegGrad_lib 107 + -@subsection tateProdCplxNegGrad_lib 108 + -@c lib tateProdCplxNegGrad.lib 109 + -@c --------------------------------------------------------- 110 + @node VecField_lib 111 + @subsection VecField_lib 112 + @c lib VecField.lib