blob: faf73a563643bfb851ef7044529c9e8f385ee26a [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "Various tools relating to the Simple Network Management Protocol"
2HOMEPAGE = "http://www.net-snmp.org/"
3SECTION = "net"
4LICENSE = "BSD"
5
6LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e"
7
8DEPENDS = "openssl libnl pciutils"
9
10SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
Patrick Williamsddad1a12017-02-23 20:36:32 -060011 file://init \
12 file://snmpd.conf \
13 file://snmptrapd.conf \
14 file://systemd-support.patch \
15 file://snmpd.service \
16 file://snmptrapd.service \
17 file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \
18 file://fix-libtool-finish.patch \
19 file://net-snmp-testing-add-the-output-format-for-ptest.patch \
20 file://run-ptest \
21 file://dont-return-incompletely-parsed-varbinds.patch \
22 file://0001-config_os_headers-Error-Fix.patch \
23 file://0001-config_os_libs2-Error-Fix.patch \
24 file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \
25 file://net-snmp-agentx-crash.patch \
26 file://0001-get_pid_from_inode-Include-limit.h.patch \
Brad Bishop7f28bc52017-12-03 23:42:40 -050027 file://0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch \
28 file://0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 file://0001-configure-fix-check-for-enable-perl-cc-checks.patch \
30 file://0002-configure-fix-a-cc-check-issue.patch \
31 file://0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch \
32 file://0004-configure-fix-incorrect-variable.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
34 file://net-snmp-fix-for-disable-des.patch \
Brad Bishop316dfdd2018-06-25 12:45:53 -040035 file://0001-Remove-U64-typedef.patch \
Patrick Williamsddad1a12017-02-23 20:36:32 -060036 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -050037SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
38SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
39
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative
Patrick Williamsb48b7b42016-08-17 15:04:38 -050041
42EXTRA_OEMAKE = "INSTALL_PREFIX=${D} OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'"
43
44PARALLEL_MAKE = ""
45CCACHE = ""
46
47TARGET_CC_ARCH += "${LDFLAGS}"
48
49PACKAGECONFIG ??= ""
50PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils"
51PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl"
52
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050054PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,,"
55
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056PACKAGECONFIG[perl] = "--enable-embedded-perl --with-perl-modules=yes, --disable-embedded-perl --with-perl-modules=no,\
57 perl, perl perl-lib"
58
59EXTRA_OECONF = "--enable-shared \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050060 --disable-manuals \
61 --with-defaults \
62 --with-install-prefix=${D} \
63 --with-persistent-directory=${localstatedir}/lib/net-snmp \
Brad Bishop316dfdd2018-06-25 12:45:53 -040064 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050065"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050066
67# net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp
68EXTRA_OECONF += "--with-mib-modules=smux"
69
70CACHED_CONFIGUREVARS = " \
71 ac_cv_header_valgrind_valgrind_h=no \
72 ac_cv_header_valgrind_memcheck_h=no \
73 ac_cv_ETC_MNTTAB=/etc/mtab \
74 lt_cv_shlibpath_overrides_runpath=yes \
75"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076export PERLPROG="${bindir}/env perl"
77PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
78
79HAS_PERL = "${@bb.utils.contains('PACKAGECONFIG', 'perl', '1', '0', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050080
81do_configure_prepend() {
Patrick Williamsb48b7b42016-08-17 15:04:38 -050082 sed -i -e "s|I/usr/include|I${STAGING_INCDIR}|g" \
83 "${S}"/configure \
84 "${S}"/configure.d/config_os_libs2
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085
86 if [ "${HAS_PERL}" = "1" ]; then
87 # this may need to be changed when package perl has any change.
88 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config.pm ${WORKDIR}/
89 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config_heavy.pl ${WORKDIR}/
90 sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \
91 -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \
92 -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \
93 -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
94 -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
95 -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \
96 -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \
97 -i ${WORKDIR}/Config.pm
98 fi
99
100}
101
102do_configure_append() {
103 if [ "${HAS_PERL}" = "1" ]; then
104 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${STAGING_DIR_TARGET}\$\{includedir\}@g" \
105 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${STAGING_DIR_TARGET}\$\{libdir\}@g" \
106 -i ${B}/net-snmp-config
107 fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500108}
109
110do_install_append() {
111 install -d ${D}${sysconfdir}/snmp
112 install -d ${D}${sysconfdir}/init.d
113 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd
114 install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp/
115 install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/snmp/
116 install -d ${D}${systemd_unitdir}/system
117 install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
118 install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
119 sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
120 -i ${D}${bindir}/net-snmp-create-v3-user
121 sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
Brad Bishop316dfdd2018-06-25 12:45:53 -0400122 -e "s@\([^ ]*-fdebug-prefix-map=[^ ]*\)\1*@@g" \
123 -e "s@\([^ ]*--sysroot=[^ ]*\)\1*@@g" \
124 -e "s@\([^ ]*--with-libtool-sysroot=[^ ]*\)\1*@@g" \
125 -e "s@\([^ ]*--with-install-prefix=[^ ]*\)\1*@@g" \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500126 -i ${D}${bindir}/net-snmp-config
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500127
128 if [ "${HAS_PERL}" = "1" ]; then
129 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=\$\{includedir\}@g" \
130 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L\$\{libdir\}@g" \
131 -i ${D}${bindir}/net-snmp-config
132 fi
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500133}
134
135do_install_ptest() {
136 install -d ${D}${PTEST_PATH}
137 for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \
138 ${B}/net-snmp-config ${S}/testing; do
139 if [ -e "$i" ]; then
140 cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH}
141 fi
142 done
143 echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version
144
145 rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build"
146 for i in $rmdlist; do
147 if [ -d "$i" ]; then
148 rm -rf "$i"
149 fi
150 done
151}
152
153SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400154SNMP_DBGDIR = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500155
156net_snmp_sysroot_preprocess () {
157 if [ -e ${D}${bindir}/net-snmp-config ]; then
158 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
159 install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
160 sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \
161 -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \
162 -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \
163 -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \
164 -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \
165 -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \
Brad Bishop316dfdd2018-06-25 12:45:53 -0400166 -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \
167 -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
168 -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \
169 -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \
170 -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \
171 -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500172 -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config
173 fi
174}
175
176PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client ${PN}-server-snmpd ${PN}-server-snmptrapd"
177
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500178# perl module
179PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}"
180
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500181ALLOW_EMPTY_${PN} = "1"
182ALLOW_EMPTY_${PN}-server = "1"
183
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500184FILES_${PN}-perl-modules = "${libdir}/perl/*"
185
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500186FILES_${PN}-libs = "${libdir}/lib*${SOLIBS}"
187FILES_${PN}-mibs = "${datadir}/snmp/mibs"
188FILES_${PN}-server-snmpd = "${sbindir}/snmpd \
189 ${sysconfdir}/snmp/snmpd.conf \
190 ${sysconfdir}/init.d \
191 ${systemd_unitdir}/system/snmpd.service \
192"
193
194FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \
195 ${sysconfdir}/snmp/snmptrapd.conf \
196 ${systemd_unitdir}/system/snmptrapd.service \
197"
198
199FILES_${PN} = ""
200FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
201FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/"
202FILES_${PN}-dev += "${bindir}/mib2c ${bindir}/mib2c-update"
203
204CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf"
205CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
206
Patrick Williamsddad1a12017-02-23 20:36:32 -0600207INITSCRIPT_PACKAGES = "${PN}-server-snmpd"
208INITSCRIPT_NAME_${PN}-server-snmpd = "snmpd"
209INITSCRIPT_PARAMS_${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ."
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500210
Patrick Williamsddad1a12017-02-23 20:36:32 -0600211EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500212
213SYSTEMD_PACKAGES = "${PN}-server-snmpd \
214 ${PN}-server-snmptrapd"
215
216SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service"
217SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service"
218
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500219RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500220RDEPENDS_${PN} += "net-snmp-client"
221RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs"
222RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd"
223RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500224RDEPENDS_${PN}-client += "net-snmp-mibs net-snmp-libs"
225RDEPENDS_${PN}-libs += "libpci"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500226RDEPENDS_${PN}-ptest += "perl \
227 perl-module-test \
228 perl-module-file-basename \
229 perl-module-getopt-long \
230 perl-module-file-temp \
231 perl-module-data-dumper \
232"
233RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
234RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
235
236RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
237RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
238RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
239
240RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
241RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
242RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
243
244LEAD_SONAME = "libnetsnmp.so"