mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Merge branch 'wip/3v1n0/some-meson-fixmes' into 'main'
meson: Handle various build system FIXME's See merge request GNOME/glib!3012
This commit is contained in:
commit
f6edb52bda
@ -9,9 +9,10 @@ gio_c_args_internal = [
|
|||||||
'-DGIO_COMPILATION',
|
'-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()
|
gnetworking_h_conf = configuration_data()
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ if g_module_impl == 'G_MODULE_IMPL_DL'
|
|||||||
message('Building for MSVC: assuming that symbols are prefixed with underscore')
|
message('Building for MSVC: assuming that symbols are prefixed with underscore')
|
||||||
g_module_need_uscore = 1
|
g_module_need_uscore = 1
|
||||||
elif meson.can_run_host_binaries()
|
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,
|
rres = cc.run(dlopen_dlsym_test_code,
|
||||||
dependencies : libdl_dep,
|
dependencies : libdl_dep,
|
||||||
name : 'dlsym() preceding underscores')
|
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
|
g_module_need_uscore = 1
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
35
meson.build
35
meson.build
@ -704,17 +704,9 @@ foreach f : functions
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# Check that stpcpy() is usable; must use header.
|
# Check that stpcpy() is usable; must use header.
|
||||||
# cc.has_function() in some cases (clang, gcc 10+) assumes that if the
|
# See:
|
||||||
# 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
|
|
||||||
# https://github.com/mesonbuild/meson/issues/5628.
|
# https://github.com/mesonbuild/meson/issues/5628.
|
||||||
# FIXME: Once meson no longer returns success for stpcpy() and
|
if cc.has_function('stpcpy', prefix : '#include <string.h>')
|
||||||
# posix_memalign() on Windows using GCC and clang we can remove this.
|
|
||||||
if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include <string.h>')
|
|
||||||
glib_conf.set('HAVE_STPCPY', 1)
|
glib_conf.set('HAVE_STPCPY', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -941,6 +933,8 @@ endif
|
|||||||
|
|
||||||
dlopen_dlsym_test_code = '''
|
dlopen_dlsym_test_code = '''
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int r;
|
||||||
int glib_underscore_test (void) { return 42; }
|
int glib_underscore_test (void) { return 42; }
|
||||||
int main (int argc, char ** argv) {
|
int main (int argc, char ** argv) {
|
||||||
void *f1 = (void*)0, *f2 = (void*)0, *handle;
|
void *f1 = (void*)0, *f2 = (void*)0, *handle;
|
||||||
@ -949,7 +943,8 @@ int main (int argc, char ** argv) {
|
|||||||
f1 = dlsym (handle, "glib_underscore_test");
|
f1 = dlsym (handle, "glib_underscore_test");
|
||||||
f2 = 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 = []
|
libdl_dep = []
|
||||||
if cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries')
|
if cc.links(dlopen_dlsym_test_code, name : 'dlopen() and dlsym() in system libraries')
|
||||||
@ -2322,11 +2317,21 @@ if want_dtrace
|
|||||||
dtrace_obj_gen = generator(dtrace,
|
dtrace_obj_gen = generator(dtrace,
|
||||||
output : '@BASENAME@.o',
|
output : '@BASENAME@.o',
|
||||||
arguments : ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@'])
|
arguments : ['-G', '-s', '@INPUT@', '-o', '@OUTPUT@'])
|
||||||
# FIXME: $(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES,"
|
dtrace_hdr_gen = generator(python,
|
||||||
# -e "s,define _SDT_HAS_SEMAPHORES 1,undef _SDT_HAS_SEMAPHORES,"
|
|
||||||
dtrace_hdr_gen = generator(dtrace,
|
|
||||||
output : '@BASENAME@.h',
|
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)
|
glib_conf.set('HAVE_DTRACE', 1)
|
||||||
enable_dtrace = true
|
enable_dtrace = true
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user