0004-meson-Add-dtrace-option.patch
text/plain
Filename: 0004-meson-Add-dtrace-option.patch
Type: text/plain
Part: 3
Patch
Format: format-patch
Series: patch 0004
Subject: meson: Add dtrace option
| File | + | − |
|---|---|---|
| meson.build | 1 | 0 |
| meson_options.txt | 6 | 0 |
| src/include/utils/meson.build | 26 | 8 |
From bf583cd5fdb7fecef8055dfa31ef2334cdd66fa6 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 11 May 2022 09:06:39 +0200
Subject: [PATCH 4/9] meson: Add dtrace option
This currently only works on macOS. The dtrace -G calls needed on
other platforms are not implemented yet. Therefore, the option is not
auto by default.
---
meson.build | 1 +
meson_options.txt | 6 ++++++
src/include/utils/meson.build | 34 ++++++++++++++++++++++++++--------
3 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/meson.build b/meson.build
index a07e25c732..7cb2083936 100644
--- a/meson.build
+++ b/meson.build
@@ -162,6 +162,7 @@ program_lz4 = find_program(get_option('LZ4'), native: true, required: false)
touch = find_program('touch', native: true)
sh = find_program('sh', native: true) # FIXME, should get rid of this
program_zstd = find_program(get_option('ZSTD'), native: true, required: false)
+dtrace = find_program(get_option('DTRACE'), required: get_option('dtrace'))
# Internal programs
testwrap = find_program('src/tools/testwrap', native: true)
diff --git a/meson_options.txt b/meson_options.txt
index f57410fa50..56440f81d0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,6 +50,9 @@ option('extra_lib_dirs', type : 'array', value: [],
# External dependencies
+option('dtrace', type : 'feature', value: 'disabled',
+ description: 'DTrace support')
+
option('gssapi', type : 'feature', value: 'auto',
description: 'GSSAPI support')
@@ -116,6 +119,9 @@ option('zstd', type : 'feature', value: 'auto',
option('BISON', type : 'string', value: 'bison',
description: 'path to bison binary')
+option('DTRACE', type : 'string', value: 'dtrace',
+ description: 'path to dtrace binary')
+
option('FLEX', type : 'string', value: 'flex',
description: 'path to flex binary')
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
index 6e1437f300..152a235b5c 100644
--- a/src/include/utils/meson.build
+++ b/src/include/utils/meson.build
@@ -7,14 +7,32 @@ errcodes = custom_target('errcodes',
)
generated_headers += errcodes
-generated_backend_headers += custom_target('probes.d',
- input: files('../../backend/utils/probes.d'),
- output : 'probes.h',
- capture: true,
- command : [sed, '-f', files('../../backend/utils/Gen_dummy_probes.sed'), '@INPUT@'],
- install: true,
- install_dir: dir_include_server/'utils',
-)
+if dtrace.found()
+ probes_tmp = custom_target('probes.h.tmp',
+ input: files('../../backend/utils/probes.d'),
+ output : 'probes.h.tmp',
+ command : [dtrace, '-C', '-h', '-s', '@INPUT@', '-o', '@OUTPUT@'],
+ )
+ probes = custom_target('probes.h',
+ input: probes_tmp[0],
+ output : 'probes.h',
+ capture: true,
+ command : [sed, '-f', files('../../backend/utils/postprocess_dtrace.sed'), '@INPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
+ )
+else
+ probes = custom_target('probes.h',
+ input: files('../../backend/utils/probes.d'),
+ output : 'probes.h',
+ capture: true,
+ command : [sed, '-f', files('../../backend/utils/Gen_dummy_probes.sed'), '@INPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
+ )
+endif
+
+generated_backend_headers += probes
fmgrtab_target = custom_target('fmgrtab',
input: '../catalog/pg_proc.dat',
--
2.35.1