Skip to content

Install packages in temporary root before copying to $SAGE_LOCAL #22509

@embray

Description

@embray

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 successful make, it can happen. This prevents messy partial installs in the case of a failed make 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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions