Bug 315 - Incorrect DESTDIR in Makefile - causing make install to stop when using prefix
Summary: Incorrect DESTDIR in Makefile - causing make install to stop when using prefix
Status: NEW
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: other (show other bugs)
Version: 2.0.0
Hardware: PC Linux
: P5 enhancement
Assignee: Christian Schoenebeck
URL:
Depends on:
Blocks:
 
Reported: 2021-11-23 19:52 CET by Del Vento
Modified: 2021-11-26 13:22 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Del Vento 2021-11-23 19:52:25 CET
When specifying a prefix in the configure, the Makefile should use the DESTDIR and it does for some things, but not for instrument DB which are still attempted to be installed in /var/lib/linuxsampler/instruments.db rather than $prefix/var/lib/linuxsampler/instruments.db

The problem is that DESTDIR is not defined inside the install-data-local Makefile target. One way to fix this is to change


install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

to

install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) DESTDIR="${prefix}" install-exec-am install-data-am

Obviously that needs to happen in autoconf, but for ease of testing and discussing I've edited and I'm discussing the makefile instead.

However that change will break the install-pkgconfigDATA target which will now have the install directory  doubled, since (at least in my environment) $(DESTDIR) and $(pkgconfigdir) contain the same path. As such, my quick hack to get it fixed is to change the install-am target to


install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am
        @$(MAKE) $(AM_MAKEFLAGS) DESTDIR="${prefix}" install-data-local
        @$(MAKE) $(AM_MAKEFLAGS) install-pkgconfigDATA

Of course there are other possible ways to fix this.
Comment 1 Christian Schoenebeck 2021-11-26 13:22:40 CET
The problem with this is that there are two different use cases for DESTDIR: one is your use case, where you just want to install *and* use LS from a different location than the default one,

The other use case is to install LS into a temporary location for the purpose of packaging, where the final installation location for LS must be preserved.

One solution could be adding a separate variable or configure switch for the final instruments DB location vs. its temporary installation directory.