Subject: pkg/30642: net/net-snmp patch for darwin 8.1.0
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <rtr@omicron-persei-8.net>
List: pkgsrc-bugs
Date: 06/30/2005 14:35:00
>Number:         30642
>Category:       pkg
>Synopsis:       net/net-snmp patch for darwin 8.1.0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 30 14:35:00 +0000 2005
>Originator:     Tyler Retzlaff
>Release:        pkgsrc-2005Q2, pkgsrc-current
>Organization:
>Environment:
System: NetBSD calculon.omicron-persei-8.net 2.0 NetBSD 2.0 (_calculon_) #0: Sat Dec 25 09:13:08 EST 2004 rtr@calculon.omicron-persei-8.net:/var/obj/_calculon_ i386
Architecture: i386
Machine: i386
>Description:

net/net-snmp has been broken on darwin for a while now, the attached
packages allow it to build and run without falling over.

the patches have been pieced together out of patches in the darwin patches
repository.  The patches / tarball contained no copyright/license
info that I could find.

I don't think the patches will break netbsd or other platforms, but they
have not been tested anywhere but darwin.

Thanks

>How-To-Repeat:
try to build net/net-snmp on darwin
>Fix:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/net/net-snmp/Makefile,v
retrieving revision 1.27.2.1
diff -u -p -r1.27.2.1 Makefile
--- Makefile	27 May 2005 14:02:23 -0000	1.27.2.1
+++ Makefile	30 Jun 2005 14:22:59 -0000
@@ -73,7 +73,7 @@ CONFIGURE_ARGS+=	--with-mibdirs="${NET_S
 .endif
 CONFIGURE_ARGS+=	--with-mib-modules="smux host"
 .if (${OPSYS} == "Darwin")
-CONFIGURE_ARGS+=	--with-out-mib-modules="ucd-snmp/diskio mibII"
+CONFIGURE_ARGS+=	--with-out-mib-modules="ucd-snmp/diskio mibII mibII/ipv6"
 .endif
 #
 # Using "dummy" values is technically not compliant with SNMP specs, but
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/net/net-snmp/distinfo,v
retrieving revision 1.13.2.1
diff -u -p -r1.13.2.1 distinfo
--- distinfo	27 May 2005 14:02:23 -0000	1.13.2.1
+++ distinfo	30 Jun 2005 14:23:00 -0000
@@ -9,6 +9,10 @@ SHA1 (patch-ac) = 43dbf5519feac2a13b893f
 SHA1 (patch-ad) = 522872c90ac1e442dafb1d210af6e978ac741ce9
 SHA1 (patch-ae) = 122cd63fcdfa01e94083a9f635c3c46d364a0237
 SHA1 (patch-af) = 21febf32bd44c63a96284b231d39abb00c050532
-SHA1 (patch-ag) = bdb76aecc3a301871c990db1440dc3d78f480bf4
+SHA1 (patch-ag) = 12a2ef2563a7531527be6653f6ed19f5a548fb9b
 SHA1 (patch-ai) = 8255b8ebfea1242076c87f879169d5f24b0f83e1
 SHA1 (patch-aj) = ba320b1b8d5c4e14456f919b70e84de4b86ac73b
+SHA1 (patch-ak) = 4e5027d1d420c8e1869582d13070cf2398ca1ba2
+SHA1 (patch-al) = 7661c6e5bd72f2cd4b9469f0d321ca8330d3fc6e
+SHA1 (patch-am) = e278e53bdf5ac4ed43f7edfcc71daeb22bb6f81b
+SHA1 (patch-an) = 79524e2c63d108c6fa3efb8d8de52442256c06c3
Index: patches/patch-ag
===================================================================
RCS file: /cvsroot/pkgsrc/net/net-snmp/patches/patch-ag,v
retrieving revision 1.2
diff -u -p -r1.2 patch-ag
--- patches/patch-ag	13 Aug 2004 11:28:50 -0000	1.2
+++ patches/patch-ag	30 Jun 2005 14:23:00 -0000
@@ -1,11 +1,10 @@
-$NetBSD: patch-ag,v 1.2 2004/08/13 11:28:50 adam Exp $
-
---- agent/mibgroup/host/hr_storage.c.orig	2004-06-18 18:39:14.000000000 +0000
-+++ agent/mibgroup/host/hr_storage.c
-@@ -164,6 +164,13 @@ extern int      fscount;
+--- agent/mibgroup/host/hr_storage.c.orig	2004-06-19 04:39:14.000000000 +1000
++++ agent/mibgroup/host/hr_storage.c	2005-06-30 15:01:45.000000000 +1000
+@@ -164,7 +164,14 @@
  #define HRFS_mount	f_mntonname
  #define HRFS_HAS_FRSIZE STRUCT_STATVFS_HAS_F_FRSIZE
  
+-#elif defined(HAVE_STATVFS)
 +#elif defined(HAVE_STATVFS) && defined(__NetBSD__)
 +
 +extern struct statvfs *HRFS_entry;
@@ -13,6 +12,7 @@ $NetBSD: patch-ag,v 1.2 2004/08/13 11:28
 +#define HRFS_statfs	statvfs
 +#define HRFS_mount	f_mntonname
 +
