pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

OpenIPMI: Fix build on NetBSD and PLIST



Module Name:	pkgsrc-wip
Committed By:	Juraj Lutter <otis%NetBSD.org@localhost>
Pushed By:	otis
Date:		Thu Oct 22 12:51:06 2020 +0200
Changeset:	071c3445d951a57a7b2bde862c2a54be1063e4c6

Modified Files:
	OpenIPMI/Makefile
	OpenIPMI/PLIST
	OpenIPMI/TODO
	OpenIPMI/distinfo
	OpenIPMI/options.mk
Added Files:
	OpenIPMI/patches/patch-lanserv_extcmd.c
	OpenIPMI/patches/patch-unix_selector.c

Log Message:
OpenIPMI: Fix build on NetBSD and PLIST

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=071c3445d951a57a7b2bde862c2a54be1063e4c6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 OpenIPMI/Makefile                       |  3 ++
 OpenIPMI/PLIST                          |  6 +++
 OpenIPMI/TODO                           |  1 -
 OpenIPMI/distinfo                       |  2 +
 OpenIPMI/options.mk                     |  5 ++
 OpenIPMI/patches/patch-lanserv_extcmd.c | 82 +++++++++++++++++++++++++++++++++
 OpenIPMI/patches/patch-unix_selector.c  | 18 ++++++++
 7 files changed, 116 insertions(+), 1 deletion(-)

diffs:
diff --git a/OpenIPMI/Makefile b/OpenIPMI/Makefile
index 8ab8cbc3b3..d5644ffd27 100644
--- a/OpenIPMI/Makefile
+++ b/OpenIPMI/Makefile
@@ -13,6 +13,9 @@ GNU_CONFIGURE=	yes
 USE_LIBTOOL=	yes
 USE_TOOLS+=	gmake perl pkg-config
 
+LDFLAGS.NetBSD+=		-lexecinfo
+BUILDLINK_TRANSFORM.NetBSD=	rm:-ldl
+
 PKGCONFIG_OVERRIDE+=	OpenIPMI.pc.in
 PKGCONFIG_OVERRIDE+=	OpenIPMIcmdlang.pc.in
 PKGCONFIG_OVERRIDE+=	OpenIPMIglib.pc.in
diff --git a/OpenIPMI/PLIST b/OpenIPMI/PLIST
index e2ac178631..e22e2c3961 100644
--- a/OpenIPMI/PLIST
+++ b/OpenIPMI/PLIST
@@ -73,12 +73,18 @@ lib/libOpenIPMIposix.la
 lib/libOpenIPMIpthread.la
 lib/libOpenIPMIui.la
 lib/libOpenIPMIutils.la
+${PLIST.perl}${PERL5_SUB_INSTALLVENDORARCH}/OpenIPMI.pm
+${PLIST.perl}${PERL5_SUB_INSTALLVENDORARCH}/auto/OpenIPMI/OpenIPMI.so
 lib/pkgconfig/OpenIPMI.pc
 lib/pkgconfig/OpenIPMIcmdlang.pc
 lib/pkgconfig/OpenIPMIposix.pc
 lib/pkgconfig/OpenIPMIpthread.pc
 lib/pkgconfig/OpenIPMIui.pc
 lib/pkgconfig/OpenIPMIutils.pc
+${PLIST.py3x}${PYSITELIB}/OpenIPMI.py
+${PLIST.py3x}${PYSITELIB}/_OpenIPMI.la
+${PLIST.py3x}${PYSITELIB}/_OpenIPMI.a
+${PLIST.py3x}${PYSITELIB}/_OpenIPMI.so
 man/man1/ipmi_sim.1
 man/man1/ipmi_ui.1
 man/man1/openipmi_eventd.1
diff --git a/OpenIPMI/TODO b/OpenIPMI/TODO
index d5a2674bae..254d510b3d 100644
--- a/OpenIPMI/TODO
+++ b/OpenIPMI/TODO
@@ -1,3 +1,2 @@
-- Fix build on NetBSD
 - Test build on Linux
 
diff --git a/OpenIPMI/distinfo b/OpenIPMI/distinfo
index d856eccf97..80bb52d6c5 100644
--- a/OpenIPMI/distinfo
+++ b/OpenIPMI/distinfo
@@ -5,3 +5,5 @@ RMD160 (OpenIPMI-2.0.29.tar.gz) = 1a82606dca2e585a5075eeb40e23aa10029724db
 SHA512 (OpenIPMI-2.0.29.tar.gz) = ff23aadfe4b9002574d1f06dda3d61f7a03ef1df2c61855516b7d67bd6d3272c53af74e3412e1045242dcb845f50b7c542083e918805c0efac424dd86e720a10
 Size (OpenIPMI-2.0.29.tar.gz) = 3119530 bytes
 SHA1 (patch-configure) = 644287934ea58b18aebad100cfe3f37c39eca3ff
+SHA1 (patch-lanserv_extcmd.c) = bb9d9b91343becc6a448efdf166b5095f5270eeb
+SHA1 (patch-unix_selector.c) = 45730697f0c4c110f4e34b4ff07a8dd9c4cc0a8b
diff --git a/OpenIPMI/options.mk b/OpenIPMI/options.mk
index 018d880fee..cd3d9a3d5a 100644
--- a/OpenIPMI/options.mk
+++ b/OpenIPMI/options.mk
@@ -4,11 +4,14 @@ PKG_OPTIONS_VAR=		PKG_OPTIONS.OpenIPMI
 PKG_SUPPORTED_OPTIONS=		perl python snmp swig
 PKG_SUGGESTED_OPTIONS=		perl python snmp swig
 
+PLIST_VARS+=			perl python
+
 .include "../../mk/bsd.options.mk"
 
 .if !empty(PKG_OPTIONS:Mperl)
 CONFIGURE_ARGS+=	--with-perl=${PERl5}
 .include "../../lang/perl5/buildlink3.mk"
+PLIST.perl=		yes
 .else
 CONFIGURE_ARGS+=	--with-perl=no
 .endif
@@ -16,6 +19,8 @@ CONFIGURE_ARGS+=	--with-perl=no
 .if !empty(PKG_OPTIONS:Mpython)
 CONFIGURE_ARGS+=	--with-python=${PYTHONBIN}
 .include "../../lang/python/pyversion.mk"
+PLIST.python=		yes
+PLIST_SUBST+=		PYSITELIB=${PYSITELIB}
 .else
 CONFIGURE_ARGS+=	--with-python=no
 .endif
diff --git a/OpenIPMI/patches/patch-lanserv_extcmd.c b/OpenIPMI/patches/patch-lanserv_extcmd.c
new file mode 100644
index 0000000000..20d7f99dc1
--- /dev/null
+++ b/OpenIPMI/patches/patch-lanserv_extcmd.c
@@ -0,0 +1,82 @@
+$NetBSD$
+
+Create compat functions.
+
+--- lanserv/extcmd.c.orig	2017-07-27 22:01:19.000000000 +0000
++++ lanserv/extcmd.c
+@@ -53,6 +53,7 @@
+  *      written permission.
+  */
+ #include <config.h>
++#include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+@@ -61,8 +62,13 @@
+ #elif defined(HAVE_SYS_ETHERNET_H)
+ #include <sys/ethernet.h>
+ #else
++#if defined (__NetBSD__)
++#include <net/if.h>
++#include <net/if_ether.h>
++#else
+ #error "either netinet/ether.h or sys/ethernet.h must exist."
+ #endif
++#endif
+ #include <ctype.h>
+ #include <string.h>
+ #include <errno.h>
+@@ -73,6 +79,53 @@
+ #include <OpenIPMI/serv.h>
+ #include <OpenIPMI/extcmd.h>
+ 
++/*
++ * These two functions (ether_aton_r() and ether_ntoa_r()
++ * were obtained from FreeBSD and modified for NetBSD
++ */
++
++#ifndef ether_aton_r
++/*
++ * Convert an ASCII representation of an ethernet address to binary form.
++ */
++struct ether_addr *
++ether_aton_r(const char *a, struct ether_addr *e)
++{
++        int i;
++        unsigned int o0, o1, o2, o3, o4, o5;
++
++        i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5);
++        if (i != 6)
++                return (NULL);
++        e->ether_addr_octet[0]=o0;
++        e->ether_addr_octet[1]=o1;
++        e->ether_addr_octet[2]=o2;
++        e->ether_addr_octet[3]=o3;
++        e->ether_addr_octet[4]=o4;
++        e->ether_addr_octet[5]=o5;
++        return (e);
++}
++#endif
++
++#ifndef ether_ntoa_r
++/*
++ * Convert a binary representation of an ethernet address to an ASCII string.
++ */
++char *
++ether_ntoa_r(const struct ether_addr *n, char *a)
++{
++        int i;
++
++        i = sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x", n->ether_addr_octet[0],
++            n->ether_addr_octet[1], n->ether_addr_octet[2],
++	    n->ether_addr_octet[3], n->ether_addr_octet[4],
++	    n->ether_addr_octet[5]);
++        if (i < 17)
++                return (NULL);
++        return (a);
++}
++#endif
++
+ static int
+ extcmd_getval(void *baseloc, extcmd_info_t *t, char *val)
+ {
diff --git a/OpenIPMI/patches/patch-unix_selector.c b/OpenIPMI/patches/patch-unix_selector.c
new file mode 100644
index 0000000000..bea2b41a41
--- /dev/null
+++ b/OpenIPMI/patches/patch-unix_selector.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Testy for EBADFD on respective platforms only.
+
+--- unix/selector.c.orig	2020-10-08 11:19:47.295098497 +0000
++++ unix/selector.c
+@@ -1030,7 +1030,11 @@ process_fds(struct selector_s	    *sel,
+ 		  &tmp_except_set,
+ 		  &ts, &sigmask);
+     if (err < 0) {
++#if defined(EBADFD)
+ 	if (errno == EBADF || errno == EBADFD)
++#else
++	if (errno == EBADF)
++#endif
+ 	    /* We raced, just retry it. */
+ 	    goto retry;
+ 	goto out;


Home | Main Index | Thread Index | Old Index