]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: always pass complete path to kmod-symlink.sh
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 22 Oct 2024 20:28:27 +0000 (21:28 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 23 Oct 2024 15:54:41 +0000 (10:54 -0500)
The end-user can provide either relative (to prefix) or an absolute
directory for bindir. Just fold the prefix and bindir with join_path()
which handles this correctly and pass that to kmod-symlink.sh instead of
relying on the MESON_INSTALL_DESTDIR_PREFIX environment variable.

This was previously failing due to trying to create the symlink in the
wrong location:

$ meson setup --prefix /usr --bindir /bin build-gentoo
$ DESTDIR=/tmp/install-gentoo meson install -C build-gentoo/
...
ln: failed to create symbolic link '/tmp/install-gentoo/usr//bin/depmod': No such file or directory
FAILED: install script '/home/ldmartin/p/kmod/scripts/kmod-symlink.sh /bin/depmod' failed with exit code 1.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/205
[ fix typo, add repro ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
meson.build
scripts/kmod-symlink.sh

index c4eb57dd1ffe962ce6b9c1d2e895cc5016f277a7..58acf2eac8e9f3f64dad5fb5c0040099bc1da344 100644 (file)
@@ -186,6 +186,7 @@ features = []
 sysconfdir = get_option('sysconfdir')
 cdata.set_quoted('SYSCONFDIR', sysconfdir)
 
+bindir = join_paths(get_option('prefix'), get_option('bindir'))
 libdir = join_paths(get_option('prefix'), get_option('libdir'))
 
 distconfdir = get_option('distconfdir')
@@ -442,7 +443,7 @@ _tools = [
 kmod_symlink = find_program('scripts/kmod-symlink.sh')
 foreach tool : _tools
   if get_option('tools')
-    symlink = join_paths(get_option('bindir'), tool)
+    symlink = join_paths(bindir, tool)
     meson.add_install_script(kmod_symlink, symlink)
   endif
 endforeach
@@ -493,7 +494,7 @@ summary({
   'distconfdir' : distconfdir,
   'libdir'      : libdir,
   'includedir'  : join_paths(get_option('prefix'), get_option('includedir')),
-  'bindir'      : join_paths(get_option('prefix'), get_option('bindir')),
+  'bindir'      : bindir
 }, section : 'Directories')
 
 summary({
index 1f97bc5153d9774c4a913ad58f89aab0497ca452..6511284a97a65633e3e3b7a8620061cd4b0ea76b 100755 (executable)
@@ -7,4 +7,4 @@ set -euo pipefail
 #
 # For context read through https://github.com/mesonbuild/meson/issues/9
 
-ln -sf kmod "$MESON_INSTALL_DESTDIR_PREFIX/$1"
+ln -sf kmod "$DESTDIR/$1"