SuiteSparse icon indicating copy to clipboard operation
SuiteSparse copied to clipboard

build system: Support staged installs via `DESTDIR`

Open paulmenzel opened this issue 3 years ago • 1 comments

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

https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/257b2ba2a5b40b893bff203626331b4b9c96d681/SuiteSparse_config/SuiteSparse_config.mk#L60-L86

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.

paulmenzel avatar Apr 08 '21 13:04 paulmenzel

Yes, this is something I plan on doing, as part of my migration to cmake.

On Thu, Apr 8, 2021 at 8:44 AM Paul Menzel @.***> wrote:

Assigned #86 https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/86 to @DrTimothyAldenDavis https://github.com/DrTimothyAldenDavis.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/86#event-4568779179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYIIOOEAS7F4CKUTA2IDGTTHWXKXANCNFSM42S5T6GQ .

DrTimothyAldenDavis avatar Apr 08 '21 14:04 DrTimothyAldenDavis

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 avatar Dec 07 '22 20:12 kiwifb

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 avatar Dec 07 '22 20:12 kiwifb

It should be

make global CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=/usr"

kiwifb avatar Dec 07 '22 20:12 kiwifb

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

DrTimothyAldenDavis avatar Dec 07 '22 21:12 DrTimothyAldenDavis

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

https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/d42beebdcc6b98c7fb2f7f2927f32c19e0f602d0/ChangeLog#L3

paulmenzel avatar Dec 07 '22 22:12 paulmenzel

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:

https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/4faadddd6d373e1b85f567dc034e9eb9733247c7/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake#L26

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 avatar Dec 07 '22 22:12 DrTimothyAldenDavis

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

DrTimothyAldenDavis avatar Dec 07 '22 22:12 DrTimothyAldenDavis

I tested DESTDIR and it behaved as expected for me.

kiwifb avatar Dec 07 '22 22:12 kiwifb