Subject: [alpine-aports] [PATCH] testing/lttng-ust: new aport

From: Michael Jeanson <[email-masked]>
Date: Thu, 26 May 2016 13:47:43 -0500

https://lttng.org
LTTng 2.0 Userspace Tracer
---
 testing/lttng-ust/APKBUILD                | 65 +++++++++++++++++++++++++++++++
 testing/lttng-ust/add-glibc-ifdef.patch   | 21 ++++++++++
 testing/lttng-ust/limits-h.patch          | 11 ++++++
 testing/lttng-ust/musl-sched-getcpu.patch | 39 +++++++++++++++++++
 4 files changed, 136 insertions(+)
 create mode 100644 testing/lttng-ust/APKBUILD
 create mode 100644 testing/lttng-ust/add-glibc-ifdef.patch
 create mode 100644 testing/lttng-ust/limits-h.patch
 create mode 100644 testing/lttng-ust/musl-sched-getcpu.patch

diff --git a/testing/lttng-ust/APKBUILD b/testing/lttng-ust/APKBUILD
new file mode 100644
index 0000000..aa6f670
--- /dev/null
+++ b/testing/lttng-ust/APKBUILD
@@ -0,0 +1,65 @@
+# Contributor: Michael Jeanson <[email-masked]>
+# Maintainer: Michael Jeanson <[email-masked]>
+pkgname=lttng-ust
+pkgver=2.8.0
+pkgrel=0
+pkgdesc="LTTng 2.0 Userspace Tracer"
+url="https://lttng.org"
+arch="all"
+license="LGPL2+"
+depends=""
+depends_dev="liburcu-dev"
+makedepends="$depends_dev util-linux-dev bash"
+install=""
+subpackages="$pkgname-dev $pkgname-doc"
+source="https://lttng.org/files/$pkgname/$pkgname-$pkgver.tar.bz2
+	add-glibc-ifdef.patch
+	musl-sched-getcpu.patch
+	limits-h.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	./configure \
+		--prefix=/usr \
+		|| return 1
+	make || return 1
+	make check || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" install || return 1
+}
+
+dev() {
+	default_dev
+	# Move back examples files that are wrongly included
+	# by the default dev splitfunc
+	mv "$subpkgdir"/usr/share/doc/$pkgname \
+		"$pkgdir"/usr/share/doc/$pkgname
+}
+
+md5sums="7b14452e7303dc4bc8475f1415223318  lttng-ust-2.8.0.tar.bz2
+4bd907494a789071aab14608285b3191  add-glibc-ifdef.patch
+2189378d85923ce21a1cb4041596cd6c  musl-sched-getcpu.patch
+425eca46145ddfcb2efb1409a4904311  limits-h.patch"
+sha256sums="6df651e56951ac233d36992f306aca8dbf065d2b0f0986d9a4863b6544ae7bb3  lttng-ust-2.8.0.tar.bz2
+985c6c15790117b6c8280342cc3ab310b58c3766d9585955f2530e3cdf2d89e1  add-glibc-ifdef.patch
+581c59bd2766b0afd0e8ee1a6b0a7711210b8e3915b7592282c5dcb5a4a0537e  musl-sched-getcpu.patch
+e7ddc8ee806ed3cfc8df4788f537c8ca59c9d376352ba89e4ab692ea20032228  limits-h.patch"
+sha512sums="7705e950539d61ec599d762d2a7aef59a10c2f692e2cfe735cd887ba706d478ae99b16292c2043ed868e93211e413c04c684d679cedd822e9ed22485288f5868  lttng-ust-2.8.0.tar.bz2
+dabe48d51370bc1063c18a215b9820b8217f8c84b6c2fa11ee823edc89222c3c3d8712be32fce61c9fd2da5902a881b0bdd451c3420583dffc36e41ea4f5fc2d  add-glibc-ifdef.patch
+29d5e856966a9489a608c6aa915a3a9a800cdfd13af0df28f3420fa1438bb0361e0670182b96710adb49076a254c48225410b52a3f6a67f96a024f4bc93e2494  musl-sched-getcpu.patch
+e5b7549c25b4ed9aeb0240dda00f6010424d7d2747c6e19325d0b162b89aa7ef609667f7564d4b0a703e967ca1f0b3dda110a2d3e0b81b281e0d82566d9f74ec  limits-h.patch"
diff --git a/testing/lttng-ust/add-glibc-ifdef.patch b/testing/lttng-ust/add-glibc-ifdef.patch
new file mode 100644
index 0000000..b367b92
--- /dev/null
+++ b/testing/lttng-ust/add-glibc-ifdef.patch
@@ -0,0 +1,21 @@
+--- lttng-ust-2.8.0.orig/include/lttng/ust-dlfcn.h
++++ lttng-ust-2.8.0/include/lttng/ust-dlfcn.h
+@@ -31,6 +31,8 @@
+ #error "Please include lttng/ust-dlfcn.h before dlfcn.h."
+ #endif /* _DLFCN_H */
+ 
++#ifdef __GLIBC__
++
+ /*
+  * glibc declares dlsym() and dlerror() with __attribute__((leaf)) (see
+  * THROW annotation). Unfortunately, this is not in sync with reality,
+@@ -57,5 +59,9 @@
+ extern void *dlsym(void *__restrict __handle,
+ 		__const char *__restrict __name) __nonnull ((2));
+ extern char *dlerror(void);
++
++#else
++#include <dlfcn.h>
++#endif /* __GLIBC__ */
+ 
+ #endif /* _LTTNG_UST_DLFCN_H */
diff --git a/testing/lttng-ust/limits-h.patch b/testing/lttng-ust/limits-h.patch
new file mode 100644
index 0000000..6492823
--- /dev/null
+++ b/testing/lttng-ust/limits-h.patch
@@ -0,0 +1,11 @@
+--- lttng-ust-2.8.0.orig/tests/ust-elf/prog.c
++++ lttng-ust-2.8.0/tests/ust-elf/prog.c
+@@ -16,7 +16,7 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+  */
+ 
+-#include <linux/limits.h>
++#include <limits.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
diff --git a/testing/lttng-ust/musl-sched-getcpu.patch b/testing/lttng-ust/musl-sched-getcpu.patch
new file mode 100644
index 0000000..48f3b43
--- /dev/null
+++ b/testing/lttng-ust/musl-sched-getcpu.patch
@@ -0,0 +1,39 @@
+--- lttng-ust-2.8.0.orig/libringbuffer/getcpu.h
++++ lttng-ust-2.8.0/libringbuffer/getcpu.h
+@@ -47,10 +47,6 @@
+  */
+ #ifdef __linux__
+ 
+-/* old uClibc versions didn't have sched_getcpu */
+-#if defined(__UCLIBC__) && __UCLIBC_MAJOR__ == 0 && \
+-	(__UCLIBC_MINOR__ < 9 || \
+-	 (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 32))
+ #include <sys/syscall.h>
+ #define __getcpu(cpu, node, cache)	syscall(__NR_getcpu, cpu, node, cache)
+ /*
+@@ -64,25 +60,8 @@
+ 	ret = __getcpu(&cpu, NULL, NULL);
+ 	if (caa_unlikely(ret < 0))
+ 		return 0;
+-	return c;
+-}
+-#else /* __UCLIBC__ */
+-#include <sched.h>
+-
+-/*
+- * If getcpu is not implemented in the kernel, use cpu 0 as fallback.
+- */
+-static inline
+-int lttng_ust_get_cpu_internal(void)
+-{
+-	int cpu;
+-
+-	cpu = sched_getcpu();
+-	if (caa_unlikely(cpu < 0))
+-		return 0;
+ 	return cpu;
+ }
+-#endif	/* __UCLIBC__ */
+ 
+ #elif (defined(__FreeBSD__) || defined(__CYGWIN__))
+ 
-- 
2.6.6

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---