Skip to content

Commit

Permalink
perfetto: build libperfetto
Browse files Browse the repository at this point in the history
- Mesa has support for perfetto, but the libperfetto library is needed
- Only v27 seems to be supported for now. Update perfetto accordingly
- Make sure perfetto and libperfetto share the same codebase
- Patch meson.build to allow shared build
- Add a version number to avoid having a non symlink so file packaged into dev package.
- Create a PC file for libperfetto to allow mesa to find it using pkgconfig.
- Add nobranch=1 for the git repos to silence warnings about missing default branch

Signed-off-by: Markus Volk <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
MarkusVolk authored and kraj committed Oct 17, 2022
1 parent 5526b77 commit 2c8181a
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From 027f90dc9386ec08f2a5107025683e5fed6f3444 Mon Sep 17 00:00:00 2001
From: Markus Volk <[email protected]>
Date: Mon, 17 Oct 2022 19:20:53 +0200
Subject: [PATCH] meson: add PC file for lib_perfetto

---
meson.build | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 06015141c..752b4d928 100644
--- a/meson.build
+++ b/meson.build
@@ -19,9 +19,12 @@
project(
'perfetto',
['c','cpp'],
- default_options: ['c_std=c99', 'cpp_std=c++11']
+ default_options: ['c_std=c99', 'cpp_std=c++11'],
+ version: '27.1'
)

+soversion = meson.project_version()
+
fs = import('fs')

if not fs.is_dir('sdk')
@@ -30,8 +33,9 @@ endif

dep_threads = dependency('threads')

-lib_perfetto = static_library(
+lib_perfetto = shared_library(
'perfetto',
+ version: soversion,
sources: 'sdk/perfetto.cc',
dependencies: dep_threads,
install: true,
@@ -39,6 +43,10 @@ lib_perfetto = static_library(

inc_perfetto = include_directories('sdk')

+install_headers('sdk/perfetto.h')
+pkg = import('pkgconfig')
+pkg.generate(lib_perfetto)
+
dep_perfetto = declare_dependency(
link_with: lib_perfetto,
include_directories: inc_perfetto,
--
2.34.1

11 changes: 11 additions & 0 deletions meta-oe/recipes-devtools/perfetto/libperfetto.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f87516e0b698007e9e75a1fe1012b390"

require perfetto.inc

inherit meson

SRC_URI:append = " file://0001-meson-add-pc-file-for-lib_perfetto.patch"

FILES:${PN} += "${datadir}"
BBCLASSEXTEND = "native nativesdk"
14 changes: 7 additions & 7 deletions meta-oe/recipes-devtools/perfetto/perfetto.bb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=f87516e0b698007e9e75a1fe1012b390 \
file://debian/copyright;md5=4e08364c82141f181de69d0a2b89d612 \
file://python/LICENSE;md5=c602a632c34ade9c78a976734077bce7"

SRC_URI = "git://github.com/google/perfetto.git;protocol=https;name=perfetto \
SRC_URI:append = " \
git://github.com/protocolbuffers/protobuf.git;branch=3.9.x;protocol=https;destsuffix=git/buildtools/protobuf;name=protobuf \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git;protocol=https;destsuffix=git/buildtools/libcxx;name=libcxx \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git;protocol=https;destsuffix=git/buildtools/libcxxabi;name=libcxxabi \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git;protocol=https;destsuffix=git/buildtools/libunwind;name=libunwind \
git://android.googlesource.com/platform/external/zlib.git;branch=master;protocol=https;destsuffix=git/buildtools/zlib;name=zlib \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git;protocol=https;destsuffix=git/buildtools/libcxx;name=libcxx;nobranch=1 \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git;protocol=https;destsuffix=git/buildtools/libcxxabi;name=libcxxabi;nobranch=1 \
git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git;protocol=https;destsuffix=git/buildtools/libunwind;name=libunwind;nobranch=1 \
git://android.googlesource.com/platform/external/zlib.git;branch=master;protocol=https;destsuffix=git/buildtools/zlib;name=zlib;nobranch=1 \
https://storage.googleapis.com/perfetto/gn-linux64-1968-0725d782;subdir=git/buildtools/;name=gn \
file://0001-Remove-check_build_deps-build-steps.patch "

SRCREV_perfetto = "5bd3f582c075d0d026c5fe0b5e291d34dee0d976"
SRCREV_protobuf = "6a59a2ad1f61d9696092f79b6d74368b4d7970a3"
SRCREV_libcxx = "d9040c75cfea5928c804ab7c235fed06a63f743a"
SRCREV_libcxxabi = "196ba1aaa8ac285d94f4ea8d9836390a45360533"
SRCREV_libunwind = "d999d54f4bca789543a2eb6c995af2d9b5a1f3ed"
SRCREV_zlib = "5c85a2da4c13eda07f69d81a1579a5afddd35f59"
SRC_URI[gn.sha256sum] = "f706aaa0676e3e22f5fc9ca482295d7caee8535d1869f99efa2358177b64f5cd"

require perfetto.inc

DEPENDS += " ninja-native"

COMPATIBLE_HOST = "(i.86|x86_64|aarch64|arm).*-linux*"
Expand All @@ -35,7 +36,6 @@ FILES:${PN}:append = " \
${bindir}/tracebox \
"

S = "${WORKDIR}/git"
B = "${WORKDIR}/build"

CXXFLAGS:append:arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', ' -mfloat-abi=hard', '', d)}"
Expand Down
9 changes: 9 additions & 0 deletions meta-oe/recipes-devtools/perfetto/perfetto.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SUMMARY = "Perfetto - System profiling, app tracing and trace analysis."
HOMEPAGE = "https://github.com/google/perfetto"

SRC_URI = "git://github.com/google/perfetto.git;protocol=https;name=perfetto;nobranch=1"

SRCREV_perfetto = "1c52b5e132312aeb007ed180d4ba1d8d66227923"
PV = "27.1"

S = "${WORKDIR}/git"

0 comments on commit 2c8181a

Please sign in to comment.