Subject: [alpine-aports] [PATCH] main/unfs3: build with musl+libtirpc-dev

From: Henrik Riomar <[email-masked]>
Date: Tue, 27 Sep 2016 19:24:20 +0200

---
 main/unfs3/APKBUILD                | 21 ++++++++++++++++-----
 main/unfs3/unfs3-0.9.22-musl.patch | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 5 deletions(-)
 create mode 100644 main/unfs3/unfs3-0.9.22-musl.patch

diff --git a/main/unfs3/APKBUILD b/main/unfs3/APKBUILD
index ddddc42..307562d 100644
--- a/main/unfs3/APKBUILD
+++ b/main/unfs3/APKBUILD
@@ -1,19 +1,25 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=unfs3
 pkgver=0.9.22
-pkgrel=2
+pkgrel=3
 pkgdesc="a user-space implementation of the NFSv3 server specification"
 url="http://unfs3.sourceforge.net/"
 arch="all"
 license='GPL'
 depends=""
-makedepends="flex"
-options="!libc_musl"
-source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+depends_dev="libtirpc-dev flex-dev"
+makedepends="$depends_dev flex"
+source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
+unfs3-0.9.22-musl.patch"
 subpackages="$pkgname-doc"
 
 build() {
 	cd "$srcdir/$pkgname-$pkgver"
+	export CFLAGS="$CFLAGS `pkgconf --cflags libtirpc`"
+	export LDFLAGS="$LDFLAGS `pkgconf --libs-only-L libtirpc`"
+	export LIBS="$LIBS `pkgconf --libs-only-l libtirpc`"
+
+	sed -i '/LDFLAGS=/ s,-R/usr/ucblib,,' ./configure
 
 	./configure \
 		--build=$CBUILD \
@@ -29,4 +35,9 @@ package() {
 	make DESTDIR="$pkgdir/" install
 }
 
-md5sums="ddf679a5d4d80096a59f3affc64f16e5  unfs3-0.9.22.tar.gz"
+md5sums="ddf679a5d4d80096a59f3affc64f16e5  unfs3-0.9.22.tar.gz
+0cf4e87daee20f8504cc8af2106033b7  unfs3-0.9.22-musl.patch"
+sha256sums="482222cae541172c155cd5dc9c2199763a6454b0c5c0619102d8143bb19fdf1c  unfs3-0.9.22.tar.gz
+6d5e371dbacb055e8775e409c24a4fd73153510fcb5ace2c0a4e7a189f9140d7  unfs3-0.9.22-musl.patch"
+sha512sums="b1e4b7f5b7b7de27bb5411c69363a6b40be0fcf1f772e283f0868a2155fa9ea4b9b8e7f05b1706e41cf09dd2ee4baab472a01bc4640ae47e3be2a19d8d3f5f9e  unfs3-0.9.22.tar.gz
+f2221651fad842acb8b5fd637514caa07300f627efd5b168ee2939ab3b6ea55fdefa3c3f3336425e255ee7badd326528c722d4064a04936b5468aabc79cbca02  unfs3-0.9.22-musl.patch"
diff --git a/main/unfs3/unfs3-0.9.22-musl.patch b/main/unfs3/unfs3-0.9.22-musl.patch
new file mode 100644
index 0000000..31f3c6a
--- /dev/null
+++ b/main/unfs3/unfs3-0.9.22-musl.patch
@@ -0,0 +1,34 @@
+--- unfs3-0.9.22/daemon.c
++++ unfs3-0.9.22-musl/daemon.c
+@@ -110,7 +110,8 @@
+  */
+ struct in_addr get_remote(struct svc_req *rqstp)
+ {
+-    return (svc_getcaller(rqstp->rq_xprt))->sin_addr;
++    struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
++    return sin->sin_addr;
+ }
+ 
+ /*
+@@ -118,7 +119,8 @@
+  */
+ short get_port(struct svc_req *rqstp)
+ {
+-    return (svc_getcaller(rqstp->rq_xprt))->sin_port;
++    struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
++    return sin->sin_port;
+ }
+ 
+ /*
+--- unfs3-0.9.22/daemon.h
++++ unfs3-0.9.22-musl/daemon.h
+@@ -46,4 +46,9 @@
+ extern int	opt_brute_force;
+ extern int	opt_readable_executables;
+ 
++static inline struct sockaddr_in *nfs_getrpccaller_in(SVCXPRT *xprt)
++{
++	return (struct sockaddr_in *)svc_getcaller(xprt);
++}
++
+ #endif
-- 
2.8.3

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