aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-07-15 05:51:45 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2017-07-21 19:40:54 +0300
commite82edc179fe86e68d1f74fe084fd891ef2d12316 (patch)
tree04e2bdbb992f2292a7668831f01d95128f929634
parent2269b7f60b2443aa697a5616fcc3692fa3496046 (diff)
downloadmeson-e82edc179fe86e68d1f74fe084fd891ef2d12316.zip
meson-e82edc179fe86e68d1f74fe084fd891ef2d12316.tar.gz
meson-e82edc179fe86e68d1f74fe084fd891ef2d12316.tar.bz2
Check for manual attempts to set rpath and update docs.
-rw-r--r--docs/markdown/Reference-manual.md1
-rw-r--r--docs/markdown/Release-notes-for-0.42.0.md11
-rw-r--r--mesonbuild/build.py4
-rw-r--r--test cases/linuxlike/7 library versions/meson.build14
4 files changed, 25 insertions, 5 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 82ea5c2..1e3f640 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -243,6 +243,7 @@ Executable supports the following keyword arguments. Note that just like the pos
- `extra_files` are not used for the build itself but are shown as source files in IDEs that group files by targets (such as Visual Studio)
- `install`, when set to true, this executable should be installed
- `install_rpath` a string to set the target's rpath to after install (but *not* before that)
+- `build_rpath` a string to add to target's rpath definition in the build dir, but which will be removed on install
- `install_dir` override install directory for this file. The value is relative to the `prefix` specified. F.ex, if you want to install plugins into a subdir, you'd use something like this: `install_dir : get_option('libdir') + '/projectname-1.0'`.
- `objects` list of prebuilt object files (usually for third party products you don't have source to) that should be linked in this target, **never** use this for object files that you build yourself.
- `name_suffix` the string that will be used as the extension for the target by overriding the default. By default on Windows this is `exe` and on other platforms it is omitted.
diff --git a/docs/markdown/Release-notes-for-0.42.0.md b/docs/markdown/Release-notes-for-0.42.0.md
index 3374d3b..c8a3305 100644
--- a/docs/markdown/Release-notes-for-0.42.0.md
+++ b/docs/markdown/Release-notes-for-0.42.0.md
@@ -65,3 +65,14 @@ A new experimental module to compile code with many different SIMD
instruction sets and selecting the best one at runtime. This module
is unstable, meaning its API is subject to change in later releases.
It might also be removed altogether.
+
+## Added build_rpath keyword argument
+
+You can specify `build_rpath : '/foo/bar'` in build targets and the
+given path will get added to the target's rpath in the build tree. It
+is removed during the install step.
+
+Meson will print a warning when the user tries to add an rpath linker
+flag manually, e.g. via `link_args` to a target. This is not
+recommended because having multiple rpath causes them to stomp on each
+other. This warning will become a hard error in some future release.
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index e1e1a33..99e132d 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -670,6 +670,10 @@ class BuildTarget(Target):
for i in self.link_args:
if not isinstance(i, str):
raise InvalidArguments('Link_args arguments must be strings.')
+ for l in self.link_args:
+ if '-Wl,-rpath' in l or l.startswith('-rpath'):
+ mlog.warning('''Please do not define rpath with a linker argument, use install_rpath or build_rpath properties instead.
+This will become a hard error in a future Meson release.''')
self.process_link_depends(kwargs.get('link_depends', []), environment)
# Target-specific include dirs must be added BEFORE include dirs from
# internal deps (added inside self.add_deps()) to override them.
diff --git a/test cases/linuxlike/7 library versions/meson.build b/test cases/linuxlike/7 library versions/meson.build
index d156eb0..5160947 100644
--- a/test cases/linuxlike/7 library versions/meson.build
+++ b/test cases/linuxlike/7 library versions/meson.build
@@ -32,20 +32,24 @@ out = custom_target('library-dependency-hack',
# Need to add this manually because Meson can't add it automatically because
# it doesn't know that we are linking to libraries in the build directory.
-rpath_arg = '-Wl,-rpath,' + meson.current_build_dir()
+rpath_dir = meson.current_build_dir()
# Manually test if the linker can find the above libraries
# i.e., whether they were generated with the right naming scheme
test('manually linked 1', executable('manuallink1', out,
- link_args : ['-L.', '-lsome', rpath_arg]))
+ link_args : ['-L.', '-lsome'],
+ build_rpath : rpath_dir))
test('manually linked 2', executable('manuallink2', out,
- link_args : ['-L.', '-lnoversion', rpath_arg]))
+ link_args : ['-L.', '-lnoversion'],
+ build_rpath : rpath_dir))
test('manually linked 3', executable('manuallink3', out,
- link_args : ['-L.', '-lonlyversion', rpath_arg]))
+ link_args : ['-L.', '-lonlyversion'],
+ build_rpath : rpath_dir))
test('manually linked 4', executable('manuallink4', out,
- link_args : ['-L.', '-lonlysoversion', rpath_arg]))
+ link_args : ['-L.', '-lonlysoversion'],
+ build_rpath : rpath_dir))
shared_module('module', 'lib.c', install : true)