[CMake] Make it possible to not create thisroot
setup scripts
#19211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The setup scripts like
thisroot.sh
and friends are disliked by packagers because they mutate the environemnt variables, which are carefully controlled by many package managers.Here some examples of package definitions that explicitly make an effort to remove these scripts:
Arch Linux: https://gitlab.archlinux.org/archlinux/packaging/packages/root/-/blob/main/PKGBUILD?ref_type=heads#L281
Conda: https://github.com/conda-forge/root-feedstock/blob/3dfe4c8caf3b9fb8715ed498bc2072ef492ab2d1/recipe/build_root.sh#L490
Nix will follow soon now that this issue is fixed: [feature request] root: make available in pythonPackages and make them work with
python.withPackages
NixOS/nixpkgs#241454If we make
pip install root
work, we probably also don't need them.And when using ROOT from LCG or
cmsenv
, one doesn't need these scripts either.So very often, the setup scripts are not needed or should even not be used, and having them present ist just confusing to the user. This commit therefore suggests a new
thisroot_scripts
built option that can be set toOFF
if you don't need these scripts.By the way the scripts are also a bit fragile to the build configuration. For example as soon as one manually specifies
CMAKE_INSTALL_PYTHONDIR
to be different from the default, they don't work anymore because they assume the Python install directory will always be the library install directory.