aboutsummaryrefslogtreecommitdiffstats
path: root/package/devel/oprofile
diff options
context:
space:
mode:
Diffstat (limited to 'package/devel/oprofile')
-rw-r--r--package/devel/oprofile/Makefile94
-rw-r--r--package/devel/oprofile/patches/100-musl.patch39
-rw-r--r--package/devel/oprofile/patches/200-add_mips_1004kc.patch10
3 files changed, 143 insertions, 0 deletions
diff --git a/package/devel/oprofile/Makefile b/package/devel/oprofile/Makefile
new file mode 100644
index 0000000..cdeeec2
--- /dev/null
+++ b/package/devel/oprofile/Makefile
@@ -0,0 +1,94 @@
+#
+# Copyright (C) 2009-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=oprofile
+PKG_VERSION:=1.1.0rc2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/oprofile/
+PKG_MD5SUM:=ebc27a8478068cb986efd295cc4ac877
+
+PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+
+PKG_BUILD_DEPENDS:=binutils
+PKG_LICENSE:=GPL-2.0+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/oprofile
+ SECTION:=devel
+ CATEGORY:=Development
+ TITLE:=OProfile System Profiler
+ URL:=http://oprofile.sourceforge.net
+ DEPENDS:=+libpopt +libstdcpp +objdump +librt @(!TARGET_uml||BROKEN)
+endef
+
+define Package/oprofile/description
+ A transparent low-overhead system-wide profiler.
+endef
+
+define Package/oprofile-utils
+ SECTION:=devel
+ CATEGORY:=Development
+ TITLE:=OProfile System Profiler (extra utilities)
+ URL:=http://oprofile.sourceforge.net
+ DEPENDS:=oprofile
+endef
+
+define Build/Configure
+ $(call Build/Configure/Default, \
+ --with-kernel-support \
+ --with-kernel=$(LINUX_DIR)/user_headers \
+ --without-x \
+ )
+endef
+
+TARGET_CXXFLAGS += -fpermissive
+TARGET_LDFLAGS := -L$(STAGING_DIR)/usr/lib $(TARGET_LDFLAGS)
+
+define Package/oprofile-utils/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/opannotate \
+ $(PKG_INSTALL_DIR)/usr/bin/oparchive \
+ $(PKG_INSTALL_DIR)/usr/bin/opgprof \
+ $(1)/usr/bin
+endef
+
+define Package/oprofile/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/* \
+ $(1)/usr/bin
+
+ rm -f \
+ $(1)/usr/bin/opannotate \
+ $(1)/usr/bin/oparchive \
+ $(1)/usr/bin/opgprof
+
+ $(INSTALL_DIR) $(1)/usr/lib/oprofile
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/oprofile/*.so* \
+ $(1)/usr/lib/oprofile/
+
+ $(INSTALL_DIR) $(1)/usr/share/oprofile
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/share/oprofile/stl.pat \
+ $(PKG_INSTALL_DIR)/usr/share/oprofile/$(patsubst x86,i386,$(LINUX_KARCH)) \
+ $(1)/usr/share/oprofile/
+endef
+
+$(eval $(call BuildPackage,oprofile))
+$(eval $(call BuildPackage,oprofile-utils))
diff --git a/package/devel/oprofile/patches/100-musl.patch b/package/devel/oprofile/patches/100-musl.patch
new file mode 100644
index 0000000..05a5283
--- /dev/null
+++ b/package/devel/oprofile/patches/100-musl.patch
@@ -0,0 +1,39 @@
+--- a/pe_profiling/operf.cpp
++++ b/pe_profiling/operf.cpp
+@@ -857,11 +857,14 @@ static int __delete_old_previous_sample_
+ int tflag __attribute__((unused)),
+ struct FTW *ftwbuf __attribute__((unused)))
+ {
++ int err;
++
+ if (remove(fpath)) {
++ err = errno;
+ perror("sample data removal error");
+- return FTW_STOP;
++ return err;
+ } else {
+- return FTW_CONTINUE;
++ return 0;
+ }
+ }
+
+@@ -896,7 +899,7 @@ static void convert_sample_data(void)
+ return;
+
+ if (!operf_options::append) {
+- int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
++ int flags = FTW_DEPTH;
+ errno = 0;
+ if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
+ errno != ENOENT) {
+--- a/libop/op_events.c
++++ b/libop/op_events.c
+@@ -83,7 +83,7 @@ static int parse_hex(char const * str)
+ static u64 parse_long_hex(char const * str)
+ {
+ u64 value;
+- if (sscanf(str, "%Lx", &value) != 1)
++ if (sscanf(str, "0x%llx", &value) != 1)
+ parse_error("expected long hexadecimal value");
+
+ fflush(stderr);
diff --git a/package/devel/oprofile/patches/200-add_mips_1004kc.patch b/package/devel/oprofile/patches/200-add_mips_1004kc.patch
new file mode 100644
index 0000000..038cd7d
--- /dev/null
+++ b/package/devel/oprofile/patches/200-add_mips_1004kc.patch
@@ -0,0 +1,10 @@
+--- a/libop/op_cpu_type.c
++++ b/libop/op_cpu_type.c
+@@ -609,6 +609,7 @@ static struct mips_cpu_descr mips_cpu_de
+ { .key = "MIPS 25Kc", .value = "mips/25K" }, /* CPU_25KF */
+ { .key = "MIPS 34Kc", .value = "mips/34K" }, /* CPU_34K */
+ { .key = "MIPS 74Kc", .value = "mips/74K" }, /* CPU_74K */
++ { .key = "MIPS 1004Kc", .value = "mips/1004K" }, /* CPU_1004K */
+ { .key = "MIPS M14Kc", .value = "mips/M14Kc" }, /* CPU_M14KC */
+ { .key = "RM9000", .value = "mips/rm9000" }, /* CPU_RM9000 */
+ { .key = "R10000", .value = "mips/r10000" }, /* CPU_R10000 */