From: Daniel Wagner <dwagner@suse.de>
To: linux-trace-users@vger.kernel.org
Cc: Daniel Wagner <dwagner@suse.de>
Subject: [RFC v1 2/2] libtracefs: Add initial support for meson
Date: Thu, 7 Jul 2022 14:15:42 +0200 [thread overview]
Message-ID: <20220707121542.28434-2-dwagner@suse.de> (raw)
In-Reply-To: <20220707121542.28434-1-dwagner@suse.de>
Add support for building the project with meson. It's not complete
yet, for example building and installing the documentation is missing.
The rest should work as expected. The only thing I was not really
clear what the purpose is the libtraceevent-dynamic-list which seems
not be used or installed. The meson build will also generate the file
but using the host nm and not the cross tool chain if any is used. I
didn't want to invest too much time figuring out this detail if it is
actually not used.
Obviously, meson is not make and there are some changes in how to use
this build system. The meson documentation is outstanding good and
usually has good tips and tricks to solve problems. But sure there is
learning curve but hopefully not so step.
Anyway, as pure user the build steps are (in source tree builds are
not supported):
# configure using .build as build directory and install destination
# /tmp/test
meson .build --prefix=/tmp/test
# trigger the build
ninja -C .build
# install the library
ninja -C .build install
I am using an alias for 'ninja -C .build' which is called 'ni'. This
makes way more convenient to use.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
include/meson.build | 9 ++++++++
meson.build | 32 +++++++++++++++++++++++++++
src/meson.build | 53 +++++++++++++++++++++++++++++++++++++++++++++
utest/meson.build | 14 ++++++++++++
4 files changed, 108 insertions(+)
create mode 100644 include/meson.build
create mode 100644 meson.build
create mode 100644 src/meson.build
create mode 100644 utest/meson.build
diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 000000000000..1bbfe8afb280
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: LGPL-2.1
+
+headers = [
+ 'tracefs.h',
+]
+
+foreach h : headers
+ install_headers(h, subdir : 'libtracefs')
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..2138d2f149f1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: LGPL-2.1
+
+project(
+ 'libtracefs', ['c'],
+ meson_version: '>= 0.47.0',
+ license: 'LGPL-2.1',
+ version: '1.4.0',
+ default_options: [
+ 'c_std=gnu99',
+ 'buildtype=release',
+ 'prefix=/usr',
+ 'warning_level=1',
+ ]
+)
+
+library_version = meson.project_version()
+
+libtraceevent_dep = dependency('libtraceevent', required: true)
+cunit_dep = dependency('cunit', required : false)
+
+add_project_arguments(
+ [
+ '-D_GNU_SOURCE',
+ ],
+ language : 'c',
+)
+
+incdir = include_directories(['include'])
+
+subdir('src')
+subdir('include')
+subdir('utest')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 000000000000..36d3be359fae
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: LGPL-2.1
+
+sources= [
+ 'tracefs-dynevents.c',
+ 'tracefs-eprobes.c',
+ 'tracefs-events.c',
+ 'tracefs-filter.c',
+ 'tracefs-hist.c',
+ 'tracefs-instance.c',
+ 'tracefs-kprobes.c',
+ 'tracefs-marker.c',
+ 'tracefs-sqlhist.c',
+ 'tracefs-tools.c',
+ 'tracefs-uprobes.c',
+ 'tracefs-utils.c',
+]
+
+flex = find_program('flex', required: true)
+bison = find_program('bison', required: true)
+
+lgen = generator(flex,
+output : '@PLAINNAME@.yy.c',
+arguments : ['-o', '@OUTPUT@', '@INPUT@'])
+
+pgen = generator(bison,
+output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
+arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
+
+lfiles = lgen.process('sqlhist.l')
+pfiles = pgen.process('sqlhist.y')
+
+libtracefs = library(
+ 'tracefs',
+ sources, lfiles, pfiles,
+ version: library_version,
+ dependencies: [libtraceevent_dep],
+ include_directories: [incdir],
+ install: true,
+)
+
+pkg = import('pkgconfig')
+pkg.generate(libtracefs,
+ 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/',
+)
+
+libtracefs_dep = declare_dependency(
+ include_directories: ['.'],
+ link_with: libtracefs,
+)
diff --git a/utest/meson.build b/utest/meson.build
new file mode 100644
index 000000000000..07058afb5f9b
--- /dev/null
+++ b/utest/meson.build
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: LGPL-2.1
+
+source = [
+ 'trace-utest.c',
+ 'tracefs-utest.c',
+]
+
+e = executable(
+ 'trace-utest',
+ source,
+ include_directories: [incdir],
+ dependencies: [libtracefs_dep, libtraceevent_dep, cunit_dep])
+
+test('trace-utest', e)
--
2.36.1
next prev parent reply other threads:[~2022-07-07 12:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 12:15 [RFC v1 1/2] libtracefs: Use explicit libtraceevent include path Daniel Wagner
2022-07-07 12:15 ` Daniel Wagner [this message]
2022-07-07 13:47 ` Steven Rostedt
2022-07-07 14:07 ` Daniel Wagner
2022-07-07 14:26 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220707121542.28434-2-dwagner@suse.de \
--to=dwagner@suse.de \
--cc=linux-trace-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).