meson: Add equivalent of configure --disable-rpath option

Discussion: https://www.postgresql.org/message-id/flat/33e957e6-4b4e-b0ed-1cc1-6335a24543ff%40enterprisedb.com
This commit is contained in:
Peter Eisentraut 2023-03-01 07:41:02 +01:00
parent 6da67a0c11
commit d2f44cc36e
4 changed files with 39 additions and 5 deletions

View File

@ -2216,7 +2216,9 @@ ninja install
different subdirectories may render the installation non-relocatable,
meaning you won't be able to move it after installation.
(The <literal>man</literal> and <literal>doc</literal> locations are
not affected by this restriction.)
not affected by this restriction.) For relocatable installs, you
might want to use the <literal>-Drpath=false</literal> option
described later.
</para>
<variablelist>
@ -2856,6 +2858,25 @@ ninja install
</listitem>
</varlistentry>
<varlistentry id="configure-rpath-meson">
<term><option>-Drpath={ true | false }</option></term>
<listitem>
<para>
This option is set to true by default. If set to false,
do not mark <productname>PostgreSQL</productname>'s executables
to indicate that they should search for shared libraries in the
installation's library directory (see <option>--libdir</option>).
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
<xref linkend="install-post-shlibs"/> for more detail.
</para>
</listitem>
</varlistentry>
<varlistentry id="configure-binary-name-meson">
<term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
<listitem>

View File

@ -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

View File

@ -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

View File

@ -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',