Wed Sep 22 10:35:57 2021 UTC ()
net-snmp: allow build on newer Darwin; fix #55927


(adam)
diff -r1.136 -r1.137 pkgsrc/net/net-snmp/Makefile

cvs diff -r1.136 -r1.137 pkgsrc/net/net-snmp/Makefile (switch to unified diff)

--- pkgsrc/net/net-snmp/Makefile 2021/05/24 19:53:21 1.136
+++ pkgsrc/net/net-snmp/Makefile 2021/09/22 10:35:57 1.137
@@ -1,148 +1,145 @@ @@ -1,148 +1,145 @@
1# $NetBSD: Makefile,v 1.136 2021/05/24 19:53:21 wiz Exp $ 1# $NetBSD: Makefile,v 1.137 2021/09/22 10:35:57 adam Exp $
2 2
3PKGREVISION= 3 3PKGREVISION= 3
4.include "Makefile.common" 4.include "Makefile.common"
5CATEGORIES= net 5CATEGORIES= net
6 6
7MAINTAINER= adam@NetBSD.org 7MAINTAINER= adam@NetBSD.org
8COMMENT= Extensible SNMP implementation 8COMMENT= Extensible SNMP implementation
9 9
10CONFLICTS= ucd-snmp-[0-9]* 10CONFLICTS= ucd-snmp-[0-9]*
11CONFLICTS+= nocol-[0-9]* # bin/snmpget bin/snmpwalk 11CONFLICTS+= nocol-[0-9]* # bin/snmpget bin/snmpwalk
12 12
13USE_LIBTOOL= yes 13USE_LIBTOOL= yes
14GNU_CONFIGURE= yes 14GNU_CONFIGURE= yes
15 15
16MAKE_ENV+= OPSYS=${OPSYS} 16MAKE_ENV+= OPSYS=${OPSYS}
17MAKE_JOBS_SAFE= no 17MAKE_JOBS_SAFE= no
18 18
19.include "../../mk/bsd.prefs.mk" 19.include "../../mk/bsd.prefs.mk"
20 20
21.include "options.mk" 21.include "options.mk"
22 22
23# Don't compress manual pages as they include each other. 23# Don't compress manual pages as they include each other.
24.undef MANZ 24.undef MANZ
25 25
26MAKE_ENV.DragonFly+= MIB_SYSTEM_LIBS=-lkinfo 26MAKE_ENV.DragonFly+= MIB_SYSTEM_LIBS=-lkinfo
27 27
28.if ${OPSYS} == "NetBSD" 28.if ${OPSYS} == "NetBSD"
29OSVERSION_SPECIFIC= YES 29OSVERSION_SPECIFIC= YES
30. if empty(CFLAGS:U:M*-Dnetbsd1*) 30. if empty(CFLAGS:U:M*-Dnetbsd1*)
31CFLAGS+= -Dnetbsd1 31CFLAGS+= -Dnetbsd1
32. endif 32. endif
33CFLAGS+= -DSOL_IP=IPPROTO_IP 33CFLAGS+= -DSOL_IP=IPPROTO_IP
34.endif 34.endif
35 35
36LDFLAGS.SunOS+= -lkvm 36LDFLAGS.SunOS+= -lkvm
37 37
38.if (${OPSYS} == "NetBSD") || !exists(/usr/bin/lpstat) 38.if (${OPSYS} == "NetBSD") || !exists(/usr/bin/lpstat)
39CONFIGURE_ENV+= ac_cv_path_LPSTAT_PATH=no 39CONFIGURE_ENV+= ac_cv_path_LPSTAT_PATH=no
40.endif 40.endif
41 41
42NET_SNMP_SYS_CONTACT?= default_user@contact.domain 42NET_SNMP_SYS_CONTACT?= default_user@contact.domain
43NET_SNMP_SYS_LOCATION?= defaultlocation 43NET_SNMP_SYS_LOCATION?= defaultlocation
44NET_SNMP_PERSISTENTDIR?= ${VARBASE}/net-snmp 44NET_SNMP_PERSISTENTDIR?= ${VARBASE}/net-snmp
45NET_SNMP_MIBDIRS?= \$$HOME/.snmp/mibs:${PREFIX}/share/snmp/mibs:${PREFIX}/lib/tcl/tnm2.1.10/mibs:/usr/local/share/snmp/mibs 45NET_SNMP_MIBDIRS?= \$$HOME/.snmp/mibs:${PREFIX}/share/snmp/mibs:${PREFIX}/lib/tcl/tnm2.1.10/mibs:/usr/local/share/snmp/mibs
46 46
47BUILD_DEFS+= NET_SNMP_SYS_CONTACT 47BUILD_DEFS+= NET_SNMP_SYS_CONTACT
48BUILD_DEFS+= NET_SNMP_SYS_LOCATION 48BUILD_DEFS+= NET_SNMP_SYS_LOCATION
49BUILD_DEFS+= NET_SNMP_PERSISTENTDIR 49BUILD_DEFS+= NET_SNMP_PERSISTENTDIR
50BUILD_DEFS+= NET_SNMP_MIBDIRS 50BUILD_DEFS+= NET_SNMP_MIBDIRS
51 51
52CONFIGURE_ARGS+= --enable-shared 52CONFIGURE_ARGS+= --enable-shared
53CONFIGURE_ARGS+= --with-defaults 53CONFIGURE_ARGS+= --with-defaults
54CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} 54CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
55CONFIGURE_ARGS+= --with-libwrap=${BUILDLINK_PREFIX.tcp_wrappers}/lib 55CONFIGURE_ARGS+= --with-libwrap=${BUILDLINK_PREFIX.tcp_wrappers}/lib
56CONFIGURE_ARGS+= --with-sys-contact=${NET_SNMP_SYS_CONTACT:Q} 56CONFIGURE_ARGS+= --with-sys-contact=${NET_SNMP_SYS_CONTACT:Q}
57CONFIGURE_ARGS+= --with-sys-location=${NET_SNMP_SYS_LOCATION:Q} 57CONFIGURE_ARGS+= --with-sys-location=${NET_SNMP_SYS_LOCATION:Q}
58CONFIGURE_ARGS+= --with-install-prefix=${DESTDIR} 58CONFIGURE_ARGS+= --with-install-prefix=${DESTDIR}
59# 59#
60# NOTE: if you specify a logfile then this file will be written to by 60# NOTE: if you specify a logfile then this file will be written to by
61# default and although it can be disabled on the command line, the 61# default and although it can be disabled on the command line, the
62# daemon must be stopped to cycle it properly. Remember rc.d/snmpd 62# daemon must be stopped to cycle it properly. Remember rc.d/snmpd
63# will use '-s' to enable standard syslog logging anyway. 63# will use '-s' to enable standard syslog logging anyway.
64# 64#
65CONFIGURE_ARGS+= --with-logfile=none 65CONFIGURE_ARGS+= --with-logfile=none
66CONFIGURE_ARGS+= --with-persistent-directory=${NET_SNMP_PERSISTENTDIR} 66CONFIGURE_ARGS+= --with-persistent-directory=${NET_SNMP_PERSISTENTDIR}
67.if !empty(NET_SNMP_MIBDIRS) 67.if !empty(NET_SNMP_MIBDIRS)
68CONFIGURE_ARGS+= --with-mibdirs=${NET_SNMP_MIBDIRS:Q} 68CONFIGURE_ARGS+= --with-mibdirs=${NET_SNMP_MIBDIRS:Q}
69.endif 69.endif
70.if ${OPSYS} == "NetBSD" || ${OPSYS} == "SunOS" 70.if ${OPSYS} == "NetBSD" || ${OPSYS} == "SunOS"
71CONFIGURE_ARGS+= --with-mib-modules="smux host ucd-snmp/diskio" 71CONFIGURE_ARGS+= --with-mib-modules="smux host ucd-snmp/diskio"
72.else 72.else
73CONFIGURE_ARGS+= --with-mib-modules="smux host" 73CONFIGURE_ARGS+= --with-mib-modules="smux host"
74.endif 74.endif
75.if !empty(MACHINE_PLATFORM:MDarwin-[567].*) 75.if !empty(MACHINE_PLATFORM:MDarwin-[567].*)
76CONFIGURE_ARGS+= --with-out-mib-modules="ucd-snmp/diskio mibII" 76CONFIGURE_ARGS+= --with-out-mib-modules="ucd-snmp/diskio mibII"
77.endif 77.endif
78.if !empty(MACHINE_PLATFORM:MDarwin-9.*) 78.if !empty(MACHINE_PLATFORM:MDarwin-9.*)
79CONFIGURE_ARGS+= --with-mib-modules="host ucd-snmp/diskio" 79CONFIGURE_ARGS+= --with-mib-modules="host ucd-snmp/diskio"
80CONFIGURE_ARGS+= --with-out-mib-modules="mibII/icmp host/hr_swrun" 80CONFIGURE_ARGS+= --with-out-mib-modules="mibII/icmp host/hr_swrun"
81CONFIGURE_ARGS+= --enable-as-needed 81CONFIGURE_ARGS+= --enable-as-needed
82CONFIGURE_ARGS+= --without-kmem-usage 82CONFIGURE_ARGS+= --without-kmem-usage
83CONFIGURE_ARGS+= --without-rpm 83CONFIGURE_ARGS+= --without-rpm
84.endif 84.endif
85# 85#
86# Using "dummy" values is technically not compliant with SNMP specs, but 86# Using "dummy" values is technically not compliant with SNMP specs, but
87# otherwise, some tools, e.g. net/tcl-scotty, net/tkined, may ignore results 87# otherwise, some tools, e.g. net/tcl-scotty, net/tkined, may ignore results
88# when they shouldn't. 88# when they shouldn't.
89# 89#
90CONFIGURE_ARGS+= --with-dummy-values 90CONFIGURE_ARGS+= --with-dummy-values
91# 91#
92# Install the UCD-SNMP look-alike headers and libraries to ease porting of 92# Install the UCD-SNMP look-alike headers and libraries to ease porting of
93# older software to use net-snmp. 93# older software to use net-snmp.
94# 94#
95CONFIGURE_ARGS+= --enable-ucd-snmp-compatibility 95CONFIGURE_ARGS+= --enable-ucd-snmp-compatibility
96 96
97CFLAGS.Darwin+= -framework ApplicationServices 97CFLAGS.Darwin+= -framework ApplicationServices
98CFLAGS.Darwin+= -framework CoreFoundation 98CFLAGS.Darwin+= -framework CoreFoundation
99CFLAGS.Darwin+= -framework CoreServices 99CFLAGS.Darwin+= -framework CoreServices
100CFLAGS.Darwin+= -framework DiskArbitration 100CFLAGS.Darwin+= -framework DiskArbitration
101CFLAGS.Darwin+= -framework IOKit 101CFLAGS.Darwin+= -framework IOKit
102 102
103# Handle ${PREFIX}/share/snmp in the DEINSTALL script since it may contain 103# Handle ${PREFIX}/share/snmp in the DEINSTALL script since it may contain
104# leftover config files or pidfiles after deinstallation. 104# leftover config files or pidfiles after deinstallation.
105# 105#
106REQD_DIRS= ${PREFIX}/share/snmp 106REQD_DIRS= ${PREFIX}/share/snmp
107RCD_SCRIPTS= snmpd snmptrapd 107RCD_SCRIPTS= snmpd snmptrapd
108SMF_NAME= snmp 108SMF_NAME= snmp
109SMF_INSTANCES= default snmptrapd 109SMF_INSTANCES= default snmptrapd
110 110
111USE_TOOLS+= sh:run 111USE_TOOLS+= sh:run
112REPLACE_INTERPRETER+= bash 112REPLACE_INTERPRETER+= bash
113REPLACE.bash.old= /bin/bash 113REPLACE.bash.old= /bin/bash
114REPLACE.bash.new= ${SH} 114REPLACE.bash.new= ${SH}
115REPLACE_FILES.bash= local/mib2c-update 115REPLACE_FILES.bash= local/mib2c-update
116 116
117INSTALLATION_DIRS+= share/examples/net-snmp 117INSTALLATION_DIRS+= share/examples/net-snmp
118 118
119post-extract: 119post-extract:
120.if ${OPSYS} == "DragonFly" 120.if ${OPSYS} == "DragonFly"
121 cp ${FILESDIR}/cpu_dragonfly.c ${WRKSRC}/agent/mibgroup/hardware/cpu/cpu_nlist.c 121 cp ${FILESDIR}/cpu_dragonfly.c ${WRKSRC}/agent/mibgroup/hardware/cpu/cpu_nlist.c
122# XXX make it build on OS X 10.10; remove on the next update 
123.elif ${OPSYS} == "Darwin" 122.elif ${OPSYS} == "Darwin"
124 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin14.h 123 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin17.h ${WRKSRC}/include/net-snmp/system/darwin18.h
125 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin15.h 124 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin17.h ${WRKSRC}/include/net-snmp/system/darwin19.h
126 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin16.h 125 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin17.h ${WRKSRC}/include/net-snmp/system/darwin20.h
127 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin17.h 126 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin17.h ${WRKSRC}/include/net-snmp/system/darwin21.h
128 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin18.h 
129 ${LN} -s ${WRKSRC}/include/net-snmp/system/darwin13.h ${WRKSRC}/include/net-snmp/system/darwin19.h 
130.endif 127.endif
131 128
132post-wrapper: 129post-wrapper:
133.if !empty(MACHINE_PLATFORM:MNetBSD-1.5.[123]*-i386) 130.if !empty(MACHINE_PLATFORM:MNetBSD-1.5.[123]*-i386)
134 mkdir ${BUILDLINK_DIR}/include/sys 131 mkdir ${BUILDLINK_DIR}/include/sys
135 cp ${FILESDIR}/disklabel.h ${BUILDLINK_DIR}/include/sys 132 cp ${FILESDIR}/disklabel.h ${BUILDLINK_DIR}/include/sys
136.endif 133.endif
137 134
138post-install: 135post-install:
139 ${INSTALL_DATA} ${WRKSRC}/EXAMPLE.conf \ 136 ${INSTALL_DATA} ${WRKSRC}/EXAMPLE.conf \
140 ${DESTDIR}${PREFIX}/share/examples/net-snmp/EXAMPLE.conf 137 ${DESTDIR}${PREFIX}/share/examples/net-snmp/EXAMPLE.conf
141 ${INSTALL_DATA} ${WRKSRC}/agent/snmp_perl.pl \ 138 ${INSTALL_DATA} ${WRKSRC}/agent/snmp_perl.pl \
142 ${DESTDIR}${PREFIX}/share/snmp/ 139 ${DESTDIR}${PREFIX}/share/snmp/
143 140
144.include "../../mk/curses.buildlink3.mk" 141.include "../../mk/curses.buildlink3.mk"
145.include "../../devel/pcre/buildlink3.mk" 142.include "../../devel/pcre/buildlink3.mk"
146.include "../../net/libpcap/buildlink3.mk" 143.include "../../net/libpcap/buildlink3.mk"
147.include "../../security/tcp_wrappers/buildlink3.mk" 144.include "../../security/tcp_wrappers/buildlink3.mk"
148.include "../../mk/bsd.pkg.mk" 145.include "../../mk/bsd.pkg.mk"