libtraceevent: Add initial support for meson
Subsystems (2)
PATCH v6 1/1 libtraceevent: Add initial support for meson
Introduce Meson as build framework for building libtraceevent.
The build steps are:
# configure using .build as build directory and install destination # /tmp/test meson setup --prefix=/tmp/libtraceevent .build
# trigger the build meson compile -C .build
# In case you want to build the documentation, trigger the
# build via the 'docs' target: meson compile -C build docs
# install the library (and documentation) meson install -C .build
---
v6:
- changed project defaults to --default-library=both
- code style consistency updates
- hardening doc install script (shellcheck)
- renamed install-man.sh.in to install-docs.sh.in
- install-docs.sh.in installs html pages too
- introduces docs target
- updated copyright year
- streamlined documentation meson build file
v5:
- build unit test only if CUnit is found
- default build target is debug
- do not install man pages into subdirs
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/install-docs.sh.in | 20 ++++ Documentation/install-man.sh.in | 15 +++ Documentation/meson.build | 196 +++++++++++++++++++++++++++++++ include/traceevent/meson.build | 14 +++ meson.build | 54 +++++++++ meson_options.txt | 18 +++ plugins/dynamic_list.sh | 11 ++ plugins/meson.build | 44 +++++++ samples/meson.build | 9 ++ src/meson.build | 35 ++++++ utest/meson.build | 16 +++ 11 files changed, 432 insertions(+) create mode 100644 Documentation/install-docs.sh.in create mode 100755 Documentation/install-man.sh.in 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/install-docs.sh.in new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +for section in 1 3; do + while IFS= read -r -d '' man; do + [ ! -d "${DESTDIR}@MANDIR@/man${section}" ] && install -d "${DESTDIR}@MANDIR@/man${section}" + + echo Installing "${man}" to "${DESTDIR}@MANDIR@/man${section}" + install -m 0644 "${man}" "${DESTDIR}@MANDIR@/man${section}/" + done< <(find "@SRCDIR@" -name "*\.${section}" -type f -print0) +done + +while IFS= read -r -d '' html; do + [ ! -d "${DESTDIR}@HTMLDIR@" ] && install -d "${DESTDIR}@HTMLDIR@" + + echo Installing "${html}" to "${DESTDIR}@HTMLDIR@" + install -m 0644 "${html}" "${DESTDIR}@HTMLDIR@" +done< <(find "@SRCDIR@" -name "*\.html" -type f -print0)
Documentation/install-man.sh.in new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/bash + +for man in $(find @SRCDIR@ -name '*\.1' -type f); do + [ ! -d ${DESTDIR}/@MANDIR@/man1/ ] && install -d ${DESTDIR}/@MANDIR@/man1/ + + echo Installing $man to ${DESTDIR}/@MANDIR@/man1/ + install -m 0644 $man ${DESTDIR}/@MANDIR@/man1/ +done + +for man in $(find @SRCDIR@ -name '*\.3' -type f); do + [ ! -d ${DESTDIR}/@MANDIR@/man3/ ] && install -d ${DESTDIR}/@MANDIR@/man3/ + + echo Installing $man to ${DESTDIR}/@MANDIR@/man3/ + install -m 0644 $man ${DESTDIR}/@MANDIR@/man3/ +done
Documentation/meson.build new file +196 -0
196 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) 2023 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 +54 -0
54 lines not on this page · raw message
meson_options.txt new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +option('plugindir', type : 'string', + description : 'set the plugin dir') +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 +11 -0
@@ -0,0 +1,11 @@ +#!/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 +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +executable( + 'test-event', + ['test-event.c'], + dependencies: libtraceevent_dep, + include_directories: [incdir])
src/meson.build new file +35 -0
@@ -0,0 +1,35 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 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) 2023 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 11 lines · On Thu, 5 Jan 2023 13:11:44 +0100 Daniel Wagner <[email protected]> wrote:
Introduce Meson as build framework for building libtraceevent.
The build steps are:
# configure using .build as build directory and install destination # /tmp/test meson setup --prefix=/tmp/libtraceevent .build# trigger the build meson compile -C .build
Quoted 6 lines
# In case you want to build the documentation, trigger the
# build via the 'docs' target: meson compile -C build docs# install the library (and documentation) meson install -C .build
So I followed the above steps, and when I did:
$ ls -l /tmp/libtraceevent total 1108 drwxr-xr-x 3 rostedt rostedt 60 Jan 9 10:49 lib drwxr-xr-x 3 rostedt rostedt 60 Jan 9 10:49 include drwxr-xr-x 3 rostedt rostedt 60 Jan 9 10:49 share -rw-r--r-- 1 rostedt rostedt 23539 Jan 9 10:49 libtraceevent-set_flag.html -rw-r--r-- 1 rostedt rostedt 31026 Jan 9 10:49 libtraceevent-parse-files.html -rw-r--r-- 1 rostedt rostedt 36636 Jan 9 10:49 libtraceevent.html -rw-r--r-- 1 rostedt rostedt 21390 Jan 9 10:49 libtraceevent-cpus.html -rw-r--r-- 1 rostedt rostedt 23962 Jan 9 10:49 libtraceevent-header_page.html -rw-r--r-- 1 rostedt rostedt 21790 Jan 9 10:49 libtraceevent-endian_read.html -rw-r--r-- 1 rostedt rostedt 32679 Jan 9 10:49 libtraceevent-reg_event_handler.html -rw-r--r-- 1 rostedt rostedt 24278 Jan 9 10:49 libtraceevent-event_find.html -rw-r--r-- 1 rostedt rostedt 23586 Jan 9 10:49 libtraceevent-host_endian.html -rw-r--r-- 1 rostedt rostedt 23775 Jan 9 10:49 libtraceevent-handle.html -rw-r--r-- 1 rostedt rostedt 30738 Jan 9 10:49 libtraceevent-tseq.html -rw-r--r-- 1 rostedt rostedt 35979 Jan 9 10:49 libtraceevent-filter.html -rw-r--r-- 1 rostedt rostedt 48365 Jan 9 10:49 libtraceevent-kvm-plugin.html -rw-r--r-- 1 rostedt rostedt 25273 Jan 9 10:49 libtraceevent-event_list.html -rw-r--r-- 1 rostedt rostedt 22342 Jan 9 10:49 libtraceevent-page_size.html -rw-r--r-- 1 rostedt rostedt 37832 Jan 9 10:49 libtraceevent-kbuffer-create.html -rw-r--r-- 1 rostedt rostedt 23697 Jan 9 10:49 libtraceevent-parse_event.html -rw-r--r-- 1 rostedt rostedt 23958 Jan 9 10:49 libtraceevent-event_get.html -rw-r--r-- 1 rostedt rostedt 26292 Jan 9 10:49 libtraceevent-record_parse.html -rw-r--r-- 1 rostedt rostedt 42977 Jan 9 10:49 libtraceevent-kbuffer-timestamp.html -rw-r--r-- 1 rostedt rostedt 22496 Jan 9 10:49 libtraceevent-strerror.html -rw-r--r-- 1 rostedt rostedt 31737 Jan 9 10:49 libtraceevent-func_apis.html -rw-r--r-- 1 rostedt rostedt 46054 Jan 9 10:49 libtraceevent-kbuffer-read.html -rw-r--r-- 1 rostedt rostedt 29118 Jan 9 10:49 libtraceevent-func_find.html -rw-r--r-- 1 rostedt rostedt 28187 Jan 9 10:49 libtraceevent-plugins.html -rw-r--r-- 1 rostedt rostedt 28611 Jan 9 10:49 libtraceevent-field_print.html -rw-r--r-- 1 rostedt rostedt 22167 Jan 9 10:49 libtraceevent-file_endian.html -rw-r--r-- 1 rostedt rostedt 25399 Jan 9 10:49 libtraceevent-fields.html -rw-r--r-- 1 rostedt rostedt 21357 Jan 9 10:49 libtraceevent-long_size.html -rw-r--r-- 1 rostedt rostedt 25549 Jan 9 10:49 libtraceevent-event_print.html -rw-r--r-- 1 rostedt rostedt 21348 Jan 9 10:49 libtraceevent-log.html -rw-r--r-- 1 rostedt rostedt 23701 Jan 9 10:49 libtraceevent-debug.html -rw-r--r-- 1 rostedt rostedt 22353 Jan 9 10:49 libtraceevent-parse_head.html -rw-r--r-- 1 rostedt rostedt 23027 Jan 9 10:49 libtraceevent-field_read.html -rw-r--r-- 1 rostedt rostedt 28251 Jan 9 10:49 libtraceevent-field_get_val.html -rw-r--r-- 1 rostedt rostedt 29720 Jan 9 10:49 libtraceevent-commands.html -rw-r--r-- 1 rostedt rostedt 30686 Jan 9 10:49 libtraceevent-reg_print_func.html -rw-r--r-- 1 rostedt rostedt 27448 Jan 9 10:49 libtraceevent-field_find.html
Is the html files suppose to be there?
-- Steve
Quoted 1 line · Steven Rostedt
Is the html files suppose to be there?
Don't know, I wasn't able to figure out the install path by reading the Makefile. Where should they go?
Quoted 5 lines · On Mon, 9 Jan 2023 17:36:59 +0100 Daniel Wagner <[email protected]> wrote:
Quoted 1 line · Steven Rostedt
Is the html files suppose to be there?
Don't know, I wasn't able to figure out the install path by reading the
Makefile. Where should they go?
After doing an install with the Makefiles:
# ls -l /usr/local/share/doc/libtraceevent-doc/ total 1108 -rw-r--r-- 1 root staff 29720 Jan 9 11:00 libtraceevent-commands.html -rw-r--r-- 1 root staff 21390 Jan 9 11:00 libtraceevent-cpus.html -rw-r--r-- 1 root staff 23701 Jan 9 11:00 libtraceevent-debug.html -rw-r--r-- 1 root staff 21790 Jan 9 11:00 libtraceevent-endian_read.html -rw-r--r-- 1 root staff 24278 Jan 9 11:00 libtraceevent-event_find.html -rw-r--r-- 1 root staff 23958 Jan 9 11:00 libtraceevent-event_get.html -rw-r--r-- 1 root staff 25273 Jan 9 11:00 libtraceevent-event_list.html -rw-r--r-- 1 root staff 25549 Jan 9 11:00 libtraceevent-event_print.html -rw-r--r-- 1 root staff 27448 Jan 9 11:00 libtraceevent-field_find.html -rw-r--r-- 1 root staff 28251 Jan 9 11:00 libtraceevent-field_get_val.html -rw-r--r-- 1 root staff 28611 Jan 9 11:00 libtraceevent-field_print.html -rw-r--r-- 1 root staff 23027 Jan 9 11:00 libtraceevent-field_read.html -rw-r--r-- 1 root staff 25399 Jan 9 11:00 libtraceevent-fields.html -rw-r--r-- 1 root staff 22167 Jan 9 11:00 libtraceevent-file_endian.html -rw-r--r-- 1 root staff 35979 Jan 9 11:00 libtraceevent-filter.html -rw-r--r-- 1 root staff 31737 Jan 9 11:00 libtraceevent-func_apis.html -rw-r--r-- 1 root staff 29118 Jan 9 11:00 libtraceevent-func_find.html -rw-r--r-- 1 root staff 23775 Jan 9 11:00 libtraceevent-handle.html -rw-r--r-- 1 root staff 23962 Jan 9 11:00 libtraceevent-header_page.html -rw-r--r-- 1 root staff 23586 Jan 9 11:00 libtraceevent-host_endian.html -rw-r--r-- 1 root staff 36636 Jan 9 11:00 libtraceevent.html -rw-r--r-- 1 root staff 37832 Jan 9 11:00 libtraceevent-kbuffer-create.html -rw-r--r-- 1 root staff 46054 Jan 9 11:00 libtraceevent-kbuffer-read.html -rw-r--r-- 1 root staff 42977 Jan 9 11:00 libtraceevent-kbuffer-timestamp.html -rw-r--r-- 1 root staff 48365 Jan 9 11:00 libtraceevent-kvm-plugin.html -rw-r--r-- 1 root staff 21348 Jan 9 11:00 libtraceevent-log.html -rw-r--r-- 1 root staff 21357 Jan 9 11:00 libtraceevent-long_size.html -rw-r--r-- 1 root staff 22342 Jan 9 11:00 libtraceevent-page_size.html -rw-r--r-- 1 root staff 23697 Jan 9 11:00 libtraceevent-parse_event.html -rw-r--r-- 1 root staff 31026 Jan 9 11:00 libtraceevent-parse-files.html -rw-r--r-- 1 root staff 22353 Jan 9 11:00 libtraceevent-parse_head.html -rw-r--r-- 1 root staff 28187 Jan 9 11:00 libtraceevent-plugins.html -rw-r--r-- 1 root staff 26292 Jan 9 11:00 libtraceevent-record_parse.html -rw-r--r-- 1 root staff 32679 Jan 9 11:00 libtraceevent-reg_event_handler.html -rw-r--r-- 1 root staff 30686 Jan 9 11:00 libtraceevent-reg_print_func.html -rw-r--r-- 1 root staff 23539 Jan 9 11:00 libtraceevent-set_flag.html -rw-r--r-- 1 root staff 22496 Jan 9 11:00 libtraceevent-strerror.html -rw-r--r-- 1 root staff 30738 Jan 9 11:00 libtraceevent-tseq.html
-- Steve
Quoted 1 line · Steven Rostedt
On Mon, 9 Jan 2023 17:36:59 +0100
After doing an install with the Makefiles:
Quoted 2 lines
# ls -l /usr/local/share/doc/libtraceevent-doc/
Okay, that's easy to fix
meson_options.txt +1 -1
@@ -4,7 +4,7 @@ option('plugindir', type : 'string', description : 'set the plugin dir') -option('htmldir', type : 'string', value : '', +option('htmldir', type : 'string', value : 'share/doc/libtraceevent-doc', description : 'directory for HTML documentation') option('asciidoctor', type : 'boolean', value: false, description : 'use asciidoctor instead of asciidoc')
Is anything which I need to update?