aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalesh Singh <kaleshsingh@google.com>2022-05-02 20:58:32 -0700
committerKalesh Singh <kaleshsingh@google.com>2022-11-22 17:56:13 +0000
commit0f84879a0b2567c33aedf88985428c2ec4828640 (patch)
tree4adcb93b6802225377b5a77102d3deae243e59b9
parent61488b893922a3b349d8ea98e7b7f9287a8640f5 (diff)
downloadtrace-cmd-0f84879a0b2567c33aedf88985428c2ec4828640.tar.gz
ANDROID: trace-cmd: Add Android.bp
Add Android.bp to build libtracecmd and trace-cmd with Soong. We restrict the visibility of libtracecmd to trace-cmd only due to LGPL license. Bug: 223905587 Test: m libtracecmd; m trace-cmd igned-off-by: Kalesh Singh <kaleshsingh@google.com> Change-Id: I47761ca75bb73bb3a15cc0a7de9d53ca2e32c826
-rw-r--r--Android.bp162
1 files changed, 162 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..1ada0863
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,162 @@
+package {
+ default_applicable_licenses: ["external_trace-cmd_license"],
+}
+
+// See: http://go/android-license-faq
+license {
+ name: "external_trace-cmd_license",
+
+ visibility: [":__subpackages__"],
+
+ license_kinds: [
+ "SPDX-license-identifier-GPL-2.0",
+ "SPDX-license-identifier-GPL-2.0-only",
+ "SPDX-license-identifier-GPL-2.0+",
+ "SPDX-license-identifier-GPL-2.0-or-later",
+ "SPDX-license-identifier-GPL-2.0-or-later",
+ "SPDX-license-identifier-LGPL-2.1+",
+ "SPDX-license-identifier-LGPL-2.1+",
+ ],
+
+ license_text: [
+ "LICENSE",
+ ],
+}
+
+genrule {
+ name: "tc_version_header",
+ srcs: ["Makefile"],
+ out: ["tc_version.h"],
+ cmd: "(" +
+ "VERSION=$$(grep '\\bTC_VERSION =' <$(in) | awk '{ print $$3 }') " +
+ "&& PATCHLEVEL=$$(grep '\\bTC_PATCHLEVEL =' <$(in) | awk '{ print $$3 }') " +
+ "&& VERSION_CODE=$$(expr $${VERSION} \\* 256 + $${PATCHLEVEL}) " +
+ "&& EXTRAVERSION=$$(grep '\\bTC_EXTRAVERSION =' <$(in) | awk '{ print $$3 }') " +
+ "&& echo '/* This file is automatically generated. Do not modify */' " +
+ "&& echo \"#define VERSION_CODE $${VERSION_CODE}\" " +
+ "&& echo \"#define EXTRAVERSION $${EXTRAVERSION}\" " +
+ "&& echo '#define VERSION_STRING \"'$${VERSION}.$${PATCHLEVEL}.$${EXTRAVERSION}'\"' " +
+ "&& echo '#define FILE_VERSION ' " +
+ "&& echo '#define VERSION_GIT \"not-a-git-repo\"' " +
+ ") > $(out)",
+}
+
+cc_library {
+ name: "libtracecmd",
+
+ // Restrict visibility due to GPL license
+ visibility: [
+ "//external/trace-cmd:__subpackages__",
+ ],
+
+ local_include_dirs: [
+ "lib/trace-cmd/include/private",
+ "lib/trace-cmd/include",
+ "include/trace-cmd",
+ "tracecmd/include",
+ "include",
+ ],
+
+ export_include_dirs: [
+ "lib/trace-cmd/include",
+ ],
+
+ srcs: [
+ "lib/trace-cmd/test.c",
+ "lib/trace-cmd/trace-blk-hack.c",
+ "lib/trace-cmd/trace-compress.c",
+ "lib/trace-cmd/trace-compress-zlib.c",
+ "lib/trace-cmd/trace-filter-hash.c",
+ "lib/trace-cmd/trace-ftrace.c",
+ "lib/trace-cmd/trace-hash.c",
+ "lib/trace-cmd/trace-hooks.c",
+ "lib/trace-cmd/trace-input.c",
+ "lib/trace-cmd/trace-msg.c",
+ "lib/trace-cmd/trace-output.c",
+ "lib/trace-cmd/trace-perf.c",
+ "lib/trace-cmd/trace-plugin.c",
+ "lib/trace-cmd/trace-recorder.c",
+ "lib/trace-cmd/trace-timesync.c",
+ "lib/trace-cmd/trace-timesync-kvm.c",
+ "lib/trace-cmd/trace-timesync-ptp.c",
+ "lib/trace-cmd/trace-util.c",
+ ],
+
+ shared: {
+ shared_libs: [
+ "libtraceevent",
+ "libtracefs",
+ "libz",
+ ],
+ export_shared_lib_headers: [
+ "libtraceevent",
+ "libtracefs",
+ "libz",
+ ],
+ },
+
+ static: {
+ static_libs: [
+ "libtraceevent",
+ "libtracefs",
+ "libz",
+ ],
+ export_static_lib_headers: [
+ "libtraceevent",
+ "libtracefs",
+ "libz",
+ ],
+ },
+
+ generated_headers: ["tc_version_header"],
+
+ export_generated_headers: ["tc_version_header"],
+
+ cflags: [
+ "-D__bswap_64=__swap64",
+ "-D_GNU_SOURCE",
+ "-DPERF",
+ "-DVSOCK",
+ "-Wno-unused-parameter",
+ "-Wno-macro-redefined",
+ "-Wno-unused-but-set-variable",
+ "-Wno-user-defined-warnings",
+ "-Wno-visibility",
+ "-Wno-pointer-arith",
+ ],
+
+ c_std: "gnu99",
+}
+
+cc_binary {
+ name: "trace-cmd",
+
+ local_include_dirs: [
+ "lib/trace-cmd/include/private",
+ "include/trace-cmd",
+ "tracecmd/include",
+ "include",
+ ],
+
+ srcs: ["tracecmd/*.c"],
+
+ static_libs: [
+ "libtraceevent",
+ "libtracecmd",
+ "libtracefs",
+ ],
+
+ static_executable: true,
+
+ cflags: [
+ "-D_GNU_SOURCE",
+ "-DNO_AUDIT",
+ "-DVSOCK",
+ "-Wno-unused-parameter",
+ "-Wno-macro-redefined",
+ "-Wno-visibility",
+ "-Wno-pointer-arith",
+ ],
+
+ c_std: "gnu99",
+}