-
-
Notifications
You must be signed in to change notification settings - Fork 656
Description
Currently we build packages, in most cases, by setting --prefix=$SAGE_LOCAL
(in ./configure
, or the equivalent in non-autoconf packages), and then installing directly to that prefix.
This is fine to keep as is. But with automake packages we can also set DESTDIR
(https://www.gnu.org/software/automake/manual/html_node/DESTDIR.html#DESTDIR) to an alternative (typically temporary) directory into which to install. This has a couple advantages:
-
Although it's not as usual for
make install
to fail after a successfulmake
, it can happen. This prevents messy partial installs in the case of a failedmake install
run. -
It gives us the opportunity to make an exact list of the files that were installed. This is a prerequisite to improving package uninstallation/reinstallation in sage-dist (see Enhanced package uninstallation for Sage spkgs #22510).
This is also standard operating procedure in most other packaging systems, so it would be good for Sage to adopt too. The general approach is the same as that used for converting an arbitrary Makefile to support this convention--everywhere a file is installed, prefix the installation path with $(DESTDIR)
(or in this case a variable we'll call $SAGE_DESTDIR
).
For packages that already support the DESTDIR
convention, then, we pass DESTDIR=$SAGE_DESTDIR
to make install
. It is also already possible for Python packages (e.g. pip install --root
).
Since the introduction of the build helper scripts in #23160, it makes the most sense to make these changes directly in the helper scripts, and then update more packages to use those helper scripts where possible.
Dependent tickets:
- Install packages in temporary root before copying to $SAGE_LOCAL (simplified) #24106 - implement the basic functionality of supporting staged installs through
sage-spkg
- Meta-ticket: Update other packages to using the sage-dist-helpers functions + DESTDIR where applicable #24024 - update more
spkg-build/install
scripts to use thesdh_
helper functions, since that is the fastest way to addDESTDIR
support for many packages. - Add support for staged installations in packages that use sdh_pip_install #24646 - add support for
--root=${SAGE_DESTDIR}
to Python spkgs - Support for spkg-postinst scripts #24645 - add support for post-install scripts; this can be useful for cases where, for example, local files are generated after the package is installed, or to handle cases where one file is shared by multiple packages and needs to be updated when a package that uses it is installed (see e.g. #22510 comment:5)
- #????? - convert all spkgs to support staged-install; for many packages this can be covered by using the helper functions, but some packages require additional steps; in particular, packages that have files that are manually copied into
$SAGE_LOCAL
, rather than through a standard installer
Depends on #23059
Depends on #23096
Depends on #23160
Depends on #23781
CC: @mkoeppe
Component: build
Author: Erik Bray
Branch/Commit: u/embray/build/destdir @ c1d5453
Issue created by migration from https://trac.sagemath.org/ticket/22509