From e955cd48420abd9fe1067a8fc10c232efd17b94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2022 20:31:45 +0200 Subject: [PATCH 1/4] gio: Install empty glib gio modules dir on install This requires to keep the relative path around not to have to play with paths too much at python level. --- gio/meson.build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gio/meson.build b/gio/meson.build index 5219f606b..9d8f8807c 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -9,9 +9,10 @@ gio_c_args_internal = [ '-DGIO_COMPILATION', ] -gio_includedir = glib_includedir / 'gio' +# Install empty glib_giomodulesdir +install_emptydir(glib_giomodulesdir) -# FIXME: Install empty glib_giomodulesdir +gio_includedir = glib_includedir / 'gio' gnetworking_h_conf = configuration_data() From 4a33e2a17635113156cc46ac7b516ba192f5ad7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2022 20:33:38 +0200 Subject: [PATCH 2/4] meson: Undefine STAP_HAS_SEMAPHORES and _STD_HAS_SEMAPHORES as autotools did --- meson.build | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index e93ed2c8d..e865f1213 100644 --- a/meson.build +++ b/meson.build @@ -2307,11 +2307,21 @@ if want_dtrace dtrace_obj_gen = generator(dtrace, output : '@BASENAME@.o', arguments : ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@']) - # FIXME: $(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," - # -e "s,define _SDT_HAS_SEMAPHORES 1,undef _SDT_HAS_SEMAPHORES," - dtrace_hdr_gen = generator(dtrace, + dtrace_hdr_gen = generator(python, output : '@BASENAME@.h', - arguments : ['-h', '-s', '@INPUT@', '-o', '@OUTPUT@']) + arguments : ['-c', ''' +import subprocess, sys +subprocess.run(sys.argv[1:], check=True) +output = sys.argv[6] +with open(output) as f: + contents = f.read() +contents = contents.replace("define STAP_HAS_SEMAPHORES 1", + "undef STAP_HAS_SEMAPHORES") +contents = contents.replace("define _SDT_HAS_SEMAPHORES 1", + "undef _SDT_HAS_SEMAPHORES") +with open(output, "w") as f: + f.write(contents) +''', dtrace.full_path(), '-h', '-s', '@INPUT@', '-o', '@OUTPUT@']) glib_conf.set('HAVE_DTRACE', 1) enable_dtrace = true endif From 98059d088fa74672a01999ea2105ea9442f05fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2022 20:36:26 +0200 Subject: [PATCH 3/4] gmodule/meson: Use stdout to communicate return value pf dlsym test code --- gmodule/meson.build | 4 ++-- meson.build | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gmodule/meson.build b/gmodule/meson.build index b238e3f9f..3195fdc29 100644 --- a/gmodule/meson.build +++ b/gmodule/meson.build @@ -28,11 +28,11 @@ if g_module_impl == 'G_MODULE_IMPL_DL' message('Building for MSVC: assuming that symbols are prefixed with underscore') g_module_need_uscore = 1 elif meson.can_run_host_binaries() - # FIXME: communicate result via stdout instead of return value, so non-0 return is not printed in bold red rres = cc.run(dlopen_dlsym_test_code, dependencies : libdl_dep, name : 'dlsym() preceding underscores') - if host_system == 'windows' or (rres.compiled() and rres.returncode() == 0) + if host_system == 'windows' or (rres.compiled() and + rres.returncode() == 0 and rres.stdout().to_int() == 0) g_module_need_uscore = 1 endif else diff --git a/meson.build b/meson.build index e865f1213..36950537d 100644 --- a/meson.build +++ b/meson.build @@ -899,6 +899,8 @@ endif dlopen_dlsym_test_code = ''' #include +#include +int r; int glib_underscore_test (void) { return 42; } int main (int argc, char ** argv) { void *f1 = (void*)0, *f2 = (void*)0, *handle; @@ -907,7 +909,8 @@ int main (int argc, char ** argv) { f1 = dlsym (handle, "glib_underscore_test"); f2 = dlsym (handle, "_glib_underscore_test"); } - return (!f2 || f1); + r = (!f2 || f1) ? puts ("1") : puts ("0"); + return r > 0 ? 0 : r; }''' libdl_dep = [] if cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries') From bd2cb39073f34a25e0afeb3aef935ee4ad1bd10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2022 20:43:03 +0200 Subject: [PATCH 4/4] meson: Remove stpcpy() workaround for old meson versions and windows This is now supported by the meson version we depend on. --- meson.build | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 36950537d..3c2b4546b 100644 --- a/meson.build +++ b/meson.build @@ -662,17 +662,9 @@ foreach f : functions endforeach # Check that stpcpy() is usable; must use header. -# cc.has_function() in some cases (clang, gcc 10+) assumes that if the -# compiler provides a builtin of the same name that the function exists, while -# it's in fact not provided by any header or library. This is true for -# stpcpy() on Windows using clang and gcc as well as posix_memalign() using -# gcc on Windows. Skip these checks on Windows for now to avoid false -# positives. See https://github.com/mesonbuild/meson/pull/7116, -# https://github.com/mesonbuild/meson/issues/3672 and +# See: # https://github.com/mesonbuild/meson/issues/5628. -# FIXME: Once meson no longer returns success for stpcpy() and -# posix_memalign() on Windows using GCC and clang we can remove this. -if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include ') +if cc.has_function('stpcpy', prefix : '#include ') glib_conf.set('HAVE_STPCPY', 1) endif