- #elif defined(HAVE_STATVFS)
++#elif defined(HAVE_STATVFS) && defined(STRUCT_STATVFS_HAS_MNT_DIR)
  
  extern struct mntent *HRFS_entry;
+ extern int      fscount;
--- /dev/null	2005-07-01 00:21:31.000000000 +1000
+++ patches/patch-ak	2005-06-30 14:43:40.000000000 +1000
@@ -0,0 +1,21 @@
+--- agent/mibgroup/ucd-snmp/disk.c.orig	2005-06-30 14:42:18.000000000 +1000
++++ agent/mibgroup/ucd-snmp/disk.c	2005-06-30 14:42:29.000000000 +1000
+@@ -73,15 +73,17 @@
+ #if HAVE_SYS_VFS_H
+ #include <sys/vfs.h>
+ #endif
+-#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
++#ifdef HAVE_STATVFS
+ #if HAVE_SYS_MOUNT_H
+ #include <sys/mount.h>
+ #endif
+ #if HAVE_SYS_SYSCTL_H
+ #include <sys/sysctl.h>
+ #endif
++#ifndef HAVE_STATVFS
+ #define statvfs statfs
+ #endif
++#endif
+ #if HAVE_VM_VM_H
+ #include <vm/vm.h>
+ #endif
--- /dev/null	2005-07-01 00:21:31.000000000 +1000
+++ patches/patch-al	2005-06-30 23:50:07.000000000 +1000
@@ -0,0 +1,37 @@
+--- agent/mibgroup/host/hr_network.c.orig	2005-06-30 15:17:53.000000000 +1000
++++ agent/mibgroup/host/hr_network.c	2005-06-30 15:18:16.000000000 +1000
+@@ -189,6 +189,8 @@
+ static char     HRN_name[MAX_PHYSADDR_LEN];
+ static nmapi_phystat HRN_ifnet;
+ #define M_Interface_Scan_Next(a, b, c, d)	Interface_Scan_Next(a, b, c)
++#elif darwin
++
+ #else                           /* hpux11 */
+ static char     HRN_name[16];
+ static struct ifnet HRN_ifnet;
+@@ -216,6 +218,9 @@
+ Get_Next_HR_Network(void)
+ {
+ #ifndef solaris2
++#elif darwin
++
++#else
+     if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL))
+         return (HRDEV_NETWORK << HRDEV_TYPE_SHIFT) + HRN_index;
+     else
+@@ -226,6 +231,7 @@
+ void
+ Save_HR_Network_Info(void)
+ {
++#ifndef darwin
+     strcpy(HRN_savedName, HRN_name);
+ #ifdef hpux11
+     HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
+@@ -235,6 +241,7 @@
+     HRN_savedFlags = HRN_ifnet.if_flags;
+     HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
+ #endif                          /* hpux11 */
++#endif /* darwin */
+ }
+ 
+ 
--- /dev/null	2005-07-01 00:21:31.000000000 +1000
+++ patches/patch-am	2005-06-30 15:36:02.000000000 +1000
@@ -0,0 +1,11 @@
+--- agent/mibgroup/host/hr_swrun.c.orig	2005-06-30 15:34:48.000000000 +1000
++++ agent/mibgroup/host/hr_swrun.c	2005-06-30 15:35:11.000000000 +1000
+@@ -1070,6 +1070,8 @@
+     #else
+             proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
+     #endif
++#elif defined darwin
++	long_return = -1;
+ #else
+         long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
+             proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
--- /dev/null	2005-07-01 00:21:31.000000000 +1000
+++ patches/patch-an	2005-06-30 23:49:25.000000000 +1000
@@ -0,0 +1,19 @@
+--- agent/Makefile.in.orig	2005-06-30 23:47:48.000000000 +1000
++++ agent/Makefile.in	2005-06-30 23:48:36.000000000 +1000
+@@ -67,6 +67,7 @@
+ LOCAL_LIBS	= 
+ LIBS		= ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION) @AGENTLIBS@
+ OUR_AGENT_LIBS	= $(INSTALLLIBS) $(HELPERLIB) @WRAPLIBS@ $(LIBS) @DLLIBS@
++OUR_AGENT_LD_LIBS = @WRAPLIBS@
+ CPPFLAGS	= -I../include -I$(top_srcdir)/include \
+ 		  -I.. -I$(srcdir)/.. -I$(srcdir)/../snmplib \
+ 		  -I$(srcdir) -I. -I$(srcdir)/mibgroup -Imibgroup @CPPFLAGS@
+@@ -120,7 +121,7 @@
+ 
+ 
+ libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION):    ${LLIBAGENTOBJS} libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
+-	$(LIB_LD_CMD) libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) ${LLIBAGENTOBJS}  $(LIB_LD_LIBS)
++	$(LIB_LD_CMD) libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION) ${LLIBAGENTOBJS}  $(LIB_LD_LIBS) $(OUR_AGENT_LD_LIBS)
+ 	$(RANLIB) libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION)
+ 
+ libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION):    ${LMIBOBJS}