mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 08:00:08 +01:00
tools: don't add the debug behavior for release builds
When the meson build type is something other than the debug types, we don't need the special behavior where we adjust executable paths and data dir lookup for tools run directly from the builddir. This avoids leaking the build dir into the final executables. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6be9c3c84e
commit
00fdbe3951
3 changed files with 19 additions and 4 deletions
|
|
@ -31,7 +31,11 @@ add_project_arguments(cppflags, language : 'cpp')
|
||||||
|
|
||||||
config_h = configuration_data()
|
config_h = configuration_data()
|
||||||
config_h.set('_GNU_SOURCE', '1')
|
config_h.set('_GNU_SOURCE', '1')
|
||||||
config_h.set_quoted('MESON_BUILD_ROOT', meson.build_root())
|
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
|
||||||
|
config_h.set_quoted('MESON_BUILD_ROOT', meson.build_root())
|
||||||
|
else
|
||||||
|
config_h.set_quoted('MESON_BUILD_ROOT', '')
|
||||||
|
endif
|
||||||
|
|
||||||
prefix = '''#define _GNU_SOURCE 1
|
prefix = '''#define _GNU_SOURCE 1
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,11 @@ tools_execdir_is_builddir(void)
|
||||||
char *pathsep;
|
char *pathsep;
|
||||||
ssize_t sz;
|
ssize_t sz;
|
||||||
|
|
||||||
|
/* In the case of release builds, the builddir is
|
||||||
|
the empty string */
|
||||||
|
if (streq(MESON_BUILD_ROOT, ""))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
sz = readlink("/proc/self/exe", execdir, sizeof(execdir) - 1);
|
sz = readlink("/proc/self/exe", execdir, sizeof(execdir) - 1);
|
||||||
if (sz <= 0 || sz == sizeof(execdir) - 1)
|
if (sz <= 0 || sz == sizeof(execdir) - 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,15 @@ int main(int argc, char **argv) {
|
||||||
if (streq(mode, "--builddir-is-null")) {
|
if (streq(mode, "--builddir-is-null")) {
|
||||||
assert(builddir == NULL);
|
assert(builddir == NULL);
|
||||||
} else if (streq(mode, "--builddir-is-set")) {
|
} else if (streq(mode, "--builddir-is-set")) {
|
||||||
|
/* In the case of release builds, the builddir is
|
||||||
|
the empty string */
|
||||||
|
if (streq(MESON_BUILD_ROOT, "")) {
|
||||||
|
assert(builddir == NULL);
|
||||||
|
} else {
|
||||||
assert(builddir != NULL);
|
assert(builddir != NULL);
|
||||||
assert(streq(MESON_BUILD_ROOT, builddir));
|
assert(streq(MESON_BUILD_ROOT, builddir));
|
||||||
free(builddir);
|
free(builddir);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue