-
-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an autoconf configure script for sagelib #29119
Comments
Dependencies: #29118 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:4
Another thing I should expand on: The proposed |
comment:5
Many distros don't use |
comment:6
This is a nice idea that would have a place within the framework of
I see it as follows:
So the way I see it, there are multiple ways how sagelib should get its build-time (and run-time) configuration. You could provide a new implementation of Downstream packagers are invited to use their own implementation of |
Changed dependencies from #29118 to none |
comment:8
+1, I was just going to suggest this on #29118. The script for sagelib should do in-depth checks for the things that sagelib uses, and would be able to e.g. detect the path to nauty executables and substitute them into graph_generators.py.in, creating graph_generators.py in the process. Packagers would have no problem with this, and would save us a lot of trouble trying to work around the seven different ways that we've wound up packaging sage due to how awkward it was to do historically. The top-level distribution script would then check for things the distribution needs (like sqlite3 on the command line), and only needs to do very basic feature tests. |
This comment has been minimized.
This comment has been minimized.
comment:10
This still makes sense, because having a configure script for sagelib which is run by setup.py would render this sage_conf script unnecessary. |
Dependencies: #29118 |
comment:11
Replying to @dimpase:
That's the sage-the-distribution ./configure. Of course they don't use it, because that's for building an entire software distribution which is obviously moot when packaging sage for their distribution. This is about adding a |
comment:12
Replying to @mkoeppe:
I think I resisted it at first because it is a bit unusual. But that's why I brought of Cysignals. I was skeptical of it there too, but after a couple years of using it I've found it works well in practice. |
comment:13
Replying to @mkoeppe:
Yeah, it's still a bit of a mess, but actually not too bad. This would only be for detecting dependencies needed to build and link sagelib's extension modules. This would require slight reworking of how matplotlib works much the same way, except I don't think it uses autoconf.
Maybe, maybe not. It would actually be good if, when building sagelib, it is installed just like any other package, including re-running its configure script, which would not be the same as the sage-the-distribution configure script. We can certainly make better use of caching to speed this up, but it's not that onerous. It would not need to do as much as the sage-the-distribution configure.
Right, and this would not need "multiple implementations" because autoconf is a (mostly) platform agnostic tool used to configure packages on their target platform.
But would you even need sage_conf anymore? I thought you might like this because it's closer to your original approach of generating a file that goes directly into the
This would obviate the need for them to and likely make their lives easier. |
comment:14
Replying to @orlitzky:
Yes, this is the right idea in general. In the case of I originally rejected that idea on two grounds:
Of these, 2. is more of a bikeshed--I think it's fine if it's a .py module, even if it's a very simple one. Issue 1. I feel was more important, and would be addressed by this proposal, I think making for a good compromise. And as I mentioned above, if there was a need to create a plain-text file with Sage configuration, that could also be just as easily output by a
For now it would still need to do more than that, because it is needed to build the entire sage-the-distribution. So it needs to decide what SPKGs to install. The proposed configure for sagelib (which in the current repository layout would be under |
comment:15
|
comment:16
Replying to @dimpase:
Sure, either way. I think this would somewhat supersede #25828, because instead the Whatever the case you need way to enable/disable certain extension modules depending on what build dependencies are detected, but using the results of a configure script to do this would be quite easy and standard practice. |
comment:18
One thing I've long wanted is a kind of pure-Python autoconf replacement, for configuring non-trivial Python packages. Many packages like Numpy, Scipy, matplotlib, and others all have their own ad-hoc code for doing essentially the same things, and it would be lovely to have a standard package for that. This is more-or-less what SCons is, yet most of these projects don't use it, and I'm curious why. Anyways, we now already have a nearly complete set of autoconf macros for checking Sage's build dependencies, so we might as well use autoconf. |
comment:19
Replying to @embray:
https://wiki.gentoo.org/wiki/SCons#Why_you_should_NOT_use_SCons_in_your_project IMO it tries to replace autotools, but does everything worse than autotools. You might as well just use autotools. Writing M4 sucks, but after you get everything written and ship a release or two with some missing files because you forgot to add |
comment:20
Replying to @orlitzky:
cmake has a much better marketing department :-) Besides scons has a reputation for being very slow.
|
comment:21
Replying to @orlitzky:
That's pretty much more-or-less what I've heard as well; I never tried building a project with it myself, but have heard mostly frustration about it (even though I do think it's a good idea in principle). Alas, for all its faults autoconf is battle-tested. And since we already have increasingly robust M4 macros for testing sage's build dependencies it seems like the right choice here. |
comment:22
I'm working on a prototype for this, but I have other work priorities that are taking precedence. |
comment:24
#29039 does this via a version of |
Reviewer: Dima Pasechnik |
The proposal is to have a
configure
script specific to sagelib itself. This can reuse most of the work already done and to be done for #27330 in order to detect sagelib's non-Python compilation dependencies at build time (spkg-configure.m4
).src/configure.ac
would be simpler than theconfigure.ac
for sage-the-distribution, as it would not need to do anything related toSAGE_LOCAL
, and (possibly) only needs to detect sagelib's direct dependencies.This
configure
script can easily be included in source tarballs for sagelib, and can be called automatically by thesetup.py
.For prior art on this, see cysignals which also runs a
configure
script to detect dependencies for its C sources. While I was at one time skeptical of cysignals' approach to this (it is unusual to makeconfigure
part of the build system for a Python package), over time I've found that it works very well in practice.It uses standard tools that would already be available on systems capable of building sagelib in the first place, and does not introduce any new or out-of-the-ordinary concepts for packagers (aside from having a
configure
alongsidesetup.py
).It would explicitly check for sagelib's dependencies in a manner that can be used completely independently of sage-the-distribution.
Q: What files would be generated by this
configure
script?src/bin/sage-env-config
implemented in ./configure --prefix=SAGE_LOCAL #21479 in 2016/17, currently written bySAGE_ROOT/configure
) or Python modules under thesage
package (such assage.env_config
, like Make sagelib installation directory more flexible by creating a module src/sage/env_config.py from src/sage/env_config.py.in, defining variables for use in sage.env #29022 had proposed), or the Python modulesage_conf
next to thesage
module (as Python package sage_conf: Provides optional configuration information for sagelib #29038 implemented).Q: How does this impact pip install of sagelib?
setup.py
call (see e.g. the--global-option
and--install-option
flags topip install
). We could easily allow passing passing through additional flags to the underlyingconfigure
script if/when special customization is needed.Q: How does this impact installing sagelib in a virtualenv/venv?
C(PP)FLAGS
andLDFLAGS
so that the virtualenv is used as a header/library search path. This is true of any package that has dependencies in a non-standard prefix.CFLAGS
andLDFLAGS
automatically by checking for theVIRTUALENV
environment variable, but this is a separate enhancement.Related:
Depends on #29039
CC: @dimpase @mkoeppe @jdemeyer @orlitzky
Component: build: configure
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/29119
The text was updated successfully, but these errors were encountered: