From 6c2e8b36cf1b8399a00b362411f19aa05677f7cf Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Thu, 7 Dec 2017 12:47:37 -0600 Subject: [PATCH] libnsl: Add alpine patches to fix w/musl --- pkgs/development/libraries/libnsl/cdefs.patch | 30 +++++++++++++ pkgs/development/libraries/libnsl/default.nix | 2 + pkgs/development/libraries/libnsl/nis_h.patch | 45 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 pkgs/development/libraries/libnsl/cdefs.patch create mode 100644 pkgs/development/libraries/libnsl/nis_h.patch diff --git a/pkgs/development/libraries/libnsl/cdefs.patch b/pkgs/development/libraries/libnsl/cdefs.patch new file mode 100644 index 000000000000..dbbe800a3479 --- /dev/null +++ b/pkgs/development/libraries/libnsl/cdefs.patch @@ -0,0 +1,30 @@ +--- a/src/rpcsvc/nislib.h ++++ b/src/rpcsvc/nislib.h +@@ -19,6 +19,7 @@ + #ifndef __RPCSVC_NISLIB_H__ + #define __RPCSVC_NISLIB_H__ + ++#include + #include + + __BEGIN_DECLS +--- a/src/rpcsvc/ypclnt.h ++++ b/src/rpcsvc/ypclnt.h +@@ -20,6 +20,7 @@ + #ifndef __RPCSVC_YPCLNT_H__ + #define __RPCSVC_YPCLNT_H__ + ++#include + #include + + /* Some defines */ +--- a/src/rpcsvc/ypupd.h ++++ b/src/rpcsvc/ypupd.h +@@ -33,6 +33,7 @@ + #ifndef __RPCSVC_YPUPD_H__ + #define __RPCSVC_YPUPD_H__ + ++#include + #include + + #include diff --git a/pkgs/development/libraries/libnsl/default.nix b/pkgs/development/libraries/libnsl/default.nix index d4af280c3cd8..9e8a46b2e6b3 100644 --- a/pkgs/development/libraries/libnsl/default.nix +++ b/pkgs/development/libraries/libnsl/default.nix @@ -14,6 +14,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook pkgconfig ]; buildInputs = [ libtirpc ]; + patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ./cdefs.patch ./nis_h.patch ]; + meta = with stdenv.lib; { description = "Client interface library for NIS(YP) and NIS+"; homepage = https://github.com/thkukuk/libnsl; diff --git a/pkgs/development/libraries/libnsl/nis_h.patch b/pkgs/development/libraries/libnsl/nis_h.patch new file mode 100644 index 000000000000..199259df2e8d --- /dev/null +++ b/pkgs/development/libraries/libnsl/nis_h.patch @@ -0,0 +1,45 @@ +--- a/src/rpcsvc/nis.h ++++ b/src/rpcsvc/nis.h +@@ -32,6 +32,7 @@ + #ifndef _RPCSVC_NIS_H + #define _RPCSVC_NIS_H 1 + ++#include + #include + #include + #include +@@ -56,6 +57,34 @@ + * + */ + ++#ifndef rawmemchr ++#define rawmemchr(s,c) memchr((s),(size_t)-1,(c)) ++#endif ++ ++#ifndef __asprintf ++#define __asprintf asprintf ++#endif ++ ++#ifndef __mempcpy ++#define __mempcpy mempcpy ++#endif ++ ++#ifndef __strtok_r ++#define __strtok_r strtok_r ++#endif ++ ++#ifndef __always_inline ++#define __always_inline __attribute__((__always_inline__)) ++#endif ++ ++#ifndef TEMP_FAILURE_RETRY ++#define TEMP_FAILURE_RETRY(exp) ({ \ ++typeof (exp) _rc; \ ++ do { \ ++ _rc = (exp); \ ++ } while (_rc == -1 && errno == EINTR); \ ++ _rc; }) ++#endif + + #ifndef __nis_object_h + #define __nis_object_h