Skip to content

Commit d2f44cc

Browse files
committed
meson: Add equivalent of configure --disable-rpath option
Discussion: https://www.postgresql.org/message-id/flat/33e957e6-4b4e-b0ed-1cc1-6335a24543ff%40enterprisedb.com
1 parent 6da67a0 commit d2f44cc

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

doc/src/sgml/installation.sgml

+22-1
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,9 @@ ninja install
22162216
different subdirectories may render the installation non-relocatable,
22172217
meaning you won't be able to move it after installation.
22182218
(The <literal>man</literal> and <literal>doc</literal> locations are
2219-
not affected by this restriction.)
2219+
not affected by this restriction.) For relocatable installs, you
2220+
might want to use the <literal>-Drpath=false</literal> option
2221+
described later.
22202222
</para>
22212223

22222224
<variablelist>
@@ -2856,6 +2858,25 @@ ninja install
28562858
</listitem>
28572859
</varlistentry>
28582860

2861+
<varlistentry id="configure-rpath-meson">
2862+
<term><option>-Drpath={ true | false }</option></term>
2863+
<listitem>
2864+
<para>
2865+
This option is set to true by default. If set to false,
2866+
do not mark <productname>PostgreSQL</productname>'s executables
2867+
to indicate that they should search for shared libraries in the
2868+
installation's library directory (see <option>--libdir</option>).
2869+
On most platforms, this marking uses an absolute path to the
2870+
library directory, so that it will be unhelpful if you relocate
2871+
the installation later. However, you will then need to provide
2872+
some other way for the executables to find the shared libraries.
2873+
Typically this requires configuring the operating system's
2874+
dynamic linker to search the library directory; see
2875+
<xref linkend="install-post-shlibs"/> for more detail.
2876+
</para>
2877+
</listitem>
2878+
</varlistentry>
2879+
28592880
<varlistentry id="configure-binary-name-meson">
28602881
<term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
28612882
<listitem>

meson.build

+13-3
Original file line numberDiff line numberDiff line change
@@ -2572,7 +2572,6 @@ default_target_args = {
25722572

25732573
default_lib_args = default_target_args + {
25742574
'name_prefix': '',
2575-
'install_rpath': ':'.join(lib_install_rpaths),
25762575
}
25772576

25782577
internal_lib_args = default_lib_args + {
@@ -2583,14 +2582,25 @@ internal_lib_args = default_lib_args + {
25832582
default_mod_args = default_lib_args + {
25842583
'name_prefix': '',
25852584
'install_dir': dir_lib_pkg,
2586-
'install_rpath': ':'.join(mod_install_rpaths),
25872585
}
25882586

25892587
default_bin_args = default_target_args + {
25902588
'install_dir': dir_bin,
2591-
'install_rpath': ':'.join(bin_install_rpaths),
25922589
}
25932590

2591+
if get_option('rpath')
2592+
default_lib_args += {
2593+
'install_rpath': ':'.join(lib_install_rpaths),
2594+
}
2595+
2596+
default_mod_args += {
2597+
'install_rpath': ':'.join(mod_install_rpaths),
2598+
}
2599+
2600+
default_bin_args += {
2601+
'install_rpath': ':'.join(bin_install_rpaths),
2602+
}
2603+
endif
25942604

25952605

25962606
# Helper for exporting a limited number of symbols

meson_options.txt

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ option('extra_version', type : 'string', value: '',
6767
option('darwin_sysroot', type : 'string', value: '',
6868
description: 'select a non-default sysroot path')
6969

70+
option('rpath', type : 'boolean', value: true,
71+
description: 'whether to embed shared library search path in executables')
72+
7073

7174
# External dependencies
7275

src/makefiles/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pgxs_kv = {
5353
'abs_top_srcdir': meson.source_root(),
5454

5555
'enable_thread_safety': 'yes',
56-
'enable_rpath': 'yes',
56+
'enable_rpath': get_option('rpath') ? 'yes' : 'no',
5757
'enable_nls': libintl.found() ? 'yes' : 'no',
5858
'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
5959
'enable_debug': get_option('debug') ? 'yes' : 'no',

0 commit comments

Comments
 (0)