Skip to content

[CMake] Make it possible to not create thisroot setup scripts #19211

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

guitargeek
Copy link
Contributor

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:

If 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 to OFF 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.

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:
    NixOS/nixpkgs#241454

If 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 to `OFF` 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.
@guitargeek guitargeek self-assigned this Jun 27, 2025
@guitargeek guitargeek requested a review from bellenot as a code owner June 27, 2025 09:44
@ferdymercury
Copy link
Collaborator

ferdymercury commented Jun 27, 2025

Nice!
Unrelated comment: I also managed to build the doxygen documentation without calling thisroot.sh and without polluting the source folder, as part of the ROOT CMake build or as standalone, see #15160

@guitargeek guitargeek merged commit 3b2ce69 into root-project:master Jun 27, 2025
24 checks passed
@guitargeek guitargeek deleted the thisroot_scripts branch June 27, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] root: make available in pythonPackages and make them work with python.withPackages
3 participants