-
Notifications
You must be signed in to change notification settings - Fork 813
Add recipe for Perfetto #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
meta-oe/recipes-devtools/perfetto/files/0001-Remove-check_build_deps-build-steps.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| From 3b7091243ec03054ca8800b51b85a1c09e7e3075 Mon Sep 17 00:00:00 2001 | ||
| From: Sui Chen <[email protected]> | ||
| Date: Mon, 13 Jun 2022 17:46:49 +0000 | ||
| Subject: [PATCH] Remove "check_build_deps" build steps | ||
|
|
||
| When building with Bitbake, we want Bitbake to manage our dependencies, | ||
| so we remove the "check_build_deps" steps from Perfetto. | ||
|
|
||
| Also setting "is_cross_compiling" to true, so that the host-side tools | ||
| (such as protoc) will always be generated using the native toolchain, | ||
| rather than the Bitbake-generated one. | ||
|
|
||
| Signed-off-by: Sui Chen <[email protected]> | ||
| --- | ||
| gn/BUILD.gn | 1 - | ||
| gn/standalone/BUILD.gn | 12 ++++++------ | ||
| gn/standalone/BUILDCONFIG.gn | 5 +++-- | ||
| 3 files changed, 9 insertions(+), 9 deletions(-) | ||
|
|
||
| diff --git a/gn/BUILD.gn b/gn/BUILD.gn | ||
| index 8a7ca72a8..e4a2d39f0 100644 | ||
| --- a/gn/BUILD.gn | ||
| +++ b/gn/BUILD.gn | ||
| @@ -111,7 +111,6 @@ group("default_deps") { | ||
| deps = [ ":gen_buildflags" ] | ||
| if (perfetto_build_standalone) { | ||
| public_deps = [ | ||
| - "//gn/standalone:check_build_deps", | ||
| "//gn/standalone/libc++:deps", | ||
| "//gn/standalone/sanitizers:deps", | ||
| ] | ||
| diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn | ||
| index 582e9b867..9c77ac64c 100644 | ||
| --- a/gn/standalone/BUILD.gn | ||
| +++ b/gn/standalone/BUILD.gn | ||
| @@ -441,10 +441,10 @@ config("android_liblog") { | ||
| } | ||
|
|
||
| # Checks that tools/install-build-deps has been run since it last changed. | ||
| -perfetto_check_build_deps("check_build_deps") { | ||
| - args = [] | ||
| -} | ||
| +#perfetto_check_build_deps("check_build_deps") { | ||
| +# args = [] | ||
| +#} | ||
|
|
||
| -perfetto_check_build_deps("check_build_deps_android") { | ||
| - args = [ "--android" ] | ||
| -} | ||
| +#perfetto_check_build_deps("check_build_deps_android") { | ||
| +# args = [ "--android" ] | ||
| +#} | ||
| diff --git a/gn/standalone/BUILDCONFIG.gn b/gn/standalone/BUILDCONFIG.gn | ||
| index 6f32686c1..c041989b0 100644 | ||
| --- a/gn/standalone/BUILDCONFIG.gn | ||
| +++ b/gn/standalone/BUILDCONFIG.gn | ||
| @@ -59,8 +59,9 @@ declare_args() { | ||
| # the ossfuzz sanitizer overrides this to true. In that config the | ||
| # host/target cpu and arch are identical, but we want to build only the | ||
| # targets with the sanitizer/fuzzer flags | ||
| - is_cross_compiling = | ||
| - target_cpu != host_cpu || target_os != host_os || target_triplet != "" | ||
| + | ||
| + # for Bitbake build | ||
| + is_cross_compiling = true | ||
| } | ||
| default_configs = [ | ||
| "//gn/standalone:debug_symbols", | ||
| -- | ||
| 2.37.1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib" | ||
|
|
||
| LIC_FILES_CHKSUM = "file://LICENSE;md5=f87516e0b698007e9e75a1fe1012b390 \ | ||
| file://buildtools/libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \ | ||
| file://buildtools/libcxx/utils/google-benchmark/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ | ||
| file://buildtools/libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \ | ||
| file://buildtools/libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \ | ||
| file://buildtools/protobuf/LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b \ | ||
| file://buildtools/zlib/LICENSE;md5=f09575dbfb09420642318b413159496f \ | ||
| file://debian/copyright;md5=4e08364c82141f181de69d0a2b89d612 \ | ||
| file://python/LICENSE;md5=c602a632c34ade9c78a976734077bce7" | ||
|
|
||
| SRC_URI = "git://github.com/google/perfetto.git;branch=master;protocol=https;name=perfetto \ | ||
| 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;branch=main;name=libcxx \ | ||
| git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git;protocol=https;destsuffix=git/buildtools/libcxxabi;branch=main;name=libcxxabi \ | ||
| git://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git;protocol=https;destsuffix=git/buildtools/libunwind;branch=main;name=libunwind \ | ||
| git://android.googlesource.com/platform/external/zlib.git;branch=master;protocol=https;destsuffix=git/buildtools/zlib;name=zlib \ | ||
| 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" | ||
|
|
||
| DEPENDS += " ninja-native" | ||
|
|
||
| COMPATIBLE_HOST = "(i.86|x86_64|aarch64|arm).*-linux*" | ||
|
|
||
| FILES:${PN}:append = " \ | ||
| ${bindir}/tracebox \ | ||
| " | ||
|
|
||
| S = "${WORKDIR}/git" | ||
| B = "${WORKDIR}/build" | ||
|
|
||
| # Run the GN (Generate Ninja) script, and replace the compiler flags where applicable | ||
| do_configure () { | ||
| # Configuration needs to be done from the source directory | ||
| cd ${S} | ||
| # Rename a few build tools if they have not been renamed | ||
| cd buildtools | ||
| x="gn-linux64-1968-0725d782" | ||
| [ -f $x ] && mkdir linux64 && mv $x linux64/gn | ||
| chmod +x linux64/gn | ||
| cd .. | ||
|
|
||
| CC_BIN=`echo $CC | awk '{print $1}'` | ||
| CXX_BIN=`echo $CXX | awk '{print $1}'` | ||
| STRIP_BIN=`echo $STRIP | awk '{print $1}'` | ||
|
|
||
| ARGS="is_debug=false " # Tell gn to use release mode | ||
|
|
||
| if [ -z `echo ${TOOLCHAIN} | grep clang` ]; then | ||
| ARGS=$ARGS" is_clang=false" | ||
| else | ||
| ARGS=$ARGS" is_clang=true" | ||
| fi | ||
|
|
||
| # Architecture parameter accepted by Perfetto | ||
| arch=${TARGET_ARCH} | ||
| if [ $arch = "i686" ]; then | ||
| arch="x86" | ||
| elif [ $arch = "x86_64" ]; then | ||
| arch="x64" | ||
| elif [ $arch = "aarch64" ]; then | ||
| arch="arm64" | ||
| fi | ||
|
|
||
| # For ARM32 with hardware floating point using clang and musl, we need to | ||
| # specify -mfloat-abi=hard to make the ABI settings of the linker and the | ||
| # compiler match. The linker would use hardware float ABI. The compiler does | ||
| # not. As a result we need to force the compiler to do so by adding | ||
| # -mfloat-abi=hard to compilation flags. | ||
| FLOAT_ABI="" | ||
| if [[ "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'true', 'false', d)}" == "true" ]]; then | ||
| FLOAT_ABI="-mfloat-abi=hard" | ||
| fi | ||
|
|
||
| ARGS=$ARGS" target_os=\"linux\"" | ||
| ARGS=$ARGS" target_cpu=\"$arch\"" | ||
| ARGS=$ARGS" target_cc=\"$CC_BIN ${FLOAT_ABI}\"" | ||
| ARGS=$ARGS" target_cxx=\"$CXX_BIN -std=c++11 ${FLOAT_ABI}\"" | ||
| ARGS=$ARGS" target_strip=\"$STRIP_BIN\"" # | ||
| ARGS=$ARGS" target_sysroot=\"${RECIPE_SYSROOT}\"" | ||
| ARGS=$ARGS" target_linker=\"$CC_BIN ${FLOAT_ABI} ${LDFLAGS}\"" | ||
| ARGS=$ARGS" target_ar=\"$AR\"" | ||
| ARGS="'$ARGS'" | ||
| cmd="tools/gn gen --args=$ARGS ${B}" | ||
|
|
||
| echo $cmd | ||
| # Use eval, not just call $cmd, due to escaping of single quotation marks | ||
| eval $cmd | ||
|
|
||
| cd ${B} | ||
| # Eliminate a few incompatible build flags | ||
| REPLACES="s/-Wl,--icf=all//g" | ||
| REPLACES=$REPLACES";s/-Werror//g" | ||
| REPLACES=$REPLACES";s/-mfpu=neon//g" | ||
| REPLACES=$REPLACES";s/-fcolor-diagnostics//g" | ||
| REPLACES=$REPLACES";s/=format-security//g" | ||
| REPLACES=$REPLACES";s/-fdiagnostics-show-template-tree//g" | ||
| REPLACES=$REPLACES";s/-D_FORTIFY_SOURCE=2//g" | ||
| REPLACES=$REPLACES";s/-fuse-ld=\S*//g" | ||
|
|
||
| find . -name "*.ninja" | xargs sed $REPLACES -i | ||
|
|
||
| # If using the clang toolchain: use the clang host-side binaries built by Bitbake | ||
| if [ "${TOOLCHAIN}" = "clang" ]; then | ||
| BB_CLANGXX="${BUILD_CXX} ${BUILD_LDFLAGS} ${FLOAT_ABI}" | ||
| BB_CLANG="${BUILD_CC} ${FLOAT_ABI}" | ||
| BB_LLVM_OBJCOPY="${RECIPE_SYSROOT_NATIVE}/usr/bin/llvm-objcopy" | ||
|
|
||
| HOST_CLANGXX="${STAGING_DIR_NATIVE}/usr/bin/clang++ -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc ${FLOAT_ABI}" | ||
| HOST_CLANG="${STAGING_DIR_NATIVE}/usr/bin/clang ${FLOAT_ABI}" | ||
| HOST_LLVM_OBJCOPY="${STAGING_DIR_NATIVE}/usr/bin/llvm-objcopy" | ||
|
|
||
| cd gcc_like_host | ||
| REPLACES="s:\S*clang++ :$HOST_CLANGXX :g" | ||
| REPLACES=$REPLACES";s:\S*clang :$HOST_CLANG :g" | ||
| REPLACES=$REPLACES";s:\S*llvm-objcopy :$HOST_LLVM_OBJCOPY :g" | ||
| find . -name "*.ninja" | xargs sed "$REPLACES" -i | ||
| cd .. | ||
| fi | ||
| # Done processing the Ninja files | ||
|
|
||
| # Workaround for the functions not supported by musl | ||
| if [ "${TCLIBC}" = "musl" ]; then | ||
| sed -e 's/strtoll_l(__a, \&__p2, __base, _LIBCPP_GET_C_LOCALE)/strtoll(__a, \&__p2, __base)/g' \ | ||
| -e 's/strtoull_l(__a, \&__p2, __base, _LIBCPP_GET_C_LOCALE)/strtoull(__a, \&__p2, __base)/g' \ | ||
| ${S}/buildtools/libcxx/include/locale -i | ||
| fi | ||
| } | ||
|
|
||
| # Perfetto generates a few different binaries, such as traced and traced_probes and perfetto. | ||
| # The "tracebox" is a busybox that combines the 3 above and provides a single stop for trace capture, so we only build "tracebox" here. | ||
| do_compile () { | ||
| cd ${B} | ||
| ninja -C . tracebox | ||
| } | ||
|
|
||
| do_install () { | ||
| BIN_DIR=${D}${bindir} | ||
|
|
||
| install -d -m0755 $BIN_DIR | ||
| install ${B}/tracebox $BIN_DIR/tracebox | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.