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

From: David Huffman <[email-masked]>
Date: Wed, 6 Jan 2016 14:54:10 -0500

https://threadingbuildingblocks.org
Intel® Threading Building Blocks

Provides version 4.4 update 2
---
 testing/libtbb/APKBUILD                    | 82 ++++++++++++++++++++++++++++++
 testing/libtbb/glibc-struct-mallinfo.patch | 43 ++++++++++++++++
 2 files changed, 125 insertions(+)
 create mode 100644 testing/libtbb/APKBUILD
 create mode 100644 testing/libtbb/glibc-struct-mallinfo.patch

diff --git a/testing/libtbb/APKBUILD b/testing/libtbb/APKBUILD
new file mode 100644
index 0000000..b12a969
--- /dev/null
+++ b/testing/libtbb/APKBUILD
@@ -0,0 +1,82 @@
+# Contributor: David Huffman <[email-masked]>
+# Maintainer: David Huffman <[email-masked]>
+
+pkgname=libtbb
+pkgver=4.4.2
+_pkgverstr=tbb44_20151115oss
+pkgrel=0
+pkgdesc="Intel® TBB, a widely used C++ template library for task parallelism"
+url="https://threadingbuildingblocks.org"
+arch="x86 x86_64"
+license="GPL2"
+subpackages="$pkgname-debug $pkgname-dev $pkgname-doc"
+source="https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/${_pkgverstr}_src.tgz"
+
+_builddir="$srcdir/$_pkgverstr"
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in "$startdir"/*; do
+		case $i in
+		*.patch) msg $i; patch --verbose -p1 -i $i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	make || return 1
+}
+
+_install_libs() {
+	local buildtype libsuffix lib builddir
+	buildtype="_$1"
+	libsuffix="$2"
+	lib="${3:-$subpkgdir}/usr/lib"
+	builddir=$(find "$_builddir/build" -maxdepth 1 -name "*$buildtype" -type d) || return 1
+	[ "$buildtype" != "_debug" ] && buildtype=''
+	mkdir -p "$lib" || return 1
+	mv "$builddir/libtbb${buildtype}.so$libsuffix" \
+	   "$builddir/libtbbmalloc${buildtype}.so$libsuffix" \
+	   "$builddir/libtbbmalloc_proxy${buildtype}.so$libsuffix" \
+	   "$lib/" || return 1
+}
+
+package() {
+	_install_libs release .2 "$pkgdir" || return 1
+}
+
+debug() {
+	pkgdesc="$pkgdesc (debug symbols)"
+	
+	_install_libs debug .2 || return 1
+}
+
+dev() {
+	pkgdesc="$pkgdesc (development files)"
+	
+	local prefix
+	prefix="$subpkgdir/usr"
+	cd "$_builddir"
+	mkdir -p "$prefix" || return 1
+	rm include/index.html && mv include "$prefix/" || return 1
+	_install_libs release && _install_libs debug || return 1
+}
+
+doc() {
+	arch="noarch"
+	pkgdesc="$pkgdesc (documentation)"
+	
+	local share doc licenses
+	share="$subpkgdir/usr/share"
+	doc="$share/doc"
+	licensesdir="$share/licenses/$pkgname"
+	cd "$_builddir"
+	mkdir -p "$doc" "$licensesdir" || return 1
+	mv doc/ "$doc/$pkgname-$pkgver" || return 1
+	mv COPYING "$licensesdir/" || return 1
+}
+
+md5sums="7fae6a6bbca68bbdc18e844d6721d5e4  tbb44_20151115oss_src.tgz"
+sha256sums="3dd5c4fc85c18f49307d3cde4ce937bda230679f7fe2906112e5c8dee4cc77bb  tbb44_20151115oss_src.tgz"
+sha512sums="a5e831fdc56767bf6e823afaa85a041d0a78ef04f506ba2c088a133893810d17433a4c2a7b7845526e5f34b68f78dcdb6106814ddb54da49ea7b03225067997a  tbb44_20151115oss_src.tgz"
diff --git a/testing/libtbb/glibc-struct-mallinfo.patch b/testing/libtbb/glibc-struct-mallinfo.patch
new file mode 100644
index 0000000..64056ec
--- /dev/null
+++ b/testing/libtbb/glibc-struct-mallinfo.patch
@@ -0,0 +1,43 @@
+From b577153a10c98f4e13405dc93ea2ab1a7b990e07 Mon Sep 17 00:00:00 2001
+From: David Huffman <[email-masked]>
+Date: Wed, 6 Jan 2016 07:09:30 -0500
+Subject: [PATCH] hard-code glibc's definition of struct mallinfo
+
+---
+ src/tbbmalloc/proxy.h | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/tbbmalloc/proxy.h b/src/tbbmalloc/proxy.h
+index 781cadc..e1ea1ae 100644
+--- a/src/tbbmalloc/proxy.h
++++ b/src/tbbmalloc/proxy.h
+@@ -32,6 +32,26 @@
+ 
+ #include <stddef.h>
+ 
++// The following definition was taken from /usr/include/malloc.h as provided by
++// the glibc-devel-2.19-17.4.x86_64 package on openSUSE Leap 42.1; it is
++// made available under the GNU Lesser General Public License v2.1 or later.
++// See <https://www.gnu.org/licenses>.
++//
++// Copyright (C) 1996-2014 Free Software Foundation, Inc.
++struct mallinfo
++{
++  int arena;    /* non-mmapped space allocated from system */
++  int ordblks;  /* number of free chunks */
++  int smblks;   /* number of fastbin blocks */
++  int hblks;    /* number of mmapped regions */
++  int hblkhd;   /* space in mmapped regions */
++  int usmblks;  /* maximum total allocated space */
++  int fsmblks;  /* space available in freed fastbin blocks */
++  int uordblks; /* total allocated space */
++  int fordblks; /* total free space */
++  int keepcost; /* top-most, releasable (via malloc_trim) space */
++};
++
+ extern "C" {
+     void * scalable_malloc(size_t size);
+     void * scalable_calloc(size_t nobj, size_t size);
+-- 
+2.6.2
+
-- 
2.6.2

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