diff options
author | Jan Beich <jbeich@FreeBSD.org> | 2015-08-14 00:13:13 +0000 |
---|---|---|
committer | Jan Beich <jbeich@FreeBSD.org> | 2015-08-14 00:13:13 +0000 |
commit | 6901fe718a10d72045d121aaec90ded2f6b1a109 (patch) | |
tree | 3265a5469fed696bf7ef98272bf5cf59eee0e36f /devel/android-tools-simpleperf | |
parent | c607c11360ff3a5f872bbee39f0458917b8f068a (diff) | |
download | ports-6901fe718a10d72045d121aaec90ded2f6b1a109.tar.gz ports-6901fe718a10d72045d121aaec90ded2f6b1a109.zip |
Notes
Diffstat (limited to 'devel/android-tools-simpleperf')
13 files changed, 256 insertions, 0 deletions
diff --git a/devel/android-tools-simpleperf/Makefile b/devel/android-tools-simpleperf/Makefile new file mode 100644 index 000000000000..d1549bf2fbf9 --- /dev/null +++ b/devel/android-tools-simpleperf/Makefile @@ -0,0 +1,47 @@ +# $FreeBSD$ + +PORTNAME= android-tools-simpleperf +DISTVERSIONPREFIX= android- +DISTVERSION= m-preview-136 +DISTVERSIONSUFFIX= -g89a2254 +CATEGORIES= devel + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= Android simpleperf tool + +LICENSE= APACHE20 + +BUILD_DEPENDS= llvm-config${LLVM_VER}:${PORTSDIR}/devel/llvm${LLVM_VER} + +USE_GITHUB= yes +GH_ACCOUNT= android:bionic,core jbeich +GH_PROJECT= platform_bionic:bionic platform_system_core:core \ + platform_system_extras +GH_TAGNAME= android-m-preview-232-gb4f2112:bionic \ + android-m-preview-868-gb81c410:core + +USES= compiler:c++11-lib uidfix +BUILD_WRKSRC= ${WRKSRC}/simpleperf +INSTALL_WRKSRC= ${BUILD_WRKSRC} +MAKEFILE= ${FILESDIR}/Makefile +MAKE_ENV= BINDIR="${PREFIX}/bin" LLVM_CONFIG="llvm-config${LLVM_VER}" +ALL_TARGET= all +LDFLAGS+= -Wl,--as-needed # avoid overlinking (llvm deps) +PLIST_FILES= bin/simpleperf + +LLVM_VER?= 36 # XXX Move to DEFAULT_VERSIONS + +OPTIONS_DEFINE= TEST + +TEST_BUILD_DEPENDS=googletest>=1.6.0:${PORTSDIR}/devel/googletest +TEST_ALL_TARGET=simpleperf_unit_test + +post-extract: +# Adjust paths relative to extras + @(cd ${WRKSRC_core} && ${COPYTREE_SHARE} . ${WRKSRC}) + @${MV} ${WRKSRC_bionic} ${WRKSRC}/bionic + +pre-install-TEST-on: + ${BUILD_WRKSRC}/simpleperf_unit_test + +.include <bsd.port.mk> diff --git a/devel/android-tools-simpleperf/distinfo b/devel/android-tools-simpleperf/distinfo new file mode 100644 index 000000000000..cfdd3a2e4b0e --- /dev/null +++ b/devel/android-tools-simpleperf/distinfo @@ -0,0 +1,6 @@ +SHA256 (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 33813515ba14743085b8e95a4a74025ac4cefd7d308d5870cc8e279ef5380d4a +SIZE (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 665360 +SHA256 (android-platform_bionic-android-m-preview-232-gb4f2112_GH0.tar.gz) = 88767af6ed1b4377c03aee44e61c175f69decc9169eea2b39661c940186eec5e +SIZE (android-platform_bionic-android-m-preview-232-gb4f2112_GH0.tar.gz) = 3438328 +SHA256 (android-platform_system_core-android-m-preview-868-gb81c410_GH0.tar.gz) = e013cf5538e25d8123bb7e423ab4269826f74d0af3d44e3e316942c2b1b5a362 +SIZE (android-platform_system_core-android-m-preview-868-gb81c410_GH0.tar.gz) = 1335909 diff --git a/devel/android-tools-simpleperf/files/Makefile b/devel/android-tools-simpleperf/files/Makefile new file mode 100644 index 000000000000..41de14f80711 --- /dev/null +++ b/devel/android-tools-simpleperf/files/Makefile @@ -0,0 +1,73 @@ +# $FreeBSD$ + +PROG_CXX=simpleperf +NO_MAN= +BINDIR?=/usr/bin + +SRCS+= callchain.cpp +SRCS+= cmd_dumprecord.cpp +SRCS+= cmd_help.cpp +SRCS+= cmd_report.cpp +SRCS+= command.cpp +SRCS+= dso.cpp +SRCS+= environment_fake.cpp +SRCS+= event_attr.cpp +SRCS+= event_type.cpp +SRCS+= main.cpp +SRCS+= perf_regs.cpp +SRCS+= read_elf.cpp +SRCS+= record.cpp +SRCS+= record_file_reader.cpp +SRCS+= sample_tree.cpp +SRCS+= thread_tree.cpp +SRCS+= utils.cpp + +TEST_SRCS+= command_test.cpp +TEST_SRCS+= gtest_main.cpp +TEST_SRCS+= record_test.cpp +TEST_SRCS+= sample_tree_test.cpp + +# required by simpleperf +.PATH: ${.CURDIR}/../base +SRCS+= file.cpp +SRCS+= logging.cpp +SRCS+= stringprintf.cpp +SRCS+= strings.cpp + +# required by base +.PATH: ${.CURDIR}/../liblog +SRCS+= fake_log_device.c +SRCS+= logd_write.c +CFLAGS.logd_write.c+= -DFAKE_LOG_DEVICE=1 + +# required by base +.PATH: ${.CURDIR}/../libcutils +SRCS+= threads.c + +CFLAGS+=-D_WITH_GETLINE +CFLAGS+=-DUSE_BIONIC_UAPI_HEADERS +CFLAGS+=-I${.CURDIR}/darwin_support +CFLAGS+=-I${.CURDIR}/../include +CFLAGS+=-I${.CURDIR}/../base/include +CFLAGS+=-I${.CURDIR}/../bionic/libc/kernel +CFLAGS+=$$(${LLVM_CONFIG} --cppflags) +CFLAGS+=${CFLAGS.${.IMPSRC:T}} + +CXXFLAGS+=-std=gnu++11 +CXXFLAGS+=${CFLAGS:N-std*} + +TEST_CFLAGS+= $$(${GTEST_CONFIG} --cppflags) +.for f in ${TEST_SRCS} +CFLAGS.${f}+= ${TEST_CFLAGS} +.endfor + +LDADD+= $$(${LLVM_CONFIG} --system-libs --libs --ldflags) +TEST_LDADD+= $$(${GTEST_CONFIG} --libs --ldflags) + +LLVM_CONFIG?= llvm-config +GTEST_CONFIG?= gtest-config + +simpleperf_unit_test: ${SRCS:R:S/$/.o/:Nmain.o} ${TEST_SRCS:R:S/$/.o/} + ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD} + +.include <bsd.prog.mk> diff --git a/devel/android-tools-simpleperf/files/patch-base_file.cpp b/devel/android-tools-simpleperf/files/patch-base_file.cpp new file mode 100644 index 000000000000..9c5526d44196 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-base_file.cpp @@ -0,0 +1,10 @@ +--- base/file.cpp.orig 2015-08-12 23:28:08 UTC ++++ base/file.cpp +@@ -21,6 +21,7 @@ + #include <sys/stat.h> + #include <sys/types.h> + ++#include <cstring> // strerror + #include <string> + + #include "base/macros.h" // For TEMP_FAILURE_RETRY on Darwin. diff --git a/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h b/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h new file mode 100644 index 000000000000..e48477ac6293 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-base_include_base_logging.h @@ -0,0 +1,10 @@ +--- base/include/base/logging.h.orig 2015-08-12 23:28:08 UTC ++++ base/include/base/logging.h +@@ -25,6 +25,7 @@ + #endif + #endif + ++#include <cerrno> // errno + #include <functional> + #include <memory> + #include <ostream> diff --git a/devel/android-tools-simpleperf/files/patch-base_logging.cpp b/devel/android-tools-simpleperf/files/patch-base_logging.cpp new file mode 100644 index 000000000000..d824fde63791 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-base_logging.cpp @@ -0,0 +1,18 @@ +--- base/logging.cpp.orig 2015-08-12 23:28:08 UTC ++++ base/logging.cpp +@@ -23,12 +23,14 @@ + #include <libgen.h> + + // For getprogname(3) or program_invocation_short_name. +-#if defined(__ANDROID__) || defined(__APPLE__) ++#if !defined(_WIN32) && !defined(__GLIBC__) + #include <stdlib.h> + #elif defined(__GLIBC__) + #include <errno.h> + #endif + ++#include <cstring> // strlen ++#include <cstdio> // fprintf + #include <iostream> + #include <limits> + #include <sstream> diff --git a/devel/android-tools-simpleperf/files/patch-libcutils_threads.c b/devel/android-tools-simpleperf/files/patch-libcutils_threads.c new file mode 100644 index 000000000000..83c53fd60224 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-libcutils_threads.c @@ -0,0 +1,38 @@ +--- libcutils/threads.c.orig 2015-08-12 23:28:08 UTC ++++ libcutils/threads.c +@@ -29,6 +29,14 @@ + #include <unistd.h> + #elif defined(_WIN32) + #include <windows.h> ++#elif defined(__DragonFly__) ++#include <unistd.h> ++#elif defined(__FreeBSD__) ++#include <sys/param.h> ++#include <sys/thr.h> ++#include <pthread_np.h> ++#elif defined(__NetBSD__) ++#include <lwp.h> + #endif + + // No definition needed for Android because we'll just pick up bionic's copy. +@@ -40,6 +48,20 @@ pid_t gettid() { + return syscall(__NR_gettid); + #elif defined(_WIN32) + return GetCurrentThreadId(); ++#elif defined(__DragonFly__) ++ return lwp_gettid(); ++#elif defined(__NetBSD__) ++ return _lwp_self(); ++#elif defined(__FreeBSD__) ++# if __FreeBSD_version > 900030 ++ return pthread_getthreadid_np(); ++# else ++ long lwpid; ++ thr_self(&lwpid); ++ return lwpid; ++# endif ++#else ++ return (intptr_t) pthread_self(); + #endif + } + #endif // __ANDROID__ diff --git a/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c b/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c new file mode 100644 index 000000000000..d9a8890325d4 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-liblog_logd__write.c @@ -0,0 +1,12 @@ +--- liblog/logd_write.c.orig 2015-05-27 20:24:08 UTC ++++ liblog/logd_write.c +@@ -22,7 +22,9 @@ + #include <pthread.h> + #endif + #include <stdarg.h> ++#if (FAKE_LOG_DEVICE == 0) + #include <stdatomic.h> ++#endif + #include <stdio.h> + #include <stdlib.h> + #include <string.h> diff --git a/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp b/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp new file mode 100644 index 000000000000..b865fadd0886 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-simpleperf_dso.cpp @@ -0,0 +1,10 @@ +--- simpleperf/dso.cpp.orig 2015-08-12 01:49:40 UTC ++++ simpleperf/dso.cpp +@@ -16,6 +16,7 @@ + + #include "dso.h" + ++#include <limits.h> // ULLONG_MAX + #include <stdlib.h> + #include <base/logging.h> + #include "environment.h" diff --git a/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp b/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp new file mode 100644 index 000000000000..c020ae427175 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-simpleperf_event__attr.cpp @@ -0,0 +1,10 @@ +--- simpleperf/event_attr.cpp.orig 2015-08-12 01:49:40 UTC ++++ simpleperf/event_attr.cpp +@@ -18,6 +18,7 @@ + + #include <inttypes.h> + #include <stdio.h> ++#include <string.h> // memset + #include <string> + #include <unordered_map> + diff --git a/devel/android-tools-simpleperf/files/patch-simpleperf_record.h b/devel/android-tools-simpleperf/files/patch-simpleperf_record.h new file mode 100644 index 000000000000..3f455d0ef410 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-simpleperf_record.h @@ -0,0 +1,10 @@ +--- simpleperf/record.h.orig 2015-08-12 01:49:40 UTC ++++ simpleperf/record.h +@@ -19,6 +19,7 @@ + + #include <sys/types.h> + ++#include <memory> // unique_ptr + #include <string> + #include <vector> + diff --git a/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp b/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp new file mode 100644 index 000000000000..f4aceb4079a2 --- /dev/null +++ b/devel/android-tools-simpleperf/files/patch-simpleperf_utils.cpp @@ -0,0 +1,10 @@ +--- simpleperf/utils.cpp.orig 2015-08-12 01:49:40 UTC ++++ simpleperf/utils.cpp +@@ -20,6 +20,7 @@ + #include <errno.h> + #include <stdarg.h> + #include <stdio.h> ++#include <string.h> // strcmp + #include <sys/stat.h> + #include <unistd.h> + diff --git a/devel/android-tools-simpleperf/pkg-descr b/devel/android-tools-simpleperf/pkg-descr new file mode 100644 index 000000000000..846c9aaa19c8 --- /dev/null +++ b/devel/android-tools-simpleperf/pkg-descr @@ -0,0 +1,2 @@ +simpleperf is a minimal Linux perf implementation for extracting +sampling information out of perf.data. |