Skip to contentSkip to conversation

libtracefs: Add initial support for meson

PATCH Superseded Daniel Wagner 1 participant 2 messages Dec 20, 2022 – Dec 21, 2022

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libtracefs: Add initial support for meson

Introduce Meson as build framework for building libtracefs. 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/libtracefs .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

---
v3:
- build documetation
- build samples
- set default location to /usr/local

v2:
- updated commit message
- dropped the include path patch, the pkg-config from libtraceevent is including them

v1:
- initial version

 Documentation/list-txt.sh  |  11 +++
 Documentation/meson.build  | 149 +++++++++++++++++++++++++++++++++++++
 include/meson.build        |   9 +++
 meson.build                |  47 ++++++++++++
 meson_options.txt          |  18 +++++
 samples/extract-example.sh |   3 +
 samples/meson.build        |  44 +++++++++++
 src/meson.build            |  64 ++++++++++++++++
 utest/meson.build          |  17 +++++
 9 files changed, 362 insertions(+)
 create mode 100644 Documentation/list-txt.sh
 create mode 100644 Documentation/meson.build
 create mode 100644 include/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 samples/extract-example.sh
 create mode 100644 samples/meson.build
 create mode 100644 src/meson.build
 create mode 100644 utest/meson.build
Documentation/list-txt.sh new file +11 -0
new file mode 100644
index 000000000000..d8937243250f
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+SECTION=$1
+TXT_PATH=$2
+
+if [ "$SECTION" = "3" ] ; then
+  ls -1 ${TXT_PATH}/libtracefs-*.txt
+  ls -1 ${TXT_PATH}/libtracefs.txt
+elif [ "$SECTION" = "1" ] ; then
+  ls -1 ${TXT_PATH}/libtracefs-*.txt.1
+fi
Documentation/meson.build new file +149 -0

149 lines not on this page · raw message

include/meson.build new file +9 -0
new file mode 100644
index 000000000000..1bbfe8afb280
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1
+
+headers = [
+   'tracefs.h',
+]
+
+foreach h : headers
+	install_headers(h, subdir : 'libtracefs')
+endforeach
meson.build new file +47 -0

47 lines not on this page · raw message

meson_options.txt new file +18 -0
new file mode 100644
index 000000000000..9bcd66f49f06
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2022 Daniel Wagner, SUSE LLC
+
+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')
samples/extract-example.sh new file +3 -0
new file mode 100644
index 000000000000..c5c0f702e7f0
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+cat $1 | sed -ne '/^EXAMPLE/,/FILES/ { /EXAMPLE/,+2d ; /^FILES/d ;  /^--/d ; p}' > $2
samples/meson.build new file +44 -0

44 lines not on this page · raw message

src/meson.build new file +64 -0

64 lines not on this page · raw message

utest/meson.build new file +17 -0
new file mode 100644
index 000000000000..8c8caf37803d
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2022 Daniel Wagner, SUSE LLC
+
+source = [
+    'trace-utest.c',
+    'tracefs-utest.c',
+]
+
+e = executable(
+   'trace-utest',
+   source,
+   include_directories: [incdir],
+   dependencies: [libtraceevent_dep, cunit_dep],
+   link_with: libtracefs_static)
+
+test('trace-utest', e)
Signature · 1 line
2.39.0
#1 lore raw

src/meson.build line 53

Quoted 2 lines · Daniel Wagner
src/meson.build new file +2 -0
+pkg = import('pkgconfig')
+pkg.generate(libtracefs,

+ subdirs: 'libtracefs',

Forgot to to add this here. with this in place I was able to build a mesonized libtracecmd project

Quoted 6 lines
src/meson.build new file +6 -0
+    filebase: meson.project_name(),
+    name: meson.project_name(),
+    version: meson.project_version(),
+    description: 'Manage trace fs',
+    url: 'https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/',
+)