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] 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