From 2677bb5f7f808000e8a04e3b8c3193e3faa4de39 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 22 Feb 2023 13:54:23 +0100 Subject: [PATCH] meson: Add equivalent of configure --disable-rpath option --- doc/src/sgml/installation.sgml | 22 +++++++++++++++++++++- meson.build | 16 +++++++++++++--- meson_options.txt | 3 +++ src/makefiles/meson.build | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 0ed35d99e9..6e1087c67f 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -2216,7 +2216,9 @@ Installation Locations different subdirectories may render the installation non-relocatable, meaning you won't be able to move it after installation. (The man and doc locations are - not affected by this restriction.) + not affected by this restriction.) For relocatable installs, you + might want to use the -Drpath=false option + described later. @@ -2856,6 +2858,24 @@ Build Process Details + + + + + Do not mark PostgreSQL's executables + to indicate that they should search for shared libraries in the + installation's library directory (see ). + On most platforms, this marking uses an absolute path to the + library directory, so that it will be unhelpful if you relocate + the installation later. However, you will then need to provide + some other way for the executables to find the shared libraries. + Typically this requires configuring the operating system's + dynamic linker to search the library directory; see + for more detail. + + + + diff --git a/meson.build b/meson.build index f534704452..136a5f8b09 100644 --- a/meson.build +++ b/meson.build @@ -2572,7 +2572,6 @@ default_target_args = { default_lib_args = default_target_args + { 'name_prefix': '', - 'install_rpath': ':'.join(lib_install_rpaths), } internal_lib_args = default_lib_args + { @@ -2583,14 +2582,25 @@ internal_lib_args = default_lib_args + { default_mod_args = default_lib_args + { 'name_prefix': '', 'install_dir': dir_lib_pkg, - 'install_rpath': ':'.join(mod_install_rpaths), } default_bin_args = default_target_args + { 'install_dir': dir_bin, - 'install_rpath': ':'.join(bin_install_rpaths), } +if get_option('rpath') + default_lib_args += { + 'install_rpath': ':'.join(lib_install_rpaths), + } + + default_mod_args += { + 'install_rpath': ':'.join(mod_install_rpaths), + } + + default_bin_args += { + 'install_rpath': ':'.join(bin_install_rpaths), + } +endif # Helper for exporting a limited number of symbols diff --git a/meson_options.txt b/meson_options.txt index 9d3ef4aa20..7d33c9f1d4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -67,6 +67,9 @@ option('extra_version', type : 'string', value: '', option('darwin_sysroot', type : 'string', value: '', description: 'select a non-default sysroot path') +option('rpath', type : 'boolean', value: true, + description: 'whether to embed shared library search path in executables') + # External dependencies diff --git a/src/makefiles/meson.build b/src/makefiles/meson.build index bf7303dc99..5a0032ab0d 100644 --- a/src/makefiles/meson.build +++ b/src/makefiles/meson.build @@ -53,7 +53,7 @@ pgxs_kv = { 'abs_top_srcdir': meson.source_root(), 'enable_thread_safety': 'yes', - 'enable_rpath': 'yes', + 'enable_rpath': get_option('rpath') ? 'yes' : 'no', 'enable_nls': libintl.found() ? 'yes' : 'no', 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no', 'enable_debug': get_option('debug') ? 'yes' : 'no', -- 2.39.2