blob: ed7f8428b12e5ad9ffd24eb42d33a932a3ae12a0 [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
Andrew Geissler69721092021-07-23 12:57:00 -04008DEPENDS = "openssl"
9DEPENDS_append_class-target = " pciutils"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010
Brad Bishop26bdd442019-08-16 17:08:17 -040011SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080012 file://init \
13 file://snmpd.conf \
14 file://snmptrapd.conf \
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://0001-config_os_headers-Error-Fix.patch \
22 file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \
23 file://0001-get_pid_from_inode-Include-limit.h.patch \
24 file://0002-configure-fix-a-cc-check-issue.patch \
25 file://0004-configure-fix-incorrect-variable.patch \
26 file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
27 file://net-snmp-fix-for-disable-des.patch \
Brad Bishop19323692019-04-05 15:28:33 -040028 file://reproducibility-have-printcap.patch \
Andrew Geisslerac970dd2021-02-12 15:32:45 -060029 file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030 "
Andrew Geissler69721092021-07-23 12:57:00 -040031SRC_URI[sha256sum] = "eb7fd4a44de6cddbffd9a92a85ad1309e5c1054fb9d5a7dd93079c8953f48c3f"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032
33UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/net-snmp/files/net-snmp/"
34UPSTREAM_CHECK_REGEX = "/net-snmp/(?P<pver>\d+(\.\d+)+)/"
35
Andrew Geissler82c905d2020-04-13 13:39:40 -050036inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative ptest multilib_script multilib_header
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037
38EXTRA_OEMAKE = "INSTALL_PREFIX=${D} OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'"
39
40PARALLEL_MAKE = ""
41CCACHE = ""
42
43TARGET_CC_ARCH += "${LDFLAGS}"
44
Andrew Geissler69721092021-07-23 12:57:00 -040045PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} des smux"
46PACKAGECONFIG[des] = "--enable-des, --disable-des"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080047PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils"
Andrew Geissler69721092021-07-23 12:57:00 -040048PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl"
Andrew Geissler69721092021-07-23 12:57:00 -040050PACKAGECONFIG[perl] = "--enable-embedded-perl --with-perl-modules=yes, --disable-embedded-perl --with-perl-modules=no, perl"
Andrew Geisslereef63862021-01-29 15:58:13 -060051PACKAGECONFIG[smux] = ""
Andrew Geissler69721092021-07-23 12:57:00 -040052PACKAGECONFIG[systemd] = "--with-systemd, --without-systemd"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053
Andrew Geissler69721092021-07-23 12:57:00 -040054EXTRA_OECONF = " \
55 --enable-shared \
56 --disable-manuals \
57 --with-defaults \
58 --with-install-prefix=${D} \
59 --with-persistent-directory=${localstatedir}/lib/net-snmp \
60 --with-endianness=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
61 --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"
Andrew Geissler69721092021-07-23 12:57:00 -040076PERLPROG = "${bindir}/env perl"
77PERLPROG_class-native = "${bindir_native}/env perl"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}"
Andrew Geissler69721092021-07-23 12:57:00 -040079export PERLPROG
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080080
81HAS_PERL = "${@bb.utils.contains('PACKAGECONFIG', 'perl', '1', '0', d)}"
82
Brad Bishop19323692019-04-05 15:28:33 -040083PTEST_BUILD_HOST_FILES += "net-snmp-config gen-variables"
84
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080085do_configure_prepend() {
86 sed -i -e "s|I/usr/include|I${STAGING_INCDIR}|g" \
87 "${S}"/configure \
88 "${S}"/configure.d/config_os_libs2
89
90 if [ "${HAS_PERL}" = "1" ]; then
91 # this may need to be changed when package perl has any change.
Brad Bishop36a3e3e2019-10-02 13:29:27 -040092 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/Config.pm ${WORKDIR}/
93 cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl?/*/*/Config_heavy.pl ${WORKDIR}/
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080094 sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \
95 -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \
96 -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \
97 -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
98 -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \
99 -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \
100 -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \
101 -i ${WORKDIR}/Config.pm
102 fi
103
104}
105
106do_configure_append() {
Andrew Geisslerac970dd2021-02-12 15:32:45 -0600107 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=${STAGING_DIR_TARGET}\$\{includedir\}@g" \
108 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L${STAGING_DIR_TARGET}\$\{libdir\}@g" \
109 -e "s@^NSC_LDFLAGS=\"-L.* @NSC_LDFLAGS=\"-L${STAGING_DIR_TARGET}\$\{libdir\} @g" \
110 -i ${B}/net-snmp-config
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800111}
112
113do_install_append() {
114 install -d ${D}${sysconfdir}/snmp
115 install -d ${D}${sysconfdir}/init.d
116 install -m 755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/snmpd
117 install -m 644 ${WORKDIR}/snmpd.conf ${D}${sysconfdir}/snmp/
118 install -m 644 ${WORKDIR}/snmptrapd.conf ${D}${sysconfdir}/snmp/
119 install -d ${D}${systemd_unitdir}/system
120 install -m 0644 ${WORKDIR}/snmpd.service ${D}${systemd_unitdir}/system
121 install -m 0644 ${WORKDIR}/snmptrapd.service ${D}${systemd_unitdir}/system
Andrew Geissler69721092021-07-23 12:57:00 -0400122 sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800123 -i ${D}${bindir}/net-snmp-create-v3-user
Brad Bishop19323692019-04-05 15:28:33 -0400124 sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \
Andrew Geisslerf103a7f2021-05-07 16:09:40 -0500125 -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \
Brad Bishop19323692019-04-05 15:28:33 -0400126 -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500127 -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \
Brad Bishop19323692019-04-05 15:28:33 -0400128 -e 's@[^ ]*--sysroot=[^ "]*@@g' \
129 -e 's@[^ ]*--with-libtool-sysroot=[^ "]*@@g' \
130 -e 's@[^ ]*--with-install-prefix=[^ "]*@@g' \
131 -e 's@[^ ]*PKG_CONFIG_PATH=[^ "]*@@g' \
132 -e 's@[^ ]*PKG_CONFIG_LIBDIR=[^ "]*@@g' \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800133 -i ${D}${bindir}/net-snmp-config
134
Andrew Geissler69721092021-07-23 12:57:00 -0400135 # ${STAGING_DIR_HOST} is empty for native builds, and the sed command below
136 # will result in errors if run for native.
137 if [ "${STAGING_DIR_HOST}" ]; then
138 sed -e 's@${STAGING_DIR_HOST}@@g' \
139 -i ${D}${bindir}/net-snmp-config ${D}${libdir}/pkgconfig/netsnmp*.pc
140 fi
Andrew Geisslerac970dd2021-02-12 15:32:45 -0600141
142 sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=\$\{includedir\}@g" \
143 -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L\$\{libdir\}@g" \
144 -e "s@^NSC_LDFLAGS=\"-L.* @NSC_LDFLAGS=\"-L\$\{libdir\} @g" \
145 -i ${D}${bindir}/net-snmp-config
Andrew Geissler82c905d2020-04-13 13:39:40 -0500146
147 oe_multilib_header net-snmp/net-snmp-config.h
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800148}
149
150do_install_ptest() {
151 install -d ${D}${PTEST_PATH}
152 for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \
153 ${B}/net-snmp-config ${S}/testing; do
154 if [ -e "$i" ]; then
155 cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH}
156 fi
157 done
158 echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version
159
160 rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build"
161 for i in $rmdlist; do
162 if [ -d "$i" ]; then
163 rm -rf "$i"
164 fi
165 done
166}
167
168SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess"
169SNMP_DBGDIR = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
170
171net_snmp_sysroot_preprocess () {
172 if [ -e ${D}${bindir}/net-snmp-config ]; then
173 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
174 install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
175 sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \
176 -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \
177 -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \
178 -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \
179 -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \
180 -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \
Andrew Geisslerf103a7f2021-05-07 16:09:40 -0500181 -e "s@-ffile-prefix-map=${SNMP_DBGDIR}@-ffile-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800182 -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \
183 -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
184 -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \
185 -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \
186 -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \
187 -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \
188 -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config
189 fi
190}
191
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800192PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \
193 ${PN}-server-snmpd ${PN}-server-snmptrapd \
194 ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \
195 ${PN}-lib-mibs ${PN}-lib-trapd"
196
197# perl module
198PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}"
199
200ALLOW_EMPTY_${PN} = "1"
201ALLOW_EMPTY_${PN}-server = "1"
202ALLOW_EMPTY_${PN}-libs = "1"
203
Brad Bishop36a3e3e2019-10-02 13:29:27 -0400204FILES_${PN}-perl-modules = "${libdir}/perl?/*"
205RDEPENDS_${PN}-perl-modules = "perl"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800206
207FILES_${PN}-libs = ""
208FILES_${PN}-mibs = "${datadir}/snmp/mibs"
209FILES_${PN}-server-snmpd = "${sbindir}/snmpd \
210 ${sysconfdir}/snmp/snmpd.conf \
211 ${sysconfdir}/init.d \
212 ${systemd_unitdir}/system/snmpd.service \
213"
214
215FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \
216 ${sysconfdir}/snmp/snmptrapd.conf \
217 ${systemd_unitdir}/system/snmptrapd.service \
218"
219
220FILES_${PN}-lib-netsnmp = "${libdir}/libnetsnmp${SOLIBS}"
221FILES_${PN}-lib-agent = "${libdir}/libnetsnmpagent${SOLIBS}"
222FILES_${PN}-lib-helpers = "${libdir}/libnetsnmphelpers${SOLIBS}"
223FILES_${PN}-lib-mibs = "${libdir}/libnetsnmpmibs${SOLIBS}"
224FILES_${PN}-lib-trapd = "${libdir}/libnetsnmptrapd${SOLIBS}"
225
226FILES_${PN} = ""
227FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
228FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/"
Brad Bishop15ae2502019-06-18 21:44:24 -0400229FILES_${PN}-dev += "${bindir}/mib2c \
230 ${bindir}/mib2c-update \
231 ${bindir}/net-snmp-config \
232 ${bindir}/net-snmp-create-v3-user \
233"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800234
235CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf"
236CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf"
237
238INITSCRIPT_PACKAGES = "${PN}-server-snmpd"
239INITSCRIPT_NAME_${PN}-server-snmpd = "snmpd"
240INITSCRIPT_PARAMS_${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ."
241
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800242SYSTEMD_PACKAGES = "${PN}-server-snmpd \
243 ${PN}-server-snmptrapd"
244
245SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service"
246SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service"
247
248RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}"
249RDEPENDS_${PN} += "net-snmp-client"
250RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs"
251RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd ${PN}-lib-trapd"
252RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd"
253RDEPENDS_${PN}-client += "net-snmp-mibs net-snmp-libs"
254RDEPENDS_${PN}-libs += "libpci \
255 ${PN}-lib-netsnmp \
256 ${PN}-lib-agent \
257 ${PN}-lib-helpers \
258 ${PN}-lib-mibs \
259"
260RDEPENDS_${PN}-ptest += "perl \
261 perl-module-test \
262 perl-module-file-basename \
263 perl-module-getopt-long \
264 perl-module-file-temp \
265 perl-module-data-dumper \
266"
267RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
268RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})"
269
270RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
271RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
272RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd"
273
274RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
275RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
276RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd"
277
278LEAD_SONAME = "libnetsnmp.so"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500279
280MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/net-snmp-config"
Andrew Geissler69721092021-07-23 12:57:00 -0400281
282BBCLASSEXTEND = "native"