libtraceevent: Add initial support for meson
Subsystems (2)
PATCH v3 1/1 libtraceevent: Add initial support for meson
Introduce Meson as build framework for building libtraceevent. This lives besides the Makefiles until all the expected initial fallouts have been dealed with.
The build steps are:
# configure using .build as build directory and install destination # /tmp/test meson --prefix=/tmp/libtraceevent .build
# trigger the build ninja -C .build
# install the library ninja -C .build install
In case you want to build/install the documentation the setup is
meson -Ddocs-build=true .build
Signed-off-by Daniel Wagner <[email protected]>
---
v3:
- build documentation
- build samples
- changed default install to /usr/local
v2:
- changed include path exported in pkg-config
exports the same paths as per Makefile
v1:
- initial version
Documentation/list-txt.sh | 6 ++ Documentation/meson.build | 115 +++++++++++++++++++++++++++++++++ include/traceevent/meson.build | 14 ++++ meson.build | 48 ++++++++++++++ meson_options.txt | 20 ++++++ plugins/dynamic_list.sh | 14 ++++ plugins/meson.build | 44 +++++++++++++ samples/meson.build | 11 ++++ src/meson.build | 37 +++++++++++ utest/meson.build | 16 +++++ 10 files changed, 325 insertions(+) create mode 100644 Documentation/list-txt.sh create mode 100644 Documentation/meson.build create mode 100644 include/traceevent/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100755 plugins/dynamic_list.sh create mode 100644 plugins/meson.build create mode 100644 samples/meson.build create mode 100644 src/meson.build create mode 100644 utest/meson.build
Documentation/list-txt.sh new file +6 -0
@@ -0,0 +1,6 @@ +#!/bin/bash + +TXT_PATH=$1 + +ls -1 ${TXT_PATH}/libtraceevent-*.txt +ls -1 ${TXT_PATH}/libtraceevent.txt
Documentation/meson.build new file +115 -0
115 lines not on this page · raw message
include/traceevent/meson.build new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2022 Daniel Wagner, SUSE LLC + +headers = [ + 'event-parse.h', + 'event-utils.h', + 'kbuffer.h', + 'trace-seq.h', +] + +foreach h : headers + install_headers(h, subdir : 'traceevent') +endforeach
meson.build new file +48 -0
48 lines not on this page · raw message
meson_options.txt new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2022 Daniel Wagner, SUSE LLC + +option('plugindir', type : 'string', + description : 'set the plugin dir') +option('docs-build', type : 'boolean', value : false, + description : 'build documentation') +option('htmldir', type : 'string', value : '', + description : 'directory for HTML documentation') +option('asciidoctor', type : 'boolean', value: false, + description : 'use asciidoctor instead of asciidoc') +option('docbook-xls-172', type : 'boolean', value : false, + description : 'enable docbook XLS 172 workaround') +option('asciidoc-no-roff', type : 'boolean', value : false, + description : 'enable no roff workaround') +option('man-bold-literal', type : 'boolean', value : false, + description : 'enable bold literals') +option('docbook-suppress-sp', type : 'boolean', value : false, + description : 'docbook suppress sp')
plugins/dynamic_list.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh +# SPDX-License-Identifier: LGPL-2.1 + +symbol_type=$(nm -u -D $@ | awk 'NF>1 {print $1}' | xargs echo "U w W" | + tr 'w ' 'W\n' | sort -u | xargs echo) + +if [ "$symbol_type" = "U W" ]; then + echo '{' + + nm -u -D $@ | awk 'NF>1 {sub("@.*", "", $2); print "\t"$2";"}' | + sort -u + + echo '};' +fi
plugins/meson.build new file +44 -0
44 lines not on this page · raw message
samples/meson.build new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2022 Daniel Wagner, SUSE LLC + +executable( + 'test-event', + ['test-event.c'], + dependencies: libtraceevent_dep, + include_directories: [incdir] +) +
src/meson.build new file +37 -0
@@ -0,0 +1,37 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2022 Daniel Wagner, SUSE LLC + +sources= [ + 'event-parse-api.c', + 'event-parse.c', + 'event-plugin.c', + 'kbuffer-parse.c', + 'parse-filter.c', + 'parse-utils.c', + 'tep_strerror.c', + 'trace-seq.c', +] + +libtraceevent = library( + 'traceevent', + sources, + version: library_version, + include_directories: [incdir], + install: true, +) + +pkg = import('pkgconfig') +pkg.generate(libtraceevent, + subdirs: 'traceevent', + filebase: meson.project_name(), + name: meson.project_name(), + version: meson.project_version(), + description: 'Manage trace event', + url: 'https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/', +) + +libtraceevent_dep = declare_dependency( + include_directories: ['.'], + link_with: libtraceevent, +)
utest/meson.build new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2022 Daniel Wagner, SUSE LLC + +source = [ + 'trace-utest.c', + 'traceevent-utest.c', +] + +e = executable( + 'trace-utest', + source, + include_directories: [incdir], + dependencies: [libtraceevent_dep, cunit_dep]) + +test('trace-utest', e)
Signature · 1 line
2.39.0