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

From: Jann - Ove Risvik <[email-masked]>
Date: Sat, 9 Jul 2016 16:41:17 +0200

https://openfabrics.org/index.php/openfabrics-software.html
OpenSM InfiniBand subnet manager

2.nd try at packages for managing infiniband hardware. Doublechecked which of the packages actually refused to build with alpine $CHOST and $CBUILD, and worked around it a bit more elegantly than pulling in a newer config.sub
---
 testing/opensm/0001-musl-fixes.patch | 55 ++++++++++++++++++++++++++++++++++++
 testing/opensm/APKBUILD              | 42 +++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 testing/opensm/0001-musl-fixes.patch
 create mode 100644 testing/opensm/APKBUILD

diff --git a/testing/opensm/0001-musl-fixes.patch b/testing/opensm/0001-musl-fixes.patch
new file mode 100644
index 0000000..4fdf8d5
--- /dev/null
+++ b/testing/opensm/0001-musl-fixes.patch
@@ -0,0 +1,55 @@
+diff -urp opensm-3.3.20/include/complib/cl_debug_osd.h opensm-3.3.20-patched/include/complib/cl_debug_osd.h
+--- opensm-3.3.20/include/complib/cl_debug_osd.h	2013-02-07 08:46:28.000000000 +0100
++++ opensm-3.3.20-patched/include/complib/cl_debug_osd.h	2016-07-05 23:33:12.674344101 +0200
+@@ -42,7 +42,7 @@
+ #define _CL_DEBUG_OSD_H_
+ 
+ #include <complib/cl_types.h>
+-#include <bits/wordsize.h>
++#include <limits.h>
+ 
+ #ifdef __cplusplus
+ #  define BEGIN_C_DECLS extern "C" {
+diff -urp opensm-3.3.20/include/complib/cl_types.h opensm-3.3.20-patched/include/complib/cl_types.h
+--- opensm-3.3.20/include/complib/cl_types.h	2013-02-07 08:46:28.000000000 +0100
++++ opensm-3.3.20-patched/include/complib/cl_types.h	2016-07-05 23:33:12.674344101 +0200
+@@ -55,6 +55,7 @@
+ 
+ BEGIN_C_DECLS
+ #include <complib/cl_types_osd.h>
++#include <limits.h>
+ #include <stddef.h>
+ typedef uint16_t net16_t;
+ typedef uint32_t net32_t;
+@@ -62,16 +63,16 @@ typedef uint64_t net64_t;
+ 
+ /* explicit cast of void* to uint32_t */
+ #ifndef ASSERT_VOIDP2UINTN
+-#if __WORDSIZE == 64
++#if LONG_BIT == 64
+ #define ASSERT_VOIDP2UINTN(var) \
+ 	CL_ASSERT( (intptr_t)var <= 0xffffffffffffffffL )
+ #else				/*  __WORDSIZE == 64 */
+-#if __WORDSIZE == 32
++#if LONG_BIT == 32
+   /* need to cast carefully to avoid the warining of un-needed check */
+ #define ASSERT_VOIDP2UINTN(var) \
+ 	CL_ASSERT( (intptr_t)var <= 0x100000000ULL )
+ #else				/*  __WORDSIZE == 32 */
+-#error "Need to know WORDSIZE to tell how to cast to unsigned long int"
++#error "Need to know LONG_BIT to tell how to cast to unsigned long int"
+ #endif				/*  __WORDSIZE == 32 */
+ #endif				/*  __WORDSIZE == 64 */
+ #endif
+diff -urp opensm-3.3.20/opensm/osm_db_files.c opensm-3.3.20-patched/opensm/osm_db_files.c
+--- opensm-3.3.20/opensm/osm_db_files.c	2014-10-21 13:49:50.000000000 +0200
++++ opensm-3.3.20-patched/opensm/osm_db_files.c	2016-07-05 23:33:12.664344239 +0200
+@@ -415,7 +415,7 @@ int osm_db_restore(IN osm_db_domain_t *
+ 					p_accum_val);
+ 
+ 				/* check that the key is a number */
+-				if (!strtouq(p_key, &endptr, 0)
++				if (!strtoull(p_key, &endptr, 0)
+ 				    && *endptr != '\0') {
+ 					OSM_LOG(p_log, OSM_LOG_ERROR,
+ 						"ERR 610B: "
diff --git a/testing/opensm/APKBUILD b/testing/opensm/APKBUILD
new file mode 100644
index 0000000..43bc5b7
--- /dev/null
+++ b/testing/opensm/APKBUILD
@@ -0,0 +1,42 @@
+# Contributor: Jann - Ove Risvik <[email-masked]>
+# Maintainer:
+pkgname=opensm
+pkgver=3.3.20
+pkgrel=0
+pkgdesc="OpenSM InfiniBand subnet manager"
+url="https://www.openfabrics.org/index.php/openfabrics-software.html"
+arch="x86 x86_64"
+license="GPL2 BSD"
+depends="libibumad"
+depends_dev="libibumad-dev"
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-dev $pkgname-doc"
+source="https://www.openfabrics.org/downloads/management/$pkgname-$pkgver.tar.gz
+0001-musl-fixes.patch"
+
+builddir="$srcdir"/$pkgname-$pkgver
+build() {
+	cd "$builddir"
+	./configure \
+		--build=`echo $CBUILD | sed s/alpine-linux-musl/linux/`\
+		--host=`echo $CHOST | sed s/alpine-linux-musl/linux/` \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--localstatedir=/var \
+		|| return 1
+	make || return 1
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="ed615b4681e94ef2e13a5de773ab89a3  opensm-3.3.20.tar.gz
+cbe036cdfddfd37f6381fe7269498d0e  0001-musl-fixes.patch"
+sha256sums="e17d7446abb99809b0975ea894a9f0ce56a65c5eac1185a857c8bf7978785a98  opensm-3.3.20.tar.gz
+a507a4cc20982e75e674da5ba43e5a56420153338f1ffd9a6f5328488acfe8b2  0001-musl-fixes.patch"
+sha512sums="ea76ae8088c949d6d0d7524920cb333d0981af34bdbe2fa2bde30f13b58dcaeb842989621990a09dfd02db56c180a70109a00e5a45aba800d593b7ee95e4b9b7  opensm-3.3.20.tar.gz
+c5f07423c9726bc4671327596d8585a669b25d75d9143db99e621ab6a08ed4aa0ee22e9725afe10bf4bf98ed503a06e9f52639f41a3cae61a34987b4ed643a32  0001-musl-fixes.patch"
-- 
2.8.3

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