]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Improve RPATH handling
authorAndrea Bolognani <abologna@redhat.com>
Wed, 19 Aug 2020 09:15:35 +0000 (11:15 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 24 Aug 2020 10:58:51 +0000 (12:58 +0200)
Right now we're unconditionally adding RPATH information to the
installed binaries and libraries, but that's not always desired.

autotools seem to be smart enough to only include that information
when targeting a non-standard prefix, so most distro packages
don't actually contain it; moreover, both Debian and Fedora have
wiki pages encouraging packagers to avoid setting RPATH:

  https://wiki.debian.org/RpathIssue
  https://fedoraproject.org/wiki/RPath_Packaging_Draft

Implement RPATH logic that Does The Right Thing™ in the most
common cases, while still offering users the ability to override
the default behavior if they have specific needs.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
meson.build
meson_options.txt
src/meson.build
tools/meson.build

index 2846c9b9f297dc22077e1af6151d517c32e9b56a..35e3da6e5599b153d632e3a231a0649c7ba19b47 100644 (file)
@@ -156,6 +156,16 @@ if rc.returncode() == 0
 endif
 
 
+# Add RPATH information when building for a non-standard prefix, or
+# when explicitly requested to do so
+
+if prefix == '/usr' and not get_option('rpath').enabled()
+  libvirt_rpath = ''
+else
+  libvirt_rpath = libdir
+endif
+
+
 # figure out libvirt version strings
 
 arr_version = meson.project_version().split('.')
index c538d323c1eeda8105a3fd1d61c6b92e465274f0..79554c318611ec724af72eccb7a66ce9a978024a 100644 (file)
@@ -6,6 +6,7 @@ option('runstatedir', type: 'string', value: '', description: 'State directory f
 option('expensive_tests', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts), use VIR_TEST_EXPENSIVE to override')
 option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')
 option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
+option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
 
 
 # build dependencies options
index 73ac99f01e04207221a17b43901a2b7ffaca0d1d..d058cec2e475a97a5b568af668ed8ef4c43c66d5 100644 (file)
@@ -454,7 +454,7 @@ libvirt_qemu_lib = shared_library(
     libvirt_qemu_syms_file,
   ],
   install: true,
-  install_rpath: libdir,
+  install_rpath: libvirt_rpath,
   version: libvirt_lib_version,
   soversion: libvirt_so_version,
 )
@@ -510,7 +510,7 @@ libvirt_lxc_lib = shared_library(
     libvirt_lxc_syms_file,
   ],
   install: true,
-  install_rpath: libdir,
+  install_rpath: libvirt_rpath,
   version: libvirt_lib_version,
   soversion: libvirt_so_version,
 )
@@ -554,7 +554,7 @@ libvirt_admin_lib = shared_library(
     libvirt_admin_syms_file,
   ],
   install: true,
-  install_rpath: libdir,
+  install_rpath: libvirt_rpath,
   version: libvirt_lib_version,
   soversion: libvirt_so_version,
 )
@@ -588,7 +588,7 @@ foreach module : virt_modules
     ],
     install: true,
     install_dir: module.get('install_dir', libdir / 'libvirt' / 'connection-driver'),
-    install_rpath: libdir,
+    install_rpath: libvirt_rpath,
   )
   set_variable('@0@_module'.format(module['name'].underscorify()), mod)
 endforeach
@@ -633,7 +633,7 @@ foreach daemon : virt_daemons
     ],
     install: true,
     install_dir: sbindir,
-    install_rpath: libdir,
+    install_rpath: libvirt_rpath,
   )
 endforeach
 
@@ -661,7 +661,7 @@ foreach helper : virt_helpers
     ],
     install: true,
     install_dir: helper.get('install_dir', libexecdir),
-    install_rpath: libdir,
+    install_rpath: libvirt_rpath,
   )
 endforeach
 
index 090179470a5f289be7059170f33b58abbebd9c0c..e18adfa7f2d20035f6801e72015f5c475e807b4d 100644 (file)
@@ -75,7 +75,7 @@ if conf.has('WITH_HOST_VALIDATE')
     ],
     install: true,
     install_dir: bindir,
-    install_rpath: libdir,
+    install_rpath: libvirt_rpath,
   )
 endif
 
@@ -112,7 +112,7 @@ if conf.has('WITH_LOGIN_SHELL')
     ],
     install: true,
     install_dir: libexecdir,
-    install_rpath: libdir,
+    install_rpath: libvirt_rpath,
   )
 
   install_data('virt-login-shell.conf', install_dir: sysconfdir / 'libvirt')
@@ -197,7 +197,7 @@ executable(
   ],
   install: true,
   install_dir: bindir,
-  install_rpath: libdir,
+  install_rpath: libvirt_rpath,
 )
 
 executable(
@@ -219,7 +219,7 @@ executable(
   ],
   install: true,
   install_dir: bindir,
-  install_rpath: libdir,
+  install_rpath: libvirt_rpath,
 )
 
 tools_conf = configuration_data()