Commit f410161e authored by jbeich's avatar jbeich
Browse files

devel/android-tools-simpleperf: add new port

simpleperf is a minimal Linux perf implementation for extracting
sampling information out of perf.data.
parent 5331ed5c
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
SUBDIR += android-tools-adb-devel SUBDIR += android-tools-adb-devel
SUBDIR += android-tools-fastboot SUBDIR += android-tools-fastboot
SUBDIR += android-tools-fastboot-devel SUBDIR += android-tools-fastboot-devel
SUBDIR += android-tools-simpleperf
SUBDIR += anjuta SUBDIR += anjuta
SUBDIR += anjuta-extras SUBDIR += anjuta-extras
SUBDIR += antlr SUBDIR += antlr
......
# $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>
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
# $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>
--- 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.
--- 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>
--- 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>
--- 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__
--- 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>
--- 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"
--- 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>
--- 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>
--- 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>
simpleperf is a minimal Linux perf implementation for extracting
sampling information out of perf.data.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment