blob: bee83c4d13e7a79fd0c426f7a636fea4489a1c0d [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "Various tools relating to the Simple Network Management Protocol"
2HOMEPAGE = "http://www.net-snmp.org/"
3SECTION = "net"
Brad Bishop19323692019-04-05 15:28:33 -04004LICENSE = "BSD & MIT"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005
Brad Bishop19323692019-04-05 15:28:33 -04006LIC_FILES_CHKSUM = "file://COPYING;md5=9d100a395a38584f2ec18a8275261687"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08007
8DEPENDS = "openssl libnl pciutils"
9
Brad Bishop26bdd442019-08-16 17:08:17 -040010SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011 file://init \
12 file://snmpd.conf \
13 file://snmptrapd.conf \
14 file://snmpd.service \
15 file://snmptrapd.service \
16 file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \
17 file://fix-libtool-finish.patch \
18 file://net-snmp-testing-add-the-output-format-for-ptest.patch \
19 file://run-ptest \
20 file://0001-config_os_headers-Error-Fix.patch \
21 file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \
22 file://0001-get_pid_from_inode-Include-limit.h.patch \
23 file://0002-configure-fix-a-cc-check-issue.patch \
24 file://0004-configure-fix-incorrect-variable.patch \
25 file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
26 file://net-snmp-fix-for-disable-des.patch \
Brad Bishop19323692019-04-05 15:28:33 -040027 file://reproducibility-have-printcap.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028 "
Andrew Geisslerd688a012020-09-18 13:36:00 -050029SRC_URI[sha256sum] = "04303a66f85d6d8b16d3cc53bde50428877c82ab524e17591dfceaeb94df6071"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030
31UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/net-snmp/files/net-snmp/"
32UPSTREAM_CHECK_REGEX = "/net-snmp/(?P<pver>\d+(\.\d+)+)/"
33
Andrew Geissler82c905d2020-04-13 13:39:40 -050034inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative ptest multilib_script multilib_header
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080035
36EXTRA_OEMAKE = "INSTALL_PREFIX=${D} OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'"
37
38PARALLEL_MAKE = ""
39CCACHE = ""
40
41TARGET_CC_ARCH += "${LDFLAGS}"
42
Andrew Geisslereef63862021-01-29 15:58:13 -060043PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} des smux"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils"
45PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl"
46
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080047PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,,"
48
49PACKAGECONFIG[perl] = "--enable-embedded-perl --with-perl-modules=yes, --disable-embedded-perl --with-perl-modules=no,\
Brad Bishop36a3e3e2019-10-02 13:29:27 -040050 perl,"
Brad Bishop19323692019-04-05 15:28:33 -040051PACKAGECONFIG[des] = "--enable-des,--disable-des"
Andrew Geisslereef63862021-01-29 15:58:13 -060052PACKAGECONFIG[smux] = ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053
54EXTRA_OECONF = "--enable-shared \
55 --disable-manuals \
56 --with-defaults \
57 --with-install-prefix=${D} \
58 --with-persistent-directory=${localstatedir}/lib/net-snmp \
59 ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \
60 --with-openssl=${STAGING_EXECPREFIXDIR} \
Andrew Geisslereef63862021-01-29 15:58:13 -060061 --with-mib-modules='${MIB_MODULES}' \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062"
63
Andrew Geisslereef63862021-01-29 15:58:13 -060064MIB_MODULES = ""
65MIB_MODULES_append = " ${@bb.utils.filter('PACKAGECONFIG', 'smux', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066
67CACHED_CONFIGUREVARS = " \
68 ac_cv_header_valgrind_valgrind_h=no \
69 ac_cv_header_valgrind_memcheck_h=no \
70 ac_cv_ETC_MNTTAB=/etc/mtab \
71 lt_cv_shlibpath_overrides_runpath=yes \
Brad Bishop19323692019-04-05 15:28:33 -040072 ac_cv_path_UNAMEPROG=${base_bindir}/uname \
73 ac_cv_file__etc_printcap=no \
74 NETSNMP_CONFIGURE_OPTIONS= \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080075"
76export 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)}"
80
Brad Bishop19323692019-04-05 15:28:33 -040081PTEST_BUILD_HOST_FILES += "net-snmp-config gen-variables"
82
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080083do_configure_prepend() {
84 sed -i -e "s|I/usr/include|I${STAGING_INCDIR}|g" \
85 "${S}"/configure \
86 "${S}"/configure.d/config_os_libs2
87
88 if [ "${HAS_PERL}" = "1" ]; then
89 # this may need to be changed when package perl has any change.
Brad Bishop36a3e3e2019-10-02 13:29:27 -040090 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/Config.pm ${WORKDIR}/
91 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/*/Config_heavy.pl ${WORKDIR}/
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080092 sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \
93 -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \
94 -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \
95 -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
96 -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
97 -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \
98 -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \
99 -i ${WORKDIR}/Config.pm
100 fi
101
102}
103
104do_configure_append() {
105 if [ "${HAS_PERL}" = "1" ]; then
106 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${STAGING_DIR_TARGET}\$\{includedir\}@g" \
107 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${STAGING_DIR_TARGET}\$\{libdir\}@g" \
108 -i ${B}/net-snmp-config
109 fi
110}
111
112do_install_append() {
113 install -d ${D}${sysconfdir}/snmp
114 install -d ${D}${sysconfdir}/init.d
115 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd
116 install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp/
117 install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/snmp/
118 install -d ${D}${systemd_unitdir}/system
119 install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
120 install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
121 sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
122 -i ${D}${bindir}/net-snmp-create-v3-user
Brad Bishop19323692019-04-05 15:28:33 -0400123 sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \
124 -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500125 -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \
Brad Bishop19323692019-04-05 15:28:33 -0400126 -e 's@[^ ]*--sysroot=[^ "]*@@g' \
127 -e 's@[^ ]*--with-libtool-sysroot=[^ "]*@@g' \
128 -e 's@[^ ]*--with-install-prefix=[^ "]*@@g' \
129 -e 's@[^ ]*PKG_CONFIG_PATH=[^ "]*@@g' \
130 -e 's@[^ ]*PKG_CONFIG_LIBDIR=[^ "]*@@g' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500131 -e 's@-L${STAGING_DIR_HOST}${libdir}@@g' \
132 -e 's@-I${STAGING_DIR_HOST}${includedir}@@g' \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800133 -i ${D}${bindir}/net-snmp-config
134
135 if [ "${HAS_PERL}" = "1" ]; then
136 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=\$\{includedir\}@g" \
137 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L\$\{libdir\}@g" \
138 -i ${D}${bindir}/net-snmp-config
139 fi
Andrew Geissler82c905d2020-04-13 13:39:40 -0500140
141 oe_multilib_header net-snmp/net-snmp-config.h
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800142}
143
144do_install_ptest() {
145 install -d ${D}${PTEST_PATH}
146 for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \
147 ${B}/net-snmp-config ${S}/testing; do
148 if [ -e "$i" ]; then
149 cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH}
150 fi
151 done
152 echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version
153
154 rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build"
155 for i in $rmdlist; do
156 if [ -d "$i" ]; then
157 rm -rf "$i"
158 fi
159 done
160}
161
162SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess"
163SNMP_DBGDIR = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
164
165net_snmp_sysroot_preprocess () {
166 if [ -e ${D}${bindir}/net-snmp-config ]; then
167 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
168 install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
169 sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \
170 -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \
171 -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \
172 -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \
173 -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \
174 -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \
175 -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \
176 -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
177 -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \
178 -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \
179 -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \
180 -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \
181 -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config
182 fi
183}
184
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800185PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \
186 ${PN}-server-snmpd ${PN}-server-snmptrapd \
187 ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \
188 ${PN}-lib-mibs ${PN}-lib-trapd"
189
190# perl module
191PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}"
192
193ALLOW_EMPTY_${PN} = "1"
194ALLOW_EMPTY_${PN}-server = "1"
195ALLOW_EMPTY_${PN}-libs = "1"
196
Brad Bishop36a3e3e2019-10-02 13:29:27 -0400197FILES_${PN}-perl-modules = "${libdir}/perl?/*"
198RDEPENDS_${PN}-perl-modules = "perl"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800199
200FILES_${PN}-libs = ""
201FILES_${PN}-mibs = "${datadir}/snmp/mibs"
202FILES_${PN}-server-snmpd = "${sbindir}/snmpd \
203 ${sysconfdir}/snmp/snmpd.conf \
204 ${sysconfdir}/init.d \
205 ${systemd_unitdir}/system/snmpd.service \
206"
207
208FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \
209 ${sysconfdir}/snmp/snmptrapd.conf \
210 ${systemd_unitdir}/system/snmptrapd.service \
211"
212
213FILES_${PN}-lib-netsnmp = "${libdir}/libnetsnmp${SOLIBS}"
214FILES_${PN}-lib-agent = "${libdir}/libnetsnmpagent${SOLIBS}"
215FILES_${PN}-lib-helpers = "${libdir}/libnetsnmphelpers${SOLIBS}"
216FILES_${PN}-lib-mibs = "${libdir}/libnetsnmpmibs${SOLIBS}"
217FILES_${PN}-lib-trapd = "${libdir}/libnetsnmptrapd${SOLIBS}"
218
219FILES_${PN} = ""
220FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
221FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/"
Brad Bishop15ae2502019-06-18 21:44:24 -0400222FILES_${PN}-dev += "${bindir}/mib2c \
223 ${bindir}/mib2c-update \
224 ${bindir}/net-snmp-config \
225 ${bindir}/net-snmp-create-v3-user \
226"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800227
228CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf"
229CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
230
231INITSCRIPT_PACKAGES = "${PN}-server-snmpd"
232INITSCRIPT_NAME_${PN}-server-snmpd = "snmpd"
233INITSCRIPT_PARAMS_${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ."
234
235EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}"
236
237SYSTEMD_PACKAGES = "${PN}-server-snmpd \
238 ${PN}-server-snmptrapd"
239
240SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service"
241SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service"
242
243RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}"
244RDEPENDS_${PN} += "net-snmp-client"
245RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs"
246RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd ${PN}-lib-trapd"
247RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd"
248RDEPENDS_${PN}-client += "net-snmp-mibs net-snmp-libs"
249RDEPENDS_${PN}-libs += "libpci \
250 ${PN}-lib-netsnmp \
251 ${PN}-lib-agent \
252 ${PN}-lib-helpers \
253 ${PN}-lib-mibs \
254"
255RDEPENDS_${PN}-ptest += "perl \
256 perl-module-test \
257 perl-module-file-basename \
258 perl-module-getopt-long \
259 perl-module-file-temp \
260 perl-module-data-dumper \
261"
262RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
263RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
264
265RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
266RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
267RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
268
269RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
270RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
271RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
272
273LEAD_SONAME = "libnetsnmp.so"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500274
275MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/net-snmp-config"