Skip to contentSkip to conversation

libtracefs: Add initial support for meson

PATCH New Daniel Wagner 1 participant 1 message Jan 10, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

Introduce Meson as build framework for building libtracefs.

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

---
v7:
- set default html doc path to share/doc/libtracefs-doc
- list libtraceevent in Required pkg-config section.
- install (any) man5 pages (keep it in sync with other projects)

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
- install sqlhist (because we install the man page too, so why not the tool?)

v4:
- add subdir include path to cflags in pkgconfg file
- refactoring build instruction for section 1 and section 3 documentation into one loop (reduce code duplication)

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/install-docs.sh.in |  20 ++++
 Documentation/meson.build        | 197 +++++++++++++++++++++++++++++++
 include/meson.build              |  11 ++
 meson.build                      |  47 ++++++++
 meson_options.txt                |  16 +++
 samples/extract-example.sh       |   3 +
 samples/meson.build              |  45 +++++++
 src/meson.build                  |  63 ++++++++++
 utest/meson.build                |  17 +++
 9 files changed, 419 insertions(+)
 create mode 100755 Documentation/install-docs.sh.in
 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/install-docs.sh.in new file +20 -0
new file mode 100755
index 000000000000..eca9b1f42dcc
@@ -0,0 +1,20 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2023 Daniel Wagner, SUSE LLC
+
+for section in 1 3 5; 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/meson.build new file +197 -0

197 lines not on this page · raw message

include/meson.build new file +11 -0
new file mode 100644
index 000000000000..52db432c8275
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2023 Daniel Wagner, SUSE LLC
+
+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 +16 -0
new file mode 100644
index 000000000000..1d92c28d5935
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2023 Daniel Wagner, SUSE LLC
+
+option('htmldir', type : 'string', value : 'share/doc/libtracefs-doc',
+       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 +45 -0

45 lines not on this page · raw message

src/meson.build new file +63 -0

63 lines not on this page · raw message

utest/meson.build new file +17 -0
new file mode 100644
index 000000000000..91a526fca2bf
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: LGPL-2.1
+#
+# Copyright (c) 2023 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