Skip to content
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

build system: Support staged installs via DESTDIR #86

Closed
paulmenzel opened this issue Apr 8, 2021 · 9 comments
Closed

build system: Support staged installs via DESTDIR #86

paulmenzel opened this issue Apr 8, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@paulmenzel
Copy link

Currenty, the variable INSTALL seems to be used as prefix, which for CMake is CMAKE_INSTALL_PREFIX.

# For "make install" and "make uninstall", the default location is
# SuiteSparse/lib, SuiteSparse/include, and
# SuiteSparse/share/doc/suitesparse-x.y.z
# If you do this:
# make install INSTALL=/usr/local
# then the libraries are installed in /usr/local/lib, include files in
# /usr/local/include, and documentation in
# /usr/local/share/doc/suitesparse-x.y.z.
# You can instead specify the install location of each of these 3 components
# separately, via (for example):
# make install INSTALL_LIB=/yada/mylibs INSTALL_INCLUDE=/yoda/myinc \
# INSTALL_DOC=/solo/mydox
# which puts the libraries in /yada/mylibs, include files in /yoda/myinc,
# and documentation in /solo/mydox.
INSTALL ?= $(SUITESPARSE)
INSTALL_LIB ?= $(INSTALL)/lib
INSTALL_INCLUDE ?= $(INSTALL)/include
INSTALL_DOC ?= $(INSTALL)/share/doc/suitesparse-$(SUITESPARSE_VERSION)
#---------------------------------------------------------------------------
# parallel make
#---------------------------------------------------------------------------
# use 8 jobs by default
JOBS ?= 8
CMAKE_OPTIONS ?= -DCMAKE_INSTALL_PREFIX=$(INSTALL)

Packagers often require support for staged installs. From CMake documentation:

On UNIX one can use the DESTDIR mechanism in order to relocate the whole installation. See DESTDIR for more information.

It’d be great, if the install target could be extended to support the variable DESTDIR.

@DrTimothyAldenDavis
Copy link
Owner

DrTimothyAldenDavis commented Apr 8, 2021 via email

@DrTimothyAldenDavis DrTimothyAldenDavis added the enhancement New feature or request label Mar 12, 2022
@kiwifb
Copy link
Contributor

kiwifb commented Dec 7, 2022

I just tested a staged install straight from the tarball with

make global CMAKE_INSTALL_PREFIX=/usr
make install CMAKE_INSTALL_PREFIX=/usr DESTDIR=${somewhere_in_my_home}

and it worked like a charm. I'd say that is pretty much fixed in 6.0.1.

@kiwifb
Copy link
Contributor

kiwifb commented Dec 7, 2022

Actually scratch that, I didn't notice but it didn't use /usr but /usr/local. I probably did not read the instruction properly. Checking.

@kiwifb
Copy link
Contributor

kiwifb commented Dec 7, 2022

It should be

make global CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=/usr"

@DrTimothyAldenDavis
Copy link
Owner

Thanks for the update. I'll close this issue then.

@paulmenzel
Copy link
Author

Probably it was fixed by the update from 5.13.0 to 6.0.0 in commit ad1b089 (to SuiteSparse v6.0.0), where SuiteSparse_config/SuiteSparse_config.mk was removed, and the change-log says:

* major update: using CMake build system for all packages

@DrTimothyAldenDavis
Copy link
Owner

Yes -- the new cmake build system should be doing the right thing for staged installs.

I also have a non-default "local install" option that installs into SuiteSparse/lib, SuiteSparse/include, and SuiteSparse/bin, as a built-in type of staged install. See:

# LOCAL_INSTALL: if true, "make install" will

The default "global install" installs into the CMAKE_INSTALL_PREFIX. Changing that will change where "make install" will install the compiled libraries and include.h files.

@DrTimothyAldenDavis
Copy link
Owner

DESTDIR should also work, since this environment variable modifies CMAKE_INSTALL_PREFIX (but I haven't tried it):

https://cmake.org/cmake/help/latest/envvar/DESTDIR.html#envvar:DESTDIR

@kiwifb
Copy link
Contributor

kiwifb commented Dec 7, 2022

I tested DESTDIR and it behaved as expected for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants