From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 26 Jul 2015 15:53:44 +0000 (+0000)
Subject: oprofile: update to 1.1.0-rc2 and make it work with musl
X-Git-Tag: reboot~2369
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=53647060abeeff507c21d1ce52abf2082aabe63f;p=openwrt%2Fopenwrt.git

oprofile: update to 1.1.0-rc2 and make it work with musl

This brings oprifle to version 1.1.0-rc2 and adds some fixes for musl.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

SVN-Revision: 46505
---

diff --git a/package/devel/oprofile/Makefile b/package/devel/oprofile/Makefile
index 49937c9db8..6944bc391b 100644
--- a/package/devel/oprofile/Makefile
+++ b/package/devel/oprofile/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=oprofile
-PKG_VERSION:=0.9.9
+PKG_VERSION:=1.1.0rc2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/oprofile/
-PKG_MD5SUM:=00aec1287da2dfffda17a9b1c0a01868
+PKG_MD5SUM:=ebc27a8478068cb986efd295cc4ac877
 
 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
 
diff --git a/package/devel/oprofile/patches/100-musl.patch b/package/devel/oprofile/patches/100-musl.patch
new file mode 100644
index 0000000000..05a5283146
--- /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/100-use_insmod_instead_of_modprobe.patch b/package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch
deleted file mode 100644
index cd71d0d959..0000000000
--- a/package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/utils/opcontrol
-+++ b/utils/opcontrol
-@@ -249,7 +249,7 @@ load_module_26()
- {
- 	grep oprofilefs /proc/filesystems >/dev/null
- 	if test "$?" -ne 0; then
--		modprobe oprofile
-+		insmod oprofile
- 		if test "$?" != "0"; then
- 			# couldn't load the module
- 			return
diff --git a/package/devel/oprofile/patches/110-fix_compile_error.patch b/package/devel/oprofile/patches/110-fix_compile_error.patch
deleted file mode 100644
index 708f83ee6c..0000000000
--- a/package/devel/oprofile/patches/110-fix_compile_error.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/libop/op_cpu_type.c
-+++ b/libop/op_cpu_type.c
-@@ -250,6 +250,7 @@ static void release_at_hw_platform(void)
- 	}
- }
- 
-+#ifdef PPC64
- static op_cpu _try_ppc64_arch_generic_cpu(void)
- {
- 	const char * platform, * base_platform;
-@@ -312,6 +313,7 @@ static op_cpu _get_ppc64_cpu_type(void)
- 	cpu_type = op_get_cpu_number(cpu_type_str);
- 	return cpu_type;
- }
-+#endif
- 
- static op_cpu _get_arm_cpu_type(void)
- {
-@@ -592,9 +594,11 @@ static op_cpu __get_cpu_type_alt_method(
- 	    fnmatch("i?86", uname_info.machine, 0) == 0) {
- 		return _get_x86_64_cpu_type();
- 	}
-+#ifdef PPC64
- 	if (strncmp(uname_info.machine, "ppc64", 5) == 0) {
- 		return _get_ppc64_cpu_type();
- 	}
-+#endif
- 	if (strncmp(uname_info.machine, "arm", 3) == 0) {
- 		return _get_arm_cpu_type();
- 	}