libtraceevent: Add initial support for meson
Subsystems (2)
PATCH v4 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
---
v4:
- install man pages to correct section, in this case 3
- run check-doc when building the docs
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 | 53 +++++++++++++++ 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, 330 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 +53 -0
53 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
Quoted 16 lines · Daniel Wagner
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
Quoted 8 lines
In case you want to build/install the documentation the setup is
meson -Ddocs-build=true .build
Signed-off-by Daniel Wagner <[email protected]>---
v4:
- install man pages to correct section, in this case 3
During my packaging attempt I found out that the man pages are installed into subdirs. So I started to look into the this and ... let's say it's complicated.
For example libtraceevent-func_apis.txt list a few function which are also listed in libtraceevent-func_find.txt. The Makefile uses these function as build names but, if we have two targets with the same name one will overwrite the other. make seems to tolerate something like this. Meson doesn't.
I am playing with various ideas how we could handle this. Currently, I think the best way is to distinguish the different source txt files. So we have files which are for generating a mans per function (1:n) and we have txt files which are general documentation (1:1).
Quoted 3 lines · On Sat, 24 Dec 2022 16:32:25 +0100 Daniel Wagner <[email protected]> wrote:
During my packaging attempt I found out that the man pages are installed into subdirs. So I started to look into the this and ... let's say it's complicated.
Oh, to make your life easier. That shouldn't happen.
Quoted 6 lines
For example libtraceevent-func_apis.txt list a few function which are also listed in libtraceevent-func_find.txt. The
Makefileuses these function as build names but, if we have two targets with the same name one will overwrite the other. make seems to tolerate something like this. Meson doesn't.
That's actually a mistake :-/
The asciidoc complains whenever a man page has more than 9 functions described, so I have to break them up when I add more related APIs.
I probably missed removing some of the old functions when I did that here.
Quoted 5 lines
I am playing with various ideas how we could handle this. Currently, I think the best way is to distinguish the different source txt files. So we have files which are for generating a mans per function (1:n) and we have txt files which are general documentation (1:1).
The real fix is to remove the tep_find_function() and tep_find_function_address() from libtraceevent-func_apis.txt.
-- Steve
Quoted 8 lines · Steven Rostedt
Quoted 3 lines · On Sat, 24 Dec 2022 16:32:25 +0100 Daniel Wagner <[email protected]> wrote:
During my packaging attempt I found out that the man pages are installed into subdirs. So I started to look into the this and ... let's say it's complicated.
Oh, to make your life easier. That shouldn't happen.
To be honest most of the Meson stuff was pretty easy to get sorted out. Generating documentation seems to be a good source of troubles. I had also headache to sort this out for libnvme/nvme-cli.
Quoted 6 lines
Quoted 5 lines
For example libtraceevent-func_apis.txt list a few function which are also listed in libtraceevent-func_find.txt. The
Makefileuses these function as build names but, if we have two targets with the same name one will overwrite the other. make seems to tolerate something like this. Meson doesn't.
Quoted 7 lines
That's actually a mistake :-/
The asciidoc complains whenever a man page has more than 9 functions described, so I have to break them up when I add more related APIs.
I probably missed removing some of the old functions when I did that here.
Ah, that explains it.
Quoted 7 lines
Quoted 4 lines
I am playing with various ideas how we could handle this. Currently, I think the best way is to distinguish the different source txt files. So we have files which are for generating a mans per function (1:n) and we have txt files which are general documentation (1:1).
The real fix is to remove the
tep_find_function()andtep_find_function_address()from libtraceevent-func_apis.txt.
Right, let me add this fix then.
Anyway, I got a new version almost ready. I try to package it with the current version, verifying I got it sorted out.