Add initial support for meson
Subsystems (3)
v6 cover Add initial support for meson
This version brings a few cleanups on the documentation intallation path and pkg-config depenedency updates.
Changes:
v6:
- lib: isntall trace-cmd.h directly in /usr/include and not subdir trace-cmd. kernelshark builds breaks otherwise
v5:
- lib: set default html doc path to share/doc/libtracemd-doc
- lib: list libtraceevent and libtracefs in Required pkg-config section.
- lib: install (any) man5 pages (keep it in sync with other projects)
- trace-cmd: install (any) man5 pages (keep it in sync with other projects)
- trace-cmd: set default html doch patch to share/doc/trace-cmd-doc
v4:
- 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
v3:
- generate tc_version.h file
- lib: cleaning up the standalone build vs trace-cmd build
- s/conf10.set/conf.set10/
- default build target is debug
- do not install man pages into subdirs
v2:
- make audit dependency optional as default
- integrate static libtracecmd build into trace-cmd directly
- remove check-manpages target in trace-cmd
v1:
- initial version
Daniel Wagner (2):
libtracecmd: Add initial support for meson
trace-cmd: Add initial support for meson
Documentation/libtracecmd/install-docs.sh.in | 20 ++ Documentation/libtracecmd/meson.build | 168 +++++++++++++++++ Documentation/trace-cmd/install-docs.sh.in | 20 ++ Documentation/trace-cmd/meson.build | 187 +++++++++++++++++++ lib/Documentation | 1 + lib/check-manpages.sh | 1 + lib/meson.build | 112 +++++++++++ lib/meson_options.txt | 19 ++ lib/trace-cmd/include/meson.build | 5 + lib/trace-cmd/include/private/meson.build | 14 ++ lib/trace-cmd/meson.build | 87 +++++++++ meson-vcs-tag.sh | 17 ++ meson.build | 149 +++++++++++++++ meson_options.txt | 23 +++ python/meson.build | 40 ++++ tracecmd/meson.build | 59 ++++++ utest/meson.build | 26 +++ 17 files changed, 948 insertions(+) create mode 100755 Documentation/libtracecmd/install-docs.sh.in create mode 100644 Documentation/libtracecmd/meson.build create mode 100755 Documentation/trace-cmd/install-docs.sh.in create mode 100644 Documentation/trace-cmd/meson.build create mode 120000 lib/Documentation create mode 120000 lib/check-manpages.sh create mode 100644 lib/meson.build create mode 100644 lib/meson_options.txt create mode 100644 lib/trace-cmd/include/meson.build create mode 100644 lib/trace-cmd/include/private/meson.build create mode 100644 lib/trace-cmd/meson.build create mode 100755 meson-vcs-tag.sh create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 python/meson.build create mode 100644 tracecmd/meson.build create mode 100644 utest/meson.build
Signature · 1 line
2.39.1
PATCH v6 1/2 libtracecmd: Add initial support for meson
Add support for building the project with meson.
As libtracecmd lives in the same source tree as trace-cmd, we have to place the 'top' meson.builld file under lib but we can't reference it from the root meson.build which controlling the main trace-cmd build.
This implies we can't access resources/path which are not below the library's main meson.build directly. Thus, to be able to build the documentation we have to use the symlink as workaround.
--- Documentation/libtracecmd/install-docs.sh.in | 20 +++ Documentation/libtracecmd/meson.build | 168 +++++++++++++++++++ lib/Documentation | 1 + lib/check-manpages.sh | 1 + lib/meson.build | 112 +++++++++++++ lib/meson_options.txt | 19 +++ lib/trace-cmd/include/meson.build | 5 + lib/trace-cmd/include/private/meson.build | 14 ++ lib/trace-cmd/meson.build | 87 ++++++++++ 9 files changed, 427 insertions(+) create mode 100755 Documentation/libtracecmd/install-docs.sh.in create mode 100644 Documentation/libtracecmd/meson.build create mode 120000 lib/Documentation create mode 120000 lib/check-manpages.sh create mode 100644 lib/meson.build create mode 100644 lib/meson_options.txt create mode 100644 lib/trace-cmd/include/meson.build create mode 100644 lib/trace-cmd/include/private/meson.build create mode 100644 lib/trace-cmd/meson.build
Documentation/libtracecmd/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 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/libtracecmd/meson.build new file +168 -0
168 lines not on this page · raw message
lib/Documentation new file +1 -0
@@ -0,0 +1 @@ +../Documentation
lib/check-manpages.sh new file +1 -0
@@ -0,0 +1 @@ +../check-manpages.sh
lib/meson.build new file +112 -0
112 lines not on this page · raw message
lib/meson_options.txt new file +19 -0
@@ -0,0 +1,19 @@ +# -*- mode: meson -*- +# SPDX-License-Identifier: LGPL-2.1 + +option('vsock', type : 'boolean', value : true, + description : 'build with vsock support') +option('ptrace', type : 'boolean', value : true, + description : 'build with ptrace support') +option('htmldir', type : 'string', value : 'share/doc/libtracecmd-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')
lib/trace-cmd/include/meson.build new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +libtracecmd_incdir = include_directories(['.'])
lib/trace-cmd/include/private/meson.build new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: LGPL-2.1 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +config_h = configure_file( + output: 'config.h', + configuration: conf +) + +libtracecmd_private_incdir = include_directories(['.']) + +config_dep = declare_dependency( + include_directories : libtracecmd_private_incdir, + sources: config_h)
lib/trace-cmd/meson.build new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.39.1
PATCH v6 2/2 trace-cmd: Add initial support for meson
In reply to Daniel WagnerAdd support for building the project with meson.
trace-cmd depends on a statically linked libtracecmd (e.g. trace_perf_open, trace_perf_close, trace_perf_init).
Instead depending libtracecmd to be compiled and installed separately add libtracecmd directly to trace-cmd build. This avoids an additional step.
We still are able to build libtracecmd as stand alone project. The top meson.build file just lives in the lib directory.
--- Documentation/trace-cmd/install-docs.sh.in | 20 +++ Documentation/trace-cmd/meson.build | 187 +++++++++++++++++++++ meson-vcs-tag.sh | 17 ++ meson.build | 149 ++++++++++++++++ meson_options.txt | 23 +++ python/meson.build | 40 +++++ tracecmd/meson.build | 59 +++++++ utest/meson.build | 26 +++ 8 files changed, 521 insertions(+) create mode 100755 Documentation/trace-cmd/install-docs.sh.in create mode 100644 Documentation/trace-cmd/meson.build create mode 100755 meson-vcs-tag.sh create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 python/meson.build create mode 100644 tracecmd/meson.build create mode 100644 utest/meson.build
Documentation/trace-cmd/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 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/trace-cmd/meson.build new file +187 -0
187 lines not on this page · raw message
meson-vcs-tag.sh new file +17 -0
@@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later + +set -eu +set -o pipefail + +dir="${1:?}" +fallback="${2:?}" + +# Apparently git describe has a bug where it always considers the work-tree +# dirty when invoked with --git-dir (even though 'git status' is happy). Work +# around this issue by cd-ing to the source directory. +cd "$dir" +# Check that we have either .git/ (a normal clone) or a .git file (a work-tree) +# and that we don't get confused if a tarball is extracted in a higher-level +# git repository. +[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
meson.build new file +149 -0
149 lines not on this page · raw message
meson_options.txt new file +23 -0
@@ -0,0 +1,23 @@ +# -*- mode: meson -*- +# SPDX-License-Identifier: GPL-2.0 + +option('version-tag', type : 'string', + description : 'override the git version string') +option('vsock', type : 'boolean', value : true, + description : 'build with vsock support') +option('ptrace', type : 'boolean', value : true, + description : 'build with ptrace support') +option('htmldir', type : 'string', value : 'share/doc/trace-cmd-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') +option('python', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'Generate trac-cmd Python bindings')
python/meson.build new file +40 -0
@@ -0,0 +1,40 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +want_python = get_option('python') +if want_python != 'false' + python3 = import('python').find_installation('python3') + py3_dep = python3.dependency(required: want_python == 'true') + swig = find_program('swig', required: want_python == 'true') + header_found = cc.has_header('Python.h', dependencies: py3_dep) + have_python_support = py3_dep.found() and swig.found() and header_found +else + have_python_support = false +endif + +if have_python_support + pymod_swig = custom_target( + 'ctracecmd.py', + input: ['ctracecmd.i'], + output: ['ctracecmd.py', 'ctracecmd_wrap.c'], + command: [ + swig, + '-python', + '-I' + meson.current_source_dir() + '/../include/trace-cmd', + '-I' + libtraceevent_dep.get_pkgconfig_variable('prefix') + '/include/traceevent', + '-o', '@OUTPUT1@', + '@INPUT0@'], + install: true, + install_dir: [ python3.get_install_dir(pure: false, subdir: 'trace-cmd'), false]) + + incdir_py = include_directories(['.', '../include/trace-cmd']) + + pyctracecmd_clib = python3.extension_module( + '_ctracecmd', + pymod_swig[1], + dependencies : [libtraceevent_dep, libtracefs_dep, py3_dep], + include_directories: [incdir, incdir_py], + install: true, + subdir: 'trace-cmd') +endif
tracecmd/meson.build new file +59 -0
59 lines not on this page · raw message
utest/meson.build new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2023 Daniel Wagner, SUSE LLC + +sources = [ + 'tracecmd-utest.c', + 'trace-utest.c', +] + +e = executable( + 'trace-utest', + sources, + include_directories: [ + incdir, + libtracecmd_incdir, + libtracecmd_private_incdir, + libtracecmd_ext_incdir], + dependencies: [ + libtraceevent_dep, + libtracefs_dep, + zlib_dep, + libzstd_dep, + cunit_dep], + link_with: [static_libtracecmd]) + +test('trace-utest', e)
Signature · 1 line
2.39.1
Quoted 8 lines · Daniel Wagner
This version brings a few cleanups on the documentation intallation path and pkg-config depenedency updates.
Changes:
v6:
- lib: isntalltrace-cmd.hdirectly in/usr/includeand not subdir trace-cmd. kernelshark builds breaks otherwise
No, this is not the real problem. The Makefile also installs it under /usr/include/trace-cmd.
Quoted 4 lines · On Tue, 7 Feb 2023 14:48:25 +0100 Daniel Wagner <[email protected]> wrote:
Quoted 3 lines · Daniel Wagner
This version brings a few cleanups on the documentation intallation path and pkg-config depenedency updates.
Quoted 8 lines
Quoted 5 lines
Changes:
v6:
- lib: isntalltrace-cmd.hdirectly in/usr/includeand not subdir trace-cmd. kernelshark builds breaks otherwiseNo, this is not the real problem. The
Makefilealso installs it under/usr/include/trace-cmd.
But pkg-config --cflags libtracecmd should give the right path:
-I/usr/include/trace-cmd -I/usr/include/tracefs -I/usr/include/traceevent
This is the way it's always been. Why are your kernelshark builds breaking?
-- Steve
Quoted 13 lines · Steven Rostedt
Quoted 10 lines · On Tue, 7 Feb 2023 14:48:25 +0100 Daniel Wagner <[email protected]> wrote:
Quoted 8 lines · Daniel Wagner
This version brings a few cleanups on the documentation intallation path and pkg-config depenedency updates.
Changes:
v6:
- lib: isntalltrace-cmd.hdirectly in/usr/includeand not subdir trace-cmd. kernelshark builds breaks otherwise
Quoted 8 lines
Quoted 2 lines
No, this is not the real problem. The
Makefilealso installs it under/usr/include/trace-cmd.But
pkg-config --cflags libtracecmdshould give the right path:-I/usr/include/trace-cmd -I/usr/include/tracefs -I/usr/include/traceevent
This is the way it's always been. Why are your kernelshark builds breaking?
Not sure what's happening. I've build and installed the library with make and the kernelshark configuration step still fails. I see the following output (make and meson):
$ cmake -S . -B foo --debug-find Running with debug output on for the `find` commands.
project: Kernel Shark: (version: 2.1.1)
CMake Debug Log at build/FindTraceEvent.cmake:39 (find_package):
find_package considered the following paths for FindPkgConfig.cmake:
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindPkgConfig.cmake
The file was found at
/usr/share/cmake/Modules/FindPkgConfig.cmake
Call Stack (most recent call first):
CMakeLists.txt:48 (find_package)
CMake Debug Log at CMakeLists.txt:48 (find_package):
find_package considered the following paths for FindTraceEvent.cmake:
/usr/share/cmake/Modules/FindTraceEvent.cmake
The file was found at
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindTraceEvent.cmake
CMake Debug Log at build/FindTraceFS.cmake:39 (find_package):
find_package considered the following paths for FindPkgConfig.cmake:
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindPkgConfig.cmake
The file was found at
/usr/share/cmake/Modules/FindPkgConfig.cmake
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
CMake Debug Log at CMakeLists.txt:49 (find_package):
find_package considered the following paths for FindTraceFS.cmake:
/usr/share/cmake/Modules/FindTraceFS.cmake
The file was found at
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindTraceFS.cmake
CMake Debug Log at build/FindTraceCmd.cmake:39 (find_package):
find_package considered the following paths for FindPkgConfig.cmake:
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindPkgConfig.cmake
The file was found at
/usr/share/cmake/Modules/FindPkgConfig.cmake
Call Stack (most recent call first):
CMakeLists.txt:50 (find_package)
CMake Debug Log at build/FindTraceCmd.cmake:45 (find_path):
find_path called with the following settings:
VAR: TraceCmd_INCLUDE_DIR
NAMES: "trace-cmd.h"
Documentation: Path to a file.
Framework
Only Search Frameworks: 0
Search Frameworks Last: 0
Search Frameworks First: 0
AppBundle
Only Search AppBundle: 0
Search AppBundle Last: 0
Search AppBundle First: 0
CMAKE_FIND_USE_CMAKE_PATH: 1
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
CMAKE_FIND_USE_INSTALL_PREFIX: 1
find_path considered the following locations:
/usr/local/include/trace-cmd/trace-cmd.h
/usr/include/libtracefs/trace-cmd.h
/usr/include/traceevent/trace-cmd.h
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/trace-cmd.h
/home/wagi/bin/trace-cmd.h
/home/wagi/.local/bin/trace-cmd.h
/home/wagi/node_modules/.bin/trace-cmd.h
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/usr/local/bin/trace-cmd.h
/usr/local/bin/trace-cmd.h
/usr/bin/trace-cmd.h
/bin/trace-cmd.h
/usr/local/include/trace-cmd.h
/usr/local/trace-cmd.h
/usr/include/trace-cmd.h
/usr/trace-cmd.h
/include/trace-cmd.h
/usr/X11R6/include/trace-cmd.h
/usr/X11R6/trace-cmd.h
/usr/pkg/include/trace-cmd.h
/usr/pkg/trace-cmd.h
/opt/include/trace-cmd.h
/opt/trace-cmd.h
/usr/include/X11/trace-cmd.hThe item was not found.
Call Stack (most recent call first):
CMakeLists.txt:50 (find_package)
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find TraceCmd (missing: TraceCmd_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) build/FindTraceCmd.cmake:57 (find_package_handle_standard_args) CMakeLists.txt:50 (find_package)
CMake Debug Log at CMakeLists.txt:50 (find_package):
find_package considered the following paths for FindTraceCmd.cmake:
/usr/share/cmake/Modules/FindTraceCmd.cmake
The file was found at
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/build/FindTraceCmd.cmake
-- Configuring incomplete, errors occurred!
See also "/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/foo/CMakeFiles/CMakeOutput.log".
Quoted 3 lines · On Tue, 7 Feb 2023 16:45:46 +0100 Daniel Wagner <[email protected]> wrote:
find_pathconsidered the following locations:
/usr/local/include/trace-cmd/trace-cmd.h
If you run "pkg-config --cflags libtracecmd" what output does it give you?
-- Steve
Quoted 22 lines
/usr/include/libtracefs/trace-cmd.h
/usr/include/traceevent/trace-cmd.h
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/trace-cmd.h
/home/wagi/bin/trace-cmd.h
/home/wagi/.local/bin/trace-cmd.h
/home/wagi/node_modules/.bin/trace-cmd.h
/home/wagi/work/osc/home:wagi:branches:devel:trace/kernelshark/kernel-shark/usr/local/bin/trace-cmd.h
/usr/local/bin/trace-cmd.h
/usr/bin/trace-cmd.h
/bin/trace-cmd.h
/usr/local/include/trace-cmd.h
/usr/local/trace-cmd.h
/usr/include/trace-cmd.h
/usr/trace-cmd.h
/include/trace-cmd.h
/usr/X11R6/include/trace-cmd.h
/usr/X11R6/trace-cmd.h
/usr/pkg/include/trace-cmd.h
/usr/pkg/trace-cmd.h
/opt/include/trace-cmd.h
/opt/trace-cmd.h
/usr/include/X11/trace-cmd.hQuoted 21 lines · Daniel Wagner
Quoted 20 lines · Steven Rostedt
Quoted 4 lines · On Tue, 7 Feb 2023 14:48:25 +0100 Daniel Wagner <[email protected]> wrote:
Quoted 3 lines · Daniel Wagner
This version brings a few cleanups on the documentation intallation path and pkg-config depenedency updates.
Quoted 8 lines
Quoted 5 lines
Changes:
v6:
- lib: isntalltrace-cmd.hdirectly in/usr/includeand not subdir trace-cmd. kernelshark builds breaks otherwiseNo, this is not the real problem. The
Makefilealso installs it under/usr/include/trace-cmd.But
pkg-config --cflags libtracecmdshould give the right path:-I/usr/include/trace-cmd -I/usr/include/tracefs -I/usr/include/traceevent
Quoted 8 lines
Quoted 1 line
This is the way it's always been. Why are your kernelshark builds breaking?
Not sure what's happening. I've build and installed the library with make and the kernelshark configuration step still fails. I see the following output (make and meson):
$ cmake -S . -B foo --debug-find Running with debug output on for the `find` commands.
There is something wierd going with the libtracecmd build in our build system. It produces a libtrace-cmd.pc and not a libtracecmd.pc file but this was with the v2 version of the meson patches. Doesn't happen with libtracecmd v5.
In short, just ignore v6.
On Tue, Feb 07, 2023 at 05:19:47PM +0100, Daniel Wagner wrote:
There is something wierd going with the libtracecmd build in our build system.
Quoted 2 lines
It produces a libtrace-cmd.pc and not a libtracecmd.pc file but this was with the v2 version of the meson patches. Doesn't happen with libtracecmd v5.
Finally found the problem in build setup. The generated pkg-config file doesn't include the trace-cmd subdir. I'll send an update on this patches.