-
-
Notifications
You must be signed in to change notification settings - Fork 704
meson: explicitly configurable options #40485
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
Conversation
|
@tobiasdiez - looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can certainly see that these options can be helpful in certain situations, and the maintenance overhead is quite small. So I'm fine with going forward with this PR.
If you feel like it, you can also add a bit of documentation on how to toggle those features. Should be enough to point to meson introspect --buildoptions for the full list of options (https://mesonbuild.com/Commands.html#introspect).
The CI is failing due to some small formatting issues.
Two small remarks:
If you are building from source (or using a source-based distro), this is the only way to achieve accurate dependency information.
Not sure if I understand this comment correctly, but the dependency info can be found in builddir\meson-info\intro-dependencies.json and in meson-logs.
Now that we are adding meson subprojects, there is again a risk of vendoring libraries that you already have installed if (say) its pkg-config check is flaky. Specifying -Dfoo=enabled makes that an error rather than quietly doing the wrong thing.
In this case, it's better to use --wrap-mode (https://mesonbuild.com/Subprojects.html#commandline-options) to skip all submodules.
|
We had those discussion before in other threads/foras. It would be best if stuff like sirocco was just split like giac is. That part is a slight regression in the meson build compared to the previous state. A growing pain no doubt. |
Done, but with with
That will give you the dependency info after the fact, but it may not be what you wanted to achieve. Essentially we want users to be able to say e.g. "build me a sage that doesn't need sirocco," and then we want our distro package to know that sirocco is not a dependency of sage from that point on. With explicit config this is pretty easy to do, we just take the user's enabled/disabled flag for the sirocco feature, and then pass it to the sage build system. This guarantees that sagelib is built with/without sirocco according to the user's wishes, and that we know ahead of time whether or not the result will depend on sirocco, so that we can pull it in as a dependency and record it in the package manager's database iff we need to do that.
Fair enough, I added that locally. |
I personally agree but each of those will require a few days of work to split off cleanly. Until then this PR will prevent things from regressing too badly when the setuptools packages are removed. |
antonio-rojas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine here, tested no configuration (everything is built) and disabling a couple of modules while still keeping the dependencies installed.
dimpase
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about mentioning --wrap-mode=... in the docs?
done |
|
CI is still falling. Could you please run the update meson script locally and commit it? |
|
Sure, it's only complaining about whitespace but that should fix it. |
tobiasdiez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then let's get this in!
|
Out of curiosity, does this provide a way to change the compilation flags passed to cythonize/gcc/etc. when building Sage? If not, would it be possible to expand upon this in a future PR to add that? |
This should already be possible. Meson supports the standard environment variables like I don't use |
Make it possible to disable the documentation build by passing, $ meson setup -Dbuild-docs=false Otherwise, the documentation will be built by default, as usual.
Several libraries are detected at setup time, and the corresponding feature is enabled or disabled based on the library's presence. This commit retains this behavior by default while making it possible to explicitly enable or disable the feature via, $ meson setup -Dfoo=disabled or $ meson setup -Dfoo=enabled The former disables the feature even if the library is installed, and the latter makes it an error if the library is not installed. The list of features (valid values for foo) is, * bliss * brial * coxeter3 * mcqd * meataxe * rankwidth * sirocco * tdlib
Add examples of explicit configuration using the "-Doption=value" syntax, and mention the auto_features option for package maintainers.
Mention how to disabled wrapped subprojects in the tips for package maintainers section.
|
Documentation preview for this PR (built with commit 3811277; changes) is ready! 🎉 |
|
It looks like eclib is optional now, so I'll add a flag for that too. |
|
That was actually not a very conscious change on my side, but it's probably a good idea to have it optional indeed. Could you please move eclib also to the optional dependencies in 'pyproject.toml' and perhaps check that there are disable flags for exactly all optional deps listed there. (I can also do this after my conference...) |
It is now possible to build sagelib without these libraries; the corresponding extensions are automatically disabled by meson.
I believe this is required anyway after commit eaef4ae, and regardless is nice to have because it guarantees that we'll have a pkg-config file and can skip the no-pkgconfig fallback.
Add an entry to meson.options (and tweak src/meson.build) so that the user can explicitly state whether or not he would like eclib support to be enabled, e.g. $ meson setup -Declib=disabled The default of "auto" is backwards-compatible.
|
|
(The list of feature flags does now match the list of optional deps.) |
|
The meataxe description doesn't seem accurate, Sage doesn't use any of the meataxe programs, but rather its multiplication tables (via the libmtx library) to optimize matrix operations over finite fields |
Better now? I tried to word them all in a way that avoids "description rot" if the implementation details change, but I don't know meataxe very well and wound up on a webpage that wasn't much help the first time around. |
|
is meataxe really used anywhere apart from defunct p-group cohomology package? |
yes, https://github.com/sagemath/sage/blob/develop/src/sage/matrix/matrix_gfpn_dense.pyx |
|
Yes, that's a Cython module split out from the now defunct package by Simon King, when he worked on refactoring his package, something that hasn't been completed. |
which is used by default if present as parent for matrices over fields of small order |
sagemathgh-40485: meson: explicitly configurable options As discussed in various places over the past two years, it is useful to be able to override the automagic detection of libraries to explicitly enable or disable a feature. This commit adds `meson.options` at the top level to do that, and to make the documentation optional as well. Example: ``` $ meson setup -Dsirocco=disabled ``` will disable the cython module `sage.libs.sirocco`, even if I have sirocco installed. This is nice for a few reasons: * If you are building from source (or using a source-based distro), this is the only way to achieve accurate dependency information. * Now that we are adding meson subprojects, there is again a risk of vendoring libraries that you already have installed if (say) its pkg- config check is flaky. Specifying `-Dfoo=enabled` makes that an error rather than quietly doing the wrong thing. * It makes it possible to easily test the `# needs whatever` tags on non-Windows systems (i.e. to test that the things we say are optional are really optional). * On a system where the corresponding libraries happen to be installed, you can speed up the build by disabling the features you aren't currently working on or using. And of course, the defaults are all "auto," and should not change anything for anyone else. I was finally motivated to do this because the doc build fails on my machine, and otherwise I have to edit out the line in `src/meson.build` and be careful not to commit it to all of my PRs. This implementation is the first thing I came up with after a few minutes of reading the docs, but it works surprisingly well. URL: sagemath#40485 Reported by: Michael Orlitzky Reviewer(s): Antonio Rojas, Dima Pasechnik, Michael Orlitzky, Tobias Diez
sagemathgh-40485: meson: explicitly configurable options As discussed in various places over the past two years, it is useful to be able to override the automagic detection of libraries to explicitly enable or disable a feature. This commit adds `meson.options` at the top level to do that, and to make the documentation optional as well. Example: ``` $ meson setup -Dsirocco=disabled ``` will disable the cython module `sage.libs.sirocco`, even if I have sirocco installed. This is nice for a few reasons: * If you are building from source (or using a source-based distro), this is the only way to achieve accurate dependency information. * Now that we are adding meson subprojects, there is again a risk of vendoring libraries that you already have installed if (say) its pkg- config check is flaky. Specifying `-Dfoo=enabled` makes that an error rather than quietly doing the wrong thing. * It makes it possible to easily test the `# needs whatever` tags on non-Windows systems (i.e. to test that the things we say are optional are really optional). * On a system where the corresponding libraries happen to be installed, you can speed up the build by disabling the features you aren't currently working on or using. And of course, the defaults are all "auto," and should not change anything for anyone else. I was finally motivated to do this because the doc build fails on my machine, and otherwise I have to edit out the line in `src/meson.build` and be careful not to commit it to all of my PRs. This implementation is the first thing I came up with after a few minutes of reading the docs, but it works surprisingly well. URL: sagemath#40485 Reported by: Michael Orlitzky Reviewer(s): Antonio Rojas, Dima Pasechnik, Michael Orlitzky, Tobias Diez
sagemathgh-40485: meson: explicitly configurable options As discussed in various places over the past two years, it is useful to be able to override the automagic detection of libraries to explicitly enable or disable a feature. This commit adds `meson.options` at the top level to do that, and to make the documentation optional as well. Example: ``` $ meson setup -Dsirocco=disabled ``` will disable the cython module `sage.libs.sirocco`, even if I have sirocco installed. This is nice for a few reasons: * If you are building from source (or using a source-based distro), this is the only way to achieve accurate dependency information. * Now that we are adding meson subprojects, there is again a risk of vendoring libraries that you already have installed if (say) its pkg- config check is flaky. Specifying `-Dfoo=enabled` makes that an error rather than quietly doing the wrong thing. * It makes it possible to easily test the `# needs whatever` tags on non-Windows systems (i.e. to test that the things we say are optional are really optional). * On a system where the corresponding libraries happen to be installed, you can speed up the build by disabling the features you aren't currently working on or using. And of course, the defaults are all "auto," and should not change anything for anyone else. I was finally motivated to do this because the doc build fails on my machine, and otherwise I have to edit out the line in `src/meson.build` and be careful not to commit it to all of my PRs. This implementation is the first thing I came up with after a few minutes of reading the docs, but it works surprisingly well. URL: sagemath#40485 Reported by: Michael Orlitzky Reviewer(s): Antonio Rojas, Dima Pasechnik, Michael Orlitzky, Tobias Diez
sagemathgh-40485: meson: explicitly configurable options As discussed in various places over the past two years, it is useful to be able to override the automagic detection of libraries to explicitly enable or disable a feature. This commit adds `meson.options` at the top level to do that, and to make the documentation optional as well. Example: ``` $ meson setup -Dsirocco=disabled ``` will disable the cython module `sage.libs.sirocco`, even if I have sirocco installed. This is nice for a few reasons: * If you are building from source (or using a source-based distro), this is the only way to achieve accurate dependency information. * Now that we are adding meson subprojects, there is again a risk of vendoring libraries that you already have installed if (say) its pkg- config check is flaky. Specifying `-Dfoo=enabled` makes that an error rather than quietly doing the wrong thing. * It makes it possible to easily test the `# needs whatever` tags on non-Windows systems (i.e. to test that the things we say are optional are really optional). * On a system where the corresponding libraries happen to be installed, you can speed up the build by disabling the features you aren't currently working on or using. And of course, the defaults are all "auto," and should not change anything for anyone else. I was finally motivated to do this because the doc build fails on my machine, and otherwise I have to edit out the line in `src/meson.build` and be careful not to commit it to all of my PRs. This implementation is the first thing I came up with after a few minutes of reading the docs, but it works surprisingly well. URL: sagemath#40485 Reported by: Michael Orlitzky Reviewer(s): Antonio Rojas, Dima Pasechnik, Michael Orlitzky, Tobias Diez
|
are there meson options allowing to control tools discovery things, e.g. getting pybind11 and cython from a prescribed location, rather than getting whatever found in /usr/bin etc? |
For cython, |
As discussed in various places over the past two years, it is useful to be able to override the automagic detection of libraries to explicitly enable or disable a feature. This commit adds
meson.optionsat the top level to do that, and to make the documentation optional as well.Example:
will disable the cython module
sage.libs.sirocco, even if I have sirocco installed. This is nice for a few reasons:-Dfoo=enabledmakes that an error rather than quietly doing the wrong thing.# needs whatevertags on non-Windows systems (i.e. to test that the things we say are optional are really optional).And of course, the defaults are all "auto," and should not change anything for anyone else.
I was finally motivated to do this because the doc build fails on my machine, and otherwise I have to edit out the line in
src/meson.buildand be careful not to commit it to all of my PRs. This implementation is the first thing I came up with after a few minutes of reading the docs, but it works surprisingly well.