Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] New package: sagemath-9.5.beta5
@ 2021-11-11 14:12 tornaria
  2021-11-11 16:08 ` dkwo
                   ` (238 more replies)
  0 siblings, 239 replies; 240+ messages in thread
From: tornaria @ 2021-11-11 14:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

There is a new pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 4316 bytes --]

From a3f2026d7738a65824d0536677a5cfebff7f5e97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/2] add option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..0ac9d7dda65a 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 9e7ae4a1e0b33ed1ea5cfad89b3f8fa2016324cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/2] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..49d835c5f39c
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
@ 2021-11-11 16:08 ` dkwo
  2021-11-12  7:27 ` fosslinux
                   ` (237 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-11 16:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-966426866

Comment:
I'd go with `sagemath`.
Is it possible to not build as root, or otherwise pass the option?
```
checking for root user... yes
configure: error: You cannot build Sage as root, switch to an unprivileged user.  (If building in a container, use --enable-build-as-root.)
```
We need more expert advice with relocation.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
  2021-11-11 16:08 ` dkwo
@ 2021-11-12  7:27 ` fosslinux
  2021-11-12 20:16 ` dkwo
                   ` (236 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: fosslinux @ 2021-11-12  7:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-966883839

Comment:
Should use the `--enable-build-as-root` option

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
  2021-11-11 16:08 ` dkwo
  2021-11-12  7:27 ` fosslinux
@ 2021-11-12 20:16 ` dkwo
  2021-11-12 20:22 ` dkwo
                   ` (235 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-12 20:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967473305

Comment:
With this, at least it gets to the end
```
=> Registering new packages to /host/binpkgs/sagemath
index: added `sage-9.5.beta5_1' (x86_64).
index: 1 packages registered.
=> sage-9.5.beta5_1: removing autodeps, please wait...
=> sage-9.5.beta5_1: cleaning build directory...
=> sage: removing files from destdir...
```
on the `x86_64`
```
make[2]: Leaving directory '/builddir/sage-9.5.beta5/build/make'

real    22m23.377s
user    164m31.944s
sys     6m1.798s
Sage build/upgrade complete!
```
Obviously, it complains that
```
=> sage-9.5.beta5_1: running pre-pkg hook: 99-pkglint ...
=> WARNING: sage-9.5.beta5_1: liblinbox.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: liblrcalc.so.1 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbrial_groebner.so.3 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libcliquer.so.1 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libpython3.9.so.1.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbrial.so.3 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libgap.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libbraiding.so.0 not found in common/shlibs!
=> WARNING: sage-9.5.beta5_1: libhomfly.so.0 not found in common/shlibs!
```
and lots of `=> WARNING: sage-9.5.beta5_1: removed empty dir: ...`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (2 preceding siblings ...)
  2021-11-12 20:16 ` dkwo
@ 2021-11-12 20:22 ` dkwo
  2021-11-12 20:28 ` dkwo
                   ` (234 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-12 20:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967482959

Comment:
Other than that, it installs fine.
I will run doctests and perhaps test on musl, but it looks not so bad.
```
[nicolo@mabragor ~]$ sage
/usr/lib/sage-9.5.beta5/bin/sage-env: line 122: cd: /builddir/sage-9.5.beta5: No such file or directory
Warning: overwriting SAGE_ROOT environment variable:
Old SAGE_ROOT=/builddir/sage-9.5.beta5
New SAGE_ROOT=
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.beta5, Release Date: 2021-10-28               │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: 2+2
4
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (3 preceding siblings ...)
  2021-11-12 20:22 ` dkwo
@ 2021-11-12 20:28 ` dkwo
  2021-11-12 20:37 ` dkwo
                   ` (233 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-12 20:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967493612

Comment:
Either `./configure --prefix=SAGE_LOCAL` or edit `#SAGE_ROOT=/path/to/sage-version` at the beginning of the scritp should fix that.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (4 preceding siblings ...)
  2021-11-12 20:28 ` dkwo
@ 2021-11-12 20:37 ` dkwo
  2021-11-12 22:06 ` fosslinux
                   ` (232 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-12 20:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3042 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967508279

Comment:
About the doctests, I'm still unable to perform them
From within sage
```
sage: run_doctests(sage.combinat.affine_permutation)
too few successful tests, not using stored timings
Running doctests with ID 2021-11-12-21-34-16-32069d04.
Using --optional=sage
Doctesting 1 file.
sage -t --random-seed=0 /builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py
    FileNotFoundError in doctesting framework
**********************************************************************
Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/forker.py", line 2465, in __call__
    doctests, extras = self._run(runner, options, results)
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/forker.py", line 2513, in _run
    doctests, extras = self.source.create_doctests(sage_namespace)
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/sources.py", line 725, in create_doctests
    raise IOError(errno.ENOENT, "File does not exist", self.path)
FileNotFoundError: [Errno 2] File does not exist: '/builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py'

----------------------------------------------------------------------
sage -t --random-seed=0 /builddir/sage-9.5.beta5/src/sage/combinat/affine_permutation.py  # FileNotFoundError in doctesting framework
----------------------------------------------------------------------
Total time for all tests: 0.0 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.0 seconds
```
From terminal
```
[nicolo@mabragor ~]$ sage --testall
/usr/lib/sage-9.5.beta5/bin/sage-env: line 122: cd: /builddir/sage-9.5.beta5: No such file or directory
Warning: overwriting SAGE_ROOT environment variable:
Old SAGE_ROOT=/builddir/sage-9.5.beta5
New SAGE_ROOT=
Running doctests with ID 2021-11-12-21-36-43-b1335b9b.
Using --optional=dochtml,pip,sage,sage.geometry.polyhedron,sage.rings.real_double
Doctesting entire Sage library.
Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta5/bin/sage-runtests", line 151, in <module>
    err = DC.run()
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 1251, in run
    self.expand_files_into_sources()
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 835, in expand_files_into_sources
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/control.py", line 835, in <listcomp>
    self.sources = [FileDocTestSource(path, self.options) for path in expand()]
  File "/usr/lib/sage-9.5.beta5/lib/python3.9/site-packages/sage/doctest/sources.py", line 527, in __init__
    raise ValueError("unknown file extension %r"%ext)
ValueError: unknown file extension ''
```
What am I missing?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (5 preceding siblings ...)
  2021-11-12 20:37 ` dkwo
@ 2021-11-12 22:06 ` fosslinux
  2021-11-12 22:12 ` [PR REVIEW] " Duncaen
                   ` (231 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: fosslinux @ 2021-11-12 22:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by fosslinux on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967659661

Comment:
You can ignore the `common/shlibs` and `empty dir` messages.

The doctest failures probably have something to do with using python 3.9; why is this?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR REVIEW] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (6 preceding siblings ...)
  2021-11-12 22:06 ` fosslinux
@ 2021-11-12 22:12 ` Duncaen
  2021-11-13  1:27 ` tornaria
                   ` (230 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: Duncaen @ 2021-11-12 22:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#discussion_r748614634

Comment:
things like this should be quoted.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (7 preceding siblings ...)
  2021-11-12 22:12 ` [PR REVIEW] " Duncaen
@ 2021-11-13  1:27 ` tornaria
  2021-11-13  1:30 ` tornaria
                   ` (229 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13  1:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967754923

Comment:
> We need more expert advice with relocation.

I think one way would be to compile sage in-place, then remove all unnecessary stuff (or vinstall all necessary stuff).

I'll give it a try later.

The alternative is how sage builds binary tarballs: compile sage in a directory with a particular pathname (long enough), then search-and-replace this pathname with the location it will be installed.

In their binary tarballs they do this search-and-replace step the first time sage runs after being extracted, in this way sage can be extracted anywhere and will fix its paths the first time it runs. We would do this at xbps-src install time.


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (8 preceding siblings ...)
  2021-11-13  1:27 ` tornaria
@ 2021-11-13  1:30 ` tornaria
  2021-11-13  1:33 ` tornaria
                   ` (228 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13  1:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967755491

Comment:
> Obviously, it complains that
> 
> ```
> => sage-9.5.beta5_1: running pre-pkg hook: 99-pkglint ...
> => WARNING: sage-9.5.beta5_1: liblinbox.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: liblrcalc.so.1 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbrial_groebner.so.3 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libcliquer.so.1 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libpython3.9.so.1.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbrial.so.3 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libgap.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libbraiding.so.0 not found in common/shlibs!
> => WARNING: sage-9.5.beta5_1: libhomfly.so.0 not found in common/shlibs!
> ```

These are false warnings, we don't want this pkg to provide any shlibs and those shlibs will not be in any standard path anyway. As a matter of fact, all of those should eventually be gone and used from system instead.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (9 preceding siblings ...)
  2021-11-13  1:30 ` tornaria
@ 2021-11-13  1:33 ` tornaria
  2021-11-13  3:14 ` [PR PATCH] [Updated] " tornaria
                   ` (227 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967756058

Comment:
> You can ignore the `common/shlibs` and `empty dir` messages.
> 
> The doctest failures probably have something to do with using python 3.9; why is this?

No, this is because sage needs the source files to be available, and I didn't include in the pkg. This is not just for testing, but also for inline help. You can see it complains about missing `/builddir/sage-9.5.beta5/...` files, which is where the source files were.

I'll do a second attempt soon.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (10 preceding siblings ...)
  2021-11-13  1:33 ` tornaria
@ 2021-11-13  3:14 ` tornaria
  2021-11-13  3:18 ` tornaria
                   ` (226 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13  3:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 7976 bytes --]

From c3a3d3732b428ccd187895647561cb8233f309e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/3] add option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..0ac9d7dda65a 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From de92a506b36c787110d68b4c49abd71ae9d50cb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/3] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..49d835c5f39c
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 5515c6226a169bba1158fc6464a811d7cb8f259e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/3] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 49d835c5f39c..fd19d60b2a1d 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $SAGE_ROOT
+	ln -sfT $SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (11 preceding siblings ...)
  2021-11-13  3:14 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-13  3:18 ` tornaria
  2021-11-13  8:59 ` dkwo
                   ` (225 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13  3:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967770614

Comment:
Second draft:
 - rename pkg from sage to sagemath (please remove sage before installing sagemath as I didn't set replaces=)
 - updated sage to sage-9.5.beta6
 - now it builds in place at `/usr/lib/sage-$version`
 - the resulting pkg includes a lot of useless stuff that comes with the distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).

A useful reference is https://github.com/sagemath/binary-pkg.

Now it's possible to run tests on the installed sage, for instance:
```
$ sage -tp 8 --all
```
to test all with 8 parallel jobs.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (12 preceding siblings ...)
  2021-11-13  3:18 ` tornaria
@ 2021-11-13  8:59 ` dkwo
  2021-11-13  9:02 ` dkwo
                   ` (224 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13  8:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967865094

Comment:
It's getting better.
Could you include your `pyzmq` patch, at least until we're using sage's python modules, so that it also builds on `musl`?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (13 preceding siblings ...)
  2021-11-13  8:59 ` dkwo
@ 2021-11-13  9:02 ` dkwo
  2021-11-13  9:28 ` dkwo
                   ` (223 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13  9:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967870203

Comment:
>     * now it builds in place at `/usr/lib/sage-$version`

@leahneukirchen What do you think?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (14 preceding siblings ...)
  2021-11-13  9:02 ` dkwo
@ 2021-11-13  9:28 ` dkwo
  2021-11-13  9:36 ` dkwo
                   ` (222 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13  9:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967916355

Comment:
>     * the resulting pkg includes a lot of useless stuff that comes with the distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).

Definitely :)
`Size required on disk:        7300MB `

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (15 preceding siblings ...)
  2021-11-13  9:28 ` dkwo
@ 2021-11-13  9:36 ` dkwo
  2021-11-13 10:22 ` dkwo
                   ` (221 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13  9:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-967928792

Comment:
Dumb question: does this in htop mean it is using system python? 
`python3 /usr/lib/sage-9.5.beta6/src/bin/sage-runtests -p 12 --all`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (16 preceding siblings ...)
  2021-11-13  9:36 ` dkwo
@ 2021-11-13 10:22 ` dkwo
  2021-11-13 10:48 ` dkwo
                   ` (220 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 10:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968008642

Comment:
Could you add `gengetopt` to the makedepends?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (17 preceding siblings ...)
  2021-11-13 10:22 ` dkwo
@ 2021-11-13 10:48 ` dkwo
  2021-11-13 10:50 ` [PR PATCH] [Updated] " tornaria
                   ` (219 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 10:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968048978

Comment:
It seems `giac` is not picked up, could you add it also to `depends`?
```
 RuntimeError: unable to start giac because the command 'giac --sage' failed: The command was not found or was not executable: giac.

    In order to use the Giac interface you need to have Giac installed
    and have a program called "giac" in your PATH. You need a giac version
    supporting "giac --sage" ( roughly after 0.9.1 of march 2011). Some giac
    instructions  and the help's langage depend of you LANG variable. To obtain
    inline help for  giac commands, you also need to have the program "cas_help"
    in your PATH.
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (18 preceding siblings ...)
  2021-11-13 10:48 ` dkwo
@ 2021-11-13 10:50 ` tornaria
  2021-11-13 10:59 ` tornaria
                   ` (218 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13 10:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 10469 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/4] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/4] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/4] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From b0a333cb0447a65134497b60a91a443d3a5f4132 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/4] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..8cbfc4023df3 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopts texinfo
 "
 
 # TODO: standard

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (19 preceding siblings ...)
  2021-11-13 10:50 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-13 10:59 ` tornaria
  2021-11-13 11:05 ` tornaria
                   ` (217 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13 10:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 10468 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/4] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/4] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/4] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From ad557eb75ef34ad8c4c2febd27e9b90f0f28c21b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/4] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (20 preceding siblings ...)
  2021-11-13 10:59 ` tornaria
@ 2021-11-13 11:05 ` tornaria
  2021-11-13 11:42 ` tornaria
                   ` (216 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13 11:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2499 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968050979

Comment:
New on sagemath-9.5.beta6_2:
 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts

This one should save ~ 3.8G installed size.

Again, it should be possible to run tests on the installed sage, for instance:
```
$ sage -tp 8 --all
```
to test all with 8 parallel jobs. There are a few tests failing will look into it when I get a chance. It may also be useful to compare tests failing on `./xbps-src check sagemath` vs test failing on installed sage.
```
----------------------------------------------------------------------
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/env.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/sympow.py  # 10 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/modular/abvar/abvar.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/modular/hecke/submodule.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_kernel/install.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/schemes/elliptic_curves/ell_rational_field.py  # 9 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage_docbuild/__init__.py  # 1 doctest failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 3 doctests failed
sage -t --random-seed=45812884732240074843516850899920199933 /usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 1186.4 seconds
    cpu time: 7017.0 seconds
    cumulative wall time: 8303.5 seconds
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (21 preceding siblings ...)
  2021-11-13 11:05 ` tornaria
@ 2021-11-13 11:42 ` tornaria
  2021-11-13 12:30 ` dkwo
                   ` (215 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-13 11:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968055202

Comment:
> It seems `giac` is not picked up, could you add it also to `depends`?

Good point, we have to explicitly add anything that is needed at runtime that is not implicitly required by shlibs. Maybe we should try to run all tests in a barebones chroot with only sagemath installed.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (22 preceding siblings ...)
  2021-11-13 11:42 ` tornaria
@ 2021-11-13 12:30 ` dkwo
  2021-11-13 13:48 ` dkwo
                   ` (214 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 12:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 8035 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968061042

Comment:
Was the building taking 90+ min on the ci also before?

I'm not yet using a chroot, but my system is quite clean: it seems we also miss `singular, pari` from `depends`.
As a consequence, I was still getting a bit more doctest failures with previous version:
```
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/schemes/elliptic_curves/ell_rational_field.py  # 14 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/sageinspect.py  # 35 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/sagedoc.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/modular/abvar/abvar.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field_element.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/modular/hecke/submodule.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/integer.pyx  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_extension.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/graphs/connectivity.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/parallel/decorate.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/number_field_rel.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/number_field/galois_group.py  # 11 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/persist.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/structure/element.pyx  # 37 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/inline_fortran.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage_docbuild/__init__.py  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/features/__init__.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/superseded.py  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/galois_group.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/interfaces/gp.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/perm_gps/permgroup_morphism.py  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/env.py  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/polynomial/ore_polynomial_element.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/ipython_kernel/install.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/tests/books/judson-abstract-algebra/galois-sage.py  # 5 doctests
 failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/tate_algebra_ideal.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/lfunctions/sympow.py  # 10 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/interfaces/qsieve.py  # 7 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/cython.py  # 21 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/structure/factory.pyx  # 8 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/graphs/graph_decompositions/fast_digraph.pyx  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/session.pyx  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/lazy_attribute.pyx  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/ext/memory_allocator.pxd  # 3 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/ext/memory_allocator.pyx  # 7 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/groups/pari_group.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/nested_class.pyx  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/arith/long.pxd  # 14 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/repl/load.py  # 2 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/docs/instancedoc.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/cython_metaclass.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/rings/integer_fake.pxd  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/wrapperdescr.pxd  # 6 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/symbolic/pynac.pxi  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/inherit_comparison.pyx  # 5 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/string.pyx  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/cpython/getattr.pyx  # 4 doctests failed
sage -t --random-seed=210801943898287344358194260905231821388 /usr/lib/sage-9.5.beta6/src/sage/misc/cachefunc.pyx  # 54 doctests failed
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (23 preceding siblings ...)
  2021-11-13 12:30 ` dkwo
@ 2021-11-13 13:48 ` dkwo
  2021-11-13 13:50 ` dkwo
                   ` (213 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 13:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968071538

Comment:
perhaps also add to depends: flintqs pari-datapkgs and zn_poly

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (24 preceding siblings ...)
  2021-11-13 13:48 ` dkwo
@ 2021-11-13 13:50 ` dkwo
  2021-11-13 13:53 ` leahneukirchen
                   ` (212 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 13:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968071841

Comment:
Sorry, forget about singular and pari.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (25 preceding siblings ...)
  2021-11-13 13:50 ` dkwo
@ 2021-11-13 13:53 ` leahneukirchen
  2021-11-13 14:20 ` leahneukirchen
                   ` (211 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 13:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968072324

Comment:
Running the test suite also requires git.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (26 preceding siblings ...)
  2021-11-13 13:53 ` leahneukirchen
@ 2021-11-13 14:20 ` leahneukirchen
  2021-11-13 14:22 ` leahneukirchen
                   ` (210 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 160 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968075951

Comment:
Also sympow.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (27 preceding siblings ...)
  2021-11-13 14:20 ` leahneukirchen
@ 2021-11-13 14:22 ` leahneukirchen
  2021-11-13 14:55 ` leahneukirchen
                   ` (209 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 14:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968075951

Comment:
Also sympow.

We may want to add this patch: https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-mathematics/sympow/files/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (28 preceding siblings ...)
  2021-11-13 14:22 ` leahneukirchen
@ 2021-11-13 14:55 ` leahneukirchen
  2021-11-13 14:58 ` leahneukirchen
                   ` (208 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 14:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081092

Comment:
I made all but 6 tests pass:

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/functions/min_max.py  # 2 doctests failed

Lack of symbolic execution and wrong rounding, this one should be investigated.

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/lfunctions/pari.py  # 1 doctest failed

Just a warning: `      ***   Warning: normalizing a series with 0 leading term.`

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage_setup/find.py  # 1 doctest failed

`find_extra_files`, not sure why there should be a `wrapper_cdf.h`.

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/env.py  # 1 doctest failed

`_get_shared_lib_path` may be broken

> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/misc/sagedoc.py  # 4 doctests failed
> sage -t --random-seed=2922128458579573960176688891507420022 usr/lib/sage-9.5.beta6/src/sage/docs/conf.py  # 1 doctest failed

No docs are installed.


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (29 preceding siblings ...)
  2021-11-13 14:55 ` leahneukirchen
@ 2021-11-13 14:58 ` leahneukirchen
  2021-11-13 15:00 ` dkwo
                   ` (207 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 14:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081422

Comment:
Also we should install pytest with `sage --pip install` to have more tests.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (30 preceding siblings ...)
  2021-11-13 14:58 ` leahneukirchen
@ 2021-11-13 15:00 ` dkwo
  2021-11-13 15:07 ` leahneukirchen
                   ` (206 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 15:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081812

Comment:
Very well.
Indeed, sage uses the same patch for sympow, see https://git.sagemath.org/sage.git/tree/build/pkgs/sympow

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (31 preceding siblings ...)
  2021-11-13 15:00 ` dkwo
@ 2021-11-13 15:07 ` leahneukirchen
  2021-11-13 15:11 ` leahneukirchen
                   ` (205 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 15:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968082964

Comment:
> sage -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 usr/lib/sage-9.5.beta6/src/sage>/rings/tate_algebra_ideal.pyx
May be a upstream bug, does someone want to report?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (32 preceding siblings ...)
  2021-11-13 15:07 ` leahneukirchen
@ 2021-11-13 15:11 ` leahneukirchen
  2021-11-13 15:28 ` dkwo
                   ` (204 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 15:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968083600

Comment:
> sage -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 usr/lib/sage-9.5.beta6/src/sage/tests/cmdline.py

Not sure about that one, has a missing fixture?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (33 preceding siblings ...)
  2021-11-13 15:11 ` leahneukirchen
@ 2021-11-13 15:28 ` dkwo
  2021-11-13 15:34 ` leahneukirchen
                   ` (203 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-13 15:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968085864

Comment:
@leahneukirchen Did you find anything missing other than these?
```
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata"
```
Are you also testing with `sage -tp NUM --all` ?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (34 preceding siblings ...)
  2021-11-13 15:28 ` dkwo
@ 2021-11-13 15:34 ` leahneukirchen
  2021-11-14  4:42 ` ericonr
                   ` (202 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-13 15:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968086750

Comment:
These: flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran 

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (35 preceding siblings ...)
  2021-11-13 15:34 ` leahneukirchen
@ 2021-11-14  4:42 ` ericonr
  2021-11-14  4:43 ` ericonr
                   ` (201 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: ericonr @ 2021-11-14  4:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968205411

Comment:
I maintain my comment from https://github.com/void-linux/void-packages/pull/34053#issuecomment-968073629

> _get_shared_lib_path may be broken

Could a patch like https://github.com/void-linux/void-packages/blob/67adbca402734d3a4fabab246e355850bf7b736b/srcpkgs/python3/patches/musl-find_library.patch be necessary?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (36 preceding siblings ...)
  2021-11-14  4:42 ` ericonr
@ 2021-11-14  4:43 ` ericonr
  2021-11-14 14:27 ` leahneukirchen
                   ` (200 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: ericonr @ 2021-11-14  4:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968205411

Comment:
I keep my comment from https://github.com/void-linux/void-packages/pull/34053#issuecomment-968073629

> _get_shared_lib_path may be broken

Could a patch like https://github.com/void-linux/void-packages/blob/67adbca402734d3a4fabab246e355850bf7b736b/srcpkgs/python3/patches/musl-find_library.patch be necessary?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (37 preceding siblings ...)
  2021-11-14  4:43 ` ericonr
@ 2021-11-14 14:27 ` leahneukirchen
  2021-11-14 15:20 ` tornaria
                   ` (199 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-14 14:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968301144

Comment:
I tried on glibc, not sure how that patch would help?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (38 preceding siblings ...)
  2021-11-14 14:27 ` leahneukirchen
@ 2021-11-14 15:20 ` tornaria
  2021-11-14 16:31 ` leahneukirchen
                   ` (198 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-14 15:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968310951

Comment:
> These: flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran

Are all those `*-devel` pkgs really necessary for running sage?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (39 preceding siblings ...)
  2021-11-14 15:20 ` tornaria
@ 2021-11-14 16:31 ` leahneukirchen
  2021-11-14 21:28 ` [PR PATCH] [Updated] " tornaria
                   ` (197 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-14 16:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968323262

Comment:
For just running, no. But some doctests need it.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (40 preceding siblings ...)
  2021-11-14 16:31 ` leahneukirchen
@ 2021-11-14 21:28 ` tornaria
  2021-11-14 21:47 ` tornaria
                   ` (196 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-14 21:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 13268 bytes --]

From 5701339d82dc6127ada60ee9487a4a0e9186adb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/5] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From e5df033c986d4451162ba9d605bc2438b4e35461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/5] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 0e85019dec9235654b682c14f80e0fdf8f5b6c0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/5] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From ad557eb75ef34ad8c4c2febd27e9b90f0f28c21b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/5] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 5c604df178fb44f4e1fa1cf02a96582f672e5fdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/5] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (41 preceding siblings ...)
  2021-11-14 21:28 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-14 21:47 ` tornaria
  2021-11-15 15:58 ` leahneukirchen
                   ` (195 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-14 21:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-968369692

Comment:
New on sagemath-9.5.beta6_3:
     - add depends needed for runtime and for testing
     - add `python_version=3`
     - disable skipping `03-rewrite-python-shebang` as it seems to be harmless after adding `python_version=3` (unexpected... let's try and be alert in case problems arise)
     - fix cleaning up of `$wrksrc` and `$_SAGE_ROOT`
     - use `sage-${version}_${revision}` for the binary symlink; this way it won't override whatever sage is installed in the system so I can test on a live system.

The doctest failures for `sympow` should be fixed when #34077 is merged.

At some point I plan on:
 - investigating all the doctest failures, try to fix them or find a workaround (goal: enable check and still have CI pass)
 - investigate https://trac.sagemath.org/ticket/30766 to see if we can get it working on system python 3.10.
 - add more packages to void:
    - standard pkgs missing: `brial cliquer gfan libbraiding libhomfly lrcalc nauty palp pdf2svg tachyon`
    - optional pkgs missing: `4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb`

Note that https://trac.sagemath.org/ticket/30766 mentions some updates necessary to support python 3.10, some of which we don't have, namely:
 - `python3-Babel` update to 2.9.1
 - `python3-traitlets` update to 5.1.1
 - `python3-distlib` update to 0.3.3

Most probably I won't have time to follow up much on this PR before next weekend.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (42 preceding siblings ...)
  2021-11-14 21:47 ` tornaria
@ 2021-11-15 15:58 ` leahneukirchen
  2021-11-15 16:16 ` tornaria
                   ` (194 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-11-15 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-969053713

Comment:
I think we are still installing too much. Wouldn't it be enough if /usr/lib/sage was $SAGELOCAL?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (43 preceding siblings ...)
  2021-11-15 15:58 ` leahneukirchen
@ 2021-11-15 16:16 ` tornaria
  2021-11-17  9:20 ` dkwo
                   ` (193 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-15 16:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-969072495

Comment:
> I think we are still installing too much. Wouldn't it be enough if /usr/lib/sage was $SAGELOCAL?

That's what revision 1 did, namely: instead of compiling in place, compile in `/build` and use `--prefix=/usr/lib/sage-$version`. Then the whole of $SAGELOCAL ended up in /usr/lib/sage-$version but it didn''t work since sage expects to have all source available for inline help and for doctesting; moreover it was looking for it at `/builddir/sage-$version`, etc...

So from what's installed now (revision 3), we must keep at least `local` and `src`. From the rest `logs` we can definitely kill, I didn't do it just to have it around while we are trying working in case it's useful but it should go. I don't know about `build`, there's 22M left and I would need to look carefully to see what's needed and what's not needed. The rest is small stuff most of it should be safe to remove but I rather have all tests passing before I start pruning.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (44 preceding siblings ...)
  2021-11-15 16:16 ` tornaria
@ 2021-11-17  9:20 ` dkwo
  2021-11-20 22:12 ` [PR PATCH] [Updated] " tornaria
                   ` (192 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-17  9:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-971388341

Comment:
> Note that https://trac.sagemath.org/ticket/30766 mentions some updates necessary to support python 3.10, some of which we don't have, namely:
> 
>     * `python3-Babel` update to 2.9.1
> 
>     * `python3-traitlets` update to 5.1.1
> 
>     * `python3-distlib` update to 0.3.3
> 

Aren't those shipped by `sage` anyway at the moment though, even if `python3` comes from system?
If so, their priority is on the same level as say `gap`.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (45 preceding siblings ...)
  2021-11-17  9:20 ` dkwo
@ 2021-11-20 22:12 ` tornaria
  2021-11-21  9:37 ` dkwo
                   ` (191 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-20 22:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta5
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 14379 bytes --]

From 34773deb2ca2fdbea3d61f5cf93e9aec8ac79beb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/6] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 9bda4cb647d64026e2e82f99ef8a1a251c96c628 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/6] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 21a5106c8b7b48ca751cd71503dc9b0e31f9cc38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/6] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 38f69160565dc1334195cc3b549e0e99f128056f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/6] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 4dc5be66df29ef22f8d1a02fc42a974e442686c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/6] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 65e8719b8e0e6ee7dc25073e158b843eef7f94e4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 6/6] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (46 preceding siblings ...)
  2021-11-20 22:12 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-21  9:37 ` dkwo
  2021-11-21 14:00 ` tornaria
                   ` (190 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-21  9:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 5849 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974783747

Comment:
With the `beta7`, using
```
checkdepends=${makedepends}
do_check() {
  ./sage -tp ${XBPS_MAKEJOBS} --all
}
```
I got the same errors as reported in https://github.com/void-linux/void-packages/pull/34030#issuecomment-968081092 , plus a few more ones, of the same nature (rounding errors). Do we have any issue or missing patch with `arb`?
```
sage -t --random-seed=143111302483655198481928268308882618130 src/sage/functions/gamma.py  # 1 doctest failed
File "src/sage/functions/gamma.py", line 1052, in sage.functions.gamma.Function_beta._method_arguments
Failed example:
    RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
Expected:
    [7.407662 +/- 6.17e-7]
Got:
    [7.4076616 +/- 5.44e-8]

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/rings/complex_arb.pyx  # 3 doctests failed
File "src/sage/rings/complex_arb.pyx", line 4192, in sage.rings.complex_arb.ComplexBall.Ei
Failed example:
    CBF(Ei(I))
Expected:
    [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
Got:
    [0.337403922900968 +/- 4.31e-16] + [2.51687939716208 +/- 2.01e-15]*I
**********************************************************************
File "src/sage/rings/complex_arb.pyx", line 4242, in sage.rings.complex_arb.ComplexBall.Ci
Failed example:
    CBF(Ci(I))
Expected:
    [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
Got:
    [0.837866940980208 +/- 4.78e-16] + [1.570796326794897 +/- 5.54e-16]*I
**********************************************************************
File "src/sage/rings/complex_arb.pyx", line 4294, in sage.rings.complex_arb.ComplexBall.Chi
Failed example:
    CBF(Chi(I))
Expected:
    [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
Got:
    [0.337403922900968 +/- 3.80e-16] + [1.570796326794897 +/- 5.54e-16]*I

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/rings/real_arb.pyx  # 12 doctests failed
File "src/sage/rings/real_arb.pyx", line 3492, in sage.rings.real_arb.RealBall.Ei
Failed example:
    RBF(1).Ei()
Expected:
    [1.89511781635594 +/- 4.94e-15]
Got:
    [1.89511781635594 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3497, in sage.rings.real_arb.RealBall.Ei
Failed example:
    RBF(Ei(1))
Expected:
    [1.89511781635594 +/- 4.94e-15]
Got:
    [1.89511781635594 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3534, in sage.rings.real_arb.RealBall.Ci
Failed example:
    RBF(1).Ci()
Expected:
    [0.337403922900968 +/- 3.25e-16]
Got:
    [0.337403922900968 +/- 3.80e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3539, in sage.rings.real_arb.RealBall.Ci
Failed example:
    RBF(Ci(1))
Expected:
    [0.337403922900968 +/- 3.25e-16]
Got:
    [0.337403922900968 +/- 3.80e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3578, in sage.rings.real_arb.RealBall.Chi
Failed example:
    RBF(1).Chi()
Expected:
    [0.837866940980208 +/- 4.72e-16]
Got:
    [0.837866940980208 +/- 4.78e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3583, in sage.rings.real_arb.RealBall.Chi
Failed example:
    RBF(Chi(1))
Expected:
    [0.837866940980208 +/- 4.72e-16]
Got:
    [0.837866940980208 +/- 4.78e-16]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3600, in sage.rings.real_arb.RealBall.li
Failed example:
    RBF(3).li()
Expected:
    [2.16358859466719 +/- 4.72e-15]
Got:
    [2.16358859466719 +/- 5.11e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3624, in sage.rings.real_arb.RealBall.Li
Failed example:
    RBF(3).Li()
Expected:
    [1.11842481454970 +/- 7.61e-15]
Got:
    [1.11842481454970 +/- 8.00e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3651, in sage.rings.real_arb.RealBall.beta
Failed example:
    RBF(sin(3)).beta(RBF(2/3).sqrt())
Expected:
    [7.407661629415 +/- 1.07e-13]
Got:
    [7.4076616294151 +/- 5.60e-14]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3653, in sage.rings.real_arb.RealBall.beta
Failed example:
    RealBallField(100)(7/2).beta(1)
Expected:
    [0.28571428571428571428571428571 +/- 5.23e-30]
Got:
    [0.28571428571428571428571428571 +/- 4.93e-30]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3688, in sage.rings.real_arb.RealBall.gamma
Failed example:
    RBF(gamma(3/2, RBF(2).sqrt()))
Expected:
    [0.37118875695353 +/- 3.00e-15]
Got:
    [0.37118875695353 +/- 3.01e-15]
**********************************************************************
File "src/sage/rings/real_arb.pyx", line 3690, in sage.rings.real_arb.RealBall.gamma
Failed example:
    RBF(3/2).gamma_inc(RBF(2).sqrt())
Expected:
    [0.37118875695353 +/- 3.00e-15]
Got:
    [0.37118875695353 +/- 3.01e-15]

sage -t --random-seed=143111302483655198481928268308882618130 src/sage/symbolic/function.pyx  # 1 doctest failed
File "src/sage/symbolic/function.pyx", line 629, in sage.symbolic.function.Function._is_numerical
Failed example:
    gamma(b, 1)
Expected:
    [0.50728223 +/- 4.67e-9]
Got:
    [0.507282234 +/- 3.81e-10]
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (47 preceding siblings ...)
  2021-11-21  9:37 ` dkwo
@ 2021-11-21 14:00 ` tornaria
  2021-11-21 19:44 ` dkwo
                   ` (189 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-21 14:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974822824

Comment:
Are you using system arb? There used to be some issue with rounding in `gamma_fmpq` that was fixed upstream in 2.21.1 (cf https://github.com/fredrik-johansson/arb/commit/450435a84a40acc1871cd84f1caf2ea47c11a18c)

Since sagemath is still shipping 2.19, maybe that's the reason?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (48 preceding siblings ...)
  2021-11-21 14:00 ` tornaria
@ 2021-11-21 19:44 ` dkwo
  2021-11-22 12:51 ` tornaria
                   ` (188 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-21 19:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-974882319

Comment:
I believe I'm using system `arb`.
Btw, I have a weird issue: if I build beta7, it only rebuilds sage the library, while using the rest from my system.
Wasn't the build supposed to happen in a chroot? How come it knows I have beta6 installed?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta5
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (49 preceding siblings ...)
  2021-11-21 19:44 ` dkwo
@ 2021-11-22 12:51 ` tornaria
  2021-11-22 13:17 ` [WIP] New package: sagemath-9.5.beta7 dkwo
                   ` (187 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 12:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2361 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975490505

Comment:
 Report on test failures for `sagemath-9.5.beta7_1` using all possible standard packages from system.

1. Failures due to missing documentation. These are all marked "optional - dochtml".

Solution: disable "dochtml" in the options to test so they are skipped.

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/misc/sagedoc.py  # 4 doctests failed
```

2. Problem because a new warning in pari 2.13.3

Solution: this will be fixed by https://trac.sagemath.org/ticket/32797

Patch: https://git.sagemath.org/sage.git/patch/?id=f5f7a86908daf60b25e66e6a189c51ada7e0a732

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/lfunctions/pari.py  # 1 doctest failed
```

3. Problem because libSingular is used from system

Solution: this will be fixed by https://trac.sagemath.org/ticket/32880

Patch: https://git.sagemath.org/sage.git/patch/?id=17e308fd9d56d022ed28592f93f07ec8dce530ef

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/env.py  # 1 doctest failed
```

4. Problem because giac is upgraded to 1.7.0.x

This is reported in https://trac.sagemath.org/ticket/32880

No solution yet

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/min_max.py  # 2 doctests failed
```

5. Problems because arb is upgraded to 2.21

This will be fixed by https://trac.sagemath.org/ticket/32905

Note that downgrading the shared lib to arb-2.20.0_1 (without even recompiling sage) makes all of these tests to pass.

Patch: https://git.sagemath.org/sage.git/patch/?id=2ee7b99e0270f80cf03b80418372f45274f46051

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/gamma.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/complex_arb.pyx  # 3 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/real_arb.pyx  # 12 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/symbolic/function.pyx  # 1 doctest failed
```


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (50 preceding siblings ...)
  2021-11-22 12:51 ` tornaria
@ 2021-11-22 13:17 ` dkwo
  2021-11-22 14:30 ` [PR PATCH] [Updated] " tornaria
                   ` (186 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 13:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975513044

Comment:
Very well, so we are left with
```
src/sage_setup/find.py
src/sage/tests/cmdline.py
src/sage/rings/tate_algebra_ideal.pyx
```
failing, right?
Could you add `https` to distfiles and the newly added packages to makedepends, in the next iteration?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (51 preceding siblings ...)
  2021-11-22 13:17 ` [WIP] New package: sagemath-9.5.beta7 dkwo
@ 2021-11-22 14:30 ` tornaria
  2021-11-22 14:35 ` tornaria
                   ` (185 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 27063 bytes --]

From 0fc1a24bb0e451b7e38a19567a34917d42ac85e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 1/7] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 39ee86e12aae3feb374fe263d8c977d14f6c19c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 2/7] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 338692887c7186b776b192af8dcc536849cceb8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 3/7] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 21b053172d023a556f022f632af48b5efedefb81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 4/7] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From d131943a21b36a2c35b65566cf8ef82652b7574c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 5/7] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 0b68044a2f53c384e07956484b673b8a5ef876b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 6/7] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 7dcff791d4a6eccd8584ea713f56346f84661fcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 7/7] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (52 preceding siblings ...)
  2021-11-22 14:30 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-22 14:35 ` tornaria
  2021-11-22 14:55 ` tornaria
                   ` (184 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 14:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975591928

Comment:
New version:
 - add more dependencies
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles

With this, the only expected doctest failures are the 2 in `src/sage/functions/min_max.py` which seem to be caused by the upgrade to giac-1.7.0 and are reported upstream at https://trac.sagemath.org/ticket/32880 with no fix so far.

The main thing now is to see if this can be made to work with system python 3.10.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (53 preceding siblings ...)
  2021-11-22 14:35 ` tornaria
@ 2021-11-22 14:55 ` tornaria
  2021-11-22 15:22 ` tornaria
                   ` (183 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 14:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975609798

Comment:
> ```
> src/sage_setup/find.py
> src/sage/tests/cmdline.py
> src/sage/rings/tate_algebra_ideal.pyx
> ```

I get the failure in `cmdline.py` when running tests inside the xbps-src chroot, but not when running outside.

As for the other two, I've never seen them. Are they on musl or glibc?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (54 preceding siblings ...)
  2021-11-22 14:55 ` tornaria
@ 2021-11-22 15:22 ` tornaria
  2021-11-22 15:30 ` dkwo
                   ` (182 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 15:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975637205

Comment:
The failures in `cmdline.py` are because we installed pytest... If we don't, then this failures go away.

The second one should go away after https://trac.sagemath.org/ticket/32892. The first one, I don't know.

We could workaround it by not installing pytest in post_build()...



^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (55 preceding siblings ...)
  2021-11-22 15:22 ` tornaria
@ 2021-11-22 15:30 ` dkwo
  2021-11-22 15:30 ` dkwo
                   ` (181 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 15:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975643915

Comment:
They are on glibc.
Does `sage-9.5.beta7_1 -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 /usr/lib/sage-9.5.beta7/src/sage/rings/tate_algebra_ideal.pyx` pass for you (outside of chroot, just in the terminal)?
Same for `sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py` ?
Btw, I now have
```
$ ls /usr/lib/sage-9.5.beta
sage-9.5.beta5/ sage-9.5.beta6/ sage-9.5.beta7/
```
even after removing `sage` via xbps-remove. Should I remove those by hand?
I thought we added `pytest` to have more tests..

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (56 preceding siblings ...)
  2021-11-22 15:30 ` dkwo
@ 2021-11-22 15:30 ` dkwo
  2021-11-22 15:41 ` dkwo
                   ` (180 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 15:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975643915

Comment:
They are on glibc.
Does `sage-9.5.beta7_1 -t --warn-long 35.7 --random-seed=327098103431076596046796804314805549386 /usr/lib/sage-9.5.beta7/src/sage/rings/tate_algebra_ideal.pyx` pass for you (outside of chroot, just in the terminal)?
Same for `sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py` ?
Btw, I now have
```
$ ls /usr/lib/sage-9.5.beta
sage-9.5.beta5/ sage-9.5.beta6/ sage-9.5.beta7/
```
even after removing `sagemath` via xbps-remove. Should I remove those by hand?
I thought we added `pytest` to have more tests..

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (57 preceding siblings ...)
  2021-11-22 15:30 ` dkwo
@ 2021-11-22 15:41 ` dkwo
  2021-11-22 16:30 ` dkwo
                   ` (179 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 15:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975655162

Comment:
Anyhow, great work.
Now that we run tests in the chroot, shall we trim down the `depends` and what is actually installed?
I guess `giac` was needed there, but not all `devel` stuff (just to run sage).

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (58 preceding siblings ...)
  2021-11-22 15:41 ` dkwo
@ 2021-11-22 16:30 ` dkwo
  2021-11-22 16:35 ` tornaria
                   ` (178 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 16:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975701012

Comment:
Ok, I stand corrected: if run from inside the chroot, both `src/sage/rings/tate_algebra_ideal.pyx` and `src/sage_setup/find.py` now pass.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (59 preceding siblings ...)
  2021-11-22 16:30 ` dkwo
@ 2021-11-22 16:35 ` tornaria
  2021-11-22 17:09 ` dkwo
                   ` (177 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 16:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975706551

Comment:
With that particular random-seed it fails every time:
```
$ ./sage -t --random-seed=327098103431076596046796804314805549386 src/sage/rings/tate_algebra_ideal.pyx 
Running doctests with ID 2021-11-22-13-31-59-591c1eef.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 36.3 --random-seed=327098103431076596046796804314805549386 src/sage/rings/tate_algebra_ideal.pyx
**********************************************************************
File "src/sage/rings/tate_algebra_ideal.pyx", line 198, in sage.rings.tate_algebra_ideal.TateAlgebraIdeal._contains_
Failed example:
    I.random_element() in I
Expected:
    True
Got:
    False
**********************************************************************
```

The second one I can't reproduce:
```
$ ./sage -t --random-seed=2922128458579573960176688891507420022 src/sage_setup/find.py
Running doctests with ID 2021-11-22-13-33-39-21d4fa99.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 36.3 --random-seed=2922128458579573960176688891507420022 src/sage_setup/find.py
    [45 tests, 0.63 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (60 preceding siblings ...)
  2021-11-22 16:35 ` tornaria
@ 2021-11-22 17:09 ` dkwo
  2021-11-22 17:28 ` tornaria
                   ` (176 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 17:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 6740 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975739343

Comment:
Are these intentional?
`Shebang converted to '#!/usr/bin/python3': /usr/lib/sage-9.5.beta7/src/setup.py`

As for the second, it still fails for me _outside_ of chroot, but perhaps it is just missing stuff.
```
[nicolo@mabragor ~]$ sage-9.5.beta7_1 -t --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find
.py
Running doctests with ID 2021-11-22-18-06-28-7269724d.
Git branch: develop
Using --optional=build,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting 1 file.
sage -t --warn-long 42.8 --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 303, in sage_setup.find.find_extra_files
Failed example:
    extras["sage/ext/interpreters"]
Expected:
    ['.../src/sage/ext/interpreters/wrapper_cdf.pxd', ...wrapper_cdf.h...]
Got:
    ['/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rr.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cdf.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cc.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rdf.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rdf.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_py.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cc.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_py.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_cdf.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_rr.pyx',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_el.pxd',
     '/usr/lib/sage-9.5.beta7/src/sage/ext/interpreters/wrapper_el.pyx']
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 364, in sage_setup.find.installed_files_by_module
Failed example:
    (f1, f2) = sorted(files_by_module['sage.structure'])
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[5]>", line 1, in <module>
        (f1, f2) = sorted(files_by_module['sage.structure'])
    ValueError: not enough values to unpack (expected 2, got 1)
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 365, in sage_setup.find.installed_files_by_module
Failed example:
    f1
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[6]>", line 1, in <module>
        f1
    NameError: name 'f1' is not defined
**********************************************************************
File "/usr/lib/sage-9.5.beta7/src/sage_setup/find.py", line 367, in sage_setup.find.installed_files_by_module
Failed example:
    f2
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, i
n _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088,
in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage_setup.find.installed_files_by_module[7]>", line 1, in <module>
        f2
    NameError: name 'f2' is not defined
**********************************************************************
**********************************************************************
2 items had failures:
   1 of   7 in sage_setup.find.find_extra_files
   3 of  10 in sage_setup.find.installed_files_by_module
    [45 tests, 4 failures, 0.54 s]
----------------------------------------------------------------------
sage -t --warn-long 42.8 --random-seed=2922128458579573960176688891507420022 /usr/lib/sage-9.5.beta7/src/sage_setup/find.py  # 4 doctest
s failed
----------------------------------------------------------------------
Total time for all tests: 0.6 seconds
    cpu time: 0.5 seconds
    cumulative wall time: 0.5 seconds
========================================================= test session starts ==========================================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /usr/lib/sage-9.5.beta7/src, configfile: tox.ini
collected 0 items

=========================================================== warnings summary ===========================================================
../../usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/cacheprovider.py:428
  /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/cacheprovider.py:428: PytestCacheWarni
ng: cache could not write path /usr/lib/sage-9.5.beta7/src/.pytest_cache/v/cache/nodeids
    config.cache.set("cache/nodeids", sorted(self.cached_nodeids))

../../usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/stepwise.py:49
  /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/_pytest/stepwise.py:49: PytestCacheWarning: ca
che could not write path /usr/lib/sage-9.5.beta7/src/.pytest_cache/v/cache/stepwise
    session.config.cache.set(STEPWISE_CACHE_DIR, [])

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================= 2 warnings in 0.00s ==========================================================
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (61 preceding siblings ...)
  2021-11-22 17:09 ` dkwo
@ 2021-11-22 17:28 ` tornaria
  2021-11-22 17:52 ` dkwo
                   ` (175 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 17:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975490505

Comment:
 Report on test failures for `sagemath-9.5.beta7_1` using all possible standard packages from system.

1. Failures due to missing documentation. These are all marked "optional - dochtml".

Solution: disable "dochtml" in the options to test so they are skipped.

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/misc/sagedoc.py  # 4 doctests failed
```

2. Problem because a new warning in pari 2.13.3

Solution: this will be fixed by https://trac.sagemath.org/ticket/32797

Patch: https://git.sagemath.org/sage.git/patch/?id=f5f7a86908daf60b25e66e6a189c51ada7e0a732

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/lfunctions/pari.py  # 1 doctest failed
```

3. Problem because libSingular is used from system

Solution: this will be fixed by https://trac.sagemath.org/ticket/32880

Patch: https://git.sagemath.org/sage.git/patch/?id=17e308fd9d56d022ed28592f93f07ec8dce530ef

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/env.py  # 1 doctest failed
```

4. Problem because giac is upgraded to 1.7.0.x

This is reported in https://trac.sagemath.org/ticket/31563
No solution yet

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/min_max.py  # 2 doctests failed
```

5. Problems because arb is upgraded to 2.21

This will be fixed by https://trac.sagemath.org/ticket/32905

Note that downgrading the shared lib to arb-2.20.0_1 (without even recompiling sage) makes all of these tests to pass.

Patch: https://git.sagemath.org/sage.git/patch/?id=2ee7b99e0270f80cf03b80418372f45274f46051

```
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/functions/gamma.py  # 1 doctest failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/complex_arb.pyx  # 3 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/rings/real_arb.pyx  # 12 doctests failed
sage -t --random-seed=297278893996117458976707301988403259133 src/sage/symbolic/function.pyx  # 1 doctest failed
```

EDIT: fix a link

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (62 preceding siblings ...)
  2021-11-22 17:28 ` tornaria
@ 2021-11-22 17:52 ` dkwo
  2021-11-22 23:41 ` tornaria
                   ` (174 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-22 17:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975775712

Comment:
Also, it would be useful to have a symlink so that sage can be used from jupyterlab.
Arch does it like that:
```
# fix symlinks to assets
  _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"`
  for _i in $(ls "$srcdir"/sage-$pkgver/src/sage/ext_data/notebook-ipython); do
    rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
    ln -s $_pythonpath/sage/ext_data/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
  done
```
I'll look into it later.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (63 preceding siblings ...)
  2021-11-22 17:52 ` dkwo
@ 2021-11-22 23:41 ` tornaria
  2021-11-23  3:22 ` [PR PATCH] [Updated] " tornaria
                   ` (173 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-22 23:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3749 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976010587

Comment:
Doctest failures in `x86_64-musl`:
```
----------------------------------------------------------------------
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/functions/min_max.py  # 2 doctests failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/tests/cmdline.py  # 1 doctest failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/lfunctions/sympow.py  # 3 doctests failed
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/misc/gperftools.py  # 1 doctest failed
----------------------------------------------------------------------
```

The first two are just the same as in glibc. The second one is actually fixed by just not installing pytest which I'll do in the next commit.

The third one is
```
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/lfunctions/sympow.py
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 279, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('389a'))
Expected:
    (2, '7.59317e-01')
Got:
    (2, '7.59316e-01')
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 281, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve('5077a'))
Expected:
    (3, '1.73185e+00')
Got:
    (3, '1.73184e+00')
**********************************************************************
File "src/sage/lfunctions/sympow.py", line 283, in sage.lfunctions.sympow.Sympow.analytic_rank
Failed example:
    sympow.analytic_rank(EllipticCurve([1, -1, 0, -79, 289]))
Expected:
    (4, '8.94385e+00')
Got:
    (4, '8.94384e+00')
**********************************************************************
1 item had failures:
   3 of   6 in sage.lfunctions.sympow.Sympow.analytic_rank
    [10 tests, 3 failures, 0.90 s]
```
Seems like a mishandling of fpu control words in sympow that affects musl printing routines (I doubt is anything more than printing since all is computed at least to double precision which is ~18 digits it would be unexpected to get a difference in the 6th decimal place).

The last one is
```
sage -t --random-seed=263343733075529654576520741661576957914 src/sage/misc/gperftools.py
**********************************************************************
File "src/sage/misc/gperftools.py", line 118, in sage.misc.gperftools.Profiler._libc
Failed example:
    Profiler()._libc()
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.gperftools.Profiler._libc[1]>", line 1, in <module>
        Profiler()._libc()
      File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/misc/gperftools.py", line 129, in _libc
        raise ImportError('failed to open libc')
    ImportError: failed to open libc
**********************************************************************
1 item had failures:
   1 of   3 in sage.misc.gperftools.Profiler._libc
    [35 tests, 1 failure, 0.89 s]
```
I'll look into it.


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (64 preceding siblings ...)
  2021-11-22 23:41 ` tornaria
@ 2021-11-23  3:22 ` tornaria
  2021-11-23  3:25 ` tornaria
                   ` (172 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-23  3:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 42178 bytes --]

From e483ed0e729742ec8eb83eb81d0f7007ad95708e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 19:24:50 -0300
Subject: [PATCH 1/9] sympow: do not mess with fpu control word

It turns out doing that on musl results in wrong output for doubles.
Moreover any cpu with sse2 should not be using fp registers anyway.

For i686 without sse, the configure will figure out that floats are
80 bits and add -ffloat-store to CFLAGS to force them to be 64 bits.

A simple way to test it is to run

    $ sympow -curve '[0,0,0,0,1]' -analrank
    ...
    Analytic Rank is 0 : L-value 7.01091e-01

When broken this prints "7.01092e-01" instead.

The actual value computed to 128 bits with pari is:

    $ echo 'elllseries(ellinit([0,0,0,0,1]),1)' | gp -q
    0.70109105266272713058750953952514706773

so the glibc output is the correct one.

What is broken is not computing but printing, as fmt_fp in musl uses
long double, which means messing with fpu control word breaks it.
This is important since sagemath parses sympow output.

This affects sagemath doctests as in

    $ sage -t src/sage/lfunctions/sympow.py
    ...
    (3 failures)

After this commit, the doctest in question passes.
---
 .../patches/dont-change-fpu-control-word.patch   | 16 ++++++++++++++++
 srcpkgs/sympow/template                          |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sympow/patches/dont-change-fpu-control-word.patch

diff --git a/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch b/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch
new file mode 100644
index 000000000000..2a1155111268
--- /dev/null
+++ b/srcpkgs/sympow/patches/dont-change-fpu-control-word.patch
@@ -0,0 +1,16 @@
+--- a/Configure	2021-11-22 22:20:42.512565997 -0300
++++ b/Configure	2021-11-22 23:10:09.986457874 -0300
+@@ -154,9 +154,10 @@
+ done
+ 
+ # Select the most appropriate FPU control scheme
+-for FLAG in '-DISOC99_FENV' '-DFPUCONTROLH' '-Dx86'; do
+-    try_add_CFLAG $FLAG && break
+-done
++## disable messing with fpu control word -- not worth it
++# for FLAG in '-DISOC99_FENV' '-DFPUCONTROLH' '-Dx86'; do
++#     try_add_CFLAG $FLAG && break
++# done
+ 
+ # Some flags to try as last resort.  These hurt performance, so only add
+ # them if needed.
diff --git a/srcpkgs/sympow/template b/srcpkgs/sympow/template
index d484cf847f57..48e2399b72e3 100644
--- a/srcpkgs/sympow/template
+++ b/srcpkgs/sympow/template
@@ -1,7 +1,7 @@
 # Template file for 'sympow'
 pkgname=sympow
 version=2.023.6
-revision=2
+revision=3
 wrksrc=${pkgname}-v${version}
 build_style=configure
 make_build_target=all

From 6b25dfcb8e39077d1283daa31e621c1ac8227454 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 2/9] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 0962da75c6bb03ae4757480178a1949f3457c41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 3/9] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 7cfead0840766a381c15e94e194645dbeb8df255 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 4/9] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 63c3e5960b171bdea8a63c08251f904307128c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 5/9] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 6d80881d35949067e13d1b1c8f77525ead03cd00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 6/9] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 442e3dfd448344ce1843b68417367a975f2bfc94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 7/9] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From f165af50129b01e61b67c57659aa2af0d21e897b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 8/9] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From b971fa9d0ce6f514e5a7749d9f14ae843ae57fbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 9/9] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (65 preceding siblings ...)
  2021-11-23  3:22 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-23  3:25 ` tornaria
  2021-11-23  9:22 ` dkwo
                   ` (171 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-23  3:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976130713

Comment:
New version:
 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (66 preceding siblings ...)
  2021-11-23  3:25 ` tornaria
@ 2021-11-23  9:22 ` dkwo
  2021-11-23 12:16 ` tornaria
                   ` (170 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-23  9:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976320284

Comment:
This looks good.
Now on x86_64 (both glibc and musl) only
`sage -t --random-seed=239417738005644781849247931063272806042 src/sage/functions/min_max.py  # 2 doctests failed`
fails, as you pointed out, while on i686 there are also
```
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
```
of which only the last one seems a real failure.
Btw, do we need `linbox` in makedepends at the moment? see
`linbox-1.6.3.p1:                             standard, will be installed as an SPKG`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (67 preceding siblings ...)
  2021-11-23  9:22 ` dkwo
@ 2021-11-23 12:16 ` tornaria
  2021-11-24 19:28 ` tornaria
                   ` (169 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-23 12:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1831 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976455781

Comment:
Same here, on 64 bit (glibc and musl) only the single failure due to giac-1.7

> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
> ```
This is due to a faulty sympow on i686, see https://github.com/void-linux/void-packages/pull/34209#issuecomment-976444205


> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
> ```

These 3 in polyhedron might also be caused by miscompilation of some external program or library, it would be useful to try to see which external packages are used in those files, remove them from makedepends and recompile/rerun these tests.

In addition to those I also had (on i686)
```
sage -t --random-seed=335940497943411300414171505300249115189 src/sage/functions/orthogonal_polys.py  # Timed out
```

No idea if this is related, but it could also be due to some miscompilation.


> Btw, do we need `linbox` in makedepends at the moment? see `linbox-1.6.3.p1: standard, will be installed as an SPKG`

No, linbox is not picked up from system yet, there is https://trac.sagemath.org/ticket/29631 which I'll try later. Note that the message is different for packages not found (something like "pkg is not available from system, will be installed as SPKG").



^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (68 preceding siblings ...)
  2021-11-23 12:16 ` tornaria
@ 2021-11-24 19:28 ` tornaria
  2021-11-25 22:41 ` tornaria
                   ` (168 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-24 19:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-976455781

Comment:
Same here, on 64 bit (glibc and musl) only the single failure due to giac-1.7

On i686:

> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/schemes/elliptic_curves/ell_rational_field.py  # 2 doctests failed
> ```
This is due to a faulty sympow on i686, see https://github.com/void-linux/void-packages/pull/34209#issuecomment-976444205


> ```
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/base.py  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx  # Killed due to abort
> sage -t --random-seed=313681864676731812413561326645236136667 src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx  # Timed out
> ```

These 3 in polyhedron might also be caused by miscompilation of some external program or library, it would be useful to try to see which external packages are used in those files, remove them from makedepends and recompile/rerun these tests.

In addition to those I also had (on i686)
```
sage -t --random-seed=335940497943411300414171505300249115189 src/sage/functions/orthogonal_polys.py  # Timed out
```

No idea if this is related, but it could also be due to some miscompilation.


> Btw, do we need `linbox` in makedepends at the moment? see `linbox-1.6.3.p1: standard, will be installed as an SPKG`

No, linbox is not picked up from system yet, there is https://trac.sagemath.org/ticket/29631 which I'll try later. Note that the message is different for packages not found (something like "pkg is not available from system, will be installed as SPKG").



^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (69 preceding siblings ...)
  2021-11-24 19:28 ` tornaria
@ 2021-11-25 22:41 ` tornaria
  2021-11-26  3:04 ` [PR PATCH] [Updated] " tornaria
                   ` (167 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-25 22:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-975591928

Comment:
New version:
 - add more dependencies
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles

With this, the only expected doctest failures are the 2 in `src/sage/functions/min_max.py` which seem to be caused by the upgrade to giac-1.7.0 and are reported upstream at https://trac.sagemath.org/ticket/31563 with no fix so far.

The main thing now is to see if this can be made to work with system python 3.10.

Edit: fix link

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (70 preceding siblings ...)
  2021-11-25 22:41 ` tornaria
@ 2021-11-26  3:04 ` tornaria
  2021-11-26  3:12 ` tornaria
                   ` (166 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-26  3:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 45198 bytes --]

From 05b0c3942ad86b95e93f06a7e17ac518ffa1cf9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 1/8] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 262f31eb166bdf8dde211a724d570c5c4f6156d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 2/8] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 701eb7ed5c1cb69f94a8c1faa7bc63392e8e4b53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 3/8] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From d15b8d8ffe769fc6e94d39f8f8041ca208574ca1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 4/8] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From dc8d1fa87812662564ba7c360f9ccad4bdb2aab4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 5/8] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 8180fcfea461af888ee490398f6bbb9b5431a2f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 6/8] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From f5c88fcfbf0927363290cc68718f746356b8ba30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 7/8] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From b6265d590293584b50ef1df433845cae39e6f2fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 8/8] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (71 preceding siblings ...)
  2021-11-26  3:04 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-26  3:12 ` tornaria
  2021-11-26  9:30 ` dkwo
                   ` (165 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-26  3:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979655784

Comment:
The new version uses system linbox. Also includes a patch to skip the doctest that fails because of giac 1.7.0 so we expect all tests to pass on x86_64 and x86_64-musl. As for i686, I'll ignore it for now, there are better ways to spend my time and I'm not even sure anyone will use it.

Most of the patches are expected to be merged upstream (probably soon, possibly for 9.5).

The main blocker at this time seems to be making it run on python 3.10.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (72 preceding siblings ...)
  2021-11-26  3:12 ` tornaria
@ 2021-11-26  9:30 ` dkwo
  2021-11-26  9:31 ` dkwo
                   ` (164 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-26  9:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```
Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)
Maybe this is creating issues?
```
# for now use sage-${version}_${revision} so it doesn't override
# other sage installed in the system
ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (73 preceding siblings ...)
  2021-11-26  9:30 ` dkwo
@ 2021-11-26  9:31 ` dkwo
  2021-11-26  9:33 ` dkwo
                   ` (163 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-26  9:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```
Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (74 preceding siblings ...)
  2021-11-26  9:31 ` dkwo
@ 2021-11-26  9:33 ` dkwo
  2021-11-26 13:10 ` tornaria
                   ` (162 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-26  9:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979820980

Comment:
Sounds reasonable.
On musl, the failures are not real (I think) (and similar for i686)
```
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
```

Do you think python3.10 will make it into sage9.5?

Can you bring the `depends` down to what is really necessary, and make sure it removes properly with xbps-remove?
(last time I tried, it left behind `/usr/lib/sage..`)

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (75 preceding siblings ...)
  2021-11-26  9:33 ` dkwo
@ 2021-11-26 13:10 ` tornaria
  2021-11-27 14:08 ` dkwo
                   ` (161 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-26 13:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-979968082

Comment:
> Sounds reasonable. On musl, the failures are not real (I think) (and similar for i686)
> 
> ```
> sage -t --random-seed=53597881869110074179920514523677232559 src/sage/parallel/map_reduce.py  # Timed out
> sage -t --random-seed=53597881869110074179920514523677232559 src/sage/schemes/affine/affine_point.py  # Killed due to kill signal
> ```

Why do you mean with "not real" ? Occasionally a timeout could be a false positive: when a test takes too long it could sometimes goes over the timeout (in that case it should has to be tagged as "# long test" so it's still a bug). All of these may be very real, just random. The failures on i686 are definitely real.
  
> Do you think python3.10 will make it into sage9.5?

I don't know, it's progressing slowly.

> Can you bring the `depends` down to what is really necessary,

What should I remove? We have to make sure all tests pass because a failed tests is a missing feature.

> and make sure it removes properly with xbps-remove? (last time I tried, it left behind `/usr/lib/sage..`)

Can you tell me which files are left behind?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (76 preceding siblings ...)
  2021-11-26 13:10 ` tornaria
@ 2021-11-27 14:08 ` dkwo
  2021-11-28 12:32 ` tornaria
                   ` (160 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-11-27 14:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-980633918

Comment:
With regard to removing:
```
[nicolo@mabragor void-packages]$ du /usr/lib/sage-9.5.beta7
du: cannot access '/usr/lib/sage-9.5.beta7': No such file or directory
nicolo@mabragor void-packages]$ xi sagemath
Size required on disk:        3846MB
doas xbps-remove -R sagemath
[nicolo@mabragor void-packages]$ du /usr/lib/sage-9.5.beta7/
4       /usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7
8       /usr/lib/sage-9.5.beta7/local/share/gap/bin
12      /usr/lib/sage-9.5.beta7/local/share/gap
16      /usr/lib/sage-9.5.beta7/local/share
20      /usr/lib/sage-9.5.beta7/local
24      /usr/lib/sage-9.5.beta7/
```
With regard to `depends`: I'm not an expert, but I thought we should not need `-devel` packages to run it. Are tests supposed to pass even for the user or just in the build process?

As for the failures, you may be right.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (77 preceding siblings ...)
  2021-11-27 14:08 ` dkwo
@ 2021-11-28 12:32 ` tornaria
  2021-11-28 13:42 ` tornaria
                   ` (159 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 12:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-981077742

Comment:
After #34273 and https://trac.sagemath.org/ticket/32867 I am able to build sagemath using system maxima and pass all doctests.

I'd appreciate some help / comments with #34273 so it can be merged. 

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (78 preceding siblings ...)
  2021-11-28 12:32 ` tornaria
@ 2021-11-28 13:42 ` tornaria
  2021-11-28 13:52 ` tornaria
                   ` (158 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 13:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3498 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-981087871

Comment:
> With regard to removing:
> 
> ```
> 4       /usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7
> ```

This is very strange. A couple of symlinks installed by the package in this directory are not removed. For some reason the `files.plist` is wrong, here's an excerpt:
```
       <dict>
            <key>file</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/config.h</string>
            <key>mtime</key>
            <integer>1638070346</integer>
            <key>target</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/gen/config.h</string>
        </dict>
        <dict>
            <key>file</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/gac</string>
            <key>mtime</key>
            <integer>1638070346</integer>
            <key>target</key>
            <string>al/bin/gac</string>
        </dict>
        <dict>
            <key>file</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/gap</string>
            <key>mtime</key>
            <integer>1638070346</integer>
            <key>target</key>
            <string>al/bin/gap-bin</string>
        </dict>
        <dict>
            <key>file</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/src</string>
            <key>mtime</key>
            <integer>1638070346</integer>
            <key>target</key>
            <string>/usr/lib/sage-9.5.beta7/local/share/gap/src</string>
        </dict>
```
These are the four symlinks installed in this directory, but two of them are incorrectly reported
Here are the relevant contents of the tarball:
```
$ tar tvf hostdir/binpkgs/sagemath/sagemath-9.5.beta7_1.x86_64.xbps  | grep -e local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7 -e local/share/gap/ga -e local/bin/ga
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/gap -> /usr/lib/sage-9.5.beta7/local/bin/gap-bin
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/gac -> /usr/lib/sage-9.5.beta7/local/bin/gac
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/src -> ../../src
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/gap -> ../../gap
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/gac -> ../../gac
lrwxrwxrwx 0/0               0 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/share/gap/bin/x86_64-pc-linux-gnu-default64-kv7/config.h -> ../../gen/config.h
-rwxr-xr-x 0/0         2248752 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/bin/gap-bin
-rwxr-xr-x 0/0             256 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/bin/gap
-rwxr-xr-x 0/0           12559 2021-11-28 00:32 ./usr/lib/sage-9.5.beta7/local/bin/gac
```
Note that `../../src` and `../../gen/config.h` are ok (point to a directory and a file) while `../../gap` and `../../gac` point to other (absolute) symlinks. Is that the source of trouble? Maybe a bug in `xbps-create`?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (79 preceding siblings ...)
  2021-11-28 13:42 ` tornaria
@ 2021-11-28 13:52 ` tornaria
  2021-11-28 23:21 ` [PR PATCH] [Updated] " tornaria
                   ` (157 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 13:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-981089325

Comment:
> With regard to `depends`: I'm not an expert, but I thought we should not need `-devel` packages to run it. Are tests supposed to pass even for the user or just in the build process?

I don't care much about pruning the depends list at this point. We can figure out the minimal list later, at this point things are pretty much in flux and I'd rather not get false doctests failures due to forgetting to depend on something. In principle I think that, since doctests are functional, everything that is needed to pass the doctests should be installed for a full experience. Later on, if there's some large package that might be considered "optional" we could figure out whether it makes sense to leave it out.

Note that most math packages (except for some core packages) are updated much much less than sagemath itself and having them split in separate packages as we now do means they are not a toll on sagemath updates, only on first install.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (80 preceding siblings ...)
  2021-11-28 13:52 ` tornaria
@ 2021-11-28 23:21 ` tornaria
  2021-11-28 23:27 ` tornaria
                   ` (156 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 23:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 63519 bytes --]

From 0e548f6e328e538757467d2b98ca65614537cca4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 27 Nov 2021 19:38:48 -0300
Subject: [PATCH 01/10] maxima: add a subpkg maxima-ecl needed for sagemath

 - Added a build option 'ecl' (enabled by default)
 - The ecl binary and library will be in a subpkg maxima-ecl so this
   should not affect current users of maxima
 - new patches:
   - a0d7a43...: build a FASL library for ECL (this is merged upstream)
   - handle-multiple-ldflags.patch: otherwise compilation with multiple
     options in LDFLAGS fails (taken from debian)
   - matrixexp.patch: fixes an error in matrix exponentiation (taken
     from debian, this originates in sagemath)

A weak point is that the library maxima.fas is installed in
/usr/lib/ecl-${ecl_version} which is where ecl looks for them, but this
doesn't seem right.

Maybe an alternative would be to have the ecl package ship a symlink at
/usr/lib/ecl pointing to the versioned directory, then have the
maxima-ecl package place its library in the non-versioned directory.
---
 srcpkgs/maxima-ecl                            |  1 +
 ...a43e5234305bd6f1de5909d4ce5d7e1ea864.patch | 24 +++++++++++
 .../patches/handle-multiple-ldflags.patch     | 43 +++++++++++++++++++
 srcpkgs/maxima/patches/matrixexp.patch        | 23 ++++++++++
 srcpkgs/maxima/template                       | 34 ++++++++++++---
 5 files changed, 120 insertions(+), 5 deletions(-)
 create mode 120000 srcpkgs/maxima-ecl
 create mode 100644 srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
 create mode 100644 srcpkgs/maxima/patches/handle-multiple-ldflags.patch
 create mode 100644 srcpkgs/maxima/patches/matrixexp.patch

diff --git a/srcpkgs/maxima-ecl b/srcpkgs/maxima-ecl
new file mode 120000
index 000000000000..b8b0e8240fa4
--- /dev/null
+++ b/srcpkgs/maxima-ecl
@@ -0,0 +1 @@
+maxima
\ No newline at end of file
diff --git a/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
new file mode 100644
index 000000000000..e1ac1e5f6086
--- /dev/null
+++ b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
@@ -0,0 +1,24 @@
+commit a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864
+Author: Robert Dodier <robert_dodier@users.sourceforge.net>
+Date:   Mon Oct 11 22:40:13 2021 -0700
+
+    Apply patch #80: "Build a FASL library, needed by SageMath"
+    
+    This modifies maxima.system for ECL only.
+
+diff --git a/src/maxima.system b/src/maxima.system
+index d954bc2b9..525fb778e 100644
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -75,6 +75,11 @@
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+ 			 files)))
++	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			  :ld-flags
++			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
++							      (find-package "MAXIMA")))))
++			    (if (and x (not (string= x ""))) (list x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
diff --git a/srcpkgs/maxima/patches/handle-multiple-ldflags.patch b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
new file mode 100644
index 000000000000..799fc15f9185
--- /dev/null
+++ b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
@@ -0,0 +1,43 @@
+Description: Handle multiple LDFLAGS
+ Without this patch, building with LDFLAGS containing more than one flag results 
+ in flags being dropped.
+Author: Graham Inggs <ginggs@debian.org>
+Bug-Debian: http://bugs.debian.org/847925
+
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -58,6 +58,19 @@
+     (and (apply #'compile-file file :output-file object-output args)
+ 	 (c:build-fasl output :lisp-files (list object-output)))))
+ 
++(defun split-string (string &key (item #\space) (test #'char=))
++  ;; Splits the string into substrings at spaces.
++  (let ((len (length string))
++	(index 0) result)
++    (dotimes (i len
++		(progn (unless (= index len)
++			 (push (subseq string index) result))
++		       (reverse result)))
++      (when (funcall test (char string i) item)
++	(unless (= index i);; two spaces in a row
++	  (push (subseq string index i) result))
++	(setf index (1+ i))))))
++
+ #+ecl
+ (defun build-maxima-lib ()
+   (labels ((list-all-objects (module)
+@@ -79,12 +92,12 @@
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x))))
++			    (if (and x (not (string= x ""))) (split-string x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x)))
++			    (if (and x (not (string= x ""))) (split-string x)))
+ 			  :epilogue-code '(progn (cl-user::run)))))))
+ 
+ (defun maxima-binary-pathname ()
diff --git a/srcpkgs/maxima/patches/matrixexp.patch b/srcpkgs/maxima/patches/matrixexp.patch
new file mode 100644
index 000000000000..7cbd9ccac089
--- /dev/null
+++ b/srcpkgs/maxima/patches/matrixexp.patch
@@ -0,0 +1,23 @@
+Description: Fix error in matrix exponentiation
+ This patch was written by SageMath but not yet committed into Maxima releases.
+ However, it is needed for SageMath to work correctly:
+ .
+ https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
+Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
+Bug-Sage: http://trac.sagemath.org/ticket/13973
+Bug: https://sourceforge.net/p/maxima/bugs/2596/
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/share/linearalgebra/matrixexp.lisp
++++ b/share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,8 @@
+ 	   (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
+ 	   (print `(ratfac = ,$ratfac))
+ 	   (merror "Unable to find the spectrum")))
+-   
+-    (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
++
++    (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
+     (setq m (length sp))
+     (dotimes (i m)
+       (setq zi (nth i sp))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 3a95e3706447..798b4f9f00de 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -1,11 +1,11 @@
 # Template file for 'maxima'
 pkgname=maxima
 version=5.45.1
-revision=1
+revision=2
 build_style=gnu-configure
-configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec)"
+configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
 hostmakedepends="python3 perl emacs texinfo"
-makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl)"
+makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
 short_desc="Computer Algebra System"
@@ -17,10 +17,11 @@ checksum=fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
 
 nostrip=yes
 nopie=yes
-build_options="clisp sbcl"
+build_options="clisp sbcl ecl"
 desc_option_clisp="Build with CLISP"
 desc_option_sbcl="Build with SBCL"
-build_options_default="sbcl"
+desc_option_ecl="Build with ECL"
+build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
 post_install() {
@@ -66,3 +67,26 @@ xmaxima_package() {
 			${PKGDESTDIR}/usr/share/pixmaps/maxima
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima"
+
+if [ "$build_option_ecl" ]; then
+	subpackages+=" maxima-ecl"
+fi
+
+maxima-ecl_package() {
+	short_desc+=" - compiled with ECL"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		# this is /usr/lib/ecl-${ecl_version}
+		# ideally we would just place it in /usr/lib/ecl but this
+		# doesn't just work
+		# Maybe we can have the ecl package ship a symlink:
+		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
+		# and have this package just install in /usr/lib/ecl
+		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
+		vmkdir $ECLDIR
+		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
+		vmove usr/lib/maxima/${version}/binary-ecl
+	}
+}

From 64d2d52ce7735a14a90d11109a4dbe995012a86e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 02/10] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From c5b3a150ee792f28baa86a1b216328e44d21d4cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 03/10] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 33be922b813689246a067d155440ca3f20ba7613 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 04/10] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 83deef4c801299951748469e63ff807b104c98ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 05/10] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 752a1e1a1cf470fcbf64f37426d7a4908133f225 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 06/10] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From b2aa4d0f446cc5a257d8d0b55cb82607f38b05a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 07/10] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From f694705d9ed2a6afa657c94fcd629dc3649bdf90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 08/10] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From 481c143c2524d8456aa3349ec36faa4aee782593 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 09/10] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 371430a3eecd0419d34135ceba540a12a92c4bc8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 28 Nov 2021 00:32:26 -0300
Subject: [PATCH 10/10] sagemath: use system maxima

Also: add patch to use relative symlinks in gap where absolute symlinks
are now used -- otherwise xbps-create gets confused
---
 ...-spkg-install-make-symlinks-relative.patch |  27 +++
 .../patches/trac-32867-system-maxima.patch    | 174 ++++++++++++++++++
 srcpkgs/sagemath/template                     |   4 +-
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32867-system-maxima.patch

diff --git a/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
new file mode 100644
index 000000000000..c9feb870f2be
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
@@ -0,0 +1,27 @@
+From 521a9ec8d447be5bbd3a4260e7a5e0e4653e0c34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Sun, 28 Nov 2021 18:57:34 -0300
+Subject: [PATCH] build/pkgs/gap/spkg-install: make symlinks relative
+
+---
+ build/pkgs/gap/spkg-install.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 32d1fb982c..2ceadf99db 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -80,8 +80,8 @@ chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+ 
+ # Create symlinks under $GAP_ROOT for these executables, as they are expected
+ # (especially when building kernel packages) to exist
+-ln -sf "$SAGE_BIN/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/gac"
++ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
++ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+ 
+ # Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+ # to the actual path of the sources GAP was compiled from)
+-- 
+2.34.1
+
diff --git a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
new file mode 100644
index 000000000000..cb6517a388d8
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
@@ -0,0 +1,174 @@
+diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
+index ae1e0ac5e1..7dbcfa6377 100644
+--- a/build/pkgs/ecl/spkg-configure.m4
++++ b/build/pkgs/ecl/spkg-configure.m4
+@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
+     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
+   fi
+ 
+-  # Maxima cannot yet be provided by the system, so we always use
++  # Kenzo cannot yet be provided by the system, so we always use
+   # the SAGE_LOCAL path for now.
+-  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
+-
+-  # Likewise for the optional Kenzo SPKG
+   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
+ ])
+diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
+new file mode 100644
+index 0000000000..df625fecc4
+--- /dev/null
++++ b/build/pkgs/maxima/spkg-configure.m4
+@@ -0,0 +1,35 @@
++SAGE_SPKG_CONFIGURE([maxima], [
++  SAGE_SPKG_DEPCHECK([ecl], [
++    dnl First check for the "maxima" executable in the user's PATH, because
++    dnl we still use pexpect to communicate with it in a few places. We pass
++    dnl the "-l ecl" flag here to ensure that the standalone executable also
++    dnl supports ECL.
++    AC_MSG_CHECKING(if "maxima -l ecl" works)
++    AS_IF([! maxima -l ecl -q -r 'quit();' \
++             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++      AC_MSG_RESULT(no)
++      sage_spkg_install_maxima=yes
++    ], [
++      AC_MSG_RESULT(yes)
++      dnl If we have the executable, check also for the ECL library.
++      AC_MSG_CHECKING([if ECL can "require" the maxima module])
++      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
++               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++        AC_MSG_RESULT(yes)
++      ], [
++	AC_MSG_RESULT(no)
++	sage_spkg_install_maxima=yes
++      ])
++    ])
++  ])
++],[],[],[
++  # post-check
++  AS_IF([test x$sage_spkg_install_maxima = xyes], [
++    dnl Leaving this variable empty will tell sagelib to load
++    dnl the maxima library (within ECL) by name instead of by
++    dnl absolute path.
++    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
++  ])
++  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
++])
++
+diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
+index fbce6947de..8cda3ebfac 100644
+--- a/pkgs/sage-conf/sage_conf.py.in
++++ b/pkgs/sage-conf/sage_conf.py.in
+@@ -9,9 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+ SAGE_LOCAL = "@prefix@"
+ SAGE_ROOT = "@SAGE_ROOT@"
+ 
+-MAXIMA = "@prefix@/bin/maxima"
+-
+-# Delete this line if your ECL can load maxima without further prodding.
++# Set this to the empty string if your ECL can load maxima without
++# further prodding.
+ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
+ 
+ # Delete this line if your ECL can load Kenzo without further prodding.
+diff --git a/src/bin/sage b/src/bin/sage
+index fcd263029d..54b69a1043 100755
+--- a/src/bin/sage
++++ b/src/bin/sage
+@@ -684,11 +684,7 @@ fi
+ 
+ if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then
+     shift
+-    maxima_cmd=$(sage-config MAXIMA 2>/dev/null)
+-    if [ -z "${maxima_cmd}" ]; then
+-        maxima_cmd="maxima -l ecl"
+-    fi
+-    exec $maxima_cmd "$@"
++    exec maxima -l ecl "$@"
+ fi
+ 
+ if [ "$1" = '-mwrank' -o "$1" = '--mwrank' ]; then
+diff --git a/src/bin/sage-env b/src/bin/sage-env
+index a0426df523..f0866b4b1b 100644
+--- a/src/bin/sage-env
++++ b/src/bin/sage-env
+@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
+     fi
+ fi
+ 
+-if [ -n "$SAGE_LOCAL" ]; then
+-    export MAXIMA_PREFIX="$SAGE_LOCAL"
+-fi
+ export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ if [ -n "$SAGE_LOCAL" ]; then
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace135f0..95edc16081 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -207,7 +207,6 @@ MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
+ MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe"))
+ THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage"))
+ PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
+-MAXIMA = var("MAXIMA", "maxima")
+ MAXIMA_FAS = var("MAXIMA_FAS")
+ KENZO_FAS = var("KENZO_FAS")
+ SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
+diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
+index fc7f48bc05..7313c7d0d3 100644
+--- a/src/sage/interfaces/maxima.py
++++ b/src/sage/interfaces/maxima.py
+@@ -484,7 +484,6 @@ import shlex
+ 
+ from random import randrange
+ 
+-from sage.env import MAXIMA
+ from sage.misc.misc import ECL_TMP
+ 
+ from .expect import (Expect, ExpectElement, gc_disabled)
+@@ -558,7 +557,7 @@ class Maxima(MaximaAbstract, Expect):
+         Expect.__init__(self,
+                         name = 'maxima',
+                         prompt = r'\(\%i[0-9]+\) ',
+-                        command = '{0} -p {1}'.format(MAXIMA, shlex.quote(STARTUP)),
++                        command = 'maxima -l ecl -p {0}'.format(shlex.quote(STARTUP)),
+                         env = {'TMPDIR': str(ECL_TMP)},
+                         script_subdirectory = script_subdirectory,
+                         restart_on_ctrlc = False,
+diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
+index 917059de0a..c966a3c9a0 100644
+--- a/src/sage/interfaces/maxima_abstract.py
++++ b/src/sage/interfaces/maxima_abstract.py
+@@ -54,7 +54,7 @@ import re
+ import sys
+ import subprocess
+ 
+-from sage.env import DOT_SAGE, MAXIMA
++from sage.env import DOT_SAGE
+ COMMANDS_CACHE = '%s/maxima_commandlist_cache.sobj' % DOT_SAGE
+ 
+ from sage.cpython.string import bytes_to_str
+@@ -164,7 +164,7 @@ class MaximaAbstract(ExtraTabCompletion, Interface):
+             -- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
+             ...
+         """
+-        cmd = '{} --very-quiet --batch-string="{}({});" '.format(MAXIMA, command, s)
++        cmd = 'maxima -l ecl --very-quiet --batch-string="{}({});" '.format(command, s)
+         env = os.environ.copy()
+         env['TMPDIR'] = str(ECL_TMP)
+ 
+@@ -2214,7 +2214,7 @@ def maxima_version():
+         sage: maxima_version()  # random
+         '5.41.0'
+     """
+-    with os.popen('{} --version'.format(MAXIMA)) as p:
++    with os.popen('maxima -l ecl --version') as p:
+         return p.read().split()[-1]
+ 
+ 
+@@ -2232,4 +2232,4 @@ def maxima_console():
+     from sage.repl.rich_output.display_manager import get_display_manager
+     if not get_display_manager().is_in_terminal():
+         raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.')
+-    os.system('{}'.format(MAXIMA))
++    os.system('maxima -l ecl')
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 1ab0e9f7d65c..7917e78cbdc6 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -11,7 +11,8 @@ make_build_target=build
 depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
- m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
+ maxima-ecl"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -124,6 +125,7 @@ makedepends+="
  gengetopt texinfo
  brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
  lrcalc-devel nauty-devel palp tachyon
+ maxima-ecl
 "
 
 # TODO: optional

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (81 preceding siblings ...)
  2021-11-28 23:21 ` [PR PATCH] [Updated] " tornaria
@ 2021-11-28 23:27 ` tornaria
  2021-11-28 23:32 ` tornaria
                   ` (155 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 23:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-981173383

Comment:
New version:
 - uses system maxima-ecl (from #34273, included in this PR for convenience)
 - fixes the issue with a couple of gap symlinks not being removed by xbps-remove (see https://github.com/void-linux/xbps/issues/435)

As far as I tested, all tests pass on x86_64 (glibc and musl).

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (82 preceding siblings ...)
  2021-11-28 23:27 ` tornaria
@ 2021-11-28 23:32 ` tornaria
  2021-12-02 16:38 ` dkwo
                   ` (154 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-11-28 23:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-981174327

Comment:
The only large (non-python-module) packages pending seem to be:
 - gap (https://trac.sagemath.org/ticket/29644, I'm not sure that is usable yet, and it's not being worked out)
 - python 3.10 (https://trac.sagemath.org/ticket/30766, this is not done yet, but it seems to be more active than the gap ticket)

For reference:
 - meta-ticket about system packages is https://trac.sagemath.org/ticket/27330
 - meta-ticket about system python modules is https://trac.sagemath.org/ticket/29023

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (83 preceding siblings ...)
  2021-11-28 23:32 ` tornaria
@ 2021-12-02 16:38 ` dkwo
  2021-12-02 16:44 ` leahneukirchen
                   ` (153 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-02 16:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-984798114

Comment:
I was trying to make `jupyterlab` pick up sage kernel.
According to the docs, it should be enough to have a symlink of the form
`ln -s $SAGE_LOCAL/share/jupyter/kernels/sagemath $HOME/.local/share/jupyter`
However, we currently have `/usr/lib/sage-9.5.beta7/venv/share/jupyter/kernels/sagemath`, but no `jupyter` folder in `/usr/lib/sage-9.5.beta7/local/share/`.
I wonder whether this is due to our not using `python` from system,
and should work once we use it.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (84 preceding siblings ...)
  2021-12-02 16:38 ` dkwo
@ 2021-12-02 16:44 ` leahneukirchen
  2021-12-02 17:04 ` dkwo
                   ` (152 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-12-02 16:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-984803795

Comment:
I use `ln -s /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/share/jupyter /usr/local/share/`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (85 preceding siblings ...)
  2021-12-02 16:44 ` leahneukirchen
@ 2021-12-02 17:04 ` dkwo
  2021-12-02 17:12 ` leahneukirchen
                   ` (151 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-02 17:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-984820811

Comment:
Thanks.
If I do that, and use 'jupyter lab', then it gives

Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/bin/sage-config", line 5, in <module>
    from sage_conf import _main
ModuleNotFoundError: No module named 'sage_conf'
/usr/bin/python3: Error while finding module specification for 'sage.repl.ipython_kernel' (ModuleNotFoundError: No module named 'sage')

Does it work smoothly for you?


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (86 preceding siblings ...)
  2021-12-02 17:04 ` dkwo
@ 2021-12-02 17:12 ` leahneukirchen
  2021-12-04 15:37 ` [PR PATCH] [Updated] " tornaria
                   ` (150 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: leahneukirchen @ 2021-12-02 17:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-984827808

Comment:
That script has a wrong shebang...

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (87 preceding siblings ...)
  2021-12-02 17:12 ` leahneukirchen
@ 2021-12-04 15:37 ` tornaria
  2021-12-04 15:38 ` tornaria
                   ` (149 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-04 15:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 65982 bytes --]

From 5cafb1588eb81db64924f567382a7c5376522e00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 27 Nov 2021 19:38:48 -0300
Subject: [PATCH 01/12] maxima: add a subpkg maxima-ecl needed for sagemath

 - Added a build option 'ecl' (enabled by default)
 - The ecl binary and library will be in a subpkg maxima-ecl so this
   should not affect current users of maxima
 - new patches:
   - a0d7a43...: build a FASL library for ECL (this is merged upstream)
   - handle-multiple-ldflags.patch: otherwise compilation with multiple
     options in LDFLAGS fails (taken from debian)
   - matrixexp.patch: fixes an error in matrix exponentiation (taken
     from debian, this originates in sagemath)

A weak point is that the library maxima.fas is installed in
/usr/lib/ecl-${ecl_version} which is where ecl looks for them, but this
doesn't seem right.

Maybe an alternative would be to have the ecl package ship a symlink at
/usr/lib/ecl pointing to the versioned directory, then have the
maxima-ecl package place its library in the non-versioned directory.
---
 srcpkgs/maxima-ecl                            |  1 +
 ...a43e5234305bd6f1de5909d4ce5d7e1ea864.patch | 24 +++++++++++
 .../patches/handle-multiple-ldflags.patch     | 43 +++++++++++++++++++
 srcpkgs/maxima/patches/matrixexp.patch        | 23 ++++++++++
 srcpkgs/maxima/template                       | 34 ++++++++++++---
 5 files changed, 120 insertions(+), 5 deletions(-)
 create mode 120000 srcpkgs/maxima-ecl
 create mode 100644 srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
 create mode 100644 srcpkgs/maxima/patches/handle-multiple-ldflags.patch
 create mode 100644 srcpkgs/maxima/patches/matrixexp.patch

diff --git a/srcpkgs/maxima-ecl b/srcpkgs/maxima-ecl
new file mode 120000
index 000000000000..b8b0e8240fa4
--- /dev/null
+++ b/srcpkgs/maxima-ecl
@@ -0,0 +1 @@
+maxima
\ No newline at end of file
diff --git a/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
new file mode 100644
index 000000000000..e1ac1e5f6086
--- /dev/null
+++ b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
@@ -0,0 +1,24 @@
+commit a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864
+Author: Robert Dodier <robert_dodier@users.sourceforge.net>
+Date:   Mon Oct 11 22:40:13 2021 -0700
+
+    Apply patch #80: "Build a FASL library, needed by SageMath"
+    
+    This modifies maxima.system for ECL only.
+
+diff --git a/src/maxima.system b/src/maxima.system
+index d954bc2b9..525fb778e 100644
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -75,6 +75,11 @@
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+ 			 files)))
++	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			  :ld-flags
++			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
++							      (find-package "MAXIMA")))))
++			    (if (and x (not (string= x ""))) (list x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
diff --git a/srcpkgs/maxima/patches/handle-multiple-ldflags.patch b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
new file mode 100644
index 000000000000..799fc15f9185
--- /dev/null
+++ b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
@@ -0,0 +1,43 @@
+Description: Handle multiple LDFLAGS
+ Without this patch, building with LDFLAGS containing more than one flag results 
+ in flags being dropped.
+Author: Graham Inggs <ginggs@debian.org>
+Bug-Debian: http://bugs.debian.org/847925
+
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -58,6 +58,19 @@
+     (and (apply #'compile-file file :output-file object-output args)
+ 	 (c:build-fasl output :lisp-files (list object-output)))))
+ 
++(defun split-string (string &key (item #\space) (test #'char=))
++  ;; Splits the string into substrings at spaces.
++  (let ((len (length string))
++	(index 0) result)
++    (dotimes (i len
++		(progn (unless (= index len)
++			 (push (subseq string index) result))
++		       (reverse result)))
++      (when (funcall test (char string i) item)
++	(unless (= index i);; two spaces in a row
++	  (push (subseq string index i) result))
++	(setf index (1+ i))))))
++
+ #+ecl
+ (defun build-maxima-lib ()
+   (labels ((list-all-objects (module)
+@@ -79,12 +92,12 @@
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x))))
++			    (if (and x (not (string= x ""))) (split-string x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x)))
++			    (if (and x (not (string= x ""))) (split-string x)))
+ 			  :epilogue-code '(progn (cl-user::run)))))))
+ 
+ (defun maxima-binary-pathname ()
diff --git a/srcpkgs/maxima/patches/matrixexp.patch b/srcpkgs/maxima/patches/matrixexp.patch
new file mode 100644
index 000000000000..7cbd9ccac089
--- /dev/null
+++ b/srcpkgs/maxima/patches/matrixexp.patch
@@ -0,0 +1,23 @@
+Description: Fix error in matrix exponentiation
+ This patch was written by SageMath but not yet committed into Maxima releases.
+ However, it is needed for SageMath to work correctly:
+ .
+ https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
+Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
+Bug-Sage: http://trac.sagemath.org/ticket/13973
+Bug: https://sourceforge.net/p/maxima/bugs/2596/
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/share/linearalgebra/matrixexp.lisp
++++ b/share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,8 @@
+ 	   (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
+ 	   (print `(ratfac = ,$ratfac))
+ 	   (merror "Unable to find the spectrum")))
+-   
+-    (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
++
++    (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
+     (setq m (length sp))
+     (dotimes (i m)
+       (setq zi (nth i sp))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 3a95e3706447..798b4f9f00de 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -1,11 +1,11 @@
 # Template file for 'maxima'
 pkgname=maxima
 version=5.45.1
-revision=1
+revision=2
 build_style=gnu-configure
-configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec)"
+configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
 hostmakedepends="python3 perl emacs texinfo"
-makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl)"
+makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
 short_desc="Computer Algebra System"
@@ -17,10 +17,11 @@ checksum=fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
 
 nostrip=yes
 nopie=yes
-build_options="clisp sbcl"
+build_options="clisp sbcl ecl"
 desc_option_clisp="Build with CLISP"
 desc_option_sbcl="Build with SBCL"
-build_options_default="sbcl"
+desc_option_ecl="Build with ECL"
+build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
 post_install() {
@@ -66,3 +67,26 @@ xmaxima_package() {
 			${PKGDESTDIR}/usr/share/pixmaps/maxima
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima"
+
+if [ "$build_option_ecl" ]; then
+	subpackages+=" maxima-ecl"
+fi
+
+maxima-ecl_package() {
+	short_desc+=" - compiled with ECL"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		# this is /usr/lib/ecl-${ecl_version}
+		# ideally we would just place it in /usr/lib/ecl but this
+		# doesn't just work
+		# Maybe we can have the ecl package ship a symlink:
+		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
+		# and have this package just install in /usr/lib/ecl
+		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
+		vmkdir $ECLDIR
+		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
+		vmove usr/lib/maxima/${version}/binary-ecl
+	}
+}

From 140b30b5f591597cbfa634f0f3c98320a01cfd05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 02/12] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From d24272eaa4f41219a74871ecbb81be6e25fa373f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 03/12] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 1741bf53f6770dab0df451ba941810716822651d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 04/12] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From d404ebeaac42a0de145ce212cbd41da71a7c8ea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 05/12] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 3061547b1f04f0adcda524bee3973aad74319901 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 06/12] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 65e720547823e2c50867b5b849b5a9e5b1a09204 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 07/12] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From 136fa1a44c8f8f9f6b6e73a2c0a5aa6a2ea72889 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 08/12] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From 0661f768b7fba1416c5f866b340a944858c3ca08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 09/12] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 8bf5297c13a024f32e63a9c6915a6eb3c8ab1d17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 28 Nov 2021 00:32:26 -0300
Subject: [PATCH 10/12] sagemath: use system maxima

Also: add patch to use relative symlinks in gap where absolute symlinks
are now used -- otherwise xbps-create gets confused
---
 ...-spkg-install-make-symlinks-relative.patch |  27 +++
 .../patches/trac-32867-system-maxima.patch    | 174 ++++++++++++++++++
 srcpkgs/sagemath/template                     |   4 +-
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32867-system-maxima.patch

diff --git a/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
new file mode 100644
index 000000000000..c9feb870f2be
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
@@ -0,0 +1,27 @@
+From 521a9ec8d447be5bbd3a4260e7a5e0e4653e0c34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Sun, 28 Nov 2021 18:57:34 -0300
+Subject: [PATCH] build/pkgs/gap/spkg-install: make symlinks relative
+
+---
+ build/pkgs/gap/spkg-install.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 32d1fb982c..2ceadf99db 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -80,8 +80,8 @@ chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+ 
+ # Create symlinks under $GAP_ROOT for these executables, as they are expected
+ # (especially when building kernel packages) to exist
+-ln -sf "$SAGE_BIN/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/gac"
++ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
++ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+ 
+ # Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+ # to the actual path of the sources GAP was compiled from)
+-- 
+2.34.1
+
diff --git a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
new file mode 100644
index 000000000000..cb6517a388d8
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
@@ -0,0 +1,174 @@
+diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
+index ae1e0ac5e1..7dbcfa6377 100644
+--- a/build/pkgs/ecl/spkg-configure.m4
++++ b/build/pkgs/ecl/spkg-configure.m4
+@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
+     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
+   fi
+ 
+-  # Maxima cannot yet be provided by the system, so we always use
++  # Kenzo cannot yet be provided by the system, so we always use
+   # the SAGE_LOCAL path for now.
+-  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
+-
+-  # Likewise for the optional Kenzo SPKG
+   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
+ ])
+diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
+new file mode 100644
+index 0000000000..df625fecc4
+--- /dev/null
++++ b/build/pkgs/maxima/spkg-configure.m4
+@@ -0,0 +1,35 @@
++SAGE_SPKG_CONFIGURE([maxima], [
++  SAGE_SPKG_DEPCHECK([ecl], [
++    dnl First check for the "maxima" executable in the user's PATH, because
++    dnl we still use pexpect to communicate with it in a few places. We pass
++    dnl the "-l ecl" flag here to ensure that the standalone executable also
++    dnl supports ECL.
++    AC_MSG_CHECKING(if "maxima -l ecl" works)
++    AS_IF([! maxima -l ecl -q -r 'quit();' \
++             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++      AC_MSG_RESULT(no)
++      sage_spkg_install_maxima=yes
++    ], [
++      AC_MSG_RESULT(yes)
++      dnl If we have the executable, check also for the ECL library.
++      AC_MSG_CHECKING([if ECL can "require" the maxima module])
++      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
++               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++        AC_MSG_RESULT(yes)
++      ], [
++	AC_MSG_RESULT(no)
++	sage_spkg_install_maxima=yes
++      ])
++    ])
++  ])
++],[],[],[
++  # post-check
++  AS_IF([test x$sage_spkg_install_maxima = xyes], [
++    dnl Leaving this variable empty will tell sagelib to load
++    dnl the maxima library (within ECL) by name instead of by
++    dnl absolute path.
++    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
++  ])
++  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
++])
++
+diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
+index fbce6947de..8cda3ebfac 100644
+--- a/pkgs/sage-conf/sage_conf.py.in
++++ b/pkgs/sage-conf/sage_conf.py.in
+@@ -9,9 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+ SAGE_LOCAL = "@prefix@"
+ SAGE_ROOT = "@SAGE_ROOT@"
+ 
+-MAXIMA = "@prefix@/bin/maxima"
+-
+-# Delete this line if your ECL can load maxima without further prodding.
++# Set this to the empty string if your ECL can load maxima without
++# further prodding.
+ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
+ 
+ # Delete this line if your ECL can load Kenzo without further prodding.
+diff --git a/src/bin/sage b/src/bin/sage
+index fcd263029d..54b69a1043 100755
+--- a/src/bin/sage
++++ b/src/bin/sage
+@@ -684,11 +684,7 @@ fi
+ 
+ if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then
+     shift
+-    maxima_cmd=$(sage-config MAXIMA 2>/dev/null)
+-    if [ -z "${maxima_cmd}" ]; then
+-        maxima_cmd="maxima -l ecl"
+-    fi
+-    exec $maxima_cmd "$@"
++    exec maxima -l ecl "$@"
+ fi
+ 
+ if [ "$1" = '-mwrank' -o "$1" = '--mwrank' ]; then
+diff --git a/src/bin/sage-env b/src/bin/sage-env
+index a0426df523..f0866b4b1b 100644
+--- a/src/bin/sage-env
++++ b/src/bin/sage-env
+@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
+     fi
+ fi
+ 
+-if [ -n "$SAGE_LOCAL" ]; then
+-    export MAXIMA_PREFIX="$SAGE_LOCAL"
+-fi
+ export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ if [ -n "$SAGE_LOCAL" ]; then
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace135f0..95edc16081 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -207,7 +207,6 @@ MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
+ MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe"))
+ THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage"))
+ PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
+-MAXIMA = var("MAXIMA", "maxima")
+ MAXIMA_FAS = var("MAXIMA_FAS")
+ KENZO_FAS = var("KENZO_FAS")
+ SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
+diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
+index fc7f48bc05..7313c7d0d3 100644
+--- a/src/sage/interfaces/maxima.py
++++ b/src/sage/interfaces/maxima.py
+@@ -484,7 +484,6 @@ import shlex
+ 
+ from random import randrange
+ 
+-from sage.env import MAXIMA
+ from sage.misc.misc import ECL_TMP
+ 
+ from .expect import (Expect, ExpectElement, gc_disabled)
+@@ -558,7 +557,7 @@ class Maxima(MaximaAbstract, Expect):
+         Expect.__init__(self,
+                         name = 'maxima',
+                         prompt = r'\(\%i[0-9]+\) ',
+-                        command = '{0} -p {1}'.format(MAXIMA, shlex.quote(STARTUP)),
++                        command = 'maxima -l ecl -p {0}'.format(shlex.quote(STARTUP)),
+                         env = {'TMPDIR': str(ECL_TMP)},
+                         script_subdirectory = script_subdirectory,
+                         restart_on_ctrlc = False,
+diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
+index 917059de0a..c966a3c9a0 100644
+--- a/src/sage/interfaces/maxima_abstract.py
++++ b/src/sage/interfaces/maxima_abstract.py
+@@ -54,7 +54,7 @@ import re
+ import sys
+ import subprocess
+ 
+-from sage.env import DOT_SAGE, MAXIMA
++from sage.env import DOT_SAGE
+ COMMANDS_CACHE = '%s/maxima_commandlist_cache.sobj' % DOT_SAGE
+ 
+ from sage.cpython.string import bytes_to_str
+@@ -164,7 +164,7 @@ class MaximaAbstract(ExtraTabCompletion, Interface):
+             -- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
+             ...
+         """
+-        cmd = '{} --very-quiet --batch-string="{}({});" '.format(MAXIMA, command, s)
++        cmd = 'maxima -l ecl --very-quiet --batch-string="{}({});" '.format(command, s)
+         env = os.environ.copy()
+         env['TMPDIR'] = str(ECL_TMP)
+ 
+@@ -2214,7 +2214,7 @@ def maxima_version():
+         sage: maxima_version()  # random
+         '5.41.0'
+     """
+-    with os.popen('{} --version'.format(MAXIMA)) as p:
++    with os.popen('maxima -l ecl --version') as p:
+         return p.read().split()[-1]
+ 
+ 
+@@ -2232,4 +2232,4 @@ def maxima_console():
+     from sage.repl.rich_output.display_manager import get_display_manager
+     if not get_display_manager().is_in_terminal():
+         raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.')
+-    os.system('{}'.format(MAXIMA))
++    os.system('maxima -l ecl')
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 1ab0e9f7d65c..7917e78cbdc6 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -11,7 +11,8 @@ make_build_target=build
 depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
- m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
+ maxima-ecl"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -124,6 +125,7 @@ makedepends+="
  gengetopt texinfo
  brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
  lrcalc-devel nauty-devel palp tachyon
+ maxima-ecl
 "
 
 # TODO: optional

From 0756d358b4158eccee942a13b08c5048d50dc1e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 11/12] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 157bad9161822e3393fcb5a065f66012f80f5da2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 4 Dec 2021 12:25:56 -0300
Subject: [PATCH 12/12] sagemath: don't rewrite python shebangs

This is still causing some issues, even if main sage and doctest works
ok with rewrite enabled, some scripts are broken as reported in the PR.

This is still a temporary workaround as we are hoping for system
python-3.10 support at some point.

Also in this commit: add some depends
---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 7917e78cbdc6..ede79e76b98d 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -12,7 +12,8 @@ depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
  m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
- maxima-ecl"
+ linbox-devel gfan nauty-devel palp tachyon maxima-ecl
+ "
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -43,8 +44,7 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-# after python_version=3, this seems harmless... strange...
-#_no_python_shebang=yes
+_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (88 preceding siblings ...)
  2021-12-04 15:37 ` [PR PATCH] [Updated] " tornaria
@ 2021-12-04 15:38 ` tornaria
  2021-12-04 15:47 ` tornaria
                   ` (148 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-04 15:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-986046857

Comment:
> That script has a wrong shebang...

Indeed: originally I had a patch to skip 03-rewrite-python-shebang because there was a failure running this hook. Later I discovered that the failure would go away by adding `python_version=3` to the template, so I removed the patch. However, many of the python scripts with shebangs that point to python inside the sage venv are broken.

The simple fix/workaround would be to reinstate this patch for now and skip rewriting all the shebangs.

I'm still hoping that sage-9.5 can work with system python 3.10 by the time it's released, but at the moment [trac #30766](https://trac.sagemath.org/ticket/30766) is a bit outdated and it was far from working last time I tried. I've just noticed that [trac #30767](https://trac.sagemath.org/ticket/30767) has just been rebased on top of a handful of other tickets with positive_review so I'm more hopeful of that.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (89 preceding siblings ...)
  2021-12-04 15:38 ` tornaria
@ 2021-12-04 15:47 ` tornaria
  2021-12-05 10:22 ` dkwo
                   ` (147 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-04 15:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-986048062

Comment:
New version (157bad91):

 - don't rewrite python shebangs, as commented above
 - add some depends (linbox, maxima, and others that I think were missing before)

@dkwo: can you try this version?

Also: should I add something to `do_install()` so you don't need to  `ln -s /usr/lib/sage-9.5.beta7/local/var/lib/sage/venv-python3.9.7/share/jupyter /usr/local/share/`? Please let me know and I'll add it (preferrably not in `/usr/local`?).

There's a bunch of tickets with positive_review that I'd like to include, but I'm hoping there will be a new beta soon which includes them so I'll just wait and see (I'm already including 6-7 patches with positive_review, they should go away with next beta). After that I might give a new try to the python 3.10 patches.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (90 preceding siblings ...)
  2021-12-04 15:47 ` tornaria
@ 2021-12-05 10:22 ` dkwo
  2021-12-10 21:28 ` dkwo
                   ` (146 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-05 10:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-986203412

Comment:
Thanks, (temporarily) rewriting shebangs works for me.

According to https://doc.sagemath.org/html/en/installation/launching.html#setting-up-sagemath-as-a-jupyter-kernel-in-an-existing-jupyter-notebook-or-jupyterlab-installation any of
```
$HOME/.local/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
```
should work.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (91 preceding siblings ...)
  2021-12-05 10:22 ` dkwo
@ 2021-12-10 21:28 ` dkwo
  2021-12-10 21:31 ` dkwo
                   ` (145 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-10 21:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-991306564

Comment:
Btw, it builds and checks fine on my laptop with `x86_64-musl` (`All tests passed!`).

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (92 preceding siblings ...)
  2021-12-10 21:28 ` dkwo
@ 2021-12-10 21:31 ` dkwo
  2021-12-11  2:29 ` ericonr
                   ` (144 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-10 21:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-991308599

Comment:
ok, now it is not installing
```
=> Registering new packages to /host/binpkgs/sagemath
index: added `sagemath-9.5.beta7_1' (x86_64-musl).
index: 6 packages registered.
=> sagemath-9.5.beta7_1: running do_clean ...
=> sagemath-9.5.beta7_1: removing autodeps, please wait...
=> sagemath: removing files from destdir...
$ xi sagemath
doas (nicolo@ajax) password:
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/x86_64-musl-repodata' ...
x86_64-musl-repodata: 1686KB [avg rate: 7320MB/s]
[*] Updating repository `https://alpha.de.repo.voidlinux.org/current/musl/nonfree/x86_64-musl-repodata' ...
MISSING: glibc>=2.32_1
Transaction aborted due to unresolved dependencies.
```
Do you know what is going wrong?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (93 preceding siblings ...)
  2021-12-10 21:31 ` dkwo
@ 2021-12-11  2:29 ` ericonr
  2021-12-11 17:58 ` dkwo
                   ` (143 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: ericonr @ 2021-12-11  2:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-991415871

Comment:
There's something wrong in the build that's making it link against musl instead of glibc...

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (94 preceding siblings ...)
  2021-12-11  2:29 ` ericonr
@ 2021-12-11 17:58 ` dkwo
  2021-12-13  3:13 ` [PR PATCH] [Updated] " tornaria
                   ` (142 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-11 17:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-991730625

Comment:
See
```
=> sagemath-9.5.beta7_1: running pre-pkg hook: 04-generate-runtime-deps ...
   SONAME: libc.so <-> musl>=1.1.24_7
   SONAME: libc.so.6 <-> glibc>=2.32_1
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (95 preceding siblings ...)
  2021-12-11 17:58 ` dkwo
@ 2021-12-13  3:13 ` tornaria
  2021-12-13  9:25 ` dkwo
                   ` (141 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-13  3:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 89712 bytes --]

From 4ed298bb586c99fed42d3913a750774b6567cb37 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 12 Dec 2021 23:48:01 -0300
Subject: [PATCH 01/16] lcalc: update to 2.0.4.

---
 common/shlibs                |   2 +-
 srcpkgs/lcalc/files/test     |  30 ----------
 srcpkgs/lcalc/files/test.out | 112 -----------------------------------
 srcpkgs/lcalc/template       |  69 ++++-----------------
 4 files changed, 14 insertions(+), 199 deletions(-)
 delete mode 100644 srcpkgs/lcalc/files/test
 delete mode 100644 srcpkgs/lcalc/files/test.out

diff --git a/common/shlibs b/common/shlibs
index 2c0536f1550a..be2975dd7a96 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4025,7 +4025,7 @@ libflint.so.16 flintlib-2.8.0_1
 libarb.so.2 arb-2.20.0_1
 libec.so.8 eclib-20210625_1
 libsymmetrica.so.2 symmetrica-3.0.1_1
-libLfunction.so lcalc-1.23_2
+libLfunction.so.1 lcalc-2.0.4_1
 liblrcalc.so.1 lrcalc-1.2_1
 libwayland-client++.so.0 libwaylandpp-0.2.8_1
 libwayland-cursor++.so.0 libwaylandpp-0.2.8_1
diff --git a/srcpkgs/lcalc/files/test b/srcpkgs/lcalc/files/test
deleted file mode 100644
index de1f2a6b34e1..000000000000
--- a/srcpkgs/lcalc/files/test
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-#
-# Quick minimal test for lcalc.
-#
-# Test running the main binary (lcalc) and running the provided
-# example program which is dynamically linked to the library.
-# Also test that loading of L-function data files works.
-#
-# The precision is truncated at 13 (rather than the default 14),
-# otherwise the output could vary a little bit depending on
-# architecture and compiler flags. For the example program we
-# patch-round using sed the two outputs that seem to vary.
-#
-echo "### First 1000 zeros of zeta function"
-./lcalc -z 10 -P 13
-echo
-echo "### Analytic rank of elliptic curve 5077a1"
-./lcalc -e --a1=0 --a2=0 --a3=1 --a4=-7 --a6=6 -r
-echo
-echo "### run example program"
-# do some ad hoc rounding to avoid minor differences
-LD_LIBRARY_PATH=. example_programs/example | sed -e '
-	s/\(L4(1,0) = ([0-9.]*\)[0-9],/\1,/;
-	s/6.123[0-9]*e-17/6.123e-17/'
-echo
-echo "### test data files: zeros of data_mass"
-./lcalc -F example_data_files/data_maass -z 10 -P 13
-echo
-echo "### test data files: zeros of data_tau"
-./lcalc -F example_data_files/data_tau -z 10 -P 13
diff --git a/srcpkgs/lcalc/files/test.out b/srcpkgs/lcalc/files/test.out
deleted file mode 100644
index b8e661e7e6c8..000000000000
--- a/srcpkgs/lcalc/files/test.out
+++ /dev/null
@@ -1,112 +0,0 @@
-### First 1000 zeros of zeta function
- 14.1347251417
- 21.0220396388
- 25.0108575801
- 30.4248761259
- 32.9350615877
- 37.5861781588
- 40.9187190121
- 43.3270732809
- 48.0051508812
- 49.7738324777
-
-### Analytic rank of elliptic curve 5077a1
-analytic rank equals 3
-
-### run example program
------------------------------------------------
-
-Name of L_function: zeta
-All coefficients are equal to 1
-
-Q = 0.564189583548
-OMEGA = (1,0)
-a = 1 (the quasi degree)
-gamma[1] =0.5    lambda[1] =(0,0)
-
-
-number of poles (of the completed L function) = 2
-pole[1] =(1,0)    residue[1] =(1,0)
-pole[2] =(0,0)    residue[2] =(-1,0)
------------------------------------------------
-
------------------------------------------------
-
-Name of L_function: L4
-number of dirichlet coefficients = 4
-coefficients are periodic
-b[1] = 1
-b[2] = 0
-b[3] = -1
-b[4] = 0
-
-Q = 1.1283791671
-OMEGA = (1,0)
-a = 1 (the quasi degree)
-gamma[1] =0.5    lambda[1] =(0.5,0)
-
-
-number of poles (of the completed L function) = 0
------------------------------------------------
-
------------------------------------------------
-
-Name of L_function: L5
-number of dirichlet coefficients = 5
-coefficients are periodic
-b[1] = (1,0)
-b[2] = (0,1)
-b[3] = (-0,-1)
-b[4] = (-1,0)
-b[5] = (0,0)
-
-Q = 1.26156626101
-OMEGA = (0.850650808352,0.525731112119)
-a = 1 (the quasi degree)
-gamma[1] =0.5    lambda[1] =(0.5,0)
-
-
-number of poles (of the completed L function) = 0
------------------------------------------------
-
-zeta(0.5,0) = (-1.46035450881,0)
-L4(0.5,0) = (0.6676914571896,0)
-L5(0.5,0) = (0.7637478801173,0.2169647675189)
-L4(1,0) = (0.785398163397,0)
-L5(1,0) = (0.8648062659772,0.2041530661384)
-0.4285714285714
-1.5
-0.1666666666667
-0.6666666666667
-0.5714285714286
-0
-0.5714285714286
-0.5714285714286
-0
-0.8888888888889
-6.123e-17
--0.7071067811865
-
-### test data files: zeros of data_mass
- 2.8977246783
- 5.5912453153
- 21.0903775087
- 23.1575104846
- 25.4393003898
- 29.1892067135
- 31.0617394845
- 32.4527182375
- 34.027279684
- 36.9312371969
-
-### test data files: zeros of data_tau
- 9.22237939992
- 13.9075498614
- 17.4427769782
- 19.656513142
- 22.3361036372
- 25.2746365481
- 26.8043911584
- 28.8316826242
- 31.1782094984
- 32.7748753822
diff --git a/srcpkgs/lcalc/template b/srcpkgs/lcalc/template
index 1b3df018d527..a030c96039ef 100644
--- a/srcpkgs/lcalc/template
+++ b/srcpkgs/lcalc/template
@@ -1,66 +1,21 @@
 # Template file for 'lcalc'
 pkgname=lcalc
-version=1.23
-revision=2
-build_wrksrc="src"
-build_style=gnu-makefile
+version=2.0.4
+revision=1
+build_style=gnu-configure
+configure_args="--with-pari"
+hostmakedepends="automake libtool pkg-config gengetopt"
 makedepends="gmp-devel pari-devel"
 short_desc="Michael Rubinstein's L-function calculator"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
-homepage="https://mirrors.mit.edu/sage/spkg/upstream/lcalc/"
-distfiles="https://mirrors.mit.edu/sage/spkg/upstream/lcalc/lcalc-${version}.tar.bz2"
-checksum="83d4253ec2f38553b21190d6d0c6b71bab7ea14717f6dde5bd18f60775d3cdb0
- bd39a43b24a332e1826e667f85ca2ce2ca14749d56f60069cd886c96f55e9e3c
- d8c660f68f33b6eeb4b801d4028faaaaccbfff5797efe654bb6367e0a687542d
- dadf6fc6d481595cb041f8b0dd92bc2e2bc390cbb3e0dd36b7fe63b74942db26
- 342cde1c9effda48597bfee439acb37c91458a100580c97c84da6a142d2cc5b6
- 55c6c9f969593f24c75a85e7a150b876671356aa68ceb8e77c563a645897643e
- 906ef33de15bb0d94883b7797d8cb3c889b9f59bceebeb171e65f1546faf1c37
- 437e3870342ef4cb5749398ead9381504403e7e1f99efadab95f4a607678b400
- 6471f2f30497486e289fc8977cbb89c495cf0d5ff58af2b1f479a497a28165e6
- dde1f80b0ca42fb43917c24e6016c19e4a8d28de9c50cd0a523a318866bdc0eb
- 941d4ac025f5d6f0142fb785b27f7a221729466dc83d45fd206cce102c012eaf
- 045f23ea9131b8039001c8f13d22152f7b3c2e91adcf8c555354eaf39e7a7b48"
-shlib_provides="libLfunction.so"
+homepage="https://gitlab.com/sagemath/lcalc"
+changelog="https://gitlab.com/sagemath/lcalc/-/raw/master/doc/ChangeLog"
+distfiles="https://gitlab.com/sagemath/lcalc/-/archive/${version}/lcalc-${version}.tar.bz2"
+checksum=28b9d33307d0aa002accf6950fa4547df8c6764df8d025bc8523aa857423417b
 
-# get patches from sagemath
-_patchurl="https://git.sagemath.org/sage.git/plain/build/pkgs/lcalc/patches"
-_patchtag="?h=9.3.rc2"
-_patches="
- Lcommon.h.patch
- Lvalue.h.patch
- Makefile.patch
- clang.patch
- lcalc-1.23_default_parameters_1.patch
- lcalc-1.23_default_parameters_2.patch
- pari-2.7.patch
- pari-mem.patch
- pari_include.patch
- time.h.patch
- using_namespace_std.patch"
-for patch in $_patches ; do
-	distfiles+=" ${_patchurl}/${patch}${_patchtag}>${patch}"
-done
-skip_extraction="$_patches"
-
-post_extract() {
-	for patch in $_patches ; do
-		patch -p1 < "$XBPS_SRCDISTDIR/${pkgname}-${version}/${patch}"
-	done
-}
-
-CXXFLAGS="-fPIC -Wno-deprecated"
-
-pre_install() {
-	mkdir -p ${DESTDIR}/usr/{bin,lib,include}
-	make_install_args+=" INSTALL_DIR=${DESTDIR}/usr"
-}
-
-do_check() {
-	echo "Testing lcalc ..."
-	sh "${FILESDIR}"/test > test.log
-	diff "${FILESDIR}"/test.out test.log && echo PASS
+pre_configure() {
+	autoreconf -fi
 }
 
 lcalc-devel_package() {
@@ -68,5 +23,7 @@ lcalc-devel_package() {
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
 	}
 }

From 78292802606542dfff3fae37df6e069d67f3153c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 27 Nov 2021 19:38:48 -0300
Subject: [PATCH 02/16] maxima: add a subpkg maxima-ecl needed for sagemath

 - Added a build option 'ecl' (enabled by default)
 - The ecl binary and library will be in a subpkg maxima-ecl so this
   should not affect current users of maxima
 - new patches:
   - a0d7a43...: build a FASL library for ECL (this is merged upstream)
   - handle-multiple-ldflags.patch: otherwise compilation with multiple
     options in LDFLAGS fails (taken from debian)
   - matrixexp.patch: fixes an error in matrix exponentiation (taken
     from debian, this originates in sagemath)

A weak point is that the library maxima.fas is installed in
/usr/lib/ecl-${ecl_version} which is where ecl looks for them, but this
doesn't seem right.

Maybe an alternative would be to have the ecl package ship a symlink at
/usr/lib/ecl pointing to the versioned directory, then have the
maxima-ecl package place its library in the non-versioned directory.
---
 srcpkgs/maxima-ecl                            |  1 +
 ...a43e5234305bd6f1de5909d4ce5d7e1ea864.patch | 24 +++++++++++
 .../patches/handle-multiple-ldflags.patch     | 43 +++++++++++++++++++
 srcpkgs/maxima/patches/matrixexp.patch        | 23 ++++++++++
 srcpkgs/maxima/template                       | 34 ++++++++++++---
 5 files changed, 120 insertions(+), 5 deletions(-)
 create mode 120000 srcpkgs/maxima-ecl
 create mode 100644 srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
 create mode 100644 srcpkgs/maxima/patches/handle-multiple-ldflags.patch
 create mode 100644 srcpkgs/maxima/patches/matrixexp.patch

diff --git a/srcpkgs/maxima-ecl b/srcpkgs/maxima-ecl
new file mode 120000
index 000000000000..b8b0e8240fa4
--- /dev/null
+++ b/srcpkgs/maxima-ecl
@@ -0,0 +1 @@
+maxima
\ No newline at end of file
diff --git a/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
new file mode 100644
index 000000000000..e1ac1e5f6086
--- /dev/null
+++ b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
@@ -0,0 +1,24 @@
+commit a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864
+Author: Robert Dodier <robert_dodier@users.sourceforge.net>
+Date:   Mon Oct 11 22:40:13 2021 -0700
+
+    Apply patch #80: "Build a FASL library, needed by SageMath"
+    
+    This modifies maxima.system for ECL only.
+
+diff --git a/src/maxima.system b/src/maxima.system
+index d954bc2b9..525fb778e 100644
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -75,6 +75,11 @@
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+ 			 files)))
++	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			  :ld-flags
++			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
++							      (find-package "MAXIMA")))))
++			    (if (and x (not (string= x ""))) (list x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
diff --git a/srcpkgs/maxima/patches/handle-multiple-ldflags.patch b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
new file mode 100644
index 000000000000..799fc15f9185
--- /dev/null
+++ b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
@@ -0,0 +1,43 @@
+Description: Handle multiple LDFLAGS
+ Without this patch, building with LDFLAGS containing more than one flag results 
+ in flags being dropped.
+Author: Graham Inggs <ginggs@debian.org>
+Bug-Debian: http://bugs.debian.org/847925
+
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -58,6 +58,19 @@
+     (and (apply #'compile-file file :output-file object-output args)
+ 	 (c:build-fasl output :lisp-files (list object-output)))))
+ 
++(defun split-string (string &key (item #\space) (test #'char=))
++  ;; Splits the string into substrings at spaces.
++  (let ((len (length string))
++	(index 0) result)
++    (dotimes (i len
++		(progn (unless (= index len)
++			 (push (subseq string index) result))
++		       (reverse result)))
++      (when (funcall test (char string i) item)
++	(unless (= index i);; two spaces in a row
++	  (push (subseq string index i) result))
++	(setf index (1+ i))))))
++
+ #+ecl
+ (defun build-maxima-lib ()
+   (labels ((list-all-objects (module)
+@@ -79,12 +92,12 @@
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x))))
++			    (if (and x (not (string= x ""))) (split-string x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x)))
++			    (if (and x (not (string= x ""))) (split-string x)))
+ 			  :epilogue-code '(progn (cl-user::run)))))))
+ 
+ (defun maxima-binary-pathname ()
diff --git a/srcpkgs/maxima/patches/matrixexp.patch b/srcpkgs/maxima/patches/matrixexp.patch
new file mode 100644
index 000000000000..7cbd9ccac089
--- /dev/null
+++ b/srcpkgs/maxima/patches/matrixexp.patch
@@ -0,0 +1,23 @@
+Description: Fix error in matrix exponentiation
+ This patch was written by SageMath but not yet committed into Maxima releases.
+ However, it is needed for SageMath to work correctly:
+ .
+ https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
+Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
+Bug-Sage: http://trac.sagemath.org/ticket/13973
+Bug: https://sourceforge.net/p/maxima/bugs/2596/
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/share/linearalgebra/matrixexp.lisp
++++ b/share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,8 @@
+ 	   (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
+ 	   (print `(ratfac = ,$ratfac))
+ 	   (merror "Unable to find the spectrum")))
+-   
+-    (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
++
++    (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
+     (setq m (length sp))
+     (dotimes (i m)
+       (setq zi (nth i sp))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 3a95e3706447..798b4f9f00de 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -1,11 +1,11 @@
 # Template file for 'maxima'
 pkgname=maxima
 version=5.45.1
-revision=1
+revision=2
 build_style=gnu-configure
-configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec)"
+configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
 hostmakedepends="python3 perl emacs texinfo"
-makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl)"
+makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
 short_desc="Computer Algebra System"
@@ -17,10 +17,11 @@ checksum=fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
 
 nostrip=yes
 nopie=yes
-build_options="clisp sbcl"
+build_options="clisp sbcl ecl"
 desc_option_clisp="Build with CLISP"
 desc_option_sbcl="Build with SBCL"
-build_options_default="sbcl"
+desc_option_ecl="Build with ECL"
+build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
 post_install() {
@@ -66,3 +67,26 @@ xmaxima_package() {
 			${PKGDESTDIR}/usr/share/pixmaps/maxima
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima"
+
+if [ "$build_option_ecl" ]; then
+	subpackages+=" maxima-ecl"
+fi
+
+maxima-ecl_package() {
+	short_desc+=" - compiled with ECL"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		# this is /usr/lib/ecl-${ecl_version}
+		# ideally we would just place it in /usr/lib/ecl but this
+		# doesn't just work
+		# Maybe we can have the ecl package ship a symlink:
+		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
+		# and have this package just install in /usr/lib/ecl
+		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
+		vmkdir $ECLDIR
+		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
+		vmove usr/lib/maxima/${version}/binary-ecl
+	}
+}

From 149d2bfba753d5c3ae6d9ff5546330a83979d721 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Fri, 10 Dec 2021 14:01:01 -0300
Subject: [PATCH 03/16] maxima: use a shared lib

---
 .../maxima/patches/use-shared-library.patch   | 21 ++++++++
 srcpkgs/maxima/template                       | 50 +++++++++++++------
 2 files changed, 55 insertions(+), 16 deletions(-)
 create mode 100644 srcpkgs/maxima/patches/use-shared-library.patch

diff --git a/srcpkgs/maxima/patches/use-shared-library.patch b/srcpkgs/maxima/patches/use-shared-library.patch
new file mode 100644
index 000000000000..a8f986ac7033
--- /dev/null
+++ b/srcpkgs/maxima/patches/use-shared-library.patch
@@ -0,0 +1,21 @@
+--- a/src/maxima.system	2021-12-02 00:26:23.955984864 -0300
++++ b/src/maxima.system	2021-12-02 00:31:22.299541969 -0300
+@@ -87,13 +87,15 @@
+       (let ((obj (mapcar #'(lambda (p)
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+-			 files)))
+-	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			 files))
++			(lib '("binary-ecl/libmaxima-ecl.so")))
++	(c::build-shared-library "binary-ecl/maxima-ecl" :lisp-files obj)
++	(c::build-fasl "binary-ecl/maxima" :lisp-files lib
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+ 			    (if (and x (not (string= x ""))) (split-string x))))
+-	(c::build-program "binary-ecl/maxima" :lisp-files obj
++	(c::build-program "binary-ecl/maxima" :lisp-files lib
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 798b4f9f00de..1a4bec0dba18 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -4,7 +4,7 @@ version=5.45.1
 revision=2
 build_style=gnu-configure
 configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
-hostmakedepends="python3 perl emacs texinfo"
+hostmakedepends="python3 perl emacs texinfo patchelf"
 makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
@@ -24,6 +24,29 @@ desc_option_ecl="Build with ECL"
 build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
+post_build() {
+	if [ "$build_option_ecl" ]; then
+		# everything will go in the same directory, use rpath=$ORIGIN
+		patchelf --remove-rpath src/binary-ecl/libmaxima-ecl.so
+		patchelf --set-rpath \$ORIGIN \
+			src/binary-ecl/{maxima,maxima.fas}
+		patchelf \
+			--replace-needed  binary-ecl/libmaxima-ecl.so libmaxima-ecl.so \
+			src/binary-ecl/{maxima,maxima.fas}
+	fi
+}
+
+do_check() {
+	if [ "$build_option_ecl" ]; then
+		echo "Check that maxima.fas works"
+		ecl --eval "(require 'maxima \"src/binary-ecl/maxima.fas\")" \
+			--eval "(quit)"
+	fi
+
+	# now run the testsuite
+	make ${makejobs} check
+}
+
 post_install() {
 	vmkdir usr/share/doc
 	ln -sf ../maxima/${version}/doc ${DESTDIR}/usr/share/doc/maxima
@@ -68,25 +91,20 @@ xmaxima_package() {
 	}
 }
 
-subpackages="maxima-src maxima-emacs xmaxima"
-
-if [ "$build_option_ecl" ]; then
-	subpackages+=" maxima-ecl"
-fi
-
 maxima-ecl_package() {
 	short_desc+=" - compiled with ECL"
 	depends="${sourcepkg}-${version}_${revision}"
 	pkg_install() {
-		# this is /usr/lib/ecl-${ecl_version}
-		# ideally we would just place it in /usr/lib/ecl but this
-		# doesn't just work
-		# Maybe we can have the ecl package ship a symlink:
-		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
-		# and have this package just install in /usr/lib/ecl
+		BINARY_ECL=/usr/lib/maxima/${version}/binary-ecl
+		vmove ${BINARY_ECL}
+		vinstall src/binary-ecl/libmaxima-ecl.so 755 ${BINARY_ECL}
+		vinstall src/binary-ecl/maxima.fas 755 ${BINARY_ECL}
+
+		# symlink maxima.fas in ECLDIR
 		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
-		vmkdir $ECLDIR
-		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
-		vmove usr/lib/maxima/${version}/binary-ecl
+		vmkdir ${ECLDIR}
+		ln -sr ${PKGDESTDIR}/${BINARY_ECL}/maxima.fas ${PKGDESTDIR}/${ECLDIR}
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima $(vopt_if ecl maxima-ecl)"

From 4b426ad0c3e51a463ef9c119fa6c35b8f40481d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 04/16] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 7936855b5fe7bbf54d2f4a55832922e7c07bc4e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 05/16] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From d27a563a4374451664923772538688816b3ca48d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 06/16] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 098706fa64fe0dc4f7e2a8d406c9b0ed320bdc27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 07/16] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From 634604d7f7e083f406460417cccc86f7f5a3ef04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 08/16] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 1771a89590bd776acd43d41412e8f952383b2330 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 09/16] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From 65df16d42f5385b99fbd86134bedd8378dd58fa7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 10/16] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From dbb2a4203aeccc98bccd13bad86c80cc216a319c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 11/16] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 49e2f1d4463d61271631be6ba59ddd3d9448144b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 28 Nov 2021 00:32:26 -0300
Subject: [PATCH 12/16] sagemath: use system maxima

Also: add patch to use relative symlinks in gap where absolute symlinks
are now used -- otherwise xbps-create gets confused
---
 ...-spkg-install-make-symlinks-relative.patch |  27 +++
 .../patches/trac-32867-system-maxima.patch    | 174 ++++++++++++++++++
 srcpkgs/sagemath/template                     |   4 +-
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32867-system-maxima.patch

diff --git a/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
new file mode 100644
index 000000000000..c9feb870f2be
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
@@ -0,0 +1,27 @@
+From 521a9ec8d447be5bbd3a4260e7a5e0e4653e0c34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Sun, 28 Nov 2021 18:57:34 -0300
+Subject: [PATCH] build/pkgs/gap/spkg-install: make symlinks relative
+
+---
+ build/pkgs/gap/spkg-install.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 32d1fb982c..2ceadf99db 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -80,8 +80,8 @@ chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+ 
+ # Create symlinks under $GAP_ROOT for these executables, as they are expected
+ # (especially when building kernel packages) to exist
+-ln -sf "$SAGE_BIN/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/gac"
++ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
++ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+ 
+ # Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+ # to the actual path of the sources GAP was compiled from)
+-- 
+2.34.1
+
diff --git a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
new file mode 100644
index 000000000000..cb6517a388d8
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
@@ -0,0 +1,174 @@
+diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
+index ae1e0ac5e1..7dbcfa6377 100644
+--- a/build/pkgs/ecl/spkg-configure.m4
++++ b/build/pkgs/ecl/spkg-configure.m4
+@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
+     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
+   fi
+ 
+-  # Maxima cannot yet be provided by the system, so we always use
++  # Kenzo cannot yet be provided by the system, so we always use
+   # the SAGE_LOCAL path for now.
+-  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
+-
+-  # Likewise for the optional Kenzo SPKG
+   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
+ ])
+diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
+new file mode 100644
+index 0000000000..df625fecc4
+--- /dev/null
++++ b/build/pkgs/maxima/spkg-configure.m4
+@@ -0,0 +1,35 @@
++SAGE_SPKG_CONFIGURE([maxima], [
++  SAGE_SPKG_DEPCHECK([ecl], [
++    dnl First check for the "maxima" executable in the user's PATH, because
++    dnl we still use pexpect to communicate with it in a few places. We pass
++    dnl the "-l ecl" flag here to ensure that the standalone executable also
++    dnl supports ECL.
++    AC_MSG_CHECKING(if "maxima -l ecl" works)
++    AS_IF([! maxima -l ecl -q -r 'quit();' \
++             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++      AC_MSG_RESULT(no)
++      sage_spkg_install_maxima=yes
++    ], [
++      AC_MSG_RESULT(yes)
++      dnl If we have the executable, check also for the ECL library.
++      AC_MSG_CHECKING([if ECL can "require" the maxima module])
++      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
++               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++        AC_MSG_RESULT(yes)
++      ], [
++	AC_MSG_RESULT(no)
++	sage_spkg_install_maxima=yes
++      ])
++    ])
++  ])
++],[],[],[
++  # post-check
++  AS_IF([test x$sage_spkg_install_maxima = xyes], [
++    dnl Leaving this variable empty will tell sagelib to load
++    dnl the maxima library (within ECL) by name instead of by
++    dnl absolute path.
++    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
++  ])
++  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
++])
++
+diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
+index fbce6947de..8cda3ebfac 100644
+--- a/pkgs/sage-conf/sage_conf.py.in
++++ b/pkgs/sage-conf/sage_conf.py.in
+@@ -9,9 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+ SAGE_LOCAL = "@prefix@"
+ SAGE_ROOT = "@SAGE_ROOT@"
+ 
+-MAXIMA = "@prefix@/bin/maxima"
+-
+-# Delete this line if your ECL can load maxima without further prodding.
++# Set this to the empty string if your ECL can load maxima without
++# further prodding.
+ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
+ 
+ # Delete this line if your ECL can load Kenzo without further prodding.
+diff --git a/src/bin/sage b/src/bin/sage
+index fcd263029d..54b69a1043 100755
+--- a/src/bin/sage
++++ b/src/bin/sage
+@@ -684,11 +684,7 @@ fi
+ 
+ if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then
+     shift
+-    maxima_cmd=$(sage-config MAXIMA 2>/dev/null)
+-    if [ -z "${maxima_cmd}" ]; then
+-        maxima_cmd="maxima -l ecl"
+-    fi
+-    exec $maxima_cmd "$@"
++    exec maxima -l ecl "$@"
+ fi
+ 
+ if [ "$1" = '-mwrank' -o "$1" = '--mwrank' ]; then
+diff --git a/src/bin/sage-env b/src/bin/sage-env
+index a0426df523..f0866b4b1b 100644
+--- a/src/bin/sage-env
++++ b/src/bin/sage-env
+@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
+     fi
+ fi
+ 
+-if [ -n "$SAGE_LOCAL" ]; then
+-    export MAXIMA_PREFIX="$SAGE_LOCAL"
+-fi
+ export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ if [ -n "$SAGE_LOCAL" ]; then
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace135f0..95edc16081 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -207,7 +207,6 @@ MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
+ MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe"))
+ THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage"))
+ PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
+-MAXIMA = var("MAXIMA", "maxima")
+ MAXIMA_FAS = var("MAXIMA_FAS")
+ KENZO_FAS = var("KENZO_FAS")
+ SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
+diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
+index fc7f48bc05..7313c7d0d3 100644
+--- a/src/sage/interfaces/maxima.py
++++ b/src/sage/interfaces/maxima.py
+@@ -484,7 +484,6 @@ import shlex
+ 
+ from random import randrange
+ 
+-from sage.env import MAXIMA
+ from sage.misc.misc import ECL_TMP
+ 
+ from .expect import (Expect, ExpectElement, gc_disabled)
+@@ -558,7 +557,7 @@ class Maxima(MaximaAbstract, Expect):
+         Expect.__init__(self,
+                         name = 'maxima',
+                         prompt = r'\(\%i[0-9]+\) ',
+-                        command = '{0} -p {1}'.format(MAXIMA, shlex.quote(STARTUP)),
++                        command = 'maxima -l ecl -p {0}'.format(shlex.quote(STARTUP)),
+                         env = {'TMPDIR': str(ECL_TMP)},
+                         script_subdirectory = script_subdirectory,
+                         restart_on_ctrlc = False,
+diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
+index 917059de0a..c966a3c9a0 100644
+--- a/src/sage/interfaces/maxima_abstract.py
++++ b/src/sage/interfaces/maxima_abstract.py
+@@ -54,7 +54,7 @@ import re
+ import sys
+ import subprocess
+ 
+-from sage.env import DOT_SAGE, MAXIMA
++from sage.env import DOT_SAGE
+ COMMANDS_CACHE = '%s/maxima_commandlist_cache.sobj' % DOT_SAGE
+ 
+ from sage.cpython.string import bytes_to_str
+@@ -164,7 +164,7 @@ class MaximaAbstract(ExtraTabCompletion, Interface):
+             -- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
+             ...
+         """
+-        cmd = '{} --very-quiet --batch-string="{}({});" '.format(MAXIMA, command, s)
++        cmd = 'maxima -l ecl --very-quiet --batch-string="{}({});" '.format(command, s)
+         env = os.environ.copy()
+         env['TMPDIR'] = str(ECL_TMP)
+ 
+@@ -2214,7 +2214,7 @@ def maxima_version():
+         sage: maxima_version()  # random
+         '5.41.0'
+     """
+-    with os.popen('{} --version'.format(MAXIMA)) as p:
++    with os.popen('maxima -l ecl --version') as p:
+         return p.read().split()[-1]
+ 
+ 
+@@ -2232,4 +2232,4 @@ def maxima_console():
+     from sage.repl.rich_output.display_manager import get_display_manager
+     if not get_display_manager().is_in_terminal():
+         raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.')
+-    os.system('{}'.format(MAXIMA))
++    os.system('maxima -l ecl')
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 1ab0e9f7d65c..7917e78cbdc6 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -11,7 +11,8 @@ make_build_target=build
 depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
- m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
+ maxima-ecl"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -124,6 +125,7 @@ makedepends+="
  gengetopt texinfo
  brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
  lrcalc-devel nauty-devel palp tachyon
+ maxima-ecl
 "
 
 # TODO: optional

From 444cab6f23d6e81923fcfd6ca1dcd6c20ac2ee8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 13/16] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From 72ecdcd38a897d601d37c46be74e588d74bd5bd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 4 Dec 2021 12:25:56 -0300
Subject: [PATCH 14/16] sagemath: don't rewrite python shebangs

This is still causing some issues, even if main sage and doctest works
ok with rewrite enabled, some scripts are broken as reported in the PR.

This is still a temporary workaround as we are hoping for system
python-3.10 support at some point.

Also in this commit: add some depends
---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 7917e78cbdc6..ede79e76b98d 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -12,7 +12,8 @@ depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
  m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
- maxima-ecl"
+ linbox-devel gfan nauty-devel palp tachyon maxima-ecl
+ "
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -43,8 +44,7 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-# after python_version=3, this seems harmless... strange...
-#_no_python_shebang=yes
+_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink

From 260018422bfeb8e1447d943d796d4de770990fb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 9 Dec 2021 22:31:15 -0300
Subject: [PATCH 15/16] sagemath: change patch for cmdline args to disable
 dochtml testing

---
 .../sagemath/patches/skip-optional-dochtml.patch    | 13 -------------
 srcpkgs/sagemath/template                           |  4 +++-
 2 files changed, 3 insertions(+), 14 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
deleted file mode 100644
index e49b18a52fbc..000000000000
--- a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
-index 288c889bd1..b9a4d3038a 100755
---- a/src/bin/sage-runtests
-+++ b/src/bin/sage-runtests
-@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
- 
- def _get_optional_defaults():
-     """Return the default value for the --optional flag."""
--    optional = ['sage', 'dochtml', 'optional']
-+    optional = ['sage', 'optional']
- 
-     # This should be good-enough to determine if we are in a sage source
-     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index ede79e76b98d..b009060232c0 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -88,8 +88,10 @@ do_check() {
 	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
 		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
 	fi
+	# the default is "sage,dochtml,optional,build", we skip dochtml
+	OPT="--optional sage,optional,build"
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
+	./sage -tp ${XBPS_MAKEJOBS} ${OPT} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 152d9a34c6e0feb307f421516e82c099bed2cc65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 13 Dec 2021 00:05:49 -0300
Subject: [PATCH 16/16] sagemath: update to 9.5.beta8.

---
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 ----
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ------------------
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ----
 srcpkgs/sagemath/template                     |   6 +-
 4 files changed, 3 insertions(+), 189 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch

diff --git a/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
deleted file mode 100644
index ec0467757ee7..000000000000
--- a/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Sat, 30 Oct 2021 10:21:52 +0200
-Subject: Fix test failure caused by new warning
-
----
- src/sage/lfunctions/pari.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
-index 0aaf91c..33d5266 100644
---- a/src/sage/lfunctions/pari.py
-+++ b/src/sage/lfunctions/pari.py
-@@ -316,7 +316,7 @@ def lfun_number_field(K):
-         sage: L(3)
-         1.15202784126080
-         sage: L(0)
--        0.000000000000000
-+        ...0.000000000000000
-     """
-     return pari.lfuncreate(K)
- 
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
deleted file mode 100644
index 426932c95c9b..000000000000
--- a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
-index 3824fd2ce9..20509db618 100644
---- a/build/pkgs/pyzmq/checksums.ini
-+++ b/build/pkgs/pyzmq/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=pyzmq-VERSION.tar.gz
--sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
--md5=f261acf884460e93d30f7113c8e9242e
--cksum=1661206741
-+sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
-+md5=ecf13c72fbea05ba5ddc771295409d48
-+cksum=1680251717
- upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
-diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
-index 0398faf11c..8326e27f9b 100644
---- a/build/pkgs/pyzmq/package-version.txt
-+++ b/build/pkgs/pyzmq/package-version.txt
-@@ -1 +1 @@
--22.2.1
-+22.3.0
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..069d87767f 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,17 +1,11 @@
--# Since we use environment vars we have to generate setup.cfg
--
--echo "[build_ext]" > src/setup.cfg
--
--# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
--# the path---which is never used but is a good habit to support---but
--# that simply does not work. Sorry.)
--
--echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
--echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
--
--echo "[configure]" >> src/setup.cfg
--
- cd src
- 
-+# Generate setup.cfg
-+cat > setup.cfg <<EOF
-+[global]
-+zmq_prefix = $SAGE_LOCAL
-+no_libzmq_extension = True
-+EOF
-+
- # Configure and install
- sdh_pip_install .
-diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
-index 6a280871e7..d9290d04ff 100644
---- a/build/pkgs/setuptools/checksums.ini
-+++ b/build/pkgs/setuptools/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=setuptools-VERSION.tar.gz
--sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
--md5=ff20ab7e0d51c5ad0a9438c50e598c06
--cksum=3564252314
-+sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
-+md5=79b36f59270a6f2e45d6a9a0c6dc68c1
-+cksum=430889097
- upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
-diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
-index e6ea636051..aec1257e4c 100644
---- a/build/pkgs/setuptools/package-version.txt
-+++ b/build/pkgs/setuptools/package-version.txt
-@@ -1 +1 @@
--58.2.0
-+59.2.0
-diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
-index ea8c36bce5..dc802612dd 100644
---- a/build/pkgs/zeromq/checksums.ini
-+++ b/build/pkgs/zeromq/checksums.ini
-@@ -1,4 +1,5 @@
- tarball=zeromq-VERSION.tar.gz
--sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
--md5=a1c95b34384257e986842f4d006957b8
--cksum=136261411
-+sha1=47277a64749049123d1401600e8cfbab10a3ae28
-+md5=c897d4005a3f0b8276b00b7921412379
-+cksum=1500782345
-+upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
-diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
-index df0228dfae..eda862a98c 100644
---- a/build/pkgs/zeromq/package-version.txt
-+++ b/build/pkgs/zeromq/package-version.txt
-@@ -1 +1 @@
--4.2.5
-+4.3.4
-diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
-deleted file mode 100644
-index e665114e1c..0000000000
---- a/build/pkgs/zeromq/patches/getrandom.patch
-+++ /dev/null
-@@ -1,39 +0,0 @@
--Patch taken from upstream git repo
--and after running aclocal && autoconf
--and removing changes to autotools input files
--
--commit 4ff814f204ee38177a392526cf12c8c0019b480f
--Author: Luca Boccassi <luca.boccassi@gmail.com>
--Date:   Wed May 9 10:41:20 2018 +0100
--
--    Problem: getrandom test does not check if it's working
--
--    Solution: check return value in autoconf and CMake. On some platforms
--    the function is available but not implemented (eg: GNU/Hurd).
--
--diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
----- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
--+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
--@@ -287,7 +287,8 @@
-- int main (int argc, char *argv [])
-- {
--     char buf[4];
---    getrandom(buf, 4, 0);
--+    int rc = getrandom(buf, 4, 0);
--+    return rc == -1 ? 1 : 0;
-- }
-- "
--     ZMQ_HAVE_GETRANDOM)
--diff -ru zeromq-4.2.5//configure b/configure
----- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
--+++ b/configure	2018-07-24 12:39:49.018035120 +0200
--@@ -23315,7 +23315,8 @@
-- int main (int argc, char *argv [])
-- {
--     char buf[4];
---    getrandom(buf, 4, 0);
--+    int rc = getrandom(buf, 4, 0);
--+    return rc == -1 ? 1 : 0;
-- }
-- 
-- _ACEOF
diff --git a/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
deleted file mode 100644
index ea05b2b6a524..000000000000
--- a/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
-From: Tobias Diez <code@tobiasdiez.com>
-Date: Wed, 17 Nov 2021 22:24:32 +0100
-Subject: Fix exit code for pytest in case of no matched files
-
----
- src/bin/sage-runtests | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
-index 882456d..8b362ca 100755
---- a/src/bin/sage-runtests
-+++ b/src/bin/sage-runtests
-@@ -157,6 +157,10 @@ if __name__ == "__main__":
-         if args.verbose:
-             pytest_options.append("-v")
-         exit_code_pytest = pytest.main(pytest_options + args.filenames)
-+        if exit_code_pytest == 5:
-+            # Exit code 5 means there were no test files, pass in this case
-+            exit_code_pytest = 0
-+
-     except ModuleNotFoundError:
-         print("Pytest is not installed, skip checking tests that rely on it.")
- 
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index b009060232c0..a1f08000669a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,6 +1,6 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta7
+version=9.5.beta8
 revision=1
 wrksrc=sage-$version
 build_style=configure
@@ -19,7 +19,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
+checksum=124f3d23ce6442ecc84ed98e3c035e0d00c8261c3125712e4742c32e731d13de
 python_version=3
 
 # path where sage will be installed
@@ -112,7 +112,7 @@ makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
 makedepends+="
  CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
  ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
- glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz-devel gsl-devel isl-devel
  libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
  libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
  pari-devel pari-elldata-small pari-galdata pari-galpol-small

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (96 preceding siblings ...)
  2021-12-13  3:13 ` [PR PATCH] [Updated] " tornaria
@ 2021-12-13  9:25 ` dkwo
  2021-12-13 13:17 ` tornaria
                   ` (140 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13  9:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992267726

Comment:
Maybe the problem is with maxima?
From the log here in musl ci:
```
Trying to install dependants of maxima-ecl:
MISSING: glibc>=2.32_1
Transaction aborted due to unresolved dependencies.
```
Btw, it seems Arch has it working with python3.10, shall we try as well?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (97 preceding siblings ...)
  2021-12-13  9:25 ` dkwo
@ 2021-12-13 13:17 ` tornaria
  2021-12-13 13:28 ` dkwo
                   ` (139 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-13 13:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3495 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992467442

Comment:
> Maybe the problem is with maxima? From the log here in musl ci:
> 
> ```
> Trying to install dependants of maxima-ecl:
> MISSING: glibc>=2.32_1
> Transaction aborted due to unresolved dependencies.
> ```

I don't see anything like that here or in github CI. Maybe you have a broken maxima-ecl from an old compilation in your binpkgs? Can you try repackaging maxima in your xbps-src? Note that these packages are changing but I'm not incrementing revision so you must ensure they are recompiled to the current version. At this time the PR includes maxima-ecl (from #34273, IMO ready to merge) and updated lcalc (#34503, should be straightforward to merge).

In my xbps-src musl chroot everything looks ok:
```
$ xbps-query -S maxima-ecl
architecture: x86_64-musl
automatic-install: yes
build-options: ecl sbcl ~clisp 
filename-sha256: f89b6e1e219df1168fa03f41c256dc9138567413dbcfb86ca3d13593e54e4fc9
filename-size: 3646KB
homepage: http://maxima.sourceforge.net
install-date: 2021-12-13 04:12 UTC
installed_size: 13MB
license: GPL-2.0-only
maintainer: Bosco Garcia <jboscogg@gmail.org>
metafile-sha256: 1d32aff1ce855c398975ea20e5a6ebffec68ace62e28aec46ce6bb28d293c090
pkgname: maxima-ecl
pkgver: maxima-ecl-5.45.1_2
repository: /host/binpkgs/sagemath
run_depends:
	maxima-5.45.1_2
	ecl>=21.2.1_1
	musl>=1.1.24_7
shlib-requires:
	libecl.so.21.2
	libc.so
short_desc: Computer Algebra System - compiled with ECL
state: installed
$ xbps-query -f maxima-ecl
/usr/lib/maxima/5.45.1/binary-ecl/libmaxima-ecl.so
/usr/lib/maxima/5.45.1/binary-ecl/maxima
/usr/lib/maxima/5.45.1/binary-ecl/maxima.fas
/usr/lib/ecl-21.2.1/maxima.fas -> /usr/lib/maxima/5.45.1/binary-ecl/maxima.fas
$ ldd /usr/lib/maxima/5.45.1/binary-ecl/libmaxima-ecl.so 
	ldd (0x7f23a7c7b000)
	libecl.so.21.2 => /lib/libecl.so.21.2 (0x7f23a6c67000)
	libc.so => ldd (0x7f23a7c7b000)
	libgmp.so.10 => /usr/lib64//libgmp.so.10 (0x7f23a6bea000)
	libgc.so.1 => /usr/lib64//libgc.so.1 (0x7f23a6b73000)
	libffi.so.7 => /usr/lib64//libffi.so.7 (0x7f23a6b67000)
$ ldd /usr/lib/maxima/5.45.1/binary-ecl/maxima           
	/lib/ld-musl-x86_64.so.1 (0x7f511e95f000)
	libmaxima-ecl.so => /usr/lib/maxima/5.45.1/binary-ecl/libmaxima-ecl.so (0x7f511dcba000)
	libecl.so.21.2 => /lib/libecl.so.21.2 (0x7f511d94b000)
	libc.so => /lib/ld-musl-x86_64.so.1 (0x7f511e95f000)
	libgmp.so.10 => /usr/lib64//libgmp.so.10 (0x7f511d8ce000)
	libgc.so.1 => /usr/lib64//libgc.so.1 (0x7f511d857000)
	libffi.so.7 => /usr/lib64//libffi.so.7 (0x7f511d84b000)
$ ldd /usr/lib/maxima/5.45.1/binary-ecl/maxima.fas 
	ldd (0x7efff7437000)
	libmaxima-ecl.so => /usr/lib/maxima/5.45.1/binary-ecl/libmaxima-ecl.so (0x7efff678c000)
	libecl.so.21.2 => /lib/libecl.so.21.2 (0x7efff641d000)
	libc.so => ldd (0x7efff7437000)
	libgmp.so.10 => /usr/lib64//libgmp.so.10 (0x7efff63a0000)
	libgc.so.1 => /usr/lib64//libgc.so.1 (0x7efff6329000)
	libffi.so.7 => /usr/lib64//libffi.so.7 (0x7efff631d000)
```


> 
> Btw, it seems Arch has it working with python3.10, shall we try as well?

I'll try it again soon. Now that 9.5.beta8 merged a few required tickets it seems we need:
 - https://trac.sagemath.org/ticket/30766
 - https://trac.sagemath.org/ticket/33013
Although there are still some issues (see https://trac.sagemath.org/ticket/30766#comment:67 and preceding comments).

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (98 preceding siblings ...)
  2021-12-13 13:17 ` tornaria
@ 2021-12-13 13:28 ` dkwo
  2021-12-13 15:25 ` dkwo
                   ` (138 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13 13:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992476894

Comment:
The last quote is from the github ci, not from my local system.
But I will try again repackaging maxima.
Great, I think not much is missing for 3.10


^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (99 preceding siblings ...)
  2021-12-13 13:28 ` dkwo
@ 2021-12-13 15:25 ` dkwo
  2021-12-13 17:10 ` tornaria
                   ` (137 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13 15:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992590035

Comment:
I get the same behavior after deleting all artifacts in binpkgs folder.
It seems to me also CI sees the same issue.
Could you try xbps-query on sagemath as well?
Anyone else using musl who could check?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (100 preceding siblings ...)
  2021-12-13 15:25 ` dkwo
@ 2021-12-13 17:10 ` tornaria
  2021-12-13 17:48 ` tornaria
                   ` (136 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-13 17:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992689211

Comment:
This is caused by prebuilt binaries linked with glibc being shipped by debugpy inside sagemath. See https://trac.sagemath.org/ticket/33020.

A workaround might be adding to the template:
```
skiprdeps="attach_linux_amd64.so attach_linux_x86.so"
```
so those binaries are skipped when looking for shlib_rdeps.

Can you try that?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (101 preceding siblings ...)
  2021-12-13 17:10 ` tornaria
@ 2021-12-13 17:48 ` tornaria
  2021-12-13 20:34 ` dkwo
                   ` (135 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-13 17:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992720951

Comment:
This is what you actually need for `skiprdeps`:
```
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -43,6 +43,11 @@ nostrip=yes
 # don't shlib_provide anything
 noshlibprovides=yes
 
+# skip bad shlib rdeps for precompiled binaries
+skiprdeps="
+ ${_SAGE_ROOT}/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_amd64.so
+ ${_SAGE_ROOT}/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/attach_linux_x86.so"
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (102 preceding siblings ...)
  2021-12-13 17:48 ` tornaria
@ 2021-12-13 20:34 ` dkwo
  2021-12-13 21:00 ` dkwo
                   ` (134 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13 20:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992872304

Comment:
With that it installs, thank you, but then it segfaults:
```
$ sage-9.5.beta8_1
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.beta8, Release Date: 2021-12-12               │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
------------------------------------------------------------------------
Attaching gdb to process id 6962.
Cannot find gdb installed
GDB is not installed.
Install gdb for enhanced tracebacks.
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (103 preceding siblings ...)
  2021-12-13 20:34 ` dkwo
@ 2021-12-13 21:00 ` dkwo
  2021-12-13 21:13 ` dkwo
                   ` (133 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13 21:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992904887

Comment:
Btw, besides the link to sagemath kernel, I use `jupyter lab --app-dir /usr/lib/python3.10/site-packages/jupyterlab`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (104 preceding siblings ...)
  2021-12-13 21:00 ` dkwo
@ 2021-12-13 21:13 ` dkwo
  2021-12-14 17:36 ` ericonr
                   ` (132 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-13 21:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-992914948

Comment:
The segfault goes away if I use musl from the repo, as opposed to newer self-built one.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (105 preceding siblings ...)
  2021-12-13 21:13 ` dkwo
@ 2021-12-14 17:36 ` ericonr
  2021-12-15 10:41 ` dkwo
                   ` (131 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: ericonr @ 2021-12-14 17:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-993818190

Comment:
Can you get a backtrace of the segfault on newer musl? Chances are some overflow issue is being caught by newer musl, but would be good to confirm.

Running with valgrind might help, though it might also complain about the other libraries involved.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (106 preceding siblings ...)
  2021-12-14 17:36 ` ericonr
@ 2021-12-15 10:41 ` dkwo
  2021-12-15 14:57 ` tornaria
                   ` (130 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-15 10:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-994663537

Comment:
Does this help?
```
Attaching gdb to process id 21891.
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
[New LWP 21956]
0x00007fc45a241388 in __cp_end () from /lib/ld-musl-x86_64.so.1

Stack backtrace
---------------
No symbol table info available.
#1  0x00007fc45a232fc1 in __syscall_cp_c () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2  0x00007fc45a27cb44 in builtin_tls () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#3  0x0000000000000000 in ?? ()
No symbol table info available.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[Inferior 1 (process 21891) detached]
Traceback (most recent call last):
  File "<string>", line 25, in <module>
ModuleNotFoundError: No module named 'Cython'
Error while executing Python code.
Saved trace to /home/nicolo/.sage/crash_logs/crash_552os0mo.log
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault
```
or what should I do?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (107 preceding siblings ...)
  2021-12-15 10:41 ` dkwo
@ 2021-12-15 14:57 ` tornaria
  2021-12-15 14:59 ` tornaria
                   ` (129 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-15 14:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-994872906

Comment:
@dkwo can you try running `sage --valgrind`?

See: https://doc.sagemath.org/html/en/developer/doctesting.html#debugging-tools

There are more options there. I'm not sure if we have to add some flag to get sage compiled with debug symbols to get better stack traces.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (108 preceding siblings ...)
  2021-12-15 14:57 ` tornaria
@ 2021-12-15 14:59 ` tornaria
  2021-12-15 15:04 ` dkwo
                   ` (128 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-15 14:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-994872906

Comment:
@dkwo can you try running `sage --valgrind`?

See: https://doc.sagemath.org/html/en/developer/doctesting.html#debugging-tools

There are more options there. I'm not sure if we have to add some flag to get sage compiled with debug symbols to get better stack traces.

Edit: possibly need to install valgrind with xbps.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (109 preceding siblings ...)
  2021-12-15 14:59 ` tornaria
@ 2021-12-15 15:04 ` dkwo
  2021-12-15 15:19 ` dkwo
                   ` (127 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-15 15:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 4099 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-994879784

Comment:
I installed valgrind. I get
```
$ sage-9.5.beta8_1 --valgrind
Python suppressions not found (not installed?), skipping
Using default flags: --leak-resolution=high --leak-check=full --num-callers=25  --suppressions=/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/ext_data/valgrind/pyalloc.supp --suppressions=/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/ext_data/valgrind/sage.supp --suppressions=/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.9.7/lib/python3.9/site-packages/sage/ext_data/valgrind/sage-additional.supp
==21873== Memcheck, a memory error detector
==21873== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==21873== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==21873== Command: /usr/lib/sage-9.5.beta8/src/bin/sage-ipython -i
==21873==
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.beta8, Release Date: 2021-12-12               │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
------------------------------------------------------------------------
Attaching gdb to process id 21877.
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
[New LWP 21912]
0x00007efe91cac388 in __cp_end () from /lib/ld-musl-x86_64.so.1

Stack backtrace
---------------
No symbol table info available.
#1  0x00007efe91c9dfc1 in __syscall_cp_c () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#2  0x00007efe91ce7b44 in builtin_tls () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#3  0x0000000000000000 in ?? ()
No symbol table info available.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[Inferior 1 (process 21877) detached]
Traceback (most recent call last):
  File "<string>", line 25, in <module>
ModuleNotFoundError: No module named 'Cython'
Error while executing Python code.
Saved trace to /home/nicolo/.sage/crash_logs/crash_6nnbkql4.log
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (110 preceding siblings ...)
  2021-12-15 15:04 ` dkwo
@ 2021-12-15 15:19 ` dkwo
  2021-12-16 23:11 ` tornaria
                   ` (126 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-15 15:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2501 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-994893356

Comment:
sage-9.5.beta8_1 --massif
```
==26499== Massif, a heap profiler
==26499== Copyright (C) 2003-2017, and GNU GPL'd, by Nicholas Nethercote
==26499== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==26499== Command: /usr/lib/sage-9.5.beta8/src/bin/sage-python -i
==26499== Parent PID: 26394
==26499==

valgrind: m_mallocfree.c:278 (mk_plain_bszB): Assertion 'bszB != 0' failed.
valgrind: This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.  If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away.  Please try that before reporting this as a bug.


host stacktrace:
==26499==    at 0x580F9061: ??? (in /usr/libexec/valgrind/massif-amd64-linux)
==26499==    by 0x580F90A7: ??? (in /usr/libexec/valgrind/massif-amd64-linux)
==26499==    by 0x580F9228: ??? (in /usr/libexec/valgrind/massif-amd64-linux)
==26499==    by 0x5813FCE4: ??? (in /usr/libexec/valgrind/massif-amd64-linux)
==26499==    by 0x581B772C: ??? (in /usr/libexec/valgrind/massif-amd64-linux)
==26499==    by 0x581B7CAB: ??? (in /usr/libexec/valgrind/massif-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 26499)
==26499==    at 0x48BE17B: free (in /usr/libexec/valgrind/vgpreload_massif-amd64-linux.so)
==26499==    by 0x11DF10: ??? (in /usr/bin/dash)
==26499==    by 0x10F445: ??? (in /usr/bin/dash)
==26499==    by 0x10E2B0: ??? (in /usr/bin/dash)
==26499==    by 0x115C0B: ??? (in /usr/bin/dash)
==26499==    by 0x10C6B2: ??? (in /usr/bin/dash)
==26499==    by 0x401E5E9: libc_start_main_stage2 (in /usr/lib/libc.so)
client stack range: [0x1FFEFFE000 0x1FFF000FFF] client SP: 0x1FFEFFFB80
valgrind stack range: [0x100268E000 0x100278DFFF] top usage: 8896 of 1048576


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.
```

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (111 preceding siblings ...)
  2021-12-15 15:19 ` dkwo
@ 2021-12-16 23:11 ` tornaria
  2021-12-17 20:08 ` dkwo
                   ` (125 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-16 23:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-996264540

Comment:
Maybe using `nostrip=yes` in the template will keep symbols and give some clue? I don't see anything of help in those backtraces without symbols.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (112 preceding siblings ...)
  2021-12-16 23:11 ` tornaria
@ 2021-12-17 20:08 ` dkwo
  2021-12-20  2:23 ` tornaria
                   ` (124 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-17 20:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-997002822

Comment:
Even with that, I'm still getting `No symbol table info available.`

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (113 preceding siblings ...)
  2021-12-17 20:08 ` dkwo
@ 2021-12-20  2:23 ` tornaria
  2021-12-20  2:35 ` [PR PATCH] [Updated] " tornaria
                   ` (123 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-20  2:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-997538738

Comment:
> Even with that, I'm still getting `No symbol table info available.`

I think you have to `export SAGE_DEBUG=yes` before running configure. I think you can add that to `pre_configure()` right after calling `./bootstrap`.

The template is already using `nostrip=yes` so that should be all.

Maybe we could add a build option `debug` to enable debug symbols.
 

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] New package: sagemath-9.5.beta7
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (114 preceding siblings ...)
  2021-12-20  2:23 ` tornaria
@ 2021-12-20  2:35 ` tornaria
  2021-12-23 17:18 ` [WIP] New package: sagemath-9.5.beta8 dkwo
                   ` (122 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-20  2:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/34030

[WIP] New package: sagemath-9.5.beta7
This is WIP, so I can get feedback.

Right now there is some issue with relocation, since `/builddir/sage-9.5.beta5` leaks all over the place. In particular starting sage complains this directory is missing... but it seems to work.

I'm unsure if the package name should be `sage` or `sagemath`.

A patch file from https://github.com/void-linux/void-packages/pull/34030.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-34030.patch --]
[-- Type: text/x-diff, Size: 193080 bytes --]

From 0eaf48ba14f273d11431caf54e160c22292d7214 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 13 Dec 2021 15:40:18 -0300
Subject: [PATCH 01/19] New package: primesieve-7.7

---
 common/shlibs               |  1 +
 srcpkgs/primesieve-devel    |  1 +
 srcpkgs/primesieve/template | 31 +++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 120000 srcpkgs/primesieve-devel
 create mode 100644 srcpkgs/primesieve/template

diff --git a/common/shlibs b/common/shlibs
index 4edfe7d909d7..9fafd98bca29 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4052,6 +4052,7 @@ libqrtr-glib.so.0 libqrtr-glib-1.0.0_1
 libbraiding.so.0 libbraiding-1.1_1
 libstemmer.so.2 libstemmer-2.1.0_1
 libdecor-0.so.0 libdecor-0.1.0_1
+libprimesieve.so.9 primesieve-7.7_1
 libavif.so.13 libavif-0.9.3_1
 libkdumpfile.so.9 libkdumpfile-0.4.1_1
 libamd.so.2 SuiteSparse-5.10.1_1
diff --git a/srcpkgs/primesieve-devel b/srcpkgs/primesieve-devel
new file mode 120000
index 000000000000..f4ffe288e787
--- /dev/null
+++ b/srcpkgs/primesieve-devel
@@ -0,0 +1 @@
+primesieve
\ No newline at end of file
diff --git a/srcpkgs/primesieve/template b/srcpkgs/primesieve/template
new file mode 100644
index 000000000000..d023f7f1e884
--- /dev/null
+++ b/srcpkgs/primesieve/template
@@ -0,0 +1,31 @@
+# Template file for 'primesieve'
+pkgname=primesieve
+version=7.7
+revision=1
+build_style=cmake
+configure_args="-DBUILD_TESTS=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF"
+short_desc="Fast prime number generator"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="BSD-2-Clause"
+homepage="https://github.com/kimwalisch/primesieve"
+distfiles="https://github.com/kimwalisch/primesieve/archive/refs/tags/v${version}.tar.gz"
+checksum=fcb3f25e68081c54e5d560d6d1f6448d384a7051e9c56d56ee0d65d6d7954db1
+
+if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
+	makedepends+=" libatomic-devel"
+fi
+
+post_install() {
+	vlicense COPYING
+}
+
+primesieve-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision} ${makedepends}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/cmake
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 58ce3c4da37b7b964d740fc11f52188561a374ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 13 Dec 2021 17:08:11 -0300
Subject: [PATCH 02/19] New package: primecount-7.2

---
 common/shlibs               |  1 +
 srcpkgs/primecount-devel    |  1 +
 srcpkgs/primecount/template | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 120000 srcpkgs/primecount-devel
 create mode 100644 srcpkgs/primecount/template

diff --git a/common/shlibs b/common/shlibs
index 9fafd98bca29..b936d7bae7e7 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4052,6 +4052,7 @@ libqrtr-glib.so.0 libqrtr-glib-1.0.0_1
 libbraiding.so.0 libbraiding-1.1_1
 libstemmer.so.2 libstemmer-2.1.0_1
 libdecor-0.so.0 libdecor-0.1.0_1
+libprimecount.so.7 primecount-7.2_1
 libprimesieve.so.9 primesieve-7.7_1
 libavif.so.13 libavif-0.9.3_1
 libkdumpfile.so.9 libkdumpfile-0.4.1_1
diff --git a/srcpkgs/primecount-devel b/srcpkgs/primecount-devel
new file mode 120000
index 000000000000..f5356598687b
--- /dev/null
+++ b/srcpkgs/primecount-devel
@@ -0,0 +1 @@
+primecount
\ No newline at end of file
diff --git a/srcpkgs/primecount/template b/srcpkgs/primecount/template
new file mode 100644
index 000000000000..09a43b602f19
--- /dev/null
+++ b/srcpkgs/primecount/template
@@ -0,0 +1,34 @@
+# Template file for 'primecount'
+pkgname=primecount
+version=7.2
+revision=1
+build_style=cmake
+configure_args="-DBUILD_TESTS=ON -DBUILD_LIBPRIMESIEVE=OFF
+ -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF"
+makedepends="primesieve-devel libgomp-devel"
+short_desc="Fast prime counting function"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="BSD-2-Clause"
+homepage="https://github.com/kimwalisch/primecount/"
+distfiles="https://github.com/kimwalisch/primecount/archive/refs/tags/v${version}.tar.gz"
+checksum=54c1eec33e665a780002dda20cf39ba0cefa8e846fdeda44734fb2265cba9257
+
+build_options="native_build"
+
+if [ -z "$build_option_native_build" ]; then
+	configure_args+=" -DWITH_POPCNT=OFF"
+fi
+
+post_install() {
+	vlicense COPYING
+}
+
+primecount-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision} ${makedepends}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove usr/lib/pkgconfig
+		vmove "usr/lib/*.so"
+	}
+}

From 11976cc732fecd92a057bcd6b2868e8c47cc20a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 27 Nov 2021 19:38:48 -0300
Subject: [PATCH 03/19] maxima: add a subpkg maxima-ecl needed for sagemath

 - Added a build option 'ecl' (enabled by default)
 - The ecl binary and library will be in a subpkg maxima-ecl so this
   should not affect current users of maxima
 - new patches:
   - a0d7a43...: build a FASL library for ECL (this is merged upstream)
   - handle-multiple-ldflags.patch: otherwise compilation with multiple
     options in LDFLAGS fails (taken from debian)
   - matrixexp.patch: fixes an error in matrix exponentiation (taken
     from debian, this originates in sagemath)

A weak point is that the library maxima.fas is installed in
/usr/lib/ecl-${ecl_version} which is where ecl looks for them, but this
doesn't seem right.

Maybe an alternative would be to have the ecl package ship a symlink at
/usr/lib/ecl pointing to the versioned directory, then have the
maxima-ecl package place its library in the non-versioned directory.
---
 srcpkgs/maxima-ecl                            |  1 +
 ...a43e5234305bd6f1de5909d4ce5d7e1ea864.patch | 24 +++++++++++
 .../patches/handle-multiple-ldflags.patch     | 43 +++++++++++++++++++
 srcpkgs/maxima/patches/matrixexp.patch        | 23 ++++++++++
 srcpkgs/maxima/template                       | 34 ++++++++++++---
 5 files changed, 120 insertions(+), 5 deletions(-)
 create mode 120000 srcpkgs/maxima-ecl
 create mode 100644 srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
 create mode 100644 srcpkgs/maxima/patches/handle-multiple-ldflags.patch
 create mode 100644 srcpkgs/maxima/patches/matrixexp.patch

diff --git a/srcpkgs/maxima-ecl b/srcpkgs/maxima-ecl
new file mode 120000
index 000000000000..b8b0e8240fa4
--- /dev/null
+++ b/srcpkgs/maxima-ecl
@@ -0,0 +1 @@
+maxima
\ No newline at end of file
diff --git a/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
new file mode 100644
index 000000000000..e1ac1e5f6086
--- /dev/null
+++ b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
@@ -0,0 +1,24 @@
+commit a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864
+Author: Robert Dodier <robert_dodier@users.sourceforge.net>
+Date:   Mon Oct 11 22:40:13 2021 -0700
+
+    Apply patch #80: "Build a FASL library, needed by SageMath"
+    
+    This modifies maxima.system for ECL only.
+
+diff --git a/src/maxima.system b/src/maxima.system
+index d954bc2b9..525fb778e 100644
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -75,6 +75,11 @@
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+ 			 files)))
++	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			  :ld-flags
++			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
++							      (find-package "MAXIMA")))))
++			    (if (and x (not (string= x ""))) (list x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
diff --git a/srcpkgs/maxima/patches/handle-multiple-ldflags.patch b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
new file mode 100644
index 000000000000..799fc15f9185
--- /dev/null
+++ b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
@@ -0,0 +1,43 @@
+Description: Handle multiple LDFLAGS
+ Without this patch, building with LDFLAGS containing more than one flag results 
+ in flags being dropped.
+Author: Graham Inggs <ginggs@debian.org>
+Bug-Debian: http://bugs.debian.org/847925
+
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -58,6 +58,19 @@
+     (and (apply #'compile-file file :output-file object-output args)
+ 	 (c:build-fasl output :lisp-files (list object-output)))))
+ 
++(defun split-string (string &key (item #\space) (test #'char=))
++  ;; Splits the string into substrings at spaces.
++  (let ((len (length string))
++	(index 0) result)
++    (dotimes (i len
++		(progn (unless (= index len)
++			 (push (subseq string index) result))
++		       (reverse result)))
++      (when (funcall test (char string i) item)
++	(unless (= index i);; two spaces in a row
++	  (push (subseq string index i) result))
++	(setf index (1+ i))))))
++
+ #+ecl
+ (defun build-maxima-lib ()
+   (labels ((list-all-objects (module)
+@@ -79,12 +92,12 @@
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x))))
++			    (if (and x (not (string= x ""))) (split-string x))))
+ 	(c::build-program "binary-ecl/maxima" :lisp-files obj
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+-			    (if (and x (not (string= x ""))) (list x)))
++			    (if (and x (not (string= x ""))) (split-string x)))
+ 			  :epilogue-code '(progn (cl-user::run)))))))
+ 
+ (defun maxima-binary-pathname ()
diff --git a/srcpkgs/maxima/patches/matrixexp.patch b/srcpkgs/maxima/patches/matrixexp.patch
new file mode 100644
index 000000000000..7cbd9ccac089
--- /dev/null
+++ b/srcpkgs/maxima/patches/matrixexp.patch
@@ -0,0 +1,23 @@
+Description: Fix error in matrix exponentiation
+ This patch was written by SageMath but not yet committed into Maxima releases.
+ However, it is needed for SageMath to work correctly:
+ .
+ https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
+Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
+Bug-Sage: http://trac.sagemath.org/ticket/13973
+Bug: https://sourceforge.net/p/maxima/bugs/2596/
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/share/linearalgebra/matrixexp.lisp
++++ b/share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,8 @@
+ 	   (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
+ 	   (print `(ratfac = ,$ratfac))
+ 	   (merror "Unable to find the spectrum")))
+-   
+-    (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
++
++    (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
+     (setq m (length sp))
+     (dotimes (i m)
+       (setq zi (nth i sp))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 3a95e3706447..798b4f9f00de 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -1,11 +1,11 @@
 # Template file for 'maxima'
 pkgname=maxima
 version=5.45.1
-revision=1
+revision=2
 build_style=gnu-configure
-configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec)"
+configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
 hostmakedepends="python3 perl emacs texinfo"
-makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl)"
+makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
 short_desc="Computer Algebra System"
@@ -17,10 +17,11 @@ checksum=fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
 
 nostrip=yes
 nopie=yes
-build_options="clisp sbcl"
+build_options="clisp sbcl ecl"
 desc_option_clisp="Build with CLISP"
 desc_option_sbcl="Build with SBCL"
-build_options_default="sbcl"
+desc_option_ecl="Build with ECL"
+build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
 post_install() {
@@ -66,3 +67,26 @@ xmaxima_package() {
 			${PKGDESTDIR}/usr/share/pixmaps/maxima
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima"
+
+if [ "$build_option_ecl" ]; then
+	subpackages+=" maxima-ecl"
+fi
+
+maxima-ecl_package() {
+	short_desc+=" - compiled with ECL"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		# this is /usr/lib/ecl-${ecl_version}
+		# ideally we would just place it in /usr/lib/ecl but this
+		# doesn't just work
+		# Maybe we can have the ecl package ship a symlink:
+		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
+		# and have this package just install in /usr/lib/ecl
+		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
+		vmkdir $ECLDIR
+		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
+		vmove usr/lib/maxima/${version}/binary-ecl
+	}
+}

From 35dd3d7ecb28703f69a6ca40b6845b47397e9078 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Fri, 10 Dec 2021 14:01:01 -0300
Subject: [PATCH 04/19] maxima: use a shared lib

---
 .../maxima/patches/use-shared-library.patch   | 21 ++++++++
 srcpkgs/maxima/template                       | 50 +++++++++++++------
 2 files changed, 55 insertions(+), 16 deletions(-)
 create mode 100644 srcpkgs/maxima/patches/use-shared-library.patch

diff --git a/srcpkgs/maxima/patches/use-shared-library.patch b/srcpkgs/maxima/patches/use-shared-library.patch
new file mode 100644
index 000000000000..a8f986ac7033
--- /dev/null
+++ b/srcpkgs/maxima/patches/use-shared-library.patch
@@ -0,0 +1,21 @@
+--- a/src/maxima.system	2021-12-02 00:26:23.955984864 -0300
++++ b/src/maxima.system	2021-12-02 00:31:22.299541969 -0300
+@@ -87,13 +87,15 @@
+       (let ((obj (mapcar #'(lambda (p)
+ 			     ;; Convert dir/foo.fas to dir/foo.o
+ 			     (make-pathname :type "o" :defaults p))
+-			 files)))
+-	(c::build-fasl "binary-ecl/maxima" :lisp-files obj
++			 files))
++			(lib '("binary-ecl/libmaxima-ecl.so")))
++	(c::build-shared-library "binary-ecl/maxima-ecl" :lisp-files obj)
++	(c::build-fasl "binary-ecl/maxima" :lisp-files lib
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
+ 			    (if (and x (not (string= x ""))) (split-string x))))
+-	(c::build-program "binary-ecl/maxima" :lisp-files obj
++	(c::build-program "binary-ecl/maxima" :lisp-files lib
+ 			  :ld-flags
+ 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ 							      (find-package "MAXIMA")))))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 798b4f9f00de..1a4bec0dba18 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -4,7 +4,7 @@ version=5.45.1
 revision=2
 build_style=gnu-configure
 configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
-hostmakedepends="python3 perl emacs texinfo"
+hostmakedepends="python3 perl emacs texinfo patchelf"
 makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
 depends="$(vopt_if clisp clisp) rlwrap"
 checkdepends="gnuplot"
@@ -24,6 +24,29 @@ desc_option_ecl="Build with ECL"
 build_options_default="sbcl ecl"
 vopt_conflict clisp sbcl
 
+post_build() {
+	if [ "$build_option_ecl" ]; then
+		# everything will go in the same directory, use rpath=$ORIGIN
+		patchelf --remove-rpath src/binary-ecl/libmaxima-ecl.so
+		patchelf --set-rpath \$ORIGIN \
+			src/binary-ecl/{maxima,maxima.fas}
+		patchelf \
+			--replace-needed  binary-ecl/libmaxima-ecl.so libmaxima-ecl.so \
+			src/binary-ecl/{maxima,maxima.fas}
+	fi
+}
+
+do_check() {
+	if [ "$build_option_ecl" ]; then
+		echo "Check that maxima.fas works"
+		ecl --eval "(require 'maxima \"src/binary-ecl/maxima.fas\")" \
+			--eval "(quit)"
+	fi
+
+	# now run the testsuite
+	make ${makejobs} check
+}
+
 post_install() {
 	vmkdir usr/share/doc
 	ln -sf ../maxima/${version}/doc ${DESTDIR}/usr/share/doc/maxima
@@ -68,25 +91,20 @@ xmaxima_package() {
 	}
 }
 
-subpackages="maxima-src maxima-emacs xmaxima"
-
-if [ "$build_option_ecl" ]; then
-	subpackages+=" maxima-ecl"
-fi
-
 maxima-ecl_package() {
 	short_desc+=" - compiled with ECL"
 	depends="${sourcepkg}-${version}_${revision}"
 	pkg_install() {
-		# this is /usr/lib/ecl-${ecl_version}
-		# ideally we would just place it in /usr/lib/ecl but this
-		# doesn't just work
-		# Maybe we can have the ecl package ship a symlink:
-		#     /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
-		# and have this package just install in /usr/lib/ecl
+		BINARY_ECL=/usr/lib/maxima/${version}/binary-ecl
+		vmove ${BINARY_ECL}
+		vinstall src/binary-ecl/libmaxima-ecl.so 755 ${BINARY_ECL}
+		vinstall src/binary-ecl/maxima.fas 755 ${BINARY_ECL}
+
+		# symlink maxima.fas in ECLDIR
 		ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
-		vmkdir $ECLDIR
-		vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
-		vmove usr/lib/maxima/${version}/binary-ecl
+		vmkdir ${ECLDIR}
+		ln -sr ${PKGDESTDIR}/${BINARY_ECL}/maxima.fas ${PKGDESTDIR}/${ECLDIR}
 	}
 }
+
+subpackages="maxima-src maxima-emacs xmaxima $(vopt_if ecl maxima-ecl)"

From 4b631d17779cace25533a2590af849fc64ec824e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 10:36:03 -0300
Subject: [PATCH 05/19] New package: sage-9.5.beta5

---
 srcpkgs/sage/template | 74 +++++++++++++++++++++++++++++++++++++++++++
 srcpkgs/sage/update   |  3 ++
 2 files changed, 77 insertions(+)
 create mode 100644 srcpkgs/sage/template
 create mode 100644 srcpkgs/sage/update

diff --git a/srcpkgs/sage/template b/srcpkgs/sage/template
new file mode 100644
index 000000000000..2ef437238cb5
--- /dev/null
+++ b/srcpkgs/sage/template
@@ -0,0 +1,74 @@
+# Template file for 'sage'
+pkgname=sage
+version=9.5.beta5
+revision=1
+build_style=configure
+configure_args=--prefix=/usr/lib/sage-${version}
+make_check_target=ptest
+short_desc="Open source mathematics software"
+maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
+license="GPL-3.0-or-later"
+homepage="http://sagemath.org/"
+distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+
+case ${version} in
+	# url for devel is different
+	*.beta*|*.rc*)
+		distfiles=${distfiles/sage\/src/sage\/devel}
+		;;
+esac
+
+# first we try to build native; we'll worry about cross later
+# besides, some dependencies are nocross
+nocross=yes
+
+# for now, to make install faster
+nostrip=yes
+
+# don't rewrite python shebang as sage uses its own python (for now)
+_no_python_shebang=yes
+
+do_install() {
+	vcopy /usr/lib/sage-${version} usr/lib/
+	vmkdir usr/bin
+	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+}
+
+### copied from sage-deps, to keep in sync
+
+# hard dependencies
+makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
+
+# recommended dependencies
+makedepends+=" gcc-fortran openssl-devel"
+
+# bootstrap dependencies
+makedepends+=" automake gettext gettext-devel"
+
+# other host dependencies
+makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
+
+# already in void
+makedepends+="
+ CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
+ ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
+ pari-devel pari-elldata-small pari-galdata pari-galpol-small
+ pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
+ perl-Term-ReadLine-Gnu perl-XML-LibXML perl-XML-LibXSLT
+ perl-XML-Writer ppl-devel python3-devel readline-devel sqlite-devel
+ zeromq-devel zlib-devel
+ FlintQS SuiteSparse-devel cddlib-devel fflas-ffpack fplll-devel gf2x-devel
+ givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
+ m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
+ singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+"
+
+# TODO: standard
+# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
+
+# TODO: optional
+# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
diff --git a/srcpkgs/sage/update b/srcpkgs/sage/update
new file mode 100644
index 000000000000..f797813dcde6
--- /dev/null
+++ b/srcpkgs/sage/update
@@ -0,0 +1,3 @@
+# for now, check both stable and devel releases
+site="http://mirrors.mit.edu/sage/src/
+http://mirrors.mit.edu/sage/devel/"

From 99f6bd814d2aa6664ca83647c54474d28d130d46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 00:08:27 -0300
Subject: [PATCH 06/19] sagemath: update to sage-9.5.beta6

Also:
 - rename pkg from sage to sagemath
 - now it will build sage in-place at /usr/lib/sage-$version
 - the resulting pkg contains a lot of useless stuff that comes with the
   distribution; we'll have to clean up. E.g. SAGE_ROOT/upstream is
   definitely unnecessary (1.2G); possibly SAGE_ROOT/pkgs or at least
   SAGE_ROOT/pkgs/sagemath-standard/build (2.6G).
---
 srcpkgs/{sage => sagemath}/template | 46 +++++++++++++++++++++--------
 srcpkgs/{sage => sagemath}/update   |  1 +
 2 files changed, 35 insertions(+), 12 deletions(-)
 rename srcpkgs/{sage => sagemath}/template (67%)
 rename srcpkgs/{sage => sagemath}/update (90%)

diff --git a/srcpkgs/sage/template b/srcpkgs/sagemath/template
similarity index 67%
rename from srcpkgs/sage/template
rename to srcpkgs/sagemath/template
index 2ef437238cb5..fa5189ad259e 100644
--- a/srcpkgs/sage/template
+++ b/srcpkgs/sagemath/template
@@ -1,41 +1,63 @@
-# Template file for 'sage'
-pkgname=sage
-version=9.5.beta5
+# Template file for 'sagemath'
+pkgname=sagemath
+version=9.5.beta6
 revision=1
+wrksrc=sage-$version
 build_style=configure
-configure_args=--prefix=/usr/lib/sage-${version}
+configure_args="--enable-build-as-root"
 make_check_target=ptest
+# for now skip building docs
+make_build_target=build
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=3b78ee848450d6881902bf68f4f3af17e1647e72c51e5fcdcb412c938ecbce57
+checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+
+# path where sage will be installed
+_SAGE_ROOT=/usr/lib/sage-${version}
 
 case ${version} in
 	# url for devel is different
-	*.beta*|*.rc*)
-		distfiles=${distfiles/sage\/src/sage\/devel}
-		;;
+	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
-# first we try to build native; we'll worry about cross later
-# besides, some dependencies are nocross
+# for now, skip check in ci, since we still have a few tests failing
+make_check=ci-skip
+
+# for now, just build native; we'll worry about cross later
+# besides, some dependencies are nocross (e.g. ntl)
 nocross=yes
 
 # for now, to make install faster
 nostrip=yes
 
+# don't shlib_provide anything
+noshlibprovides=yes
+
 # don't rewrite python shebang as sage uses its own python (for now)
 _no_python_shebang=yes
 
+post_extract() {
+	# sage wants to be built in place so let $wrksrc be a symlink
+	mv -T $wrksrc $_SAGE_ROOT
+	ln -sfT $_SAGE_ROOT $wrksrc
+}
+
+do_clean() {
+	# undo post_extract()
+	rm $wrksrc
+	mv $_SAGE_ROOT $wrksrc
+}
+
 do_install() {
 	vcopy /usr/lib/sage-${version} usr/lib/
 	vmkdir usr/bin
-	ln -s /usr/lib/sage-${version}/bin/sage ${DESTDIR}/usr/bin/
+	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
 
-### copied from sage-deps, to keep in sync
+### copied from sage-deps, to be kept in sync
 
 # hard dependencies
 makedepends+=" gcc make m4 perl binutils git tar libgomp-devel"
diff --git a/srcpkgs/sage/update b/srcpkgs/sagemath/update
similarity index 90%
rename from srcpkgs/sage/update
rename to srcpkgs/sagemath/update
index f797813dcde6..c33aba4e6df2 100644
--- a/srcpkgs/sage/update
+++ b/srcpkgs/sagemath/update
@@ -1,3 +1,4 @@
+pkgname=sage
 # for now, check both stable and devel releases
 site="http://mirrors.mit.edu/sage/src/
 http://mirrors.mit.edu/sage/devel/"

From 9c76d4c1345460a97ffd71b5b686529865dd8e41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 13 Nov 2021 07:40:55 -0300
Subject: [PATCH 07/19] sagemath: revbump for changes

 - include patch fixing build of pyzmq on musl
 - add gengetopts and texinfo to makedepends
 - first attempt at cleanup: remove upstream sources and build artifacts
---
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch | 15 +++++++++++++++
 srcpkgs/sagemath/template                     |  9 +++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch

diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
new file mode 100644
index 000000000000..9190830d835e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
@@ -0,0 +1,15 @@
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..b7260c6d27 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,6 +1,9 @@
+ # Since we use environment vars we have to generate setup.cfg
+ 
+-echo "[build_ext]" > src/setup.cfg
++echo "[global]" > src/setup.cfg
++echo "skip_check_zmq = True" >> src/setup.cfg
++
++echo "[build_ext]" >> src/setup.cfg
+ 
+ # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+ # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index fa5189ad259e..56166cd44272 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=1
+revision=2
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -52,7 +52,11 @@ do_clean() {
 }
 
 do_install() {
-	vcopy /usr/lib/sage-${version} usr/lib/
+	vcopy $_SAGE_ROOT usr/lib/
+	# cleanup: upstream sources and build artifacts
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/upstream
+	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
+	# symlink main binary
 	vmkdir usr/bin
 	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
 }
@@ -87,6 +91,7 @@ makedepends+="
  givaro-devel igraph-devel iml-devel lcalc-devel linbox-devel
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
+ gengetopt texinfo
 "
 
 # TODO: standard

From 856417f1d85f98127aa243da90eddb568035e165 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 18:23:29 -0300
Subject: [PATCH 08/19] sagemath: revbump to 9.5.beta6_3 for changes

 - add depends needed for runtime and for testing
 - add python_version=3
 - disable skipping 03-rewrite-python-shebang as it seems to be harmless
   after adding python_version=3
 - fix cleaning up of $wrksrc and $_SAGE_ROOT
 - use sage-${version}_${revision} for the binary symlink; this way it
   won't override whatever sage is installed in the system so I can test
   on a live system.
---
 srcpkgs/sagemath/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 56166cd44272..cfe97e039974 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,19 +1,24 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.5.beta6
-revision=2
+revision=3
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
 make_check_target=ptest
 # for now skip building docs
 make_build_target=build
+depends="giac git FlintQS zn_poly sympow
+ pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
+ flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+python_version=3
 
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
@@ -37,7 +42,8 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-_no_python_shebang=yes
+# after python_version=3, this seems harmless... strange...
+#_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
@@ -46,9 +52,12 @@ post_extract() {
 }
 
 do_clean() {
-	# undo post_extract()
-	rm $wrksrc
-	mv $_SAGE_ROOT $wrksrc
+	rm -rf $wrksrc $_SAGE_ROOT
+}
+
+post_build() {
+	# install pytest for more tests
+	./sage -i pytest
 }
 
 do_install() {
@@ -58,7 +67,9 @@ do_install() {
 	rm -rf ${DESTDIR}/$_SAGE_ROOT/pkgs/*/build
 	# symlink main binary
 	vmkdir usr/bin
-	ln -s $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/
+	# for now use sage-${version}_${revision} so it doesn't override
+	# other sage installed in the system
+	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
 ### copied from sage-deps, to be kept in sync

From e3c8d4e42ea65d184779be38223b6c22183bd3a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 20 Nov 2021 19:01:21 -0300
Subject: [PATCH 09/19] sagemath: update to 9.5.beta7.

---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index cfe97e039974..3f9a3e9e077f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta6
-revision=3
+version=9.5.beta7
+revision=1
 wrksrc=sage-$version
 build_style=configure
 configure_args="--enable-build-as-root"
@@ -17,7 +17,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=7bae8cbb4db73147bd698261497102524bfadeb71ca66b1c68e96827bd5a8975
+checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
 # path where sage will be installed

From 251fe2e7955d588221dc61cbd4634247e39b8d74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 10:23:03 -0300
Subject: [PATCH 10/19] sagemath: add more dependencies

Also:
 - add patches so more doctests pass
 - add do_check() to skip building docs
 - use https for distfiles
---
 ...08fd9d56d022ed28592f93f07ec8dce530ef.patch |  49 ++++++
 ...b99e0270f80cf03b80418372f45274f46051.patch | 163 ++++++++++++++++++
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 +++
 .../patches/skip-optional-dochtml.patch       |  13 ++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 260 insertions(+), 5 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
 create mode 100644 srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
 create mode 100644 srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 create mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
new file mode 100644
index 000000000000..e295bb91af5b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
@@ -0,0 +1,49 @@
+From 17e308fd9d56d022ed28592f93f07ec8dce530ef Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 15 Nov 2021 23:37:15 -0500
+Subject: Trac #32880: use GAP instead of Singular to test
+ _get_shared_lib_path().
+
+We still have a doctest for _get_shared_lib_path() that tries to find
+the path to libSingular; however, we no longer actually need it to
+find libSingular because the path to libSingular is contained in
+LIBSINGULAR_PATH.
+
+Since _get_shared_lib_path() is a bit fragile, this commit replaces
+that test case with one for libgap, which is still always installed
+via SPKG and for which we still need _get_shared_lib_path() to be able
+to find the path.
+---
+ src/sage/env.py | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace13..3bd4826 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -267,20 +267,12 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+ 
+     EXAMPLES::
+ 
+-        sage: import sys
+-        sage: from fnmatch import fnmatch
+         sage: from sage.env import _get_shared_lib_path
+-        sage: lib_filename = _get_shared_lib_path("Singular", "singular-Singular")
+-        sage: if sys.platform == 'cygwin':
+-        ....:     pattern = "*/cygSingular-*.dll"
+-        ....: elif sys.platform == 'darwin':
+-        ....:     pattern = "*/libSingular-*.dylib"
+-        ....: else:
+-        ....:     pattern = "*/lib*Singular-*.so"
+-        sage: fnmatch(str(lib_filename), pattern)
++        sage: "gap" in _get_shared_lib_path("gap")
+         True
+         sage: _get_shared_lib_path("an_absurd_lib") is None
+         True
++
+     """
+ 
+     for libname in libnames:
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
new file mode 100644
index 000000000000..32e641edb3aa
--- /dev/null
+++ b/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
@@ -0,0 +1,163 @@
+From 2ee7b99e0270f80cf03b80418372f45274f46051 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Samuel=20Leli=C3=A8vre?= <samuel.lelievre@gmail.com>
+Date: Sat, 20 Nov 2021 13:34:16 +0100
+Subject: 32905: abs tol for some CBF and RBF doctests
+
+---
+ src/sage/functions/gamma.py    |  2 +-
+ src/sage/rings/complex_arb.pyx |  6 +++---
+ src/sage/rings/real_arb.pyx    | 24 ++++++++++++------------
+ src/sage/symbolic/function.pyx |  2 +-
+ 4 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py
+index 3a4deef..307deb1 100644
+--- a/src/sage/functions/gamma.py
++++ b/src/sage/functions/gamma.py
+@@ -1049,7 +1049,7 @@ class Function_beta(GinacFunction):
+         r"""
+         TESTS::
+ 
+-            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))
++            sage: RBF(beta(sin(3),sqrt(RBF(2).add_error(1e-8)/3)))  # abs tol 6e-7
+             [7.407662 +/- 6.17e-7]
+         """
+         return [x, y]
+diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
+index ce9b1b1..7e10ec9 100644
+--- a/src/sage/rings/complex_arb.pyx
++++ b/src/sage/rings/complex_arb.pyx
+@@ -4189,7 +4189,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ei(I))
++            sage: CBF(Ei(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4239,7 +4239,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Ci(I))
++            sage: CBF(Ci(I))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+@@ -4291,7 +4291,7 @@ cdef class ComplexBall(RingElement):
+ 
+         TESTS:
+ 
+-            sage: CBF(Chi(I))
++            sage: CBF(Chi(I))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
+         """
+         cdef ComplexBall result = self._new()
+diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
+index 80a840e..49caa63 100644
+--- a/src/sage/rings/real_arb.pyx
++++ b/src/sage/rings/real_arb.pyx
+@@ -3489,12 +3489,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ei()
++            sage: RBF(1).Ei()  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ei(1))
++            sage: RBF(Ei(1))  # abs tol 5e-16
+             [1.89511781635594 +/- 4.94e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3531,12 +3531,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Ci()
++            sage: RBF(1).Ci()  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Ci(1))
++            sage: RBF(Ci(1))  # abs tol 1e-16
+             [0.337403922900968 +/- 3.25e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3575,12 +3575,12 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(1).Chi()
++            sage: RBF(1).Chi()  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+ 
+         TESTS::
+ 
+-            sage: RBF(Chi(1))
++            sage: RBF(Chi(1))  # abs tol 1e-17
+             [0.837866940980208 +/- 4.72e-16]
+         """
+         cdef RealBall res = self._new()
+@@ -3597,7 +3597,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).li()
++            sage: RBF(3).li()  # abs tol 1e-15
+             [2.16358859466719 +/- 4.72e-15]
+ 
+         TESTS::
+@@ -3621,7 +3621,7 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(3).Li()
++            sage: RBF(3).Li()  # abs tol 1e-15
+             [1.11842481454970 +/- 7.61e-15]
+         """
+         cdef RealBall res = self._new()
+@@ -3648,9 +3648,9 @@ cdef class RealBall(RingElement):
+ 
+         EXAMPLES::
+ 
+-            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())
++            sage: RBF(sin(3)).beta(RBF(2/3).sqrt())  # abs tol 1e-13
+             [7.407661629415 +/- 1.07e-13]
+-            sage: RealBallField(100)(7/2).beta(1)
++            sage: RealBallField(100)(7/2).beta(1)  # abs tol 1e-30
+             [0.28571428571428571428571428571 +/- 5.23e-30]
+             sage: RealBallField(100)(7/2).beta(1, 1/2)
+             [0.025253813613805268728601584361 +/- 2.53e-31]
+@@ -3685,9 +3685,9 @@ cdef class RealBall(RingElement):
+ 
+             sage: RBF(1/2).gamma()
+             [1.772453850905516 +/- ...e-16]
+-            sage: RBF(gamma(3/2, RBF(2).sqrt()))
++            sage: RBF(gamma(3/2, RBF(2).sqrt()))  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+-            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())
++            sage: RBF(3/2).gamma_inc(RBF(2).sqrt())  # abs tol 2e-17
+             [0.37118875695353 +/- 3.00e-15]
+ 
+         .. SEEALSO::
+diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx
+index 89cdce5..480a601 100644
+--- a/src/sage/symbolic/function.pyx
++++ b/src/sage/symbolic/function.pyx
+@@ -626,7 +626,7 @@ cdef class Function(SageObject):
+             sage: b = RBF(3/2, 1e-10)
+             sage: airy_ai(b)
+             airy_ai([1.500000000 +/- 1.01e-10])
+-            sage: gamma(b, 1)
++            sage: gamma(b, 1)  # abs tol 4.5e-9
+             [0.50728223 +/- 4.67e-9]
+             sage: hurwitz_zeta(b, b)
+             hurwitz_zeta([1.500000000 +/- 1.01e-10], [1.500000000 +/- 1.01e-10])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
new file mode 100644
index 000000000000..ec0467757ee7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
@@ -0,0 +1,25 @@
+From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sat, 30 Oct 2021 10:21:52 +0200
+Subject: Fix test failure caused by new warning
+
+---
+ src/sage/lfunctions/pari.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
+index 0aaf91c..33d5266 100644
+--- a/src/sage/lfunctions/pari.py
++++ b/src/sage/lfunctions/pari.py
+@@ -316,7 +316,7 @@ def lfun_number_field(K):
+         sage: L(3)
+         1.15202784126080
+         sage: L(0)
+-        0.000000000000000
++        ...0.000000000000000
+     """
+     return pari.lfuncreate(K)
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
new file mode 100644
index 000000000000..e49b18a52fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
@@ -0,0 +1,13 @@
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 288c889bd1..b9a4d3038a 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
+ 
+ def _get_optional_defaults():
+     """Return the default value for the --optional flag."""
+-    optional = ['sage', 'dochtml', 'optional']
++    optional = ['sage', 'optional']
+ 
+     # This should be good-enough to determine if we are in a sage source
+     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 3f9a3e9e077f..d4130be12a7a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -16,7 +16,7 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="http://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
+distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
 python_version=3
 
@@ -47,6 +47,7 @@ noshlibprovides=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
+	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -sfT $_SAGE_ROOT $wrksrc
 }
@@ -72,6 +73,11 @@ do_install() {
 	ln -sfT $_SAGE_ROOT/sage ${DESTDIR}/usr/bin/sage-${version}_${revision}
 }
 
+do_check() {
+	# since make check will build the docs, run test like this instead
+	./sage -tp ${XBPS_MAKEJOBS} --all
+}
+
 ### copied from sage-deps, to be kept in sync
 
 # hard dependencies
@@ -103,10 +109,9 @@ makedepends+="
  m4ri-devel m4rie-devel mpfi-devel ntl-devel perl-SVG rankwidth-devel
  singular sympow zn_poly symmetrica-devel planarity-devel qhull libqhull-devel
  gengetopt texinfo
+ brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
+ lrcalc-devel nauty-devel palp tachyon
 "
 
-# TODO: standard
-# brial cliquer gfan libbraiding libhomfly lrcalc nauty palp tachyon
-
 # TODO: optional
-# 4ti2 coxeter3 libnauty libsemigroups lrslib perl_mongodb
+# 4ti2 coxeter3 libsemigroups lrslib pdf2svg perl_mongodb polymake

From d07cb571d0977f9681ae7571f3eec03914586cf9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 22 Nov 2021 15:16:23 -0300
Subject: [PATCH 11/19] sagemath: more changes

 - do not install pytest, which is still broken (pending trac 31924)
 - add patch from sagemath trac 32892
 - replace the patch to fix the build of pyzmq on musl by a different
   one from sagemath trac 32828 which is what will be merged upstream
 - patch to fix doctest failure on musl (src/sage/misc/gperftools.py)
 - rebase on latest sympow rev to fix doctest failure on musl
   (src/sage/lfunctions/sympow.py)
 - enable check on CI to see what happens...
---
 ...hat-fixes-ctypes.util.find_library-c.patch |  64 +++++++++
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ++++
 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch |  15 --
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ++++++++++++++++++
 srcpkgs/sagemath/template                     |  15 +-
 5 files changed, 235 insertions(+), 20 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
 create mode 100644 srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
 delete mode 100644 srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch

diff --git a/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
new file mode 100644
index 000000000000..4f89c2bd8fbc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-Add-a-patch-that-fixes-ctypes.util.find_library-c.patch
@@ -0,0 +1,64 @@
+From dc1a0e8168a9ffb4fbf07dd03c0846b4933a6dbe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 22 Nov 2021 23:57:37 -0300
+Subject: [PATCH] Add a patch that fixes ctypes.util.find_library('c')
+
+The issue causes a failure doctesting src/sage/misc/gperftools.py
+---
+ .../python3/patches/musl-find_library.patch   | 44 +++++++++++++++++++
+ 1 file changed, 44 insertions(+)
+ create mode 100644 build/pkgs/python3/patches/musl-find_library.patch
+
+diff --git a/build/pkgs/python3/patches/musl-find_library.patch b/build/pkgs/python3/patches/musl-find_library.patch
+new file mode 100644
+index 0000000000..82f436b407
+--- /dev/null
++++ b/build/pkgs/python3/patches/musl-find_library.patch
+@@ -0,0 +1,44 @@
++--- a/Lib/ctypes/util.py
+++++ b/Lib/ctypes/util.py
++@@ -204,6 +204,41 @@
++         def find_library(name, is64 = False):
++             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++ 
+++    elif True:
+++
+++        # Patched for Alpine Linux / musl - search manually system paths
+++        def _is_elf(filepath):
+++            try:
+++                with open(filepath, 'rb') as fh:
+++                    return fh.read(4) == b'\x7fELF'
+++            except:
+++                return False
+++
+++        def find_library(name):
+++            from glob import glob
+++            # absolute name?
+++            if os.path.isabs(name):
+++                return name
+++            # special case for libm, libcrypt and libpthread and musl
+++            if name in ['m', 'crypt', 'pthread']:
+++                name = 'c'
+++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
+++                name = 'libc.so'
+++            # search in standard locations (musl order)
+++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
+++            if 'LD_LIBRARY_PATH' in os.environ:
+++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
+++            for d in paths:
+++                f = os.path.join(d, name)
+++                if _is_elf(f):
+++                    return os.path.basename(f)
+++
+++                prefix = os.path.join(d, 'lib'+name)
+++                for suffix in ['.so', '.so.*']:
+++                    for f in glob('{0}{1}'.format(prefix, suffix)):
+++                        if _is_elf(f):
+++                            return os.path.basename(f)
+++
++     else:
++ 
++         def _findSoname_ldconfig(name):
+-- 
+2.34.0
+
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
new file mode 100644
index 000000000000..ea05b2b6a524
--- /dev/null
+++ b/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
@@ -0,0 +1,27 @@
+From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
+From: Tobias Diez <code@tobiasdiez.com>
+Date: Wed, 17 Nov 2021 22:24:32 +0100
+Subject: Fix exit code for pytest in case of no matched files
+
+---
+ src/bin/sage-runtests | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
+index 882456d..8b362ca 100755
+--- a/src/bin/sage-runtests
++++ b/src/bin/sage-runtests
+@@ -157,6 +157,10 @@ if __name__ == "__main__":
+         if args.verbose:
+             pytest_options.append("-v")
+         exit_code_pytest = pytest.main(pytest_options + args.filenames)
++        if exit_code_pytest == 5:
++            # Exit code 5 means there were no test files, pass in this case
++            exit_code_pytest = 0
++
+     except ModuleNotFoundError:
+         print("Pytest is not installed, skip checking tests that rely on it.")
+ 
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch b/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
deleted file mode 100644
index 9190830d835e..000000000000
--- a/srcpkgs/sagemath/patches/fix-pyzmq-musl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..b7260c6d27 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,6 +1,9 @@
- # Since we use environment vars we have to generate setup.cfg
- 
--echo "[build_ext]" > src/setup.cfg
-+echo "[global]" > src/setup.cfg
-+echo "skip_check_zmq = True" >> src/setup.cfg
-+
-+echo "[build_ext]" >> src/setup.cfg
- 
- # (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
- # the path---which is never used but is a good habit to support---but
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
new file mode 100644
index 000000000000..426932c95c9b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
@@ -0,0 +1,134 @@
+diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
+index 3824fd2ce9..20509db618 100644
+--- a/build/pkgs/pyzmq/checksums.ini
++++ b/build/pkgs/pyzmq/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pyzmq-VERSION.tar.gz
+-sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
+-md5=f261acf884460e93d30f7113c8e9242e
+-cksum=1661206741
++sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
++md5=ecf13c72fbea05ba5ddc771295409d48
++cksum=1680251717
+ upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
+diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
+index 0398faf11c..8326e27f9b 100644
+--- a/build/pkgs/pyzmq/package-version.txt
++++ b/build/pkgs/pyzmq/package-version.txt
+@@ -1 +1 @@
+-22.2.1
++22.3.0
+diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
+index 0ce404ee5a..069d87767f 100644
+--- a/build/pkgs/pyzmq/spkg-install.in
++++ b/build/pkgs/pyzmq/spkg-install.in
+@@ -1,17 +1,11 @@
+-# Since we use environment vars we have to generate setup.cfg
+-
+-echo "[build_ext]" > src/setup.cfg
+-
+-# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
+-# the path---which is never used but is a good habit to support---but
+-# that simply does not work. Sorry.)
+-
+-echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
+-echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
+-
+-echo "[configure]" >> src/setup.cfg
+-
+ cd src
+ 
++# Generate setup.cfg
++cat > setup.cfg <<EOF
++[global]
++zmq_prefix = $SAGE_LOCAL
++no_libzmq_extension = True
++EOF
++
+ # Configure and install
+ sdh_pip_install .
+diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
+index 6a280871e7..d9290d04ff 100644
+--- a/build/pkgs/setuptools/checksums.ini
++++ b/build/pkgs/setuptools/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=setuptools-VERSION.tar.gz
+-sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
+-md5=ff20ab7e0d51c5ad0a9438c50e598c06
+-cksum=3564252314
++sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
++md5=79b36f59270a6f2e45d6a9a0c6dc68c1
++cksum=430889097
+ upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
+index e6ea636051..aec1257e4c 100644
+--- a/build/pkgs/setuptools/package-version.txt
++++ b/build/pkgs/setuptools/package-version.txt
+@@ -1 +1 @@
+-58.2.0
++59.2.0
+diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
+index ea8c36bce5..dc802612dd 100644
+--- a/build/pkgs/zeromq/checksums.ini
++++ b/build/pkgs/zeromq/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=zeromq-VERSION.tar.gz
+-sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
+-md5=a1c95b34384257e986842f4d006957b8
+-cksum=136261411
++sha1=47277a64749049123d1401600e8cfbab10a3ae28
++md5=c897d4005a3f0b8276b00b7921412379
++cksum=1500782345
++upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
+diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
+index df0228dfae..eda862a98c 100644
+--- a/build/pkgs/zeromq/package-version.txt
++++ b/build/pkgs/zeromq/package-version.txt
+@@ -1 +1 @@
+-4.2.5
++4.3.4
+diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
+deleted file mode 100644
+index e665114e1c..0000000000
+--- a/build/pkgs/zeromq/patches/getrandom.patch
++++ /dev/null
+@@ -1,39 +0,0 @@
+-Patch taken from upstream git repo
+-and after running aclocal && autoconf
+-and removing changes to autotools input files
+-
+-commit 4ff814f204ee38177a392526cf12c8c0019b480f
+-Author: Luca Boccassi <luca.boccassi@gmail.com>
+-Date:   Wed May 9 10:41:20 2018 +0100
+-
+-    Problem: getrandom test does not check if it's working
+-
+-    Solution: check return value in autoconf and CMake. On some platforms
+-    the function is available but not implemented (eg: GNU/Hurd).
+-
+-diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
+---- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
+-+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
+-@@ -287,7 +287,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- "
+-     ZMQ_HAVE_GETRANDOM)
+-diff -ru zeromq-4.2.5//configure b/configure
+---- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
+-+++ b/configure	2018-07-24 12:39:49.018035120 +0200
+-@@ -23315,7 +23315,8 @@
+- int main (int argc, char *argv [])
+- {
+-     char buf[4];
+--    getrandom(buf, 4, 0);
+-+    int rc = getrandom(buf, 4, 0);
+-+    return rc == -1 ? 1 : 0;
+- }
+- 
+- _ACEOF
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index d4130be12a7a..622ee06d85b8 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -29,7 +29,7 @@ case ${version} in
 esac
 
 # for now, skip check in ci, since we still have a few tests failing
-make_check=ci-skip
+#make_check=ci-skip
 
 # for now, just build native; we'll worry about cross later
 # besides, some dependencies are nocross (e.g. ntl)
@@ -56,10 +56,15 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
-post_build() {
-	# install pytest for more tests
-	./sage -i pytest
-}
+# DISABLED pytest since it brings more harm than good
+# it seems currently all it does is to look for files matching
+# *_test.py and run pytest on those, but I don't think these are meant
+# to be run on pytest (and one even gives a failure...)
+#
+# post_build() {
+# 	# install pytest for more tests
+# 	./sage -i pytest
+# }
 
 do_install() {
 	vcopy $_SAGE_ROOT usr/lib/

From 0f737f38782286f1fdf0a2dcb34caee4dfec0eee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 25 Nov 2021 22:47:35 -0300
Subject: [PATCH 12/19] sagemath: more changes

 - skip a doctest which fails due to giac 1.7.0
 - rename patches to include trac ticket #
 - add a patch to use system linbox (needs to run ./bootstrap)
 - look for an optional file ${XBPS_DISTDIR}/sagemath-check ; if that
   file exists, its contents are used as arguments for sage check
   Intended usage: place the names of files that you want to doctest
   instead of all files (useful when you have a few failing doctests you
   are trying to fix)
---
 ...p-doctest-giac-1.7.0--see-trac-31563.patch | 14 +++++++++
 ...119d27d091b3894860547673c2f6b224f61a.patch | 31 +++++++++++++++++++
 ...86908daf60b25e66e6a189c51ada7e0a732.patch} |  0
 ...8fd9d56d022ed28592f93f07ec8dce530ef.patch} |  0
 ...54ad30c6a1bd1fdbd6d62011055bf13b24a.patch} |  0
 ...99e0270f80cf03b80418372f45274f46051.patch} |  0
 srcpkgs/sagemath/template                     | 10 +++++-
 7 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
 rename srcpkgs/sagemath/patches/{f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch => trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch} (100%)
 rename srcpkgs/sagemath/patches/{17e308fd9d56d022ed28592f93f07ec8dce530ef.patch => trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch} (100%)
 rename srcpkgs/sagemath/patches/{89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch => trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch} (100%)
 rename srcpkgs/sagemath/patches/{2ee7b99e0270f80cf03b80418372f45274f46051.patch => trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch} (100%)

diff --git a/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
new file mode 100644
index 000000000000..563bb8526788
--- /dev/null
+++ b/srcpkgs/sagemath/patches/skip-doctest-giac-1.7.0--see-trac-31563.patch
@@ -0,0 +1,14 @@
+--- a/src/sage/functions/min_max.py
++++ b/src/sage/functions/min_max.py
+@@ -233,9 +233,9 @@ class MaxSymbolic(MinMax_base):
+             sage: f = max_symbolic(sin(x), cos(x))
+             sage: r = integral(f, x, 0, 1)
+             ...
+-            sage: r
++            sage: r             # not tested -- broken with giac 1.7.0
+             sqrt(2) - cos(1)
+-            sage: r.n()
++            sage: r.n()         # not tested -- broken with giac 1.7.0
+             0.873911256504955
+         """
+         return max_symbolic(args)
diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
new file mode 100644
index 000000000000..8154c2453c15
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
@@ -0,0 +1,31 @@
+From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 10:07:44 -0500
+Subject: Trac #29631: new spkg-configure.m4 for linbox.
+
+This is essentially the file posted as an attachment on Trac 29631 by
+Thierry Thomas. I've chosen to leave the lower bound at the latest
+v1.6.3, since in the intervening months most distributions appear to
+have updated.
+---
+ build/pkgs/linbox/spkg-configure.m4 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ create mode 100644 build/pkgs/linbox/spkg-configure.m4
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+new file mode 100644
+index 00000000..fbf405c
+--- /dev/null
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -0,0 +1,8 @@
++SAGE_SPKG_CONFIGURE([linbox], [
++  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++    PKG_CHECK_MODULES([LINBOX],
++                      [linbox >= 1.6.3],
++                      [],
++                      [sage_spkg_install_linbox=yes])
++  ])
++])
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
rename to srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
diff --git a/srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch b/srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
rename to srcpkgs/sagemath/patches/trac-32880-17e308fd9d56d022ed28592f93f07ec8dce530ef.patch
diff --git a/srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
rename to srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
diff --git a/srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch b/srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
similarity index 100%
rename from srcpkgs/sagemath/patches/2ee7b99e0270f80cf03b80418372f45274f46051.patch
rename to srcpkgs/sagemath/patches/trac-32905-2ee7b99e0270f80cf03b80418372f45274f46051.patch
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 622ee06d85b8..1ab0e9f7d65c 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -56,6 +56,10 @@ do_clean() {
 	rm -rf $wrksrc $_SAGE_ROOT
 }
 
+pre_configure() {
+	./bootstrap
+}
+
 # DISABLED pytest since it brings more harm than good
 # it seems currently all it does is to look for files matching
 # *_test.py and run pytest on those, but I don't think these are meant
@@ -79,8 +83,12 @@ do_install() {
 }
 
 do_check() {
+	TEST=--all
+	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
+		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
+	fi
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} --all
+	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 1334c1512b205f2669a4bc1e752e9bb52fd1a086 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 28 Nov 2021 00:32:26 -0300
Subject: [PATCH 13/19] sagemath: use system maxima

Also: add patch to use relative symlinks in gap where absolute symlinks
are now used -- otherwise xbps-create gets confused
---
 ...-spkg-install-make-symlinks-relative.patch |  27 +++
 .../patches/trac-32867-system-maxima.patch    | 174 ++++++++++++++++++
 srcpkgs/sagemath/template                     |   4 +-
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32867-system-maxima.patch

diff --git a/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
new file mode 100644
index 000000000000..c9feb870f2be
--- /dev/null
+++ b/srcpkgs/sagemath/patches/0001-build-pkgs-gap-spkg-install-make-symlinks-relative.patch
@@ -0,0 +1,27 @@
+From 521a9ec8d447be5bbd3a4260e7a5e0e4653e0c34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Sun, 28 Nov 2021 18:57:34 -0300
+Subject: [PATCH] build/pkgs/gap/spkg-install: make symlinks relative
+
+---
+ build/pkgs/gap/spkg-install.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 32d1fb982c..2ceadf99db 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -80,8 +80,8 @@ chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+ 
+ # Create symlinks under $GAP_ROOT for these executables, as they are expected
+ # (especially when building kernel packages) to exist
+-ln -sf "$SAGE_BIN/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/gac"
++ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
++ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+ 
+ # Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+ # to the actual path of the sources GAP was compiled from)
+-- 
+2.34.1
+
diff --git a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
new file mode 100644
index 000000000000..cb6517a388d8
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
@@ -0,0 +1,174 @@
+diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
+index ae1e0ac5e1..7dbcfa6377 100644
+--- a/build/pkgs/ecl/spkg-configure.m4
++++ b/build/pkgs/ecl/spkg-configure.m4
+@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
+     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
+   fi
+ 
+-  # Maxima cannot yet be provided by the system, so we always use
++  # Kenzo cannot yet be provided by the system, so we always use
+   # the SAGE_LOCAL path for now.
+-  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
+-
+-  # Likewise for the optional Kenzo SPKG
+   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
+ ])
+diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
+new file mode 100644
+index 0000000000..df625fecc4
+--- /dev/null
++++ b/build/pkgs/maxima/spkg-configure.m4
+@@ -0,0 +1,35 @@
++SAGE_SPKG_CONFIGURE([maxima], [
++  SAGE_SPKG_DEPCHECK([ecl], [
++    dnl First check for the "maxima" executable in the user's PATH, because
++    dnl we still use pexpect to communicate with it in a few places. We pass
++    dnl the "-l ecl" flag here to ensure that the standalone executable also
++    dnl supports ECL.
++    AC_MSG_CHECKING(if "maxima -l ecl" works)
++    AS_IF([! maxima -l ecl -q -r 'quit();' \
++             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++      AC_MSG_RESULT(no)
++      sage_spkg_install_maxima=yes
++    ], [
++      AC_MSG_RESULT(yes)
++      dnl If we have the executable, check also for the ECL library.
++      AC_MSG_CHECKING([if ECL can "require" the maxima module])
++      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
++               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++        AC_MSG_RESULT(yes)
++      ], [
++	AC_MSG_RESULT(no)
++	sage_spkg_install_maxima=yes
++      ])
++    ])
++  ])
++],[],[],[
++  # post-check
++  AS_IF([test x$sage_spkg_install_maxima = xyes], [
++    dnl Leaving this variable empty will tell sagelib to load
++    dnl the maxima library (within ECL) by name instead of by
++    dnl absolute path.
++    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
++  ])
++  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
++])
++
+diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
+index fbce6947de..8cda3ebfac 100644
+--- a/pkgs/sage-conf/sage_conf.py.in
++++ b/pkgs/sage-conf/sage_conf.py.in
+@@ -9,9 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+ SAGE_LOCAL = "@prefix@"
+ SAGE_ROOT = "@SAGE_ROOT@"
+ 
+-MAXIMA = "@prefix@/bin/maxima"
+-
+-# Delete this line if your ECL can load maxima without further prodding.
++# Set this to the empty string if your ECL can load maxima without
++# further prodding.
+ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
+ 
+ # Delete this line if your ECL can load Kenzo without further prodding.
+diff --git a/src/bin/sage b/src/bin/sage
+index fcd263029d..54b69a1043 100755
+--- a/src/bin/sage
++++ b/src/bin/sage
+@@ -684,11 +684,7 @@ fi
+ 
+ if [ "$1" = '-maxima' -o "$1" = '--maxima' ]; then
+     shift
+-    maxima_cmd=$(sage-config MAXIMA 2>/dev/null)
+-    if [ -z "${maxima_cmd}" ]; then
+-        maxima_cmd="maxima -l ecl"
+-    fi
+-    exec $maxima_cmd "$@"
++    exec maxima -l ecl "$@"
+ fi
+ 
+ if [ "$1" = '-mwrank' -o "$1" = '--mwrank' ]; then
+diff --git a/src/bin/sage-env b/src/bin/sage-env
+index a0426df523..f0866b4b1b 100644
+--- a/src/bin/sage-env
++++ b/src/bin/sage-env
+@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
+     fi
+ fi
+ 
+-if [ -n "$SAGE_LOCAL" ]; then
+-    export MAXIMA_PREFIX="$SAGE_LOCAL"
+-fi
+ export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ if [ -n "$SAGE_LOCAL" ]; then
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 40ace135f0..95edc16081 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -207,7 +207,6 @@ MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
+ MTXLIB = var("MTXLIB", join(SAGE_SHARE, "meataxe"))
+ THREEJS_DIR = var("THREEJS_DIR", join(SAGE_SHARE, "threejs-sage"))
+ PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
+-MAXIMA = var("MAXIMA", "maxima")
+ MAXIMA_FAS = var("MAXIMA_FAS")
+ KENZO_FAS = var("KENZO_FAS")
+ SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
+diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
+index fc7f48bc05..7313c7d0d3 100644
+--- a/src/sage/interfaces/maxima.py
++++ b/src/sage/interfaces/maxima.py
+@@ -484,7 +484,6 @@ import shlex
+ 
+ from random import randrange
+ 
+-from sage.env import MAXIMA
+ from sage.misc.misc import ECL_TMP
+ 
+ from .expect import (Expect, ExpectElement, gc_disabled)
+@@ -558,7 +557,7 @@ class Maxima(MaximaAbstract, Expect):
+         Expect.__init__(self,
+                         name = 'maxima',
+                         prompt = r'\(\%i[0-9]+\) ',
+-                        command = '{0} -p {1}'.format(MAXIMA, shlex.quote(STARTUP)),
++                        command = 'maxima -l ecl -p {0}'.format(shlex.quote(STARTUP)),
+                         env = {'TMPDIR': str(ECL_TMP)},
+                         script_subdirectory = script_subdirectory,
+                         restart_on_ctrlc = False,
+diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
+index 917059de0a..c966a3c9a0 100644
+--- a/src/sage/interfaces/maxima_abstract.py
++++ b/src/sage/interfaces/maxima_abstract.py
+@@ -54,7 +54,7 @@ import re
+ import sys
+ import subprocess
+ 
+-from sage.env import DOT_SAGE, MAXIMA
++from sage.env import DOT_SAGE
+ COMMANDS_CACHE = '%s/maxima_commandlist_cache.sobj' % DOT_SAGE
+ 
+ from sage.cpython.string import bytes_to_str
+@@ -164,7 +164,7 @@ class MaximaAbstract(ExtraTabCompletion, Interface):
+             -- Function: gcd (<p_1>, <p_2>, <x_1>, ...)
+             ...
+         """
+-        cmd = '{} --very-quiet --batch-string="{}({});" '.format(MAXIMA, command, s)
++        cmd = 'maxima -l ecl --very-quiet --batch-string="{}({});" '.format(command, s)
+         env = os.environ.copy()
+         env['TMPDIR'] = str(ECL_TMP)
+ 
+@@ -2214,7 +2214,7 @@ def maxima_version():
+         sage: maxima_version()  # random
+         '5.41.0'
+     """
+-    with os.popen('{} --version'.format(MAXIMA)) as p:
++    with os.popen('maxima -l ecl --version') as p:
+         return p.read().split()[-1]
+ 
+ 
+@@ -2232,4 +2232,4 @@ def maxima_console():
+     from sage.repl.rich_output.display_manager import get_display_manager
+     if not get_display_manager().is_in_terminal():
+         raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.')
+-    os.system('{}'.format(MAXIMA))
++    os.system('maxima -l ecl')
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 1ab0e9f7d65c..7917e78cbdc6 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -11,7 +11,8 @@ make_build_target=build
 depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
- m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran"
+ m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
+ maxima-ecl"
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -124,6 +125,7 @@ makedepends+="
  gengetopt texinfo
  brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
  lrcalc-devel nauty-devel palp tachyon
+ maxima-ecl
 "
 
 # TODO: optional

From 037dd0a6397ddd0a2ec01a223c1018c66609cc7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 11 Nov 2021 09:39:20 -0300
Subject: [PATCH 14/19] hooks: option to skip 03-rewrite-python-shebang

---
 common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 07162ad2c69b..c0f2198e44cf 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,6 +4,10 @@
 hook() {
 	local pyver= shebang= off=
 
+	if [ -n "$_no_python_shebang" ]; then
+		return 0
+	fi
+
 	if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
 		pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]\+$')"
 	fi

From a96570d6c0926108bcbb89b6da354189d93a52cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 4 Dec 2021 12:25:56 -0300
Subject: [PATCH 15/19] sagemath: don't rewrite python shebangs

This is still causing some issues, even if main sage and doctest works
ok with rewrite enabled, some scripts are broken as reported in the PR.

This is still a temporary workaround as we are hoping for system
python-3.10 support at some point.

Also in this commit: add some depends
---
 srcpkgs/sagemath/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 7917e78cbdc6..ede79e76b98d 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -12,7 +12,8 @@ depends="giac git FlintQS zn_poly sympow
  pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small
  flintlib-devel gsl-devel ntl-devel eclib-devel pari-devel mpfr-devel
  m4ri-devel gd-devel libpng-devel fflas-ffpack pkg-config gcc-fortran
- maxima-ecl"
+ linbox-devel gfan nauty-devel palp tachyon maxima-ecl
+ "
 short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
@@ -43,8 +44,7 @@ nostrip=yes
 noshlibprovides=yes
 
 # don't rewrite python shebang as sage uses its own python (for now)
-# after python_version=3, this seems harmless... strange...
-#_no_python_shebang=yes
+_no_python_shebang=yes
 
 post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink

From 93016f8f392c66478957182e0ae1e0746b5aa9e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 9 Dec 2021 22:31:15 -0300
Subject: [PATCH 16/19] sagemath: change patch for cmdline args to disable
 dochtml testing

---
 .../sagemath/patches/skip-optional-dochtml.patch    | 13 -------------
 srcpkgs/sagemath/template                           |  4 +++-
 2 files changed, 3 insertions(+), 14 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/skip-optional-dochtml.patch

diff --git a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch b/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
deleted file mode 100644
index e49b18a52fbc..000000000000
--- a/srcpkgs/sagemath/patches/skip-optional-dochtml.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
-index 288c889bd1..b9a4d3038a 100755
---- a/src/bin/sage-runtests
-+++ b/src/bin/sage-runtests
-@@ -15,7 +15,7 @@ os.environ['SAGE_STARTUP_FILE'] = os.path.join(DOT_SAGE, 'init-doctests.sage')
- 
- def _get_optional_defaults():
-     """Return the default value for the --optional flag."""
--    optional = ['sage', 'dochtml', 'optional']
-+    optional = ['sage', 'optional']
- 
-     # This should be good-enough to determine if we are in a sage source
-     # repository working tree
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index ede79e76b98d..b009060232c0 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -88,8 +88,10 @@ do_check() {
 	if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
 		TEST="$(grep -v "^#" ${XBPS_DISTDIR}/sagemath-check)"
 	fi
+	# the default is "sage,dochtml,optional,build", we skip dochtml
+	OPT="--optional sage,optional,build"
 	# since make check will build the docs, run test like this instead
-	./sage -tp ${XBPS_MAKEJOBS} ${TEST}
+	./sage -tp ${XBPS_MAKEJOBS} ${OPT} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

From 5d6191ddc7b2772528935544f4eb5620698a8b6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 13 Dec 2021 00:05:49 -0300
Subject: [PATCH 17/19] sagemath: update to 9.5.beta8.

---
 ...a86908daf60b25e66e6a189c51ada7e0a732.patch |  25 ----
 .../patches/trac-32828-fix-pyzmq.patch        | 134 ------------------
 ...754ad30c6a1bd1fdbd6d62011055bf13b24a.patch |  27 ----
 srcpkgs/sagemath/template                     |   6 +-
 4 files changed, 3 insertions(+), 189 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch

diff --git a/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch b/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
deleted file mode 100644
index ec0467757ee7..000000000000
--- a/srcpkgs/sagemath/patches/trac-32797-f5f7a86908daf60b25e66e6a189c51ada7e0a732.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From f5f7a86908daf60b25e66e6a189c51ada7e0a732 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Sat, 30 Oct 2021 10:21:52 +0200
-Subject: Fix test failure caused by new warning
-
----
- src/sage/lfunctions/pari.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
-index 0aaf91c..33d5266 100644
---- a/src/sage/lfunctions/pari.py
-+++ b/src/sage/lfunctions/pari.py
-@@ -316,7 +316,7 @@ def lfun_number_field(K):
-         sage: L(3)
-         1.15202784126080
-         sage: L(0)
--        0.000000000000000
-+        ...0.000000000000000
-     """
-     return pari.lfuncreate(K)
- 
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch b/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
deleted file mode 100644
index 426932c95c9b..000000000000
--- a/srcpkgs/sagemath/patches/trac-32828-fix-pyzmq.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-diff --git a/build/pkgs/pyzmq/checksums.ini b/build/pkgs/pyzmq/checksums.ini
-index 3824fd2ce9..20509db618 100644
---- a/build/pkgs/pyzmq/checksums.ini
-+++ b/build/pkgs/pyzmq/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=pyzmq-VERSION.tar.gz
--sha1=50abf6482a6395f15dce0b2774021e12c9f4faad
--md5=f261acf884460e93d30f7113c8e9242e
--cksum=1661206741
-+sha1=d8bb8cb345c0bfd9e67a95ac796bf4b10354dde6
-+md5=ecf13c72fbea05ba5ddc771295409d48
-+cksum=1680251717
- upstream_url=https://pypi.io/packages/source/p/pyzmq/pyzmq-VERSION.tar.gz
-diff --git a/build/pkgs/pyzmq/package-version.txt b/build/pkgs/pyzmq/package-version.txt
-index 0398faf11c..8326e27f9b 100644
---- a/build/pkgs/pyzmq/package-version.txt
-+++ b/build/pkgs/pyzmq/package-version.txt
-@@ -1 +1 @@
--22.2.1
-+22.3.0
-diff --git a/build/pkgs/pyzmq/spkg-install.in b/build/pkgs/pyzmq/spkg-install.in
-index 0ce404ee5a..069d87767f 100644
---- a/build/pkgs/pyzmq/spkg-install.in
-+++ b/build/pkgs/pyzmq/spkg-install.in
-@@ -1,17 +1,11 @@
--# Since we use environment vars we have to generate setup.cfg
--
--echo "[build_ext]" > src/setup.cfg
--
--# (I tried putting quotes around $SAGE_LOCAL to allow for spaces in
--# the path---which is never used but is a good habit to support---but
--# that simply does not work. Sorry.)
--
--echo "library_dirs = $SAGE_LOCAL/lib/" >> src/setup.cfg
--echo "include_dirs = $SAGE_LOCAL/include/" >> src/setup.cfg
--
--echo "[configure]" >> src/setup.cfg
--
- cd src
- 
-+# Generate setup.cfg
-+cat > setup.cfg <<EOF
-+[global]
-+zmq_prefix = $SAGE_LOCAL
-+no_libzmq_extension = True
-+EOF
-+
- # Configure and install
- sdh_pip_install .
-diff --git a/build/pkgs/setuptools/checksums.ini b/build/pkgs/setuptools/checksums.ini
-index 6a280871e7..d9290d04ff 100644
---- a/build/pkgs/setuptools/checksums.ini
-+++ b/build/pkgs/setuptools/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=setuptools-VERSION.tar.gz
--sha1=5d97de0e774b2269c85685a4aa8fd5956bcfd2bb
--md5=ff20ab7e0d51c5ad0a9438c50e598c06
--cksum=3564252314
-+sha1=cd4e5d1f7c47f86354fc89d040d869cde244da3b
-+md5=79b36f59270a6f2e45d6a9a0c6dc68c1
-+cksum=430889097
- upstream_url=https://pypi.io/packages/source/s/setuptools/setuptools-VERSION.tar.gz
-diff --git a/build/pkgs/setuptools/package-version.txt b/build/pkgs/setuptools/package-version.txt
-index e6ea636051..aec1257e4c 100644
---- a/build/pkgs/setuptools/package-version.txt
-+++ b/build/pkgs/setuptools/package-version.txt
-@@ -1 +1 @@
--58.2.0
-+59.2.0
-diff --git a/build/pkgs/zeromq/checksums.ini b/build/pkgs/zeromq/checksums.ini
-index ea8c36bce5..dc802612dd 100644
---- a/build/pkgs/zeromq/checksums.ini
-+++ b/build/pkgs/zeromq/checksums.ini
-@@ -1,4 +1,5 @@
- tarball=zeromq-VERSION.tar.gz
--sha1=1132f839d703486c4ee1cf22f056585dfbb329c2
--md5=a1c95b34384257e986842f4d006957b8
--cksum=136261411
-+sha1=47277a64749049123d1401600e8cfbab10a3ae28
-+md5=c897d4005a3f0b8276b00b7921412379
-+cksum=1500782345
-+upstream_url=https://github.com/zeromq/libzmq/releases/download/vVERSION/zeromq-VERSION.tar.gz
-diff --git a/build/pkgs/zeromq/package-version.txt b/build/pkgs/zeromq/package-version.txt
-index df0228dfae..eda862a98c 100644
---- a/build/pkgs/zeromq/package-version.txt
-+++ b/build/pkgs/zeromq/package-version.txt
-@@ -1 +1 @@
--4.2.5
-+4.3.4
-diff --git a/build/pkgs/zeromq/patches/getrandom.patch b/build/pkgs/zeromq/patches/getrandom.patch
-deleted file mode 100644
-index e665114e1c..0000000000
---- a/build/pkgs/zeromq/patches/getrandom.patch
-+++ /dev/null
-@@ -1,39 +0,0 @@
--Patch taken from upstream git repo
--and after running aclocal && autoconf
--and removing changes to autotools input files
--
--commit 4ff814f204ee38177a392526cf12c8c0019b480f
--Author: Luca Boccassi <luca.boccassi@gmail.com>
--Date:   Wed May 9 10:41:20 2018 +0100
--
--    Problem: getrandom test does not check if it's working
--
--    Solution: check return value in autoconf and CMake. On some platforms
--    the function is available but not implemented (eg: GNU/Hurd).
--
--diff -ru zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake
----- zeromq-4.2.5//builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-03-23 20:33:36.000000000 +0100
--+++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake	2018-07-24 12:39:23.340035053 +0200
--@@ -287,7 +287,8 @@
-- int main (int argc, char *argv [])
-- {
--     char buf[4];
---    getrandom(buf, 4, 0);
--+    int rc = getrandom(buf, 4, 0);
--+    return rc == -1 ? 1 : 0;
-- }
-- "
--     ZMQ_HAVE_GETRANDOM)
--diff -ru zeromq-4.2.5//configure b/configure
----- zeromq-4.2.5//configure	2018-03-23 20:34:18.000000000 +0100
--+++ b/configure	2018-07-24 12:39:49.018035120 +0200
--@@ -23315,7 +23315,8 @@
-- int main (int argc, char *argv [])
-- {
--     char buf[4];
---    getrandom(buf, 4, 0);
--+    int rc = getrandom(buf, 4, 0);
--+    return rc == -1 ? 1 : 0;
-- }
-- 
-- _ACEOF
diff --git a/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch b/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
deleted file mode 100644
index ea05b2b6a524..000000000000
--- a/srcpkgs/sagemath/patches/trac-32892-89b8754ad30c6a1bd1fdbd6d62011055bf13b24a.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 89b8754ad30c6a1bd1fdbd6d62011055bf13b24a Mon Sep 17 00:00:00 2001
-From: Tobias Diez <code@tobiasdiez.com>
-Date: Wed, 17 Nov 2021 22:24:32 +0100
-Subject: Fix exit code for pytest in case of no matched files
-
----
- src/bin/sage-runtests | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/src/bin/sage-runtests b/src/bin/sage-runtests
-index 882456d..8b362ca 100755
---- a/src/bin/sage-runtests
-+++ b/src/bin/sage-runtests
-@@ -157,6 +157,10 @@ if __name__ == "__main__":
-         if args.verbose:
-             pytest_options.append("-v")
-         exit_code_pytest = pytest.main(pytest_options + args.filenames)
-+        if exit_code_pytest == 5:
-+            # Exit code 5 means there were no test files, pass in this case
-+            exit_code_pytest = 0
-+
-     except ModuleNotFoundError:
-         print("Pytest is not installed, skip checking tests that rely on it.")
- 
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index b009060232c0..a1f08000669a 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,6 +1,6 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.5.beta7
+version=9.5.beta8
 revision=1
 wrksrc=sage-$version
 build_style=configure
@@ -19,7 +19,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-3.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
-checksum=b81e1fe22d1b990bf1230260241ead016470da1f2f7b260f562d50f74c2904c7
+checksum=124f3d23ce6442ecc84ed98e3c035e0d00c8261c3125712e4742c32e731d13de
 python_version=3
 
 # path where sage will be installed
@@ -112,7 +112,7 @@ makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
 makedepends+="
  CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
  ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
- glpk-devel gmp-devel gmpxx-devel gp2c graphviz gsl-devel isl-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz-devel gsl-devel isl-devel
  libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
  libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
  pari-devel pari-elldata-small pari-galdata pari-galpol-small

From fc94c4d1e79f1d7252b5a7ee2f2908fbc4d5affe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 19 Dec 2021 10:42:01 -0300
Subject: [PATCH 18/19] sagemath: more changes

 - cleanup and rename some patches
 - make symlink relative so it works ok outside the chroot
 - add graphviz to depends (not implied by graphviz-devel)
 - add primecount and primesieve to depends
---
 ...3e88ee188d516e4956832a23f985a73917a.patch} |   2 +-
 ...ea979d4bfa1a26ef3b08a29ca626b83b6ff5.patch |  23 ++
 ...ba734cb4ded0b04165fa142b5cf4c38fd23.patch} | 233 ++++++++++++------
 srcpkgs/sagemath/template                     |   8 +-
 4 files changed, 181 insertions(+), 85 deletions(-)
 rename srcpkgs/sagemath/patches/{trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch => trac-29631-001-system_linbox-794713e88ee188d516e4956832a23f985a73917a.patch} (94%)
 create mode 100644 srcpkgs/sagemath/patches/trac-29631-002-system_linbox-7e16ea979d4bfa1a26ef3b08a29ca626b83b6ff5.patch
 rename srcpkgs/sagemath/patches/{trac-32867-system-maxima.patch => trac-32867-system_maxima-ed39aba734cb4ded0b04165fa142b5cf4c38fd23.patch} (66%)

diff --git a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch b/srcpkgs/sagemath/patches/trac-29631-001-system_linbox-794713e88ee188d516e4956832a23f985a73917a.patch
similarity index 94%
rename from srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
rename to srcpkgs/sagemath/patches/trac-29631-001-system_linbox-794713e88ee188d516e4956832a23f985a73917a.patch
index 8154c2453c15..483dbe2c2597 100644
--- a/srcpkgs/sagemath/patches/trac-29631-7072119d27d091b3894860547673c2f6b224f61a.patch
+++ b/srcpkgs/sagemath/patches/trac-29631-001-system_linbox-794713e88ee188d516e4956832a23f985a73917a.patch
@@ -1,4 +1,4 @@
-From 7072119d27d091b3894860547673c2f6b224f61a Mon Sep 17 00:00:00 2001
+From 794713e88ee188d516e4956832a23f985a73917a Mon Sep 17 00:00:00 2001
 From: Michael Orlitzky <michael@orlitzky.com>
 Date: Fri, 12 Nov 2021 10:07:44 -0500
 Subject: Trac #29631: new spkg-configure.m4 for linbox.
diff --git a/srcpkgs/sagemath/patches/trac-29631-002-system_linbox-7e16ea979d4bfa1a26ef3b08a29ca626b83b6ff5.patch b/srcpkgs/sagemath/patches/trac-29631-002-system_linbox-7e16ea979d4bfa1a26ef3b08a29ca626b83b6ff5.patch
new file mode 100644
index 000000000000..3b20d13100e7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-29631-002-system_linbox-7e16ea979d4bfa1a26ef3b08a29ca626b83b6ff5.patch
@@ -0,0 +1,23 @@
+From 7e16ea979d4bfa1a26ef3b08a29ca626b83b6ff5 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Sun, 5 Dec 2021 10:59:34 +0000
+Subject: correct the package name: `-`->`_`
+
+---
+ build/pkgs/linbox/spkg-configure.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/linbox/spkg-configure.m4 b/build/pkgs/linbox/spkg-configure.m4
+index fbf405c..f54b210 100644
+--- a/build/pkgs/linbox/spkg-configure.m4
++++ b/build/pkgs/linbox/spkg-configure.m4
+@@ -1,5 +1,5 @@
+ SAGE_SPKG_CONFIGURE([linbox], [
+-  SAGE_SPKG_DEPCHECK([fflas-ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
++  SAGE_SPKG_DEPCHECK([fflas_ffpack flint fplll givaro gmp iml m4ri m4rie mpfr ntl], [
+     PKG_CHECK_MODULES([LINBOX],
+                       [linbox >= 1.6.3],
+                       [],
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch b/srcpkgs/sagemath/patches/trac-32867-system_maxima-ed39aba734cb4ded0b04165fa142b5cf4c38fd23.patch
similarity index 66%
rename from srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
rename to srcpkgs/sagemath/patches/trac-32867-system_maxima-ed39aba734cb4ded0b04165fa142b5cf4c38fd23.patch
index cb6517a388d8..8edbde0ce76f 100644
--- a/srcpkgs/sagemath/patches/trac-32867-system-maxima.patch
+++ b/srcpkgs/sagemath/patches/trac-32867-system_maxima-ed39aba734cb4ded0b04165fa142b5cf4c38fd23.patch
@@ -1,78 +1,66 @@
-diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
-index ae1e0ac5e1..7dbcfa6377 100644
---- a/build/pkgs/ecl/spkg-configure.m4
-+++ b/build/pkgs/ecl/spkg-configure.m4
-@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
-     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
-   fi
+From ab5400040fcf3a1061229afb3ab81f26fef0858d Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 21:33:39 -0500
+Subject: Trac #32867: don't export MAXIMA_PREFIX.
+
+This should work automatically, and the previous behavior is
+incorrect if we intend to use the system copy of maxima.
+---
+ src/bin/sage-env | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/bin/sage-env b/src/bin/sage-env
+index a0426df..f0866b4 100644
+--- a/src/bin/sage-env
++++ b/src/bin/sage-env
+@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
+     fi
+ fi
  
--  # Maxima cannot yet be provided by the system, so we always use
-+  # Kenzo cannot yet be provided by the system, so we always use
-   # the SAGE_LOCAL path for now.
--  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
--
--  # Likewise for the optional Kenzo SPKG
-   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
- ])
-diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
-new file mode 100644
-index 0000000000..df625fecc4
---- /dev/null
-+++ b/build/pkgs/maxima/spkg-configure.m4
-@@ -0,0 +1,35 @@
-+SAGE_SPKG_CONFIGURE([maxima], [
-+  SAGE_SPKG_DEPCHECK([ecl], [
-+    dnl First check for the "maxima" executable in the user's PATH, because
-+    dnl we still use pexpect to communicate with it in a few places. We pass
-+    dnl the "-l ecl" flag here to ensure that the standalone executable also
-+    dnl supports ECL.
-+    AC_MSG_CHECKING(if "maxima -l ecl" works)
-+    AS_IF([! maxima -l ecl -q -r 'quit();' \
-+             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
-+      AC_MSG_RESULT(no)
-+      sage_spkg_install_maxima=yes
-+    ], [
-+      AC_MSG_RESULT(yes)
-+      dnl If we have the executable, check also for the ECL library.
-+      AC_MSG_CHECKING([if ECL can "require" the maxima module])
-+      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
-+               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
-+        AC_MSG_RESULT(yes)
-+      ], [
-+	AC_MSG_RESULT(no)
-+	sage_spkg_install_maxima=yes
-+      ])
-+    ])
-+  ])
-+],[],[],[
-+  # post-check
-+  AS_IF([test x$sage_spkg_install_maxima = xyes], [
-+    dnl Leaving this variable empty will tell sagelib to load
-+    dnl the maxima library (within ECL) by name instead of by
-+    dnl absolute path.
-+    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
-+  ])
-+  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
-+])
-+
+-if [ -n "$SAGE_LOCAL" ]; then
+-    export MAXIMA_PREFIX="$SAGE_LOCAL"
+-fi
+ export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ if [ -n "$SAGE_LOCAL" ]; then
+-- 
+cgit v1.0-1-gd88e
+
+
+From 0e29761fbd23736d8d9acd235e4fa2de839df6a4 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 21:13:21 -0500
+Subject: Trac #32867: remove the MAXIMA sage_conf variable.
+
+Until now, the MAXIMA variable held the name of the main maxima
+executable. But there really is no reason to use anything other
+than "maxima -l ecl", which works in all cases. This commit
+replaces the variable with the hard-coded value. This simplifies
+the use of maxima from the system because we no longer need to
+set sage_conf.MAXIMA to any particular value during ./configure.
+---
+ pkgs/sage-conf/sage_conf.py.in         | 2 --
+ src/bin/sage                           | 6 +-----
+ src/sage/env.py                        | 1 -
+ src/sage/interfaces/maxima.py          | 3 +--
+ src/sage/interfaces/maxima_abstract.py | 8 ++++----
+ 5 files changed, 6 insertions(+), 14 deletions(-)
+
 diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
-index fbce6947de..8cda3ebfac 100644
+index fbce694..b40cda6 100644
 --- a/pkgs/sage-conf/sage_conf.py.in
 +++ b/pkgs/sage-conf/sage_conf.py.in
-@@ -9,9 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+@@ -9,8 +9,6 @@ VERSION = "@PACKAGE_VERSION@"
  SAGE_LOCAL = "@prefix@"
  SAGE_ROOT = "@SAGE_ROOT@"
  
 -MAXIMA = "@prefix@/bin/maxima"
 -
--# Delete this line if your ECL can load maxima without further prodding.
-+# Set this to the empty string if your ECL can load maxima without
-+# further prodding.
+ # Delete this line if your ECL can load maxima without further prodding.
  MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
  
- # Delete this line if your ECL can load Kenzo without further prodding.
 diff --git a/src/bin/sage b/src/bin/sage
-index fcd263029d..54b69a1043 100755
+index fcd2630..54b69a1 100755
 --- a/src/bin/sage
 +++ b/src/bin/sage
 @@ -684,11 +684,7 @@ fi
@@ -88,22 +76,8 @@ index fcd263029d..54b69a1043 100755
  fi
  
  if [ "$1" = '-mwrank' -o "$1" = '--mwrank' ]; then
-diff --git a/src/bin/sage-env b/src/bin/sage-env
-index a0426df523..f0866b4b1b 100644
---- a/src/bin/sage-env
-+++ b/src/bin/sage-env
-@@ -482,9 +482,6 @@ if [ -d "$DOT_SAGE" ] ; then
-     fi
- fi
- 
--if [ -n "$SAGE_LOCAL" ]; then
--    export MAXIMA_PREFIX="$SAGE_LOCAL"
--fi
- export MAXIMA_USERDIR="$DOT_SAGE/maxima"
- 
- if [ -n "$SAGE_LOCAL" ]; then
 diff --git a/src/sage/env.py b/src/sage/env.py
-index 40ace135f0..95edc16081 100644
+index 40ace13..95edc16 100644
 --- a/src/sage/env.py
 +++ b/src/sage/env.py
 @@ -207,7 +207,6 @@ MATHJAX_DIR = var("MATHJAX_DIR", join(SAGE_SHARE, "mathjax"))
@@ -115,7 +89,7 @@ index 40ace135f0..95edc16081 100644
  KENZO_FAS = var("KENZO_FAS")
  SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
 diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
-index fc7f48bc05..7313c7d0d3 100644
+index fc7f48b..7313c7d 100644
 --- a/src/sage/interfaces/maxima.py
 +++ b/src/sage/interfaces/maxima.py
 @@ -484,7 +484,6 @@ import shlex
@@ -136,7 +110,7 @@ index fc7f48bc05..7313c7d0d3 100644
                          script_subdirectory = script_subdirectory,
                          restart_on_ctrlc = False,
 diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
-index 917059de0a..c966a3c9a0 100644
+index 917059d..c966a3c 100644
 --- a/src/sage/interfaces/maxima_abstract.py
 +++ b/src/sage/interfaces/maxima_abstract.py
 @@ -54,7 +54,7 @@ import re
@@ -172,3 +146,102 @@ index 917059de0a..c966a3c9a0 100644
          raise RuntimeError('Can use the console only in the terminal. Try %%maxima magics instead.')
 -    os.system('{}'.format(MAXIMA))
 +    os.system('maxima -l ecl')
+-- 
+cgit v1.0-1-gd88e
+
+
+From 88992bfae6d2aba0819b8cd67ae36621a5873b38 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 12 Nov 2021 20:51:28 -0500
+Subject: Trac #32867: new spkg-configure.m4 for maxima.
+
+This new spkg-configure.m4 checks for both a "maxima" executable, and
+the usability of a "maxima" package by ECL. (The latter requires a
+patched maxima until a new release with commit a0d7a43e523 is made.)
+Notably absent for the moment is a version check, but feature testing
+is moot until we decide what to do about matrixexp.patch.
+
+This commit also moves the SAGE_MAXIMA_FAS variable handling from
+ECL's spkg-configure.m4 to maxima's (where it would have belonged in
+the first place, if maxima had an spkg-configure.m4 at the time.)
+---
+ build/pkgs/ecl/spkg-configure.m4    |  5 +----
+ build/pkgs/maxima/spkg-configure.m4 | 35 +++++++++++++++++++++++++++++++++++
+ pkgs/sage-conf/sage_conf.py.in      |  3 ++-
+ 3 files changed, 38 insertions(+), 5 deletions(-)
+ create mode 100644 build/pkgs/maxima/spkg-configure.m4
+
+diff --git a/build/pkgs/ecl/spkg-configure.m4 b/build/pkgs/ecl/spkg-configure.m4
+index ae1e0ac..7dbcfa6 100644
+--- a/build/pkgs/ecl/spkg-configure.m4
++++ b/build/pkgs/ecl/spkg-configure.m4
+@@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
+     AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
+   fi
+ 
+-  # Maxima cannot yet be provided by the system, so we always use
++  # Kenzo cannot yet be provided by the system, so we always use
+   # the SAGE_LOCAL path for now.
+-  AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
+-
+-  # Likewise for the optional Kenzo SPKG
+   AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
+ ])
+diff --git a/build/pkgs/maxima/spkg-configure.m4 b/build/pkgs/maxima/spkg-configure.m4
+new file mode 100644
+index 00000000..df625fe
+--- /dev/null
++++ b/build/pkgs/maxima/spkg-configure.m4
+@@ -0,0 +1,35 @@
++SAGE_SPKG_CONFIGURE([maxima], [
++  SAGE_SPKG_DEPCHECK([ecl], [
++    dnl First check for the "maxima" executable in the user's PATH, because
++    dnl we still use pexpect to communicate with it in a few places. We pass
++    dnl the "-l ecl" flag here to ensure that the standalone executable also
++    dnl supports ECL.
++    AC_MSG_CHECKING(if "maxima -l ecl" works)
++    AS_IF([! maxima -l ecl -q -r 'quit();' \
++             >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++      AC_MSG_RESULT(no)
++      sage_spkg_install_maxima=yes
++    ], [
++      AC_MSG_RESULT(yes)
++      dnl If we have the executable, check also for the ECL library.
++      AC_MSG_CHECKING([if ECL can "require" the maxima module])
++      AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
++               >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
++        AC_MSG_RESULT(yes)
++      ], [
++	AC_MSG_RESULT(no)
++	sage_spkg_install_maxima=yes
++      ])
++    ])
++  ])
++],[],[],[
++  # post-check
++  AS_IF([test x$sage_spkg_install_maxima = xyes], [
++    dnl Leaving this variable empty will tell sagelib to load
++    dnl the maxima library (within ECL) by name instead of by
++    dnl absolute path.
++    SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
++  ])
++  AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
++])
++
+diff --git a/pkgs/sage-conf/sage_conf.py.in b/pkgs/sage-conf/sage_conf.py.in
+index b40cda6..8cda3eb 100644
+--- a/pkgs/sage-conf/sage_conf.py.in
++++ b/pkgs/sage-conf/sage_conf.py.in
+@@ -9,7 +9,8 @@ VERSION = "@PACKAGE_VERSION@"
+ SAGE_LOCAL = "@prefix@"
+ SAGE_ROOT = "@SAGE_ROOT@"
+ 
+-# Delete this line if your ECL can load maxima without further prodding.
++# Set this to the empty string if your ECL can load maxima without
++# further prodding.
+ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)
+ 
+ # Delete this line if your ECL can load Kenzo without further prodding.
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index a1f08000669a..7764899e557f 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -50,7 +50,7 @@ post_extract() {
 	# sage wants to be built in place so let $wrksrc be a symlink
 	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
-	ln -sfT $_SAGE_ROOT $wrksrc
+	ln -srfT $_SAGE_ROOT $wrksrc
 }
 
 do_clean() {
@@ -112,8 +112,8 @@ makedepends+=" cmake curl git ninja pandoc patch pkg-config python3 tox"
 makedepends+="
  CoinMP-devel R arb-devel boost-devel bzip2-devel ecl eclib-devel
  ecm-devel flintlib-devel freetype-devel gc-devel gd-devel giac-devel
- glpk-devel gmp-devel gmpxx-devel gp2c graphviz-devel gsl-devel isl-devel
- libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
+ glpk-devel gmp-devel gmpxx-devel gp2c graphviz graphviz-devel gsl-devel
+ isl-devel libatomic_ops-devel libcurl-devel libffi-devel libmpc-devel
  libpng-devel libxml2-devel mpfr-devel ncurses-devel openblas-devel
  pari-devel pari-elldata-small pari-galdata pari-galpol-small
  pari-seadata pcre-devel perl-File-Slurp perl-JSON perl-Term-ReadKey
@@ -127,7 +127,7 @@ makedepends+="
  gengetopt texinfo
  brial-devel cliquer-devel gfan libbraiding-devel libhomfly-devel
  lrcalc-devel nauty-devel palp tachyon
- maxima-ecl
+ maxima-ecl primesieve-devel primecount-devel
 "
 
 # TODO: optional

From 96eba896c8784bba244e0e827e8a6b3917332301 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 19 Dec 2021 13:48:48 -0300
Subject: [PATCH 19/19] sagemath: use system python 3.10

---
 ...3996062c71a9326aafddaf465f6a56b40fe0.patch |  886 ++++++++++++
 ...f82f52b6f05f512cb359ec7c100f93cf8841.patch |  128 ++
 ...77cfadd7b3872ad6f7001fe84fb7568c947c.patch |   84 ++
 ...a54526829b79d5d236a40f83ddc6ce7b2696.patch | 1196 +++++++++++++++++
 srcpkgs/sagemath/template                     |   78 ++
 5 files changed, 2372 insertions(+)
 create mode 100644 srcpkgs/sagemath/patches/trac-30766-system_python_3.10-b5c73996062c71a9326aafddaf465f6a56b40fe0.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-32968-update_sphinx_to_4.3.1-fc84f82f52b6f05f512cb359ec7c100f93cf8841.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33020-update_ipykernel_to_6.6.0-715277cfadd7b3872ad6f7001fe84fb7568c947c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33040-update_matplotlib_to_3.5-d865a54526829b79d5d236a40f83ddc6ce7b2696.patch

diff --git a/srcpkgs/sagemath/patches/trac-30766-system_python_3.10-b5c73996062c71a9326aafddaf465f6a56b40fe0.patch b/srcpkgs/sagemath/patches/trac-30766-system_python_3.10-b5c73996062c71a9326aafddaf465f6a56b40fe0.patch
new file mode 100644
index 000000000000..eb9b0c3f6672
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-30766-system_python_3.10-b5c73996062c71a9326aafddaf465f6a56b40fe0.patch
@@ -0,0 +1,886 @@
+From fe947f3c9a6109b92dd4c19dda795ceb01c6f9a7 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:23:16 -0800
+Subject: build/pkgs/ipython: Update to 7.29.0
+
+---
+ build/pkgs/ipython/checksums.ini       | 6 +++---
+ build/pkgs/ipython/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/ipython/checksums.ini b/build/pkgs/ipython/checksums.ini
+index aa743ea..03da012 100644
+--- a/build/pkgs/ipython/checksums.ini
++++ b/build/pkgs/ipython/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=ipython-VERSION.tar.gz
+-sha1=a64001602601a4a7917a32b496543153f82dd65a
+-md5=e28a91669dc8b86569a99abed2c67f08
+-cksum=4064786540
++sha1=05165e7fdcebde908aa6b65892ef230795a01e6b
++md5=159340b8ba158386f938a8b882749fed
++cksum=1960065579
+ upstream_url=https://pypi.io/packages/source/i/ipython/ipython-VERSION.tar.gz
+diff --git a/build/pkgs/ipython/package-version.txt b/build/pkgs/ipython/package-version.txt
+index f6b1800..d88eca0 100644
+--- a/build/pkgs/ipython/package-version.txt
++++ b/build/pkgs/ipython/package-version.txt
+@@ -1 +1 @@
+-7.27.0
++7.29.0
+-- 
+cgit v1.0-1-gd88e
+
+
+From 7939a79de125c7f20e981b31c0124e1d80ec9e42 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:28:14 -0800
+Subject: build/pkgs/ipykernel: Update to 6.5.1
+
+---
+ build/pkgs/ipykernel/checksums.ini       | 6 +++---
+ build/pkgs/ipykernel/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/ipykernel/checksums.ini b/build/pkgs/ipykernel/checksums.ini
+index 51eb667..ca1302e 100644
+--- a/build/pkgs/ipykernel/checksums.ini
++++ b/build/pkgs/ipykernel/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=ipykernel-VERSION.tar.gz
+-sha1=19b16c61057bb7f5ad97f7e91bb54cdfec260257
+-md5=329c172babb38dff1be130ddf3a609af
+-cksum=2936157099
++sha1=2c2aa0e929bfd0e694da6b45d2de846a0a5d2812
++md5=78797cb2389d8f131c75280f808aac15
++cksum=1454395629
+ upstream_url=https://pypi.io/packages/source/i/ipykernel/ipykernel-VERSION.tar.gz
+diff --git a/build/pkgs/ipykernel/package-version.txt b/build/pkgs/ipykernel/package-version.txt
+index dc0208a..a194c18 100644
+--- a/build/pkgs/ipykernel/package-version.txt
++++ b/build/pkgs/ipykernel/package-version.txt
+@@ -1 +1 @@
+-6.3.1
++6.5.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From 73df3fc22ba3455befb05758f813caa3dd0a010b Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:28:44 -0800
+Subject: build/pkgs/ipywidgets: Update to 7.6.5
+
+---
+ build/pkgs/ipywidgets/checksums.ini       | 6 +++---
+ build/pkgs/ipywidgets/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/ipywidgets/checksums.ini b/build/pkgs/ipywidgets/checksums.ini
+index efb9fe9..af4a04d 100644
+--- a/build/pkgs/ipywidgets/checksums.ini
++++ b/build/pkgs/ipywidgets/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=ipywidgets-VERSION.tar.gz
+-sha1=8ea8c8e15a4779897dc9f12cc20e29cfe5fb689f
+-md5=771fd3999f93af336c6e40ae1f5c37a2
+-cksum=980834502
++sha1=ad63e99f44fd759c34ab70161e9ac8f4276294f8
++md5=420aabfddee27fc215ad9a9c14c9c529
++cksum=259379988
+ upstream_url=https://pypi.io/packages/source/i/ipywidgets/ipywidgets-VERSION.tar.gz
+diff --git a/build/pkgs/ipywidgets/package-version.txt b/build/pkgs/ipywidgets/package-version.txt
+index b7ade06..bf43f75 100644
+--- a/build/pkgs/ipywidgets/package-version.txt
++++ b/build/pkgs/ipywidgets/package-version.txt
+@@ -1 +1 @@
+-7.6.4.p0
++7.6.5
+-- 
+cgit v1.0-1-gd88e
+
+
+From 5e144e95b13005cfb2cd7e3a3b7abd70d0a902c7 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:30:04 -0800
+Subject: build/pkgs/jedi: Update to 0.18.1
+
+---
+ build/pkgs/jedi/checksums.ini       | 6 +++---
+ build/pkgs/jedi/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/jedi/checksums.ini b/build/pkgs/jedi/checksums.ini
+index f5be931..2db629c 100644
+--- a/build/pkgs/jedi/checksums.ini
++++ b/build/pkgs/jedi/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=jedi-VERSION.tar.gz
+-sha1=f9acd323b88563fafb5bb4dff592794a2713a15c
+-md5=72707c00e8d6d0b190a5e5664be1cac5
+-cksum=620165561
++sha1=e94444bd83b55247fd1f3d27d47cc0b148560134
++md5=d8dba4a98a35530f7f5b461c20aff180
++cksum=4093067035
+ upstream_url=https://pypi.io/packages/source/j/jedi/jedi-VERSION.tar.gz
+diff --git a/build/pkgs/jedi/package-version.txt b/build/pkgs/jedi/package-version.txt
+index 6633391..249afd5 100644
+--- a/build/pkgs/jedi/package-version.txt
++++ b/build/pkgs/jedi/package-version.txt
+@@ -1 +1 @@
+-0.18.0
++0.18.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From 6347f984a697b3aecfe0ed6d2f7363c9dc3b5b65 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:30:58 -0800
+Subject: build/pkgs/prompt_toolkit: Update to 3.0.22
+
+---
+ build/pkgs/prompt_toolkit/checksums.ini       | 6 +++---
+ build/pkgs/prompt_toolkit/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/prompt_toolkit/checksums.ini b/build/pkgs/prompt_toolkit/checksums.ini
+index 7868d1a..0e3fe14 100644
+--- a/build/pkgs/prompt_toolkit/checksums.ini
++++ b/build/pkgs/prompt_toolkit/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=prompt_toolkit-VERSION.tar.gz
+-sha1=20fe2a6126ee2b992d9f77cd20e4b80626b036d7
+-md5=ba9e63c3e7e5a4f4ce4e4770a4daba96
+-cksum=3647925903
++sha1=5efb27677b89b2c81241645c6658e60771af3b7b
++md5=bbaeba1142a64ecf2264eaf4f85201b1
++cksum=1605705668
+ upstream_url=https://pypi.io/packages/source/p/prompt_toolkit/prompt_toolkit-VERSION.tar.gz
+diff --git a/build/pkgs/prompt_toolkit/package-version.txt b/build/pkgs/prompt_toolkit/package-version.txt
+index 3e4a61b..6795d4d 100644
+--- a/build/pkgs/prompt_toolkit/package-version.txt
++++ b/build/pkgs/prompt_toolkit/package-version.txt
+@@ -1 +1 @@
+-3.0.20
++3.0.22
+-- 
+cgit v1.0-1-gd88e
+
+
+From 28e535d3a1dd6b67e740b1900c4fad36cccd1121 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:32:02 -0800
+Subject: build/pkgs/widgetsnbextension: Update to 3.5.2
+
+---
+ build/pkgs/widgetsnbextension/checksums.ini       | 6 +++---
+ build/pkgs/widgetsnbextension/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/widgetsnbextension/checksums.ini b/build/pkgs/widgetsnbextension/checksums.ini
+index 2f7e946..81205c5 100644
+--- a/build/pkgs/widgetsnbextension/checksums.ini
++++ b/build/pkgs/widgetsnbextension/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=widgetsnbextension-VERSION.tar.gz
+-sha1=f92ee894f3b08cfb6cfac0856d77521bbbf45e92
+-md5=3dc5f96919c032a885950e3819bdee7b
+-cksum=4195536255
++sha1=010f70ab9a6d6e0a4f9607cce0da182ee6c1280a
++md5=c126a06559afe658e285bcd483790710
++cksum=160710350
+ upstream_url=https://pypi.io/packages/source/w/widgetsnbextension/widgetsnbextension-VERSION.tar.gz
+diff --git a/build/pkgs/widgetsnbextension/package-version.txt b/build/pkgs/widgetsnbextension/package-version.txt
+index ffe3090..87ce492 100644
+--- a/build/pkgs/widgetsnbextension/package-version.txt
++++ b/build/pkgs/widgetsnbextension/package-version.txt
+@@ -1 +1 @@
+-3.5.1.p0
++3.5.2
+-- 
+cgit v1.0-1-gd88e
+
+
+From 63078ac3e486d986d43e78f76a2037455147b8da Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:33:12 -0800
+Subject: build/pkgs/terminado: Update to 0.12.1
+
+---
+ build/pkgs/terminado/checksums.ini       | 6 +++---
+ build/pkgs/terminado/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/terminado/checksums.ini b/build/pkgs/terminado/checksums.ini
+index ba1b392..f33efd4 100644
+--- a/build/pkgs/terminado/checksums.ini
++++ b/build/pkgs/terminado/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=terminado-VERSION.tar.gz
+-sha1=9a4f75d9f1bad0e7eadf33da774ab4e09d75a47b
+-md5=8150154423841a90b1d8ca60943ad84c
+-cksum=2702442904
++sha1=65f40480c1d8077b78dcffb7e0c909eae86998bf
++md5=4871263f6aaed18e09603fa6785b4340
++cksum=2070178009
+ upstream_url=https://pypi.io/packages/source/t/terminado/terminado-VERSION.tar.gz
+diff --git a/build/pkgs/terminado/package-version.txt b/build/pkgs/terminado/package-version.txt
+index af88ba8..34a8361 100644
+--- a/build/pkgs/terminado/package-version.txt
++++ b/build/pkgs/terminado/package-version.txt
+@@ -1 +1 @@
+-0.11.1
++0.12.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From 22de5dc202d63cbcef3a752a6c68e7d99332d705 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:34:42 -0800
+Subject: build/pkgs/notebook: Update to 6.4.6
+
+---
+ build/pkgs/notebook/checksums.ini       | 6 +++---
+ build/pkgs/notebook/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/notebook/checksums.ini b/build/pkgs/notebook/checksums.ini
+index 1355f59..29c39e9 100644
+--- a/build/pkgs/notebook/checksums.ini
++++ b/build/pkgs/notebook/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=notebook-VERSION.tar.gz
+-sha1=0a6d27e401d04d516c3851862491824007272dc0
+-md5=718f7f0267e0111b4ef9ff3238e9f7e8
+-cksum=2383141171
++sha1=93736a3a9c5b025f71a25a301b676a40aca3124b
++md5=ecb9319cf82a9a83b1c4c8e1cc4efbee
++cksum=1697144622
+ upstream_url=https://pypi.io/packages/source/n/notebook/notebook-VERSION.tar.gz
+diff --git a/build/pkgs/notebook/package-version.txt b/build/pkgs/notebook/package-version.txt
+index 133cad2..3d05e8c 100644
+--- a/build/pkgs/notebook/package-version.txt
++++ b/build/pkgs/notebook/package-version.txt
+@@ -1 +1 @@
+-6.4.3
++6.4.6
+-- 
+cgit v1.0-1-gd88e
+
+
+From a0fe18ba460d87e0bd46ada9f4246baa49c7c251 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:35:36 -0800
+Subject: build/pkgs/nbclient: Update to 0.5.4
+
+---
+ build/pkgs/nbclient/checksums.ini       | 6 +++---
+ build/pkgs/nbclient/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/nbclient/checksums.ini b/build/pkgs/nbclient/checksums.ini
+index 914ee93..b1f9790 100644
+--- a/build/pkgs/nbclient/checksums.ini
++++ b/build/pkgs/nbclient/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=nbclient-VERSION.tar.gz
+-sha1=9c1059878ae04da987ae00025908ae802cbfc066
+-md5=593579773bd8128f845ea01a46ccbedb
+-cksum=2389564342
++sha1=a5efba590429270c901f4f5a16c8b46a7e6b8e4a
++md5=a3cf8c1c121b0718a6ccf384c5683424
++cksum=2650264415
+ upstream_url=https://pypi.io/packages/source/n/nbclient/nbclient-VERSION.tar.gz
+diff --git a/build/pkgs/nbclient/package-version.txt b/build/pkgs/nbclient/package-version.txt
+index 7d85683..416bfb0 100644
+--- a/build/pkgs/nbclient/package-version.txt
++++ b/build/pkgs/nbclient/package-version.txt
+@@ -1 +1 @@
+-0.5.4
++0.5.9
+-- 
+cgit v1.0-1-gd88e
+
+
+From ef3fc7f3a0877ee92dd1bf6e8d6e8c84db9f6050 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:38:02 -0800
+Subject: build/pkgs/jupyter_client: Update to 7.1.0
+
+---
+ build/pkgs/jupyter_client/checksums.ini       | 6 +++---
+ build/pkgs/jupyter_client/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/jupyter_client/checksums.ini b/build/pkgs/jupyter_client/checksums.ini
+index ab486e6..cbe7b83 100644
+--- a/build/pkgs/jupyter_client/checksums.ini
++++ b/build/pkgs/jupyter_client/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=jupyter_client-VERSION.tar.gz
+-sha1=d03249e98f821ac8f43408e71b5390cef336d859
+-md5=7c6ef694cde43fd365046869842a1cde
+-cksum=236454943
++sha1=aad5dd5337e20e53de66e094092333e04d9c4e1d
++md5=33fb5eab82f3e89c68f2082b52a8e966
++cksum=481041414
+ upstream_url=https://pypi.io/packages/source/j/jupyter_client/jupyter_client-VERSION.tar.gz
+diff --git a/build/pkgs/jupyter_client/package-version.txt b/build/pkgs/jupyter_client/package-version.txt
+index a8907c0..a3fcc71 100644
+--- a/build/pkgs/jupyter_client/package-version.txt
++++ b/build/pkgs/jupyter_client/package-version.txt
+@@ -1 +1 @@
+-7.0.2
++7.1.0
+-- 
+cgit v1.0-1-gd88e
+
+
+From a593bc993aa860f847b803a3d41fe7c2d5d99780 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:40:11 -0800
+Subject: build/pkgs/jupyter_core: Update to 4.9.1
+
+---
+ build/pkgs/jupyter_core/checksums.ini       | 6 +++---
+ build/pkgs/jupyter_core/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/jupyter_core/checksums.ini b/build/pkgs/jupyter_core/checksums.ini
+index 8310cf0..f3a3068 100644
+--- a/build/pkgs/jupyter_core/checksums.ini
++++ b/build/pkgs/jupyter_core/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=jupyter_core-VERSION.tar.gz
+-sha1=01e57900f8e4475fb90ae533cf7ebd6f4c323867
+-md5=adc204a306a7122a61aa742ccc4c252a
+-cksum=1333962761
++sha1=afa48d85b3611beb42236be3c130767a6524ccfd
++md5=77a1e7642abfb834a6046e14b94f5c88
++cksum=1811078933
+ upstream_url=https://pypi.io/packages/source/j/jupyter_core/jupyter_core-VERSION.tar.gz
+diff --git a/build/pkgs/jupyter_core/package-version.txt b/build/pkgs/jupyter_core/package-version.txt
+index 7c66fca..5b341fd 100644
+--- a/build/pkgs/jupyter_core/package-version.txt
++++ b/build/pkgs/jupyter_core/package-version.txt
+@@ -1 +1 @@
+-4.7.1
++4.9.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From 66c16b14f9081c6d62f5d105cfe76b470074c187 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 24 Nov 2021 18:41:20 -0800
+Subject: build/pkgs/importlib_metadata: Update to 4.8.2
+
+---
+ build/pkgs/importlib_metadata/checksums.ini       | 6 +++---
+ build/pkgs/importlib_metadata/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/importlib_metadata/checksums.ini b/build/pkgs/importlib_metadata/checksums.ini
+index 4006b51..d5a9b1a 100644
+--- a/build/pkgs/importlib_metadata/checksums.ini
++++ b/build/pkgs/importlib_metadata/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=importlib_metadata-VERSION.tar.gz
+-sha1=1572500dd099439cbd86bb70bfe1d206fbc844f6
+-md5=5b944bce3fccaf848f0cba7a07f850a1
+-cksum=416853070
++sha1=7d15d8e06299a8f24e076600899aceee75ce8b0b
++md5=a605ba6ec315bc1324fd6b7210fe7c12
++cksum=448954927
+ upstream_url=https://pypi.io/packages/source/i/importlib_metadata/importlib_metadata-VERSION.tar.gz
+diff --git a/build/pkgs/importlib_metadata/package-version.txt b/build/pkgs/importlib_metadata/package-version.txt
+index 697e993..326ec63 100644
+--- a/build/pkgs/importlib_metadata/package-version.txt
++++ b/build/pkgs/importlib_metadata/package-version.txt
+@@ -1 +1 @@
+-4.8.1
++4.8.2
+-- 
+cgit v1.0-1-gd88e
+
+
+From 27fbff02000609d9bf9c5f429b887e321148c6b6 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 09:57:10 +0100
+Subject: Assign module property to test class
+
+Otherwise, Python 3.10 will report a "source code not available" error, see https://github.com/python/cpython/commit/48a62559dfaf775e4f1cc56b19379c799e8e2587
+---
+ src/sage/misc/sageinspect.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
+index fb2073f..bd89233 100644
+--- a/src/sage/misc/sageinspect.py
++++ b/src/sage/misc/sageinspect.py
+@@ -1585,6 +1585,8 @@ def sage_getargspec(obj):
+         ....:     'class Foo:\n'
+         ....:     '    def __call__(self):\n'
+         ....:     '        return None\n'
++        ....:     '    def __module__(self):\n'
++        ....:     '        return "sage.misc.sageinspect"\n'
+         ....:     '    def _sage_src_(self):\n'
+         ....:     '        return "the source code string"')
+         sage: shell.run_cell('f = Foo()')
+-- 
+cgit v1.0-1-gd88e
+
+
+From 26c9b33878aef88a0b1e88d6664823d9d4591a5f Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 09:59:07 +0100
+Subject: Add abs tol to some tests to make them pass with Python 3.10
+
+---
+ src/sage/plot/colors.py | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py
+index 6fdba0f..f46b736 100644
+--- a/src/sage/plot/colors.py
++++ b/src/sage/plot/colors.py
+@@ -918,12 +918,12 @@ class Color(object):
+ 
+             sage: Color(0.3, 0.5, 0.7, space='hls').hls()
+             (0.30000000000000004, 0.5, 0.7)
+-            sage: Color(0.3, 0.5, 0.7, space='hsl').hls()
++            sage: Color(0.3, 0.5, 0.7, space='hsl').hls() # abs tol 1e-15
+             (0.30000000000000004, 0.7, 0.5000000000000001)
+-            sage: Color('#aabbcc').hls()
++            sage: Color('#aabbcc').hls() # abs tol 1e-15
+             (0.5833333333333334, 0.7333333333333334, 0.25000000000000017)
+             sage: from sage.plot.colors import orchid
+-            sage: orchid.hls()
++            sage: orchid.hls() # abs tol 1e-15
+             (0.8396226415094339, 0.6470588235294117, 0.5888888888888889)
+         """
+         return tuple(map(float, rgb_to_hls(*self._rgb)))
+@@ -942,9 +942,9 @@ class Color(object):
+             sage: Color(1,0,0).hsl()
+             (0.0, 1.0, 0.5)
+             sage: from sage.plot.colors import orchid
+-            sage: orchid.hsl()
++            sage: orchid.hsl() # abs tol 1e-15
+             (0.8396226415094339, 0.5888888888888889, 0.6470588235294117)
+-            sage: Color('#aabbcc').hsl()
++            sage: Color('#aabbcc').hsl() # abs tol 1e-15
+             (0.5833333333333334, 0.25000000000000017, 0.7333333333333334)
+         """
+         h, l, s = tuple(map(float, rgb_to_hls(*self._rgb)))
+-- 
+cgit v1.0-1-gd88e
+
+
+From 079ceca95e5d3ad9fb81d3234df3e984ddde09d4 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 09:59:43 +0100
+Subject: Add missing space
+
+Surprisingly, this didn't throw an error before Python 3.10
+---
+ src/sage/schemes/riemann_surfaces/riemann_surface.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/schemes/riemann_surfaces/riemann_surface.py b/src/sage/schemes/riemann_surfaces/riemann_surface.py
+index 3c3d387..f9d1e2b 100644
+--- a/src/sage/schemes/riemann_surfaces/riemann_surface.py
++++ b/src/sage/schemes/riemann_surfaces/riemann_surface.py
+@@ -1390,7 +1390,7 @@ class RiemannSurface(object):
+             sage: S = RiemannSurface(f)
+             sage: _ = S.homology_basis()
+             sage: g,d = S.make_zw_interpolator([(0,0),(1,0)]);
+-            sage: all(f(*g(i*0.1)).abs() < 1e-13for i in range(10))
++            sage: all(f(*g(i*0.1)).abs() < 1e-13 for i in range(10))
+             True
+             sage: abs((g(1)[0]-g(0)[0]) - d) < 1e-13
+             True
+-- 
+cgit v1.0-1-gd88e
+
+
+From 6603e290fff0e49a6394e40382c4ebdc8975049d Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 10:00:49 +0100
+Subject: Update some error messages to match Python 3.10 format
+
+---
+ src/sage/structure/unique_representation.py |  2 +-
+ src/sage/symbolic/callable.py               | 10 +++++-----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/sage/structure/unique_representation.py b/src/sage/structure/unique_representation.py
+index 9ead7a4..5d8d4ad 100644
+--- a/src/sage/structure/unique_representation.py
++++ b/src/sage/structure/unique_representation.py
+@@ -1221,7 +1221,7 @@ class UniqueRepresentation(CachedRepresentation, WithEqualityById):
+         sage: isinstance(GF(7), GF)
+         Traceback (most recent call last):
+         ...
+-        TypeError: isinstance() arg 2 must be a type or tuple of types
++        TypeError: isinstance() arg 2 must be a type...
+ 
+         sage: isinstance(GF, sage.structure.factory.UniqueFactory)
+         True
+diff --git a/src/sage/symbolic/callable.py b/src/sage/symbolic/callable.py
+index 5f3a7be..4b8efda 100644
+--- a/src/sage/symbolic/callable.py
++++ b/src/sage/symbolic/callable.py
+@@ -38,27 +38,27 @@ The arguments in the definition must be symbolic variables (:trac:`10747`)::
+     sage: f(1)=2
+     Traceback (most recent call last):
+     ...
+-    SyntaxError: can...t assign to function call
++    SyntaxError: can...t assign to function call...
+ 
+     sage: f(x,1)=2
+     Traceback (most recent call last):
+     ...
+-    SyntaxError: can...t assign to function call
++    SyntaxError: can...t assign to function call...
+ 
+     sage: f(1,2)=3
+     Traceback (most recent call last):
+     ...
+-    SyntaxError: can...t assign to function call
++    SyntaxError: can...t assign to function call...
+ 
+     sage: f(1,2)=x
+     Traceback (most recent call last):
+     ...
+-    SyntaxError: can...t assign to function call
++    SyntaxError: can...t assign to function call...
+ 
+     sage: f(x,2)=x
+     Traceback (most recent call last):
+     ...
+-    SyntaxError: can...t assign to function call
++    SyntaxError: can...t assign to function call...
+ """
+ 
+ import sage.rings.abc
+-- 
+cgit v1.0-1-gd88e
+
+
+From f345263b8c46d72d12fb1d2482fbfbbd6f23a570 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 10:01:18 +0100
+Subject: Make sure the timeout passed to select.select is a float
+
+Python 3.10 does a type check
+---
+ src/sage/tests/cmdline.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
+index 4f16b0e..ba5aa14 100644
+--- a/src/sage/tests/cmdline.py
++++ b/src/sage/tests/cmdline.py
+@@ -766,6 +766,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
+             rfd.append(fderr)
+         if len(rfd) == 0:
+             break
++        timeout = float(timeout)
+         rlist = select.select(rfd, [], [], timeout)[0]
+ 
+         if len(rlist) == 0:
+-- 
+cgit v1.0-1-gd88e
+
+
+From 2f13b8666aef7001b7464f7cf68d145a5752c067 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Sun, 12 Dec 2021 18:30:05 +0100
+Subject: Update another error message for Python 3.10
+
+---
+ src/sage/rings/asymptotic/growth_group.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py
+index ba7e684..a91ec31 100644
+--- a/src/sage/rings/asymptotic/growth_group.py
++++ b/src/sage/rings/asymptotic/growth_group.py
+@@ -5434,7 +5434,7 @@ class GrowthGroupFactory(UniqueFactory):
+             describing a growth group.
+             > *previous* ValueError: Cannot create a parent out of 'as'.
+             >> *previous* ValueError: unknown specification as
+-            >> *and* SyntaxError: unexpected EOF while parsing (<string>, line 1)
++            >> *and* SyntaxError: ... (<string>, line 1)
+             > *and* ValueError: Cannot create a parent out of 'df'.
+             >> *previous* ValueError: unknown specification df
+             >> *and* NameError: name 'df' is not defined
+-- 
+cgit v1.0-1-gd88e
+
+
+From e65ae6ca71fbe284affeb4ed88e63acc97a3fe0a Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Mon, 24 May 2021 17:06:47 -0700
+Subject: build/pkgs/python3/spkg-configure.m4: Accept system python 3.10.x
+
+---
+ build/pkgs/python3/spkg-configure.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4
+index df74019..3cbb994 100644
+--- a/build/pkgs/python3/spkg-configure.m4
++++ b/build/pkgs/python3/spkg-configure.m4
+@@ -1,7 +1,7 @@
+ SAGE_SPKG_CONFIGURE([python3], [
+    m4_pushdef([MIN_VERSION],               [3.7.0])
+    m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.7.0])
+-   m4_pushdef([LT_VERSION],                [3.10.0])
++   m4_pushdef([LT_VERSION],                [3.11.0])
+    AC_ARG_WITH([python],
+                [AS_HELP_STRING([--with-python=PYTHON3],
+                                [Python 3 executable to use for the Sage venv; default: python3])])
+-- 
+cgit v1.0-1-gd88e
+
+
+From 59173d01b4ed85077a847d2643c80bb3499c926a Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Wed, 15 Sep 2021 17:49:12 -0700
+Subject: pkgs/sage-setup/setup.cfg: Allow Python 3.10
+
+---
+ pkgs/sage-setup/setup.cfg | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pkgs/sage-setup/setup.cfg b/pkgs/sage-setup/setup.cfg
+index a1710d4..197fc67 100644
+--- a/pkgs/sage-setup/setup.cfg
++++ b/pkgs/sage-setup/setup.cfg
+@@ -31,7 +31,7 @@ packages =
+     sage_setup.autogen.interpreters.specs
+     sage_setup.command
+ 
+-python_requires = >=3.7, <3.10
++python_requires = >=3.7, <3.11
+ 
+ install_requires =
+     pkgconfig
+-- 
+cgit v1.0-1-gd88e
+
+
+From c902b7bc44c1b2116416962ec1194b8e59f11f06 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 09:15:25 -0800
+Subject: src/setup.cfg.m4: Allow Python 3.10
+
+---
+ src/setup.cfg.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4
+index 16f88f2..b8bd0c0 100644
+--- a/src/setup.cfg.m4
++++ b/src/setup.cfg.m4
+@@ -26,7 +26,7 @@ classifiers =
+     Topic :: Scientific/Engineering :: Mathematics
+ 
+ [options]
+-python_requires = >=3.7, <3.10
++python_requires = >=3.7, <3.11
+ install_requires =
+     sage_conf
+     esyscmd(`sage-get-system-packages install-requires \
+-- 
+cgit v1.0-1-gd88e
+
+
+From cb305525af1f872d00bb63387f7c68b88fb70a38 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 09:38:43 -0800
+Subject: build/pkgs/python3/spkg-configure.m4: Warn on system python 3.10.x
+
+---
+ build/pkgs/python3/spkg-configure.m4 | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/build/pkgs/python3/spkg-configure.m4 b/build/pkgs/python3/spkg-configure.m4
+index 3cbb994..5e3481a 100644
+--- a/build/pkgs/python3/spkg-configure.m4
++++ b/build/pkgs/python3/spkg-configure.m4
+@@ -1,6 +1,7 @@
+ SAGE_SPKG_CONFIGURE([python3], [
+    m4_pushdef([MIN_VERSION],               [3.7.0])
+    m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.7.0])
++   m4_pushdef([LT_STABLE_VERSION],         [3.10.0])
+    m4_pushdef([LT_VERSION],                [3.11.0])
+    AC_ARG_WITH([python],
+                [AS_HELP_STRING([--with-python=PYTHON3],
+@@ -116,6 +117,10 @@ and will be removed in the next development cycle.  Consider using a newer versi
+ that may be available on your system or can be installed using the system package manager.
+ To build Sage with a different system python, use ./configure --with-python=/path/to/python])
+         ])
++        AX_COMPARE_VERSION([$python3_version], [ge], LT_STABLE_VERSION, [
++            AC_MSG_WARN([Support for system python >= LT_STABLE_VERSION is experimental.
++To build Sage with a different system python, use ./configure --with-python=/path/to/python])
++        ])
+     ])
+     AC_SUBST([PYTHON_FOR_VENV])
+ 
+-- 
+cgit v1.0-1-gd88e
+
+
+From 249357dd30c54162e4b9204d6113c70b310a5087 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Sat, 18 Dec 2021 13:35:21 -0800
+Subject: sage.cpython.atexit: fix for python 3.10 (#30766)
+
+---
+ src/sage/cpython/atexit.pyx | 75 +++++++++++++++++++++++++++++----------------
+ 1 file changed, 48 insertions(+), 27 deletions(-)
+
+diff --git a/src/sage/cpython/atexit.pyx b/src/sage/cpython/atexit.pyx
+index 5b0c6d1..3ba391b 100644
+--- a/src/sage/cpython/atexit.pyx
++++ b/src/sage/cpython/atexit.pyx
+@@ -144,43 +144,63 @@ cdef class restore_atexit:
+ 
+ from cpython.ref cimport PyObject
+ 
+-# Internal structures defined in the CPython source in
+-# Modules/atexitmodule.c and subject to (but unlikely to) change.  Watch
+-# https://bugs.python.org/issue32082 for a request to (eventually)
+-# re-expose more of the atexit module's internals to Python
+-ctypedef struct atexit_callback:
+-    PyObject* func
+-    PyObject* args
+-    PyObject* kwargs
+-
+-
+-ctypedef struct atexitmodule_state:
+-    atexit_callback** atexit_callbacks
+-    int ncallbacks
+-    int callback_len
+-
+-
+-cdef extern from "Python.h":
+-    void* PyModule_GetState(object module)
+-
++# Implement "_atexit_callbacks()" for each supported python version
++cdef extern from *:
++    """
++    #if PY_VERSION_HEX >= 0x030a0000
++    /********** Python 3.10 **********/
++    #define Py_BUILD_CORE
++    #undef _PyGC_FINALIZED
++    #include "internal/pycore_interp.h"
++    #include "internal/pycore_pystate.h"
++    static atexit_callback ** _atexit_callbacks(PyObject *self) {
++        PyInterpreterState *interp = _PyInterpreterState_GET();
++        struct atexit_state state = interp->atexit;
++        return state.callbacks;
++    }
++    #else
++    /********** Python < 3.10 **********/
++    /* Internal structures defined in the CPython source in
++     * Modules/atexitmodule.c and subject to (but unlikely to) change.  Watch
++     * https://bugs.python.org/issue32082 for a request to (eventually)
++     * re-expose more of the atexit module's internals to Python
++     * typedef struct
++     */
++    typedef struct {
++        PyObject *func;
++        PyObject *args;
++        PyObject *kwargs;
++    } atexit_callback;
++    typedef struct {
++        atexit_callback **atexit_callbacks;
++        int ncallbacks;
++        int callback_len;
++    } atexitmodule_state;
++    static atexit_callback ** _atexit_callbacks(PyObject *self) {
++        atexitmodule_state *state = PyModule_GetState(self);
++        return state->atexit_callbacks;
++    }
++    #endif
++    """
++    ctypedef struct atexit_callback:
++        PyObject* func
++        PyObject* args
++        PyObject* kwargs
++    atexit_callback** _atexit_callbacks(object module)
+ 
+ def _get_exithandlers():
+     """Return list of exit handlers registered with the atexit module."""
+-    cdef atexitmodule_state* state
++    cdef atexit_callback ** callbacks
+     cdef atexit_callback callback
+     cdef list exithandlers
+     cdef int idx
+     cdef object kwargs
+ 
+-    state = <atexitmodule_state*>PyModule_GetState(atexit)
+-
+-    if not state:
+-        raise RuntimeError("atexit module state missing or corrupt")
+-
+     exithandlers = []
++    callbacks = _atexit_callbacks(atexit)
+ 
+-    for idx in range(state.ncallbacks):
+-        callback = state.atexit_callbacks[idx][0]
++    for idx in range(atexit._ncallbacks()):
++        callback = callbacks[idx][0]
+         if callback.kwargs:
+             kwargs = <object>callback.kwargs
+         else:
+@@ -207,4 +227,5 @@ def _set_exithandlers(exithandlers):
+ 
+ def _clear_exithandlers():
+     """Clear the atexit module of all registered exit handlers."""
++
+     atexit._clear()
+-- 
+cgit v1.0-1-gd88e
+
+
+From df9f1d4ced4264f65ab704f725f6f5879b012796 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Sun, 19 Dec 2021 22:36:44 -0300
+Subject: Pass float(0.5) to time.sleep
+
+Since python 3.10, passing RealNumber breaks.
+---
+ src/sage_docbuild/utils.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/sage_docbuild/utils.py b/src/sage_docbuild/utils.py
+index 956d703f..3e4793e 100644
+--- a/src/sage_docbuild/utils.py
++++ b/src/sage_docbuild/utils.py
+@@ -79,7 +79,7 @@ def build_many(target, args, processes=None):
+         ....:         # Task 4 is a poison pill
+         ....:         1 / 0
+         ....:     else:
+-        ....:         time.sleep(0.5)
++        ....:         time.sleep(float(0.5))
+         ....:         print('Processed task %s' % N)
+         ....:
+ 
+@@ -104,7 +104,7 @@ def build_many(target, args, processes=None):
+         ....:         # Task 4 is a poison pill
+         ....:         os.kill(os.getpid(), signal.SIGKILL)
+         ....:     else:
+-        ....:         time.sleep(0.5)
++        ....:         time.sleep(float(0.5))
+         ....:         print('Processed task %s' % N)
+         ....:
+         sage: build_many(target, range(8), processes=8)
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-32968-update_sphinx_to_4.3.1-fc84f82f52b6f05f512cb359ec7c100f93cf8841.patch b/srcpkgs/sagemath/patches/trac-32968-update_sphinx_to_4.3.1-fc84f82f52b6f05f512cb359ec7c100f93cf8841.patch
new file mode 100644
index 000000000000..8bce2b2a63e1
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-32968-update_sphinx_to_4.3.1-fc84f82f52b6f05f512cb359ec7c100f93cf8841.patch
@@ -0,0 +1,128 @@
+From e2adfb1efbc76a439ddc7c028288e3f011244878 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= <frp.bissey@gmail.com>
+Date: Mon, 13 Dec 2021 11:18:44 +1300
+Subject: Update sphinx to 4.3.1
+
+---
+ build/pkgs/sphinx/checksums.ini        | 6 +++---
+ build/pkgs/sphinx/install-requires.txt | 2 +-
+ build/pkgs/sphinx/package-version.txt  | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/build/pkgs/sphinx/checksums.ini b/build/pkgs/sphinx/checksums.ini
+index f7ba552..02fcbde 100644
+--- a/build/pkgs/sphinx/checksums.ini
++++ b/build/pkgs/sphinx/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=Sphinx-VERSION.tar.gz
+-sha1=b7d3ad1e91059d62044a3296112fa6662a38f089
+-md5=6af34550e36dd6d58a496e47ec67280f
+-cksum=1867791932
++sha1=f1c33352c018a5a3df39d5f01c3e38c8c063d6c9
++md5=08f6589fa8ab57fd36f0f80d1079b233
++cksum=2796062391
+ upstream_url=https://pypi.io/packages/source/s/sphinx/Sphinx-VERSION.tar.gz
+diff --git a/build/pkgs/sphinx/install-requires.txt b/build/pkgs/sphinx/install-requires.txt
+index 0c661b6..0a751b2 100644
+--- a/build/pkgs/sphinx/install-requires.txt
++++ b/build/pkgs/sphinx/install-requires.txt
+@@ -1 +1 @@
+-sphinx >=4, <4.3
++sphinx >=4.3, <4.4
+diff --git a/build/pkgs/sphinx/package-version.txt b/build/pkgs/sphinx/package-version.txt
+index 6aba2b2..f77856a 100644
+--- a/build/pkgs/sphinx/package-version.txt
++++ b/build/pkgs/sphinx/package-version.txt
+@@ -1 +1 @@
+-4.2.0
++4.3.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From efb00a873b766b6e2be4be9818f2e9bedb6a9238 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= <frp.bissey@gmail.com>
+Date: Mon, 13 Dec 2021 11:19:13 +1300
+Subject: update sphinx dependency list and special installation instructions
+
+---
+ build/pkgs/sphinx/SPKG.rst | 12 +-----------
+ 1 file changed, 1 insertion(+), 11 deletions(-)
+
+diff --git a/build/pkgs/sphinx/SPKG.rst b/build/pkgs/sphinx/SPKG.rst
+index 62a8ff0..2a34c9d 100644
+--- a/build/pkgs/sphinx/SPKG.rst
++++ b/build/pkgs/sphinx/SPKG.rst
+@@ -27,21 +27,11 @@ Upstream Contact
+ Dependencies
+ ------------
+ 
+--  six >= 1.4
+ -  Jinja2 >= 2.3
+ -  Pygments >= 2.0
+--  docutils >= 0.11
++-  docutils < 0.18
+ -  snowballstemmer >= 1.1
+ -  babel >= 1.3
+ -  setuptools / distribute
+ -  Python
+ -  GNU patch (shipped with Sage)
+-
+-
+-Special Update/Build Instructions
+----------------------------------
+-
+--  The script create_grammar_pickle.py creates the file
+-   Grammar2.7.pickle in site-packages/Sphinx-.../sphinx/pycode/. This
+-   helps to avoid race conditions when building the documentation in
+-   parallel.
+-- 
+cgit v1.0-1-gd88e
+
+
+From 25cba02d3e5094b78ffbc66c38687e25caca2681 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= <frp.bissey@gmail.com>
+Date: Mon, 13 Dec 2021 11:20:17 +1300
+Subject: add gentoo distros file
+
+---
+ build/pkgs/sphinx/distros/gentoo.txt | 1 +
+ 1 file changed, 1 insertion(+)
+ create mode 100644 build/pkgs/sphinx/distros/gentoo.txt
+
+diff --git a/build/pkgs/sphinx/distros/gentoo.txt b/build/pkgs/sphinx/distros/gentoo.txt
+new file mode 100644
+index 00000000..059e3ae
+--- /dev/null
++++ b/build/pkgs/sphinx/distros/gentoo.txt
+@@ -0,0 +1 @@
++dev-python/sphinx
+-- 
+cgit v1.0-1-gd88e
+
+
+From fc84f82f52b6f05f512cb359ec7c100f93cf8841 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fran=C3=A7ois=20Bissey?= <frp.bissey@gmail.com>
+Date: Mon, 13 Dec 2021 11:23:48 +1300
+Subject: Add required new option for sphinx 4.3+ as per Tobias Hansen's
+ original patch
+
+---
+ src/sage/docs/conf.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py
+index f2efb65..0caac35 100644
+--- a/src/sage/docs/conf.py
++++ b/src/sage/docs/conf.py
+@@ -911,6 +911,7 @@ def setup(app):
+     if app.srcdir.startswith(SAGE_DOC_SRC):
+         app.add_config_value('intersphinx_mapping', {}, False)
+         app.add_config_value('intersphinx_cache_limit', 5, False)
++        app.add_config_value('intersphinx_disabled_reftypes', [], False)
+         app.connect('config-inited', set_intersphinx_mappings)
+         app.connect('builder-inited', intersphinx.load_mappings)
+         # We do *not* fully initialize intersphinx since we call it by hand
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33020-update_ipykernel_to_6.6.0-715277cfadd7b3872ad6f7001fe84fb7568c947c.patch b/srcpkgs/sagemath/patches/trac-33020-update_ipykernel_to_6.6.0-715277cfadd7b3872ad6f7001fe84fb7568c947c.patch
new file mode 100644
index 000000000000..9cb11b381ea2
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33020-update_ipykernel_to_6.6.0-715277cfadd7b3872ad6f7001fe84fb7568c947c.patch
@@ -0,0 +1,84 @@
+From 715277cfadd7b3872ad6f7001fe84fb7568c947c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Mon, 13 Dec 2021 18:04:04 -0300
+Subject: update ipykernel and make debugpy optional
+
+ - update ipykernel to 6.6.0, for which debugpy is optional
+ - patch out debugpy from pyproject.toml and setup.py
+ - make debugpy optional for sagemath
+---
+ build/pkgs/debugpy/type                             |  2 +-
+ build/pkgs/ipykernel/checksums.ini                  |  6 +++---
+ build/pkgs/ipykernel/dependencies                   |  2 +-
+ build/pkgs/ipykernel/package-version.txt            |  2 +-
+ .../ipykernel/patches/debugpy-make-optional.patch   | 21 +++++++++++++++++++++
+ 5 files changed, 27 insertions(+), 6 deletions(-)
+ create mode 100644 build/pkgs/ipykernel/patches/debugpy-make-optional.patch
+
+diff --git a/build/pkgs/debugpy/type b/build/pkgs/debugpy/type
+index a6a7b9c..134d9bc 100644
+--- a/build/pkgs/debugpy/type
++++ b/build/pkgs/debugpy/type
+@@ -1 +1 @@
+-standard
++optional
+diff --git a/build/pkgs/ipykernel/checksums.ini b/build/pkgs/ipykernel/checksums.ini
+index ca1302e..724eec8 100644
+--- a/build/pkgs/ipykernel/checksums.ini
++++ b/build/pkgs/ipykernel/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=ipykernel-VERSION.tar.gz
+-sha1=2c2aa0e929bfd0e694da6b45d2de846a0a5d2812
+-md5=78797cb2389d8f131c75280f808aac15
+-cksum=1454395629
++sha1=5a5cf7f8c0c02d0c0cc5fe3e0fe7481a86de6552
++md5=f940975eb00de793695c386ad3a8800c
++cksum=597841676
+ upstream_url=https://pypi.io/packages/source/i/ipykernel/ipykernel-VERSION.tar.gz
+diff --git a/build/pkgs/ipykernel/dependencies b/build/pkgs/ipykernel/dependencies
+index eec7126..5b3708a 100644
+--- a/build/pkgs/ipykernel/dependencies
++++ b/build/pkgs/ipykernel/dependencies
+@@ -1,4 +1,4 @@
+-$(PYTHON) ipython_genutils importlib_metadata argcomplete debugpy matplotlib_inline ipython jupyter_client tornado appnope traitlets | $(PYTHON_TOOLCHAIN)
++$(PYTHON) ipython_genutils importlib_metadata argcomplete matplotlib_inline ipython jupyter_client tornado appnope traitlets | $(PYTHON_TOOLCHAIN)
+ 
+ ----------
+ All lines of this file are ignored except the first.
+diff --git a/build/pkgs/ipykernel/package-version.txt b/build/pkgs/ipykernel/package-version.txt
+index a194c18..826f5ce 100644
+--- a/build/pkgs/ipykernel/package-version.txt
++++ b/build/pkgs/ipykernel/package-version.txt
+@@ -1 +1 @@
+-6.5.1
++6.6.0
+diff --git a/build/pkgs/ipykernel/patches/debugpy-make-optional.patch b/build/pkgs/ipykernel/patches/debugpy-make-optional.patch
+new file mode 100644
+index 00000000..308e4dd
+--- /dev/null
++++ b/build/pkgs/ipykernel/patches/debugpy-make-optional.patch
+@@ -0,0 +1,21 @@
++--- a/pyproject.toml	2021-12-01 10:23:30.000000000 -0300
+++++ b/pyproject.toml	2021-12-13 18:01:36.239921204 -0300
++@@ -3,7 +3,6 @@
++ requires=[
++   "setuptools",
++   "wheel",
++-  "debugpy",
++   "ipython>=5",
++   "jupyter_core>=4.2",
++   "jupyter_client",
++diff -ruN a/setup.py b/setup.py
++--- a/setup.py	2021-12-01 10:23:09.000000000 -0300
+++++ b/setup.py	2021-12-13 18:01:40.112873823 -0300
++@@ -63,7 +63,6 @@
++     install_requires=[
++         'importlib-metadata<5;python_version<"3.8.0"',
++         'argcomplete>=1.12.3;python_version<"3.8.0"',
++-        'debugpy>=1.0.0,<2.0',
++         'ipython>=7.23.1',
++         'traitlets>=5.1.0,<6.0',
++         'jupyter_client<8.0',
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33040-update_matplotlib_to_3.5-d865a54526829b79d5d236a40f83ddc6ce7b2696.patch b/srcpkgs/sagemath/patches/trac-33040-update_matplotlib_to_3.5-d865a54526829b79d5d236a40f83ddc6ce7b2696.patch
new file mode 100644
index 000000000000..3ae6fe01822d
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33040-update_matplotlib_to_3.5-d865a54526829b79d5d236a40f83ddc6ce7b2696.patch
@@ -0,0 +1,1196 @@
+From 6cd3723646a516b27864fbb6669d2a9a25fd11e0 Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Tue, 30 Mar 2021 20:05:47 +0200
+Subject: Update matplotlib to 3.4.0
+
+---
+ build/pkgs/matplotlib/checksums.ini       | 6 +++---
+ build/pkgs/matplotlib/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/matplotlib/checksums.ini b/build/pkgs/matplotlib/checksums.ini
+index 75fbea5..96f2344 100644
+--- a/build/pkgs/matplotlib/checksums.ini
++++ b/build/pkgs/matplotlib/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=matplotlib-VERSION.tar.gz
+-sha1=a26c32c19f39d88ad6ae67e774b677c075a36eac
+-md5=0b48f34ec623e765a1bda15924ce0b56
+-cksum=3626490879
++sha1=e29cc841d52b3df2c080b05b4019a9fe7d092c13
++md5=556395cc4ef4306025ce5138b9b68dd3
++cksum=3473305609
+ upstream_url=https://pypi.io/packages/source/m/matplotlib/matplotlib-VERSION.tar.gz
+diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt
+index a0891f5..1809198 100644
+--- a/build/pkgs/matplotlib/package-version.txt
++++ b/build/pkgs/matplotlib/package-version.txt
+@@ -1 +1 @@
+-3.3.4
++3.4.0
+-- 
+cgit v1.0-1-gd88e
+
+
+From 4d742f220a3b0479afab1675d4bea5a39b944f7a Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Wed, 12 May 2021 08:23:25 +0200
+Subject: Update matplotlib to 3.4.2
+
+---
+ build/pkgs/matplotlib/checksums.ini       | 6 +++---
+ build/pkgs/matplotlib/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/matplotlib/checksums.ini b/build/pkgs/matplotlib/checksums.ini
+index 96f2344..9a32546 100644
+--- a/build/pkgs/matplotlib/checksums.ini
++++ b/build/pkgs/matplotlib/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=matplotlib-VERSION.tar.gz
+-sha1=e29cc841d52b3df2c080b05b4019a9fe7d092c13
+-md5=556395cc4ef4306025ce5138b9b68dd3
+-cksum=3473305609
++sha1=1a8a2b31fe5eaf70ea6d687dc05be3bd5cc595e5
++md5=e34749a5f0661b8af74a1dc327fb74f6
++cksum=1488332141
+ upstream_url=https://pypi.io/packages/source/m/matplotlib/matplotlib-VERSION.tar.gz
+diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt
+index 1809198..4d9d11c 100644
+--- a/build/pkgs/matplotlib/package-version.txt
++++ b/build/pkgs/matplotlib/package-version.txt
+@@ -1 +1 @@
+-3.4.0
++3.4.2
+-- 
+cgit v1.0-1-gd88e
+
+
+From e406102e240c8931f24caf5f354266f76f4a91d6 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Sat, 17 Jul 2021 11:34:20 +0100
+Subject: qhull is a dependency
+
+---
+ build/pkgs/matplotlib/dependencies | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies
+index 542dab4..e32a563 100644
+--- a/build/pkgs/matplotlib/dependencies
++++ b/build/pkgs/matplotlib/dependencies
+@@ -1,4 +1,4 @@
+-$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi
++$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi
+ 
+ ----------
+ All lines of this file are ignored except the first.
+-- 
+cgit v1.0-1-gd88e
+
+
+From 51ba6f3cd21f83b1f70faaf17a97490ab12d97a9 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Sat, 17 Jul 2021 11:49:33 +0100
+Subject: qhull standard, as a dep of matplotlib
+
+matplotlib has qhull as a dependency now
+---
+ build/pkgs/qhull/type | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/qhull/type b/build/pkgs/qhull/type
+index 134d9bc..a6a7b9c 100644
+--- a/build/pkgs/qhull/type
++++ b/build/pkgs/qhull/type
+@@ -1 +1 @@
+-optional
++standard
+-- 
+cgit v1.0-1-gd88e
+
+
+From 86698214e0d42b3a7a1b935da6f7723122503785 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Mon, 19 Jul 2021 12:42:13 +0100
+Subject: do not vendor ghull, unconditionally
+
+---
+ build/pkgs/matplotlib/make-setup-config.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/build/pkgs/matplotlib/make-setup-config.py b/build/pkgs/matplotlib/make-setup-config.py
+index b4d5d05..2a53eab 100644
+--- a/build/pkgs/matplotlib/make-setup-config.py
++++ b/build/pkgs/matplotlib/make-setup-config.py
+@@ -9,8 +9,7 @@ config.set('directories', 'basedirlist', os.environ['SAGE_LOCAL'])
+ 
+ config.add_section('libs')
+ config.set('libs', 'system_freetype', 'True')
+-if pkgconfig.installed('qhull', '>= 7.2.0'):
+-    config.set('libs', 'system_qhull', 'True')
++config.set('libs', 'system_qhull', 'True')
+ # lto is problematic if we mix libraries from the OS with our own libraries,
+ # which are not necessarily compiled with the same gcc version
+ # https://trac.sagemath.org/ticket/27754
+-- 
+cgit v1.0-1-gd88e
+
+
+From f999e9b913e4e6a69398318b0651a82ceb9e0e06 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Wed, 28 Jul 2021 11:31:30 +0100
+Subject: upstream patch to recitfy docbuild problem
+
+see https://github.com/matplotlib/matplotlib/pull/20748
+and trac #32262
+---
+ build/pkgs/matplotlib/package-version.txt                 |  2 +-
+ build/pkgs/matplotlib/patches/create_staticifneeded.patch | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+ create mode 100644 build/pkgs/matplotlib/patches/create_staticifneeded.patch
+
+diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt
+index 4d9d11c..09d7341 100644
+--- a/build/pkgs/matplotlib/package-version.txt
++++ b/build/pkgs/matplotlib/package-version.txt
+@@ -1 +1 @@
+-3.4.2
++3.4.2.p1
+diff --git a/build/pkgs/matplotlib/patches/create_staticifneeded.patch b/build/pkgs/matplotlib/patches/create_staticifneeded.patch
+new file mode 100644
+index 00000000..7e6ed2f
+--- /dev/null
++++ b/build/pkgs/matplotlib/patches/create_staticifneeded.patch
+@@ -0,0 +1,10 @@
++diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py
++index d59d9bdd71bf..d40e0c58b4a5 100644
++--- a/lib/matplotlib/sphinxext/plot_directive.py
+++++ b/lib/matplotlib/sphinxext/plot_directive.py
++@@ -266,6 +266,7 @@ def _copy_css_file(app, exc):
++     if exc is None and app.builder.format == 'html':
++         src = cbook._get_data_path('plot_directive/plot_directive.css')
++         dst = app.outdir / Path('_static')
+++        dst.mkdir(exist_ok=True)
++         shutil.copy(src, dst)
+-- 
+cgit v1.0-1-gd88e
+
+
+From af761fa8ac78452b92fa9ff0a1dbaf9bfe787ac7 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Wed, 8 Sep 2021 13:33:51 +0100
+Subject: update to 3.4.3
+
+---
+ build/pkgs/matplotlib/checksums.ini       | 6 +++---
+ build/pkgs/matplotlib/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/matplotlib/checksums.ini b/build/pkgs/matplotlib/checksums.ini
+index 9a32546..2783080 100644
+--- a/build/pkgs/matplotlib/checksums.ini
++++ b/build/pkgs/matplotlib/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=matplotlib-VERSION.tar.gz
+-sha1=1a8a2b31fe5eaf70ea6d687dc05be3bd5cc595e5
+-md5=e34749a5f0661b8af74a1dc327fb74f6
+-cksum=1488332141
++sha1=764fb3c673f45bedb472bc81c63b9c36f7973c46
++md5=6858958370a26cccfa81abc7b6dd3622
++cksum=2317464343
+ upstream_url=https://pypi.io/packages/source/m/matplotlib/matplotlib-VERSION.tar.gz
+diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt
+index 09d7341..6cb9d3d 100644
+--- a/build/pkgs/matplotlib/package-version.txt
++++ b/build/pkgs/matplotlib/package-version.txt
+@@ -1 +1 @@
+-3.4.2.p1
++3.4.3
+-- 
+cgit v1.0-1-gd88e
+
+
+From 24b7a9a9c19bcfc32e1975012b2fad55736dc0ec Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Wed, 8 Sep 2021 14:04:48 +0100
+Subject: Revert "upstream patch to recitfy docbuild problem"
+
+This reverts commit 13912acb0e04c6548e6914f8bd40f42fc2d5863c.
+---
+ build/pkgs/matplotlib/patches/create_staticifneeded.patch | 10 ----------
+ 1 file changed, 10 deletions(-)
+ delete mode 100644 build/pkgs/matplotlib/patches/create_staticifneeded.patch
+
+diff --git a/build/pkgs/matplotlib/patches/create_staticifneeded.patch b/build/pkgs/matplotlib/patches/create_staticifneeded.patch
+deleted file mode 100644
+index 7e6ed2f..00000000
+--- a/build/pkgs/matplotlib/patches/create_staticifneeded.patch
++++ /dev/null
+@@ -1,10 +0,0 @@
+-diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py
+-index d59d9bdd71bf..d40e0c58b4a5 100644
+---- a/lib/matplotlib/sphinxext/plot_directive.py
+-+++ b/lib/matplotlib/sphinxext/plot_directive.py
+-@@ -266,6 +266,7 @@ def _copy_css_file(app, exc):
+-     if exc is None and app.builder.format == 'html':
+-         src = cbook._get_data_path('plot_directive/plot_directive.css')
+-         dst = app.outdir / Path('_static')
+-+        dst.mkdir(exist_ok=True)
+-         shutil.copy(src, dst)
+-- 
+cgit v1.0-1-gd88e
+
+
+From 42435f4aee9cd901dba119255a02247055b7dc80 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Sun, 19 Sep 2021 15:51:34 +0100
+Subject: add gfortran to _prereq/distros/*
+
+---
+ build/pkgs/_prereq/distros/arch.txt      | 1 +
+ build/pkgs/_prereq/distros/conda.txt     | 1 +
+ build/pkgs/_prereq/distros/cygwin.txt    | 1 +
+ build/pkgs/_prereq/distros/debian.txt    | 1 +
+ build/pkgs/_prereq/distros/fedora.txt    | 1 +
+ build/pkgs/_prereq/distros/freebsd.txt   | 1 +
+ build/pkgs/_prereq/distros/homebrew.txt  | 3 +--
+ build/pkgs/_prereq/distros/macports.txt  | 1 +
+ build/pkgs/_prereq/distros/opensuse.txt  | 1 +
+ build/pkgs/_prereq/distros/slackware.txt | 1 +
+ build/pkgs/_prereq/distros/void.txt      | 1 +
+ 11 files changed, 11 insertions(+), 2 deletions(-)
+ create mode 100644 build/pkgs/_prereq/distros/macports.txt
+
+diff --git a/build/pkgs/_prereq/distros/arch.txt b/build/pkgs/_prereq/distros/arch.txt
+index 9b9bf09..f43cab4 100644
+--- a/build/pkgs/_prereq/distros/arch.txt
++++ b/build/pkgs/_prereq/distros/arch.txt
+@@ -6,5 +6,6 @@ python # system python for bootstrapping the build
+ tar
+ bc
+ gcc
++gcc-fortran
+ # Needed for 4ti2:
+ which
+diff --git a/build/pkgs/_prereq/distros/conda.txt b/build/pkgs/_prereq/distros/conda.txt
+index a02a39e..0e66d82 100644
+--- a/build/pkgs/_prereq/distros/conda.txt
++++ b/build/pkgs/_prereq/distros/conda.txt
+@@ -1,4 +1,5 @@
+ compilers
++fortran-compiler
+ make
+ m4
+ perl
+diff --git a/build/pkgs/_prereq/distros/cygwin.txt b/build/pkgs/_prereq/distros/cygwin.txt
+index 635afe8..fc0304d 100644
+--- a/build/pkgs/_prereq/distros/cygwin.txt
++++ b/build/pkgs/_prereq/distros/cygwin.txt
+@@ -19,6 +19,7 @@ perl-ExtUtils-MakeMaker
+ tar
+ gcc-core
+ gcc-g++
++gcc-fortran
+ # Needed according to embray at https://trac.sagemath.org/ticket/26964:
+ # The need for which comes [...] from MPIR's configure script
+ findutils
+diff --git a/build/pkgs/_prereq/distros/debian.txt b/build/pkgs/_prereq/distros/debian.txt
+index 50be6ac..c348ee3 100644
+--- a/build/pkgs/_prereq/distros/debian.txt
++++ b/build/pkgs/_prereq/distros/debian.txt
+@@ -26,5 +26,6 @@ gcc
+ # configure: error: in `/sage':
+ # configure: error: C++ preprocessor "/lib/cpp" fails sanity check
+ g++
++gfortran
+ # Needed if we download some packages from a https upstream URL
+ ca-certificates
+diff --git a/build/pkgs/_prereq/distros/fedora.txt b/build/pkgs/_prereq/distros/fedora.txt
+index a82e29a..d5a5ae7 100644
+--- a/build/pkgs/_prereq/distros/fedora.txt
++++ b/build/pkgs/_prereq/distros/fedora.txt
+@@ -26,6 +26,7 @@ gcc
+ # configure: error: in `/sage':
+ # configure: error: C++ preprocessor "/lib/cpp" fails sanity check
+ gcc-c++
++gcc-gfortran
+ # Needed according to embray at https://trac.sagemath.org/ticket/26964:
+ # The need for which comes [...] from MPIR's configure script
+ findutils
+diff --git a/build/pkgs/_prereq/distros/freebsd.txt b/build/pkgs/_prereq/distros/freebsd.txt
+index cc708cc..ec26136 100644
+--- a/build/pkgs/_prereq/distros/freebsd.txt
++++ b/build/pkgs/_prereq/distros/freebsd.txt
+@@ -17,3 +17,4 @@ automake
+ bash
+ dash
+ python # python metaport for bootstrapping the build
++lang/gcc9 # gfortran
+diff --git a/build/pkgs/_prereq/distros/homebrew.txt b/build/pkgs/_prereq/distros/homebrew.txt
+index 863c22a..f537c17 100644
+--- a/build/pkgs/_prereq/distros/homebrew.txt
++++ b/build/pkgs/_prereq/distros/homebrew.txt
+@@ -8,5 +8,4 @@
+ # for use in "sage -info SPKG".
+ #
+ # Everything on a line after a # character is ignored.
+-
+-# No packages needed
++gcc
+diff --git a/build/pkgs/_prereq/distros/macports.txt b/build/pkgs/_prereq/distros/macports.txt
+new file mode 100644
+index 00000000..c2878ad
+--- /dev/null
++++ b/build/pkgs/_prereq/distros/macports.txt
+@@ -0,0 +1 @@
++gcc10 +gfortran
+diff --git a/build/pkgs/_prereq/distros/opensuse.txt b/build/pkgs/_prereq/distros/opensuse.txt
+index 070f456..959ab26 100644
+--- a/build/pkgs/_prereq/distros/opensuse.txt
++++ b/build/pkgs/_prereq/distros/opensuse.txt
+@@ -19,6 +19,7 @@ which
+ glibc-locale-base
+ gcc
+ gcc-c++
++gcc-fortran
+ # Needed if we download some packages from a https upstream URL
+ ca-certificates
+ # gunzip needed for ppl spkg
+diff --git a/build/pkgs/_prereq/distros/slackware.txt b/build/pkgs/_prereq/distros/slackware.txt
+index a976efe..11ec3b9 100644
+--- a/build/pkgs/_prereq/distros/slackware.txt
++++ b/build/pkgs/_prereq/distros/slackware.txt
+@@ -3,6 +3,7 @@ make
+ guile gc libffi  # dependencies of make
+ "gcc-[0-9]"      # So that slackpkg pattern matching does not pull in all gcc-* packages
+ gcc-g++
++gcc-gfortran
+ libmpc glibc kernel-headers # dependencies of gcc
+ perl
+ m4
+diff --git a/build/pkgs/_prereq/distros/void.txt b/build/pkgs/_prereq/distros/void.txt
+index a2e7644..2769f4d 100644
+--- a/build/pkgs/_prereq/distros/void.txt
++++ b/build/pkgs/_prereq/distros/void.txt
+@@ -7,4 +7,5 @@ python3
+ tar
+ bc
+ gcc
++gcc-fortran
+ which
+-- 
+cgit v1.0-1-gd88e
+
+
+From 8af511c414982483de66a93d84865475b262efc1 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 15:47:08 +0000
+Subject: rebase, update deps
+
+---
+ build/pkgs/cycler/checksums.ini           | 1 +
+ build/pkgs/cycler/package-version.txt     | 2 +-
+ build/pkgs/kiwisolver/checksums.ini       | 7 ++++---
+ build/pkgs/kiwisolver/package-version.txt | 2 +-
+ build/pkgs/pytz/SPKG.rst                  | 1 +
+ build/pkgs/pytz/package-version.txt       | 2 +-
+ 6 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/build/pkgs/cycler/checksums.ini b/build/pkgs/cycler/checksums.ini
+index 6c1ffe0..f6d988d 100644
+--- a/build/pkgs/cycler/checksums.ini
++++ b/build/pkgs/cycler/checksums.ini
+@@ -2,3 +2,4 @@ tarball=cycler-VERSION.tar.gz
+ sha1=1bcf4a985a5f414333603f3f70a7deebbaf30439
+ md5=4cb42917ac5007d1cdff6cccfe2d016b
+ cksum=4189438538
++upstream_url=https://github.com/matplotlib/cycler/archive/refs/tags/vVERSION.tar.gz
+diff --git a/build/pkgs/cycler/package-version.txt b/build/pkgs/cycler/package-version.txt
+index db2d863..d9df1bb 100644
+--- a/build/pkgs/cycler/package-version.txt
++++ b/build/pkgs/cycler/package-version.txt
+@@ -1 +1 @@
+-0.10.0.p0
++0.11.0
+diff --git a/build/pkgs/kiwisolver/checksums.ini b/build/pkgs/kiwisolver/checksums.ini
+index 1ca0ba3..fc15fad 100644
+--- a/build/pkgs/kiwisolver/checksums.ini
++++ b/build/pkgs/kiwisolver/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=kiwisolver-VERSION.tar.gz
+-sha1=093c2348a53fe18d42983ddbd823911b21781928
+-md5=e2a1718b837e2cd001f7c06934616fcd
+-cksum=4236707026
++sha1=61811685031328a8a2a77f45593d8238432ce35e
++md5=98d746f558685c6b6658cefc39be14df
++cksum=1915059157
++upstream_url=https://files.pythonhosted.org/packages/source/k/kiwisolver/kiwisolver-VERSION.tar.gz
+diff --git a/build/pkgs/kiwisolver/package-version.txt b/build/pkgs/kiwisolver/package-version.txt
+index 7dea76e..1892b92 100644
+--- a/build/pkgs/kiwisolver/package-version.txt
++++ b/build/pkgs/kiwisolver/package-version.txt
+@@ -1 +1 @@
+-1.0.1
++1.3.2
+diff --git a/build/pkgs/pytz/SPKG.rst b/build/pkgs/pytz/SPKG.rst
+index 75827d0..199f8df 100644
+--- a/build/pkgs/pytz/SPKG.rst
++++ b/build/pkgs/pytz/SPKG.rst
+@@ -5,6 +5,7 @@ Description
+ -----------
+ 
+ World Timezone Definitions for Python
++See https://pypi.org/project/pytz/
+ 
+ 
+ Special Update/Build Instructions
+diff --git a/build/pkgs/pytz/package-version.txt b/build/pkgs/pytz/package-version.txt
+index d673154..c9c8e05 100644
+--- a/build/pkgs/pytz/package-version.txt
++++ b/build/pkgs/pytz/package-version.txt
+@@ -1 +1 @@
+-2021.1
++2021.3
+-- 
+cgit v1.0-1-gd88e
+
+
+From 5c972e4f1e27382191f268880c5222dc9d687d11 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 15:52:31 +0000
+Subject: correct checksum
+
+---
+ build/pkgs/pytz/checksums.ini | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/build/pkgs/pytz/checksums.ini b/build/pkgs/pytz/checksums.ini
+index ede348f..0faabac 100644
+--- a/build/pkgs/pytz/checksums.ini
++++ b/build/pkgs/pytz/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=pytz-VERSION.tar.gz
+-sha1=738cff9addf39084e5655558482f865dca2c66dd
+-md5=8c849bdf95414fe708a84473e42d4406
+-cksum=1633513953
++sha1=fa6729d40cfa607daee0f40cdab165976ab0e0a3
++md5=d7b7060bbac4970afa2050c139c9fcb6
++cksum=3161093227
+ upstream_url=https://pypi.io/packages/source/p/pytz/pytz-VERSION.tar.gz
+-- 
+cgit v1.0-1-gd88e
+
+
+From 00b677bcc532b75faec7ee8980e25d8ddeb395ae Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 16:52:32 +0000
+Subject: new dep of kiwisolver, cppy
+
+---
+ build/pkgs/cppy/checksums.ini       | 5 +++++
+ build/pkgs/cppy/package-version.txt | 1 +
+ build/pkgs/cppy/spkg-install.in     | 1 +
+ build/pkgs/cppy/type                | 1 +
+ 4 files changed, 8 insertions(+)
+ create mode 100644 build/pkgs/cppy/checksums.ini
+ create mode 100644 build/pkgs/cppy/package-version.txt
+ create mode 100644 build/pkgs/cppy/spkg-install.in
+ create mode 100644 build/pkgs/cppy/type
+
+diff --git a/build/pkgs/cppy/checksums.ini b/build/pkgs/cppy/checksums.ini
+new file mode 100644
+index 00000000..85eb695
+--- /dev/null
++++ b/build/pkgs/cppy/checksums.ini
+@@ -0,0 +1,5 @@
++tarball=cppy-VERSION.tar.gz
++sha1=61811685031328a8a2a77f45593d8238432ce35e
++md5=98d746f558685c6b6658cefc39be14df
++cksum=1915059157
++upstream_url=https://files.pythonhosted.org/packages/source/c/cppy/cppy-VERSION.tar.gz
+diff --git a/build/pkgs/cppy/package-version.txt b/build/pkgs/cppy/package-version.txt
+new file mode 100644
+index 00000000..9084fa2
+--- /dev/null
++++ b/build/pkgs/cppy/package-version.txt
+@@ -0,0 +1 @@
++1.1.0
+diff --git a/build/pkgs/cppy/spkg-install.in b/build/pkgs/cppy/spkg-install.in
+new file mode 100644
+index 00000000..deba1bb
+--- /dev/null
++++ b/build/pkgs/cppy/spkg-install.in
+@@ -0,0 +1 @@
++cd src && sdh_pip_install .
+diff --git a/build/pkgs/cppy/type b/build/pkgs/cppy/type
+new file mode 100644
+index 00000000..a6a7b9c
+--- /dev/null
++++ b/build/pkgs/cppy/type
+@@ -0,0 +1 @@
++standard
+-- 
+cgit v1.0-1-gd88e
+
+
+From 48b7ec3849754abb1a526887a85f6fdd4e6a4d30 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 16:56:36 +0000
+Subject: update matplotlib deps
+
+---
+ build/pkgs/certifi/checksums.ini         | 6 +++---
+ build/pkgs/certifi/package-version.txt   | 2 +-
+ build/pkgs/cppy/checksums.ini            | 6 +++---
+ build/pkgs/cppy/dependencies             | 5 +++++
+ build/pkgs/cycler/checksums.ini          | 6 +++---
+ build/pkgs/dateutil/checksums.ini        | 7 ++++---
+ build/pkgs/dateutil/package-version.txt  | 2 +-
+ build/pkgs/kiwisolver/dependencies       | 2 +-
+ build/pkgs/pillow/checksums.ini          | 6 +++---
+ build/pkgs/pillow/package-version.txt    | 2 +-
+ build/pkgs/pyparsing/checksums.ini       | 7 ++++---
+ build/pkgs/pyparsing/package-version.txt | 2 +-
+ 12 files changed, 30 insertions(+), 23 deletions(-)
+ create mode 100644 build/pkgs/cppy/dependencies
+
+diff --git a/build/pkgs/certifi/checksums.ini b/build/pkgs/certifi/checksums.ini
+index bc548e0..87d8378 100644
+--- a/build/pkgs/certifi/checksums.ini
++++ b/build/pkgs/certifi/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=certifi-VERSION.tar.gz
+-sha1=93145f31550b5e11dc323085d75a227856b93fd4
+-md5=4b38238b7305fcb3ffbc4368be4e8845
+-cksum=3424910066
++sha1=b13e22d55867e2ca5f92e5289cfdc21ba6e343aa
++md5=880ed9e5d04aff8f46f5ff82a3a3e395
++cksum=613361382
+ upstream_url=https://pypi.io/packages/source/c/certifi/certifi-VERSION.tar.gz
+diff --git a/build/pkgs/certifi/package-version.txt b/build/pkgs/certifi/package-version.txt
+index 6b59105..6b1fb39 100644
+--- a/build/pkgs/certifi/package-version.txt
++++ b/build/pkgs/certifi/package-version.txt
+@@ -1 +1 @@
+-2021.5.30
++2021.10.8
+diff --git a/build/pkgs/cppy/checksums.ini b/build/pkgs/cppy/checksums.ini
+index 85eb695..5c78167 100644
+--- a/build/pkgs/cppy/checksums.ini
++++ b/build/pkgs/cppy/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=cppy-VERSION.tar.gz
+-sha1=61811685031328a8a2a77f45593d8238432ce35e
+-md5=98d746f558685c6b6658cefc39be14df
+-cksum=1915059157
++sha1=3af4f5f14ef1f9b49d7457e2fa5c241c721db29c
++md5=2110891d75aa12551deebba1603428c6
++cksum=793876648
+ upstream_url=https://files.pythonhosted.org/packages/source/c/cppy/cppy-VERSION.tar.gz
+diff --git a/build/pkgs/cppy/dependencies b/build/pkgs/cppy/dependencies
+new file mode 100644
+index 00000000..15df0c4
+--- /dev/null
++++ b/build/pkgs/cppy/dependencies
+@@ -0,0 +1,5 @@
++$(PYTHON) | $(PYTHON_TOOLCHAIN)
++
++----------
++All lines of this file are ignored except the first.
++It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
+diff --git a/build/pkgs/cycler/checksums.ini b/build/pkgs/cycler/checksums.ini
+index f6d988d..8883ddd 100644
+--- a/build/pkgs/cycler/checksums.ini
++++ b/build/pkgs/cycler/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=cycler-VERSION.tar.gz
+-sha1=1bcf4a985a5f414333603f3f70a7deebbaf30439
+-md5=4cb42917ac5007d1cdff6cccfe2d016b
+-cksum=4189438538
++sha1=ea144185cf1d54d7415e3c66d705d9a232e57da5
++md5=cf3b4846fded12fa4d2a7a291a5d6e13
++cksum=3626319704
+ upstream_url=https://github.com/matplotlib/cycler/archive/refs/tags/vVERSION.tar.gz
+diff --git a/build/pkgs/dateutil/checksums.ini b/build/pkgs/dateutil/checksums.ini
+index e08ee45..20fbeb6 100644
+--- a/build/pkgs/dateutil/checksums.ini
++++ b/build/pkgs/dateutil/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=python-dateutil-VERSION.tar.gz
+-sha1=bd26127e57f83a10f656b62c46524c15aeb844dd
+-md5=f2a1d4b680b297b367a974664ca3a4f6
+-cksum=675236266
++sha1=c2ba10c775b7a52a4b57cac4d4110a0c0f812a82
++md5=5970010bb72452344df3d76a10281b65
++cksum=3093929984
++upstream_url=https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-VERSION.tar.gz
+diff --git a/build/pkgs/dateutil/package-version.txt b/build/pkgs/dateutil/package-version.txt
+index dbe5900..1817afe 100644
+--- a/build/pkgs/dateutil/package-version.txt
++++ b/build/pkgs/dateutil/package-version.txt
+@@ -1 +1 @@
+-2.8.1
++2.8.2
+diff --git a/build/pkgs/kiwisolver/dependencies b/build/pkgs/kiwisolver/dependencies
+index 15df0c4..80b9352 100644
+--- a/build/pkgs/kiwisolver/dependencies
++++ b/build/pkgs/kiwisolver/dependencies
+@@ -1,4 +1,4 @@
+-$(PYTHON) | $(PYTHON_TOOLCHAIN)
++$(PYTHON) cppy | $(PYTHON_TOOLCHAIN)
+ 
+ ----------
+ All lines of this file are ignored except the first.
+diff --git a/build/pkgs/pillow/checksums.ini b/build/pkgs/pillow/checksums.ini
+index 7adfee1..71d2e39 100644
+--- a/build/pkgs/pillow/checksums.ini
++++ b/build/pkgs/pillow/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=Pillow-VERSION.tar.gz
+-sha1=2c972f30581da0c58edb1e2bed420c2b8f6fd216
+-md5=14ce2c5d19369e335c331c8f529ecf87
+-cksum=976804255
++sha1=ca8d057aec64ccd0804044bc71c17921afbe2e4e
++md5=7a1eb5a250c7ccbd549a89e16404f09f
++cksum=555919456
+ upstream_url=https://pypi.io/packages/source/p/pillow/Pillow-VERSION.tar.gz
+diff --git a/build/pkgs/pillow/package-version.txt b/build/pkgs/pillow/package-version.txt
+index 6b409d9..a2f28f4 100644
+--- a/build/pkgs/pillow/package-version.txt
++++ b/build/pkgs/pillow/package-version.txt
+@@ -1 +1 @@
+-8.1.2
++8.4.0
+diff --git a/build/pkgs/pyparsing/checksums.ini b/build/pkgs/pyparsing/checksums.ini
+index 30aa3fa..d3c3d9b 100644
+--- a/build/pkgs/pyparsing/checksums.ini
++++ b/build/pkgs/pyparsing/checksums.ini
+@@ -1,4 +1,5 @@
+ tarball=pyparsing-VERSION.tar.gz
+-sha1=ca8d892c93fe2d54ea5e6f31c5798e40c58e8667
+-md5=f0953e47a0112f7a65aec2305ffdf7b4
+-cksum=2411150047
++sha1=9c25e076bcf191734a44b85d1eb5d8c3324894c6
++md5=2f5fad6c8e99ac2562ab08ad9e45b195
++cksum=421409881
++upstream_url=https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-VERSION.tar.gz
+diff --git a/build/pkgs/pyparsing/package-version.txt b/build/pkgs/pyparsing/package-version.txt
+index e30309f..818bd47 100644
+--- a/build/pkgs/pyparsing/package-version.txt
++++ b/build/pkgs/pyparsing/package-version.txt
+@@ -1 +1 @@
+-2.4.7
++3.0.6
+-- 
+cgit v1.0-1-gd88e
+
+
+From 26910e65f5357fc2f6505440fccc718a52908872 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 17:48:55 +0000
+Subject: fix SPKG.rst's for cppy and kiwisolver
+
+---
+ build/pkgs/cppy/SPKG.rst       | 22 ++++++++++++++++++++++
+ build/pkgs/kiwisolver/SPKG.rst |  6 ------
+ 2 files changed, 22 insertions(+), 6 deletions(-)
+ create mode 100644 build/pkgs/cppy/SPKG.rst
+
+diff --git a/build/pkgs/cppy/SPKG.rst b/build/pkgs/cppy/SPKG.rst
+new file mode 100644
+index 00000000..a10d0e1
+--- /dev/null
++++ b/build/pkgs/cppy/SPKG.rst
+@@ -0,0 +1,22 @@
++cppy: C++ headers for C extension development
++===========================================================================
++
++Description
++-----------
++
++From: https://pypi.org/project/cppy/
++
++A small C++ header library which makes it easier to write Python extension
++modules. The primary feature is a PyObject smart pointer which automatically
++handles reference counting and provides convenience methods for performing
++common object operations.
++
++License
++-------
++
++Modified BSD 3-Clause-License
++
++Upstream Contact
++----------------
++
++https://github.com/nucleic/cppy
+diff --git a/build/pkgs/kiwisolver/SPKG.rst b/build/pkgs/kiwisolver/SPKG.rst
+index afaccda..f461bf0 100644
+--- a/build/pkgs/kiwisolver/SPKG.rst
++++ b/build/pkgs/kiwisolver/SPKG.rst
+@@ -29,9 +29,3 @@ Upstream Contact
+ ----------------
+ 
+ https://github.com/nucleic/kiwi
+-
+-Dependencies
+-------------
+-
+--  python
+--  setuptools
+-- 
+cgit v1.0-1-gd88e
+
+
+From aedaf93a51ee4bd69cf61b7c999940d6990b911c Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 17:58:07 +0000
+Subject: Revert "add gfortran to _prereq/distros/*"
+
+This reverts commit 42435f4aee9cd901dba119255a02247055b7dc80.
+---
+ build/pkgs/_prereq/distros/arch.txt      | 1 -
+ build/pkgs/_prereq/distros/conda.txt     | 1 -
+ build/pkgs/_prereq/distros/cygwin.txt    | 1 -
+ build/pkgs/_prereq/distros/debian.txt    | 1 -
+ build/pkgs/_prereq/distros/fedora.txt    | 1 -
+ build/pkgs/_prereq/distros/freebsd.txt   | 1 -
+ build/pkgs/_prereq/distros/homebrew.txt  | 3 ++-
+ build/pkgs/_prereq/distros/macports.txt  | 1 -
+ build/pkgs/_prereq/distros/opensuse.txt  | 1 -
+ build/pkgs/_prereq/distros/slackware.txt | 1 -
+ build/pkgs/_prereq/distros/void.txt      | 1 -
+ 11 files changed, 2 insertions(+), 11 deletions(-)
+ delete mode 100644 build/pkgs/_prereq/distros/macports.txt
+
+diff --git a/build/pkgs/_prereq/distros/arch.txt b/build/pkgs/_prereq/distros/arch.txt
+index f43cab4..9b9bf09 100644
+--- a/build/pkgs/_prereq/distros/arch.txt
++++ b/build/pkgs/_prereq/distros/arch.txt
+@@ -6,6 +6,5 @@ python # system python for bootstrapping the build
+ tar
+ bc
+ gcc
+-gcc-fortran
+ # Needed for 4ti2:
+ which
+diff --git a/build/pkgs/_prereq/distros/conda.txt b/build/pkgs/_prereq/distros/conda.txt
+index 0e66d82..a02a39e 100644
+--- a/build/pkgs/_prereq/distros/conda.txt
++++ b/build/pkgs/_prereq/distros/conda.txt
+@@ -1,5 +1,4 @@
+ compilers
+-fortran-compiler
+ make
+ m4
+ perl
+diff --git a/build/pkgs/_prereq/distros/cygwin.txt b/build/pkgs/_prereq/distros/cygwin.txt
+index fc0304d..635afe8 100644
+--- a/build/pkgs/_prereq/distros/cygwin.txt
++++ b/build/pkgs/_prereq/distros/cygwin.txt
+@@ -19,7 +19,6 @@ perl-ExtUtils-MakeMaker
+ tar
+ gcc-core
+ gcc-g++
+-gcc-fortran
+ # Needed according to embray at https://trac.sagemath.org/ticket/26964:
+ # The need for which comes [...] from MPIR's configure script
+ findutils
+diff --git a/build/pkgs/_prereq/distros/debian.txt b/build/pkgs/_prereq/distros/debian.txt
+index c348ee3..50be6ac 100644
+--- a/build/pkgs/_prereq/distros/debian.txt
++++ b/build/pkgs/_prereq/distros/debian.txt
+@@ -26,6 +26,5 @@ gcc
+ # configure: error: in `/sage':
+ # configure: error: C++ preprocessor "/lib/cpp" fails sanity check
+ g++
+-gfortran
+ # Needed if we download some packages from a https upstream URL
+ ca-certificates
+diff --git a/build/pkgs/_prereq/distros/fedora.txt b/build/pkgs/_prereq/distros/fedora.txt
+index d5a5ae7..a82e29a 100644
+--- a/build/pkgs/_prereq/distros/fedora.txt
++++ b/build/pkgs/_prereq/distros/fedora.txt
+@@ -26,7 +26,6 @@ gcc
+ # configure: error: in `/sage':
+ # configure: error: C++ preprocessor "/lib/cpp" fails sanity check
+ gcc-c++
+-gcc-gfortran
+ # Needed according to embray at https://trac.sagemath.org/ticket/26964:
+ # The need for which comes [...] from MPIR's configure script
+ findutils
+diff --git a/build/pkgs/_prereq/distros/freebsd.txt b/build/pkgs/_prereq/distros/freebsd.txt
+index ec26136..cc708cc 100644
+--- a/build/pkgs/_prereq/distros/freebsd.txt
++++ b/build/pkgs/_prereq/distros/freebsd.txt
+@@ -17,4 +17,3 @@ automake
+ bash
+ dash
+ python # python metaport for bootstrapping the build
+-lang/gcc9 # gfortran
+diff --git a/build/pkgs/_prereq/distros/homebrew.txt b/build/pkgs/_prereq/distros/homebrew.txt
+index f537c17..863c22a 100644
+--- a/build/pkgs/_prereq/distros/homebrew.txt
++++ b/build/pkgs/_prereq/distros/homebrew.txt
+@@ -8,4 +8,5 @@
+ # for use in "sage -info SPKG".
+ #
+ # Everything on a line after a # character is ignored.
+-gcc
++
++# No packages needed
+diff --git a/build/pkgs/_prereq/distros/macports.txt b/build/pkgs/_prereq/distros/macports.txt
+deleted file mode 100644
+index c2878ad..00000000
+--- a/build/pkgs/_prereq/distros/macports.txt
++++ /dev/null
+@@ -1 +0,0 @@
+-gcc10 +gfortran
+diff --git a/build/pkgs/_prereq/distros/opensuse.txt b/build/pkgs/_prereq/distros/opensuse.txt
+index 959ab26..070f456 100644
+--- a/build/pkgs/_prereq/distros/opensuse.txt
++++ b/build/pkgs/_prereq/distros/opensuse.txt
+@@ -19,7 +19,6 @@ which
+ glibc-locale-base
+ gcc
+ gcc-c++
+-gcc-fortran
+ # Needed if we download some packages from a https upstream URL
+ ca-certificates
+ # gunzip needed for ppl spkg
+diff --git a/build/pkgs/_prereq/distros/slackware.txt b/build/pkgs/_prereq/distros/slackware.txt
+index 11ec3b9..a976efe 100644
+--- a/build/pkgs/_prereq/distros/slackware.txt
++++ b/build/pkgs/_prereq/distros/slackware.txt
+@@ -3,7 +3,6 @@ make
+ guile gc libffi  # dependencies of make
+ "gcc-[0-9]"      # So that slackpkg pattern matching does not pull in all gcc-* packages
+ gcc-g++
+-gcc-gfortran
+ libmpc glibc kernel-headers # dependencies of gcc
+ perl
+ m4
+diff --git a/build/pkgs/_prereq/distros/void.txt b/build/pkgs/_prereq/distros/void.txt
+index 2769f4d..a2e7644 100644
+--- a/build/pkgs/_prereq/distros/void.txt
++++ b/build/pkgs/_prereq/distros/void.txt
+@@ -7,5 +7,4 @@ python3
+ tar
+ bc
+ gcc
+-gcc-fortran
+ which
+-- 
+cgit v1.0-1-gd88e
+
+
+From 62792d4b191d2116774562147a5d089b88d5c1cd Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Tue, 16 Nov 2021 18:42:30 +0000
+Subject: use pypi host for cycler url
+
+---
+ build/pkgs/cycler/checksums.ini | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/cycler/checksums.ini b/build/pkgs/cycler/checksums.ini
+index 8883ddd..b9f7e51 100644
+--- a/build/pkgs/cycler/checksums.ini
++++ b/build/pkgs/cycler/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=cycler-VERSION.tar.gz
+-sha1=ea144185cf1d54d7415e3c66d705d9a232e57da5
+-md5=cf3b4846fded12fa4d2a7a291a5d6e13
+-cksum=3626319704
+-upstream_url=https://github.com/matplotlib/cycler/archive/refs/tags/vVERSION.tar.gz
++sha1=576c8605d33a8f70eccabf321ecc9e2fbdb9fb72
++md5=4d0c25f418956e91c47163179682e0ef
++cksum=2916957464
++upstream_url=https://files.pythonhosted.org/packages/source/c/cycler/cycler-VERSION.tar.gz
+-- 
+cgit v1.0-1-gd88e
+
+
+From 6d203eb9812b244096f597f6998655110468c6ee Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 18:34:30 -0800
+Subject: build/pkgs/matplotlib: Update to 3.5.1
+
+---
+ build/pkgs/matplotlib/checksums.ini       | 6 +++---
+ build/pkgs/matplotlib/package-version.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/build/pkgs/matplotlib/checksums.ini b/build/pkgs/matplotlib/checksums.ini
+index 2783080..b2b3d3c 100644
+--- a/build/pkgs/matplotlib/checksums.ini
++++ b/build/pkgs/matplotlib/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=matplotlib-VERSION.tar.gz
+-sha1=764fb3c673f45bedb472bc81c63b9c36f7973c46
+-md5=6858958370a26cccfa81abc7b6dd3622
+-cksum=2317464343
++sha1=a9bb3b92594d991908a0052384c6abed81227a6f
++md5=63adf3126167a54b1d5a506a71ecef46
++cksum=1898324331
+ upstream_url=https://pypi.io/packages/source/m/matplotlib/matplotlib-VERSION.tar.gz
+diff --git a/build/pkgs/matplotlib/package-version.txt b/build/pkgs/matplotlib/package-version.txt
+index 6cb9d3d..d5c0c99 100644
+--- a/build/pkgs/matplotlib/package-version.txt
++++ b/build/pkgs/matplotlib/package-version.txt
+@@ -1 +1 @@
+-3.4.3
++3.5.1
+-- 
+cgit v1.0-1-gd88e
+
+
+From 5a68988cfb3f32884e9d2d68f484745c34c70ee1 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 18:46:25 -0800
+Subject: build/pkgs/matplotlib/make-setup-config.py: Write mplsetup.cfg, not
+ setup.cfg
+
+---
+ build/pkgs/matplotlib/make-setup-config.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/matplotlib/make-setup-config.py b/build/pkgs/matplotlib/make-setup-config.py
+index 2a53eab..98450de 100644
+--- a/build/pkgs/matplotlib/make-setup-config.py
++++ b/build/pkgs/matplotlib/make-setup-config.py
+@@ -37,5 +37,5 @@ config.add_section('gui_support')
+ for backend in ('gtk', 'gtkagg', 'tkagg', 'wxagg', 'macosx', 'windowing'):
+     config.set('gui_support', backend,  graphical_backend)
+ 
+-with open('src/setup.cfg', 'w') as configfile:
++with open('src/mplsetup.cfg', 'w') as configfile:
+     config.write(configfile)
+-- 
+cgit v1.0-1-gd88e
+
+
+From 767092b9dc04a4744b9e10ab4dabc0684756e038 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 18:46:42 -0800
+Subject: build/pkgs/matplotlib/dependencies: Update dependencies
+
+---
+ build/pkgs/matplotlib/dependencies | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build/pkgs/matplotlib/dependencies b/build/pkgs/matplotlib/dependencies
+index e32a563..0b3e62b 100644
+--- a/build/pkgs/matplotlib/dependencies
++++ b/build/pkgs/matplotlib/dependencies
+@@ -1,4 +1,4 @@
+-$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi
++$(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler qhull fonttools | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi setuptools_scm_git_archive
+ 
+ ----------
+ All lines of this file are ignored except the first.
+-- 
+cgit v1.0-1-gd88e
+
+
+From 9b5a66335b9cf7b46c27c35b75ed12511660f858 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Fri, 17 Dec 2021 18:47:08 -0800
+Subject: build/pkgs/setuptools_scm_git_archive: New, matplotlib dependency
+
+---
+ build/pkgs/setuptools_scm_git_archive/SPKG.rst         | 18 ++++++++++++++++++
+ build/pkgs/setuptools_scm_git_archive/checksums.ini    |  5 +++++
+ build/pkgs/setuptools_scm_git_archive/dependencies     |  4 ++++
+ .../setuptools_scm_git_archive/install-requires.txt    |  1 +
+ .../setuptools_scm_git_archive/package-version.txt     |  1 +
+ build/pkgs/setuptools_scm_git_archive/spkg-install.in  |  2 ++
+ build/pkgs/setuptools_scm_git_archive/type             |  1 +
+ 7 files changed, 32 insertions(+)
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/SPKG.rst
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/checksums.ini
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/dependencies
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/install-requires.txt
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/package-version.txt
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/spkg-install.in
+ create mode 100644 build/pkgs/setuptools_scm_git_archive/type
+
+diff --git a/build/pkgs/setuptools_scm_git_archive/SPKG.rst b/build/pkgs/setuptools_scm_git_archive/SPKG.rst
+new file mode 100644
+index 00000000..540e0c2
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/SPKG.rst
+@@ -0,0 +1,18 @@
++setuptools_scm_git_archive: setuptools_scm plugin for git archives
++==================================================================
++
++Description
++-----------
++
++setuptools_scm plugin for git archives
++
++License
++-------
++
++MIT
++
++Upstream Contact
++----------------
++
++https://pypi.org/project/setuptools-scm-git-archive/
++
+diff --git a/build/pkgs/setuptools_scm_git_archive/checksums.ini b/build/pkgs/setuptools_scm_git_archive/checksums.ini
+new file mode 100644
+index 00000000..9a773ee
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/checksums.ini
+@@ -0,0 +1,5 @@
++tarball=setuptools_scm_git_archive-VERSION.tar.gz
++sha1=eda18924f3917e94cc54227660e3437d47f53bb9
++md5=1c9351fa5cebd12e76488737a7c78f2e
++cksum=188023730
++upstream_url=https://pypi.io/packages/source/s/setuptools_scm_git_archive/setuptools_scm_git_archive-VERSION.tar.gz
+diff --git a/build/pkgs/setuptools_scm_git_archive/dependencies b/build/pkgs/setuptools_scm_git_archive/dependencies
+new file mode 100644
+index 00000000..0738c2d
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/dependencies
+@@ -0,0 +1,4 @@
++$(PYTHON) | $(PYTHON_TOOLCHAIN)
++
++----------
++All lines of this file are ignored except the first.
+diff --git a/build/pkgs/setuptools_scm_git_archive/install-requires.txt b/build/pkgs/setuptools_scm_git_archive/install-requires.txt
+new file mode 100644
+index 00000000..538474f
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/install-requires.txt
+@@ -0,0 +1 @@
++setuptools-scm-git-archive
+diff --git a/build/pkgs/setuptools_scm_git_archive/package-version.txt b/build/pkgs/setuptools_scm_git_archive/package-version.txt
+new file mode 100644
+index 00000000..9459d4b
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/package-version.txt
+@@ -0,0 +1 @@
++1.1
+diff --git a/build/pkgs/setuptools_scm_git_archive/spkg-install.in b/build/pkgs/setuptools_scm_git_archive/spkg-install.in
+new file mode 100644
+index 00000000..37ac1a5
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/spkg-install.in
+@@ -0,0 +1,2 @@
++cd src
++sdh_pip_install .
+diff --git a/build/pkgs/setuptools_scm_git_archive/type b/build/pkgs/setuptools_scm_git_archive/type
+new file mode 100644
+index 00000000..a6a7b9c
+--- /dev/null
++++ b/build/pkgs/setuptools_scm_git_archive/type
+@@ -0,0 +1 @@
++standard
+-- 
+cgit v1.0-1-gd88e
+
+
+From d865a54526829b79d5d236a40f83ddc6ce7b2696 Mon Sep 17 00:00:00 2001
+From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
+Date: Sat, 18 Dec 2021 12:33:27 -0800
+Subject: build/pkgs/fonttools: New
+
+---
+ build/pkgs/fonttools/SPKG.rst             | 18 ++++++++++++++++++
+ build/pkgs/fonttools/checksums.ini        |  5 +++++
+ build/pkgs/fonttools/dependencies         |  4 ++++
+ build/pkgs/fonttools/install-requires.txt |  1 +
+ build/pkgs/fonttools/package-version.txt  |  1 +
+ build/pkgs/fonttools/spkg-install.in      |  3 +++
+ build/pkgs/fonttools/type                 |  1 +
+ 7 files changed, 33 insertions(+)
+ create mode 100644 build/pkgs/fonttools/SPKG.rst
+ create mode 100644 build/pkgs/fonttools/checksums.ini
+ create mode 100644 build/pkgs/fonttools/dependencies
+ create mode 100644 build/pkgs/fonttools/install-requires.txt
+ create mode 100644 build/pkgs/fonttools/package-version.txt
+ create mode 100644 build/pkgs/fonttools/spkg-install.in
+ create mode 100644 build/pkgs/fonttools/type
+
+diff --git a/build/pkgs/fonttools/SPKG.rst b/build/pkgs/fonttools/SPKG.rst
+new file mode 100644
+index 00000000..7882c8b
+--- /dev/null
++++ b/build/pkgs/fonttools/SPKG.rst
+@@ -0,0 +1,18 @@
++fonttools: Tools to manipulate font files
++=========================================
++
++Description
++-----------
++
++Tools to manipulate font files
++
++License
++-------
++
++MIT
++
++Upstream Contact
++----------------
++
++https://pypi.org/project/fonttools/
++
+diff --git a/build/pkgs/fonttools/checksums.ini b/build/pkgs/fonttools/checksums.ini
+new file mode 100644
+index 00000000..1a0ba14
+--- /dev/null
++++ b/build/pkgs/fonttools/checksums.ini
+@@ -0,0 +1,5 @@
++tarball=fonttools-VERSION.zip
++sha1=8d6f8120ad4b3d00dd92cfea3a2e0b4ae1d72bc7
++md5=c1605575dcc45ef35455ae1d606868b3
++cksum=3346598630
++upstream_url=https://pypi.io/packages/source/f/fonttools/fonttools-VERSION.zip
+diff --git a/build/pkgs/fonttools/dependencies b/build/pkgs/fonttools/dependencies
+new file mode 100644
+index 00000000..9c73666
+--- /dev/null
++++ b/build/pkgs/fonttools/dependencies
+@@ -0,0 +1,4 @@
++$(PYTHON) | $(PYTHON_TOOLCHAIN) cython
++
++----------
++All lines of this file are ignored except the first.
+diff --git a/build/pkgs/fonttools/install-requires.txt b/build/pkgs/fonttools/install-requires.txt
+new file mode 100644
+index 00000000..d32bfca
+--- /dev/null
++++ b/build/pkgs/fonttools/install-requires.txt
+@@ -0,0 +1 @@
++fonttools
+diff --git a/build/pkgs/fonttools/package-version.txt b/build/pkgs/fonttools/package-version.txt
+new file mode 100644
+index 00000000..1f30b28
+--- /dev/null
++++ b/build/pkgs/fonttools/package-version.txt
+@@ -0,0 +1 @@
++4.28.4
+diff --git a/build/pkgs/fonttools/spkg-install.in b/build/pkgs/fonttools/spkg-install.in
+new file mode 100644
+index 00000000..8855291
+--- /dev/null
++++ b/build/pkgs/fonttools/spkg-install.in
+@@ -0,0 +1,3 @@
++cd src
++export FONTTOOLS_WITH_CYTHON=1
++sdh_pip_install .
+diff --git a/build/pkgs/fonttools/type b/build/pkgs/fonttools/type
+new file mode 100644
+index 00000000..a6a7b9c
+--- /dev/null
++++ b/build/pkgs/fonttools/type
+@@ -0,0 +1 @@
++standard
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 7764899e557f..1d11705eecb7 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -22,6 +22,11 @@ distfiles="https://mirrors.mit.edu/sage/src/sage-$version.tar.gz"
 checksum=124f3d23ce6442ecc84ed98e3c035e0d00c8261c3125712e4742c32e731d13de
 python_version=3
 
+build_options="system_python3"
+desc_option_system_python="Build using system python 3"
+build_options_default="system_python3"
+configure_args+=" $(vopt_with system_python3)"
+
 # path where sage will be installed
 _SAGE_ROOT=/usr/lib/sage-${version}
 
@@ -30,6 +35,74 @@ case ${version} in
 	*.beta*|*.rc*) distfiles=${distfiles/sage\/src/sage\/devel} ;;
 esac
 
+# extra upstream packages (trac-30766 / trac-32968 / trac-33020 / trac-33040)
+_upstream="
+ https://pypi.io/packages/source/i/ipython/ipython-7.29.0.tar.gz
+ https://pypi.io/packages/source/i/ipykernel/ipykernel-6.5.1.tar.gz
+ https://pypi.io/packages/source/i/ipywidgets/ipywidgets-7.6.5.tar.gz
+ https://pypi.io/packages/source/j/jedi/jedi-0.18.1.tar.gz
+ https://pypi.io/packages/source/p/prompt_toolkit/prompt_toolkit-3.0.22.tar.gz
+ https://pypi.io/packages/source/w/widgetsnbextension/widgetsnbextension-3.5.2.tar.gz
+ https://pypi.io/packages/source/t/terminado/terminado-0.12.1.tar.gz
+ https://pypi.io/packages/source/n/notebook/notebook-6.4.6.tar.gz
+ https://pypi.io/packages/source/n/nbclient/nbclient-0.5.9.tar.gz
+ https://pypi.io/packages/source/j/jupyter_client/jupyter_client-7.1.0.tar.gz
+ https://pypi.io/packages/source/j/jupyter_core/jupyter_core-4.9.1.tar.gz
+ https://pypi.io/packages/source/i/importlib_metadata/importlib_metadata-4.8.2.tar.gz
+
+ https://pypi.io/packages/source/s/sphinx/Sphinx-4.3.1.tar.gz
+
+ https://pypi.io/packages/source/i/ipykernel/ipykernel-6.6.0.tar.gz
+
+ https://files.pythonhosted.org/packages/source/c/cycler/cycler-0.11.0.tar.gz
+ https://files.pythonhosted.org/packages/source/k/kiwisolver/kiwisolver-1.3.2.tar.gz
+ https://pypi.io/packages/source/p/pytz/pytz-2021.3.tar.gz
+ https://files.pythonhosted.org/packages/source/c/cppy/cppy-1.1.0.tar.gz
+ https://pypi.io/packages/source/c/certifi/certifi-2021.10.8.tar.gz
+ https://files.pythonhosted.org/packages/source/p/python-dateutil/python-dateutil-2.8.2.tar.gz
+ https://pypi.io/packages/source/p/pillow/Pillow-8.4.0.tar.gz
+ https://files.pythonhosted.org/packages/source/p/pyparsing/pyparsing-3.0.6.tar.gz
+ https://pypi.io/packages/source/m/matplotlib/matplotlib-3.5.1.tar.gz
+ https://pypi.io/packages/source/s/setuptools_scm_git_archive/setuptools_scm_git_archive-1.1.tar.gz
+ https://pypi.io/packages/source/f/fonttools/fonttools-4.28.4.zip
+"
+
+checksum+="
+ 4f69d7423a5a1972f6347ff233e38bbf4df6a150ef20fbb00c635442ac3060aa
+ dd27172bccbbcfef952991e49372e4c6fd1c14eed0df05ebd5b4335cb27a81a2
+ 00974f7cb4d5f8d494c19810fedb9fa9b64bffd3cda7c2be23c133a1ad3c99c5
+ 74137626a64a99c8eb6ae5832d99b3bdd7d29a3850fe2aa80a4126b2a7d949ab
+ 449f333dd120bd01f5d296a8ce1452114ba3a71fae7288d2f0ae2c918764fa72
+ e0731a60ba540cd19bbbefe771a9076dcd2dde90713a8f87f27f53f2d1db7727
+ b20fd93cc57c1678c799799d117874367cc07a3d2d55be95205b1a88fa08393f
+ 7bcdf79bd1cda534735bd9830d2cbedab4ee34d8fe1df6e7b946b3aab0902ba3
+ 99e46ddafacd0b861293bf246fed8540a184adfa3aa7d641f89031ec070701e0
+ a5f995a73cffb314ed262713ae6dfce53c6b8216cea9f332071b8ff44a6e1654
+ dce8a7499da5a53ae3afd5a9f4b02e5df1d57250cf48f3ad79da23b4778cd6fa
+ 75bdec14c397f528724c1bfd9709d660b33a4d2e77387a3358f20b848bb5e5fb
+
+ 32a5b3e9a1b176cc25ed048557d4d3d01af635e6b76c5bc7a43b0a34447fbd45
+
+ 3a227788216b43982d9ac28195949467627b0d16e6b8af9741d95dcaa8c41a89
+
+ 9c87405839a19696e837b3b818fed3f5f69f16f1eec1a1ad77e043dcea9c772f
+ fc4453705b81d03568d5b808ad8f09c77c47534f6ac2e72e733f9ca4714aa75c
+ acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326
+ 4eda6f1952054a270f32dc11df7c5e24b259a09fddf7bfaa5f33df9fb4a29642
+ 78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872
+ 0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86
+ b8e2f83c56e141920c39464b852de3719dfbfb6e3c99a2d8da0edf4fb33176ed
+ d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81
+ b2e9810e09c3a47b73ce9cab5a72243a1258f61e7900969097a817232246ce1c
+ 6026f61089b73fa1b5ee737e95314f41cb512609b393530385ed281d0b46c062
+ 581a682a7102a41421e7e484303572c565c1b8e52b1cc9fecd3c159dbe9a02f4
+"
+
+for u in ${_upstream}; do
+	distfiles+=" $u"
+	skip_extraction+=" ${u##*[/>]}"
+done
+
 # for now, skip check in ci, since we still have a few tests failing
 #make_check=ci-skip
 
@@ -51,6 +124,10 @@ post_extract() {
 	rm -rf $_SAGE_ROOT
 	mv -T $wrksrc $_SAGE_ROOT
 	ln -srfT $_SAGE_ROOT $wrksrc
+
+	for u in ${_upstream}; do
+		cp "$XBPS_SRCDISTDIR/${pkgname}-${version}/${u##*[/>]}" $wrksrc/upstream
+	done
 }
 
 do_clean() {
@@ -92,6 +169,7 @@ do_check() {
 	OPT="--optional sage,optional,build"
 	# since make check will build the docs, run test like this instead
 	./sage -tp ${XBPS_MAKEJOBS} ${OPT} ${TEST}
+	#./sage -t ${OPT} ${TEST}
 }
 
 ### copied from sage-deps, to be kept in sync

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta8
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (115 preceding siblings ...)
  2021-12-20  2:35 ` [PR PATCH] [Updated] " tornaria
@ 2021-12-23 17:18 ` dkwo
  2021-12-23 17:47 ` dkwo
                   ` (121 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-23 17:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-1000434912

Comment:
The new version builds and works fine on newer musl, no more segfaults.
However, I'm unable to use it from `jupyterlab`: since we're now using system python, should the link be changed?
I tried `/usr/local/share/jupyter -> /usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/share/jupyter` @leahneukirchen 

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta8
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (116 preceding siblings ...)
  2021-12-23 17:18 ` [WIP] New package: sagemath-9.5.beta8 dkwo
@ 2021-12-23 17:47 ` dkwo
  2021-12-23 18:28 ` tornaria
                   ` (120 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-23 17:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-1000447788

Comment:
OK, I take it back.

Jupyterlab still works, provided I also use
`jupyter lab --app-dir /usr/lib/python3.10/site-packages/jupyterlab`
(I'll look into that later.)

As for segfaults, it goes a bit further, but e.g.
```
sage: V = var('r1, r2, u, v, m')
sage: r1 = exp(m*(u^2-v^2))*u
sage: r2 = exp(m*(v^2-u^2))*v
sage: Jac = jacobian((r1,r2),(u,v)).inverse().simplify_full()

*** SIG 11 *** inside sig_on
do_raise_exception(sig=11)
PyErr_Occurred() = 0
Raising Python exception 0 ms after signal...
---------------------------------------------------------------------------
SignalError                               Traceback (most recent call last)
<ipython-input-5-5a754cefa940> in <module>
----> 1 Jac = jacobian((r1,r2),(u,v)).inverse().simplify_full()

(stuff)

/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/rings/integer.pyx in sage.rings.integer.Integer.factorial (build/c
ythonized/sage/rings/integer.c:29386)()
   4476         cdef Integer z = PY_NEW(Integer)
   4477
-> 4478         sig_on()
   4479         mpz_fac_ui(z.value, mpz_get_ui(self.value))
   4480         sig_off()

SignalError: Segmentation fault
```
Does this work on glibc with new version of template?

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta8
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (117 preceding siblings ...)
  2021-12-23 17:47 ` dkwo
@ 2021-12-23 18:28 ` tornaria
  2021-12-23 19:20 ` dkwo
                   ` (119 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: tornaria @ 2021-12-23 18:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-1000466098

Comment:
Works for me on glibc and also on a xbps-src chroot with musl libc, in fact all tests pass on x86_64 and x86_64-musl.
```
$ ./xbps-src -m masterdir.musl -Ct chroot
[...]
[.../masterdir.musl /]$ /usr/lib/sage-9.5.beta8/sage 
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.5.beta8, Release Date: 2021-12-12               │
│ Using Python 3.10.1. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: V = var('r1, r2, u, v, m')
sage: r1 = exp(m*(u^2-v^2))*u
sage: r2 = exp(m*(v^2-u^2))*v
sage: Jac = jacobian((r1,r2),(u,v)).inverse().simplify_full()
sage: Jac
[(2*m*v^2 + 1)*e^(m*v^2)/(2*m*v^2*e^(m*u^2) + (2*m*u^2 + 1)*e^(m*u^2))                     2*m*u*v*e^(m*u^2 - m*v^2)/(2*m*u^2 + 2*m*v^2 + 1)]
[      2*m*u*v*e^(m*v^2)/(2*m*v^2*e^(m*u^2) + (2*m*u^2 + 1)*e^(m*u^2))               (2*m*u^2 + 1)*e^(m*u^2 - m*v^2)/(2*m*u^2 + 2*m*v^2 + 1)]
```

Did you manage to compile with debug symbols to see if we can get a better stack trace?

Does this happen always exactly the same, at the same point? A segmentation fault is very weird at that point...

As for the jupyterlab stuff... for now it's bound to be inconvenient. Sage installs python modules in its own venv which is isolated from system site-packages, but now that system python 3.10 is working we'll eventually try https://trac.sagemath.org/ticket/29665 which will allow us to configure the sage venv to default to system site-packages so we can use system python modules.

We are really close to having a working modular sagemath. Then we can start to think about the venv and integration.

^ permalink raw reply	[flat|nested] 240+ messages in thread

* Re: [WIP] New package: sagemath-9.5.beta8
  2021-11-11 14:12 [PR PATCH] [WIP] New package: sagemath-9.5.beta5 tornaria
                   ` (118 preceding siblings ...)
  2021-12-23 18:28 ` tornaria
@ 2021-12-23 19:20 ` dkwo
  2021-12-23 19:39 ` tornaria
                   ` (118 subsequent siblings)
  238 siblings, 0 replies; 240+ messages in thread
From: dkwo @ 2021-12-23 19:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3834 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/34030#issuecomment-1000486115

Comment:
I agree about jupyterlab.

I did manage to compile with debug, as you suggested.
With gdb installed, I get
```
$ sage-9.5.beta8_1 -t --all
no stored timings available
Running doctests with ID 2021-12-23-20-18-29-7fa0c985.
Git branch: develop
Using --optional=build,dochtml,pip,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_spkg,void
Doctesting entire Sage library.
Doctesting 4410 files.
Traceback (most recent call last):
  File "/usr/lib/sage-9.5.beta8/src/bin/sage-runtests", line 155, in <module>
    err = DC.run()
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/control.py", line 1257, in run
    self.run_doctests()
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/control.py", line 954, in run_doctests
    self.dispatcher = DocTestDispatcher(self)
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 1614, in __init__
    init_sage(controller)
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/doctest/forker.py", line 224, in init_sage
    import sympy
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sympy/__init__.py", line 22, in <module>
    import mpmath
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/__init__.py", line 5, in <module>
    from .ctx_fp import FPContext
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/ctx_fp.py", line 1, in <module>
    from .ctx_base import StandardBaseContext
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/ctx_base.py", line 3, in <module>
    from .libmp.backend import xrange
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/libmp/__init__.py", line 40, in <module>
    from .libhyper import (NoConvergence, make_hyp_summator,
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/libmp/libhyper.py", line 41, in <module>
    from .gammazeta import mpf_gamma_int, mpf_euler, euler_fixed
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/libmp/gammazeta.py", line 1371, in <module>
    small_factorial_cache = [from_int(ifac(n)) for \
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/libmp/gammazeta.py", line 1371, in <listcomp>
    small_factorial_cache = [from_int(ifac(n)) for \
  File "/usr/lib/sage-9.5.beta8/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/mpmath/libmp/libintmath.py", line 387, in <lambda>
    ifac = lambda n: int(sage.factorial(n))
  File "sage/symbolic/function.pyx", line 1026, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.c:10701)
  File "sage/rings/integer.pyx", line 4478, in sage.rings.integer.Integer.factorial (build/cythonized/sage/rings/integer.c:29386)
cysignals.signals.SignalError: Segmentation fault
----------