Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | SUMMARY = "Various tools relating to the Simple Network Management Protocol" |
| 2 | HOMEPAGE = "http://www.net-snmp.org/" |
| 3 | SECTION = "net" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 4 | LICENSE = "BSD & MIT" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 5 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=9d100a395a38584f2ec18a8275261687" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 7 | |
| 8 | DEPENDS = "openssl libnl pciutils" |
| 9 | |
| 10 | SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ |
| 11 | 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 Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 27 | file://reproducibility-have-printcap.patch \ |
| 28 | file://reproducibility-accept-configure-options-from-env.patch \ |
| 29 | file://0001-net-snmp-fix-compile-error-disable-des.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 30 | " |
| 31 | SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4" |
| 32 | SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042" |
| 33 | |
| 34 | UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/net-snmp/files/net-snmp/" |
| 35 | UPSTREAM_CHECK_REGEX = "/net-snmp/(?P<pver>\d+(\.\d+)+)/" |
| 36 | |
Andrew Geissler | 1548c07 | 2019-02-22 16:03:50 -0600 | [diff] [blame] | 37 | inherit autotools-brokensep update-rc.d siteinfo systemd pkgconfig perlnative ptest |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 38 | |
| 39 | EXTRA_OEMAKE = "INSTALL_PREFIX=${D} OTHERLDFLAGS='${LDFLAGS}' HOST_CPPFLAGS='${BUILD_CPPFLAGS}'" |
| 40 | |
| 41 | PARALLEL_MAKE = "" |
| 42 | CCACHE = "" |
| 43 | |
| 44 | TARGET_CC_ARCH += "${LDFLAGS}" |
| 45 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 46 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} des" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 47 | PACKAGECONFIG[elfutils] = "--with-elf, --without-elf, elfutils" |
| 48 | PACKAGECONFIG[libnl] = "--with-nl, --without-nl, libnl" |
| 49 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 50 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,," |
| 51 | |
| 52 | PACKAGECONFIG[perl] = "--enable-embedded-perl --with-perl-modules=yes, --disable-embedded-perl --with-perl-modules=no,\ |
| 53 | perl, perl perl-lib" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 54 | PACKAGECONFIG[des] = "--enable-des,--disable-des" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 55 | |
| 56 | EXTRA_OECONF = "--enable-shared \ |
| 57 | --disable-manuals \ |
| 58 | --with-defaults \ |
| 59 | --with-install-prefix=${D} \ |
| 60 | --with-persistent-directory=${localstatedir}/lib/net-snmp \ |
| 61 | ${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '--with-endianness=little', '--with-endianness=big', d)} \ |
| 62 | --with-openssl=${STAGING_EXECPREFIXDIR} \ |
| 63 | " |
| 64 | |
| 65 | # net-snmp needs to have mib-modules=smux enabled to enable quagga to support snmp |
| 66 | EXTRA_OECONF += "--with-mib-modules=smux" |
| 67 | |
| 68 | CACHED_CONFIGUREVARS = " \ |
| 69 | ac_cv_header_valgrind_valgrind_h=no \ |
| 70 | ac_cv_header_valgrind_memcheck_h=no \ |
| 71 | ac_cv_ETC_MNTTAB=/etc/mtab \ |
| 72 | lt_cv_shlibpath_overrides_runpath=yes \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 73 | ac_cv_path_UNAMEPROG=${base_bindir}/uname \ |
| 74 | ac_cv_file__etc_printcap=no \ |
| 75 | NETSNMP_CONFIGURE_OPTIONS= \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 76 | " |
| 77 | export PERLPROG="${bindir}/env perl" |
| 78 | PERLPROG_append = "${@bb.utils.contains('PACKAGECONFIG', 'perl', ' -I${WORKDIR}', '', d)}" |
| 79 | |
| 80 | HAS_PERL = "${@bb.utils.contains('PACKAGECONFIG', 'perl', '1', '0', d)}" |
| 81 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 82 | PTEST_BUILD_HOST_FILES += "net-snmp-config gen-variables" |
| 83 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 84 | do_configure_prepend() { |
| 85 | sed -i -e "s|I/usr/include|I${STAGING_INCDIR}|g" \ |
| 86 | "${S}"/configure \ |
| 87 | "${S}"/configure.d/config_os_libs2 |
| 88 | |
| 89 | if [ "${HAS_PERL}" = "1" ]; then |
| 90 | # this may need to be changed when package perl has any change. |
| 91 | cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config.pm ${WORKDIR}/ |
| 92 | cp -f ${STAGING_DIR_TARGET}/usr/lib*/perl/*/Config_heavy.pl ${WORKDIR}/ |
| 93 | sed -e "s@libpth => '/usr/lib.*@libpth => '${STAGING_DIR_TARGET}/${libdir} ${STAGING_DIR_TARGET}/${base_libdir}',@g" \ |
| 94 | -e "s@privlibexp => '/usr@privlibexp => '${STAGING_DIR_TARGET}/usr@g" \ |
| 95 | -e "s@scriptdir => '/usr@scriptdir => '${STAGING_DIR_TARGET}/usr@g" \ |
| 96 | -e "s@sitearchexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \ |
| 97 | -e "s@sitelibexp => '/usr@sitearchexp => '${STAGING_DIR_TARGET}/usr@g" \ |
| 98 | -e "s@vendorarchexp => '/usr@vendorarchexp => '${STAGING_DIR_TARGET}/usr@g" \ |
| 99 | -e "s@vendorlibexp => '/usr@vendorlibexp => '${STAGING_DIR_TARGET}/usr@g" \ |
| 100 | -i ${WORKDIR}/Config.pm |
| 101 | fi |
| 102 | |
| 103 | } |
| 104 | |
| 105 | do_configure_append() { |
| 106 | if [ "${HAS_PERL}" = "1" ]; then |
| 107 | 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 | -i ${B}/net-snmp-config |
| 110 | fi |
| 111 | } |
| 112 | |
| 113 | do_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 |
| 122 | sed -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g" \ |
| 123 | -i ${D}${bindir}/net-snmp-create-v3-user |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 124 | sed -e 's@^NSC_SRCDIR=.*@NSC_SRCDIR=.@g' \ |
| 125 | -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \ |
| 126 | -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' \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 131 | -i ${D}${bindir}/net-snmp-config |
| 132 | |
| 133 | if [ "${HAS_PERL}" = "1" ]; then |
| 134 | sed -e "s@^NSC_INCLUDEDIR=.*@NSC_INCLUDEDIR=\$\{includedir\}@g" \ |
| 135 | -e "s@^NSC_LIBDIR=-L.*@NSC_LIBDIR=-L\$\{libdir\}@g" \ |
| 136 | -i ${D}${bindir}/net-snmp-config |
| 137 | fi |
| 138 | } |
| 139 | |
| 140 | do_install_ptest() { |
| 141 | install -d ${D}${PTEST_PATH} |
| 142 | for i in ${S}/dist ${S}/include ${B}/include ${S}/mibs ${S}/configure \ |
| 143 | ${B}/net-snmp-config ${S}/testing; do |
| 144 | if [ -e "$i" ]; then |
| 145 | cp -R --no-dereference --preserve=mode,links -v "$i" ${D}${PTEST_PATH} |
| 146 | fi |
| 147 | done |
| 148 | echo `autoconf -V|awk '/autoconf/{print $NF}'` > ${D}${PTEST_PATH}/dist/autoconf-version |
| 149 | |
| 150 | rmdlist="${D}${PTEST_PATH}/dist/net-snmp-solaris-build" |
| 151 | for i in $rmdlist; do |
| 152 | if [ -d "$i" ]; then |
| 153 | rm -rf "$i" |
| 154 | fi |
| 155 | done |
| 156 | } |
| 157 | |
| 158 | SYSROOT_PREPROCESS_FUNCS += "net_snmp_sysroot_preprocess" |
| 159 | SNMP_DBGDIR = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" |
| 160 | |
| 161 | net_snmp_sysroot_preprocess () { |
| 162 | if [ -e ${D}${bindir}/net-snmp-config ]; then |
| 163 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 164 | install -m 755 ${D}${bindir}/net-snmp-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ |
| 165 | sed -e "s@-I/usr/include@-I${STAGING_INCDIR}@g" \ |
| 166 | -e "s@^prefix=.*@prefix=${STAGING_DIR_HOST}${prefix}@g" \ |
| 167 | -e "s@^exec_prefix=.*@exec_prefix=${STAGING_EXECPREFIXDIR}@g" \ |
| 168 | -e "s@^includedir=.*@includedir=${STAGING_INCDIR}@g" \ |
| 169 | -e "s@^libdir=.*@libdir=${STAGING_LIBDIR}@g" \ |
| 170 | -e "s@^NSC_SRCDIR=.*@NSC_SRCDIR=${S}@g" \ |
| 171 | -e "s@-fdebug-prefix-map=${SNMP_DBGDIR}@-fdebug-prefix-map=${WORKDIR}=${SNMP_DBGDIR}@g" \ |
| 172 | -e "s@-fdebug-prefix-map= -fdebug-prefix-map=@-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ |
| 173 | -fdebug-prefix-map=${STAGING_DIR_HOST}=@g" \ |
| 174 | -e "s@--sysroot=@--sysroot=${STAGING_DIR_HOST}@g" \ |
| 175 | -e "s@--with-libtool-sysroot=@--with-libtool-sysroot=${STAGING_DIR_HOST}@g" \ |
| 176 | -e "s@--with-install-prefix=@--with-install-prefix=${D}@g" \ |
| 177 | -i ${SYSROOT_DESTDIR}${bindir_crossscripts}/net-snmp-config |
| 178 | fi |
| 179 | } |
| 180 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 181 | PACKAGES += "${PN}-libs ${PN}-mibs ${PN}-server ${PN}-client \ |
| 182 | ${PN}-server-snmpd ${PN}-server-snmptrapd \ |
| 183 | ${PN}-lib-netsnmp ${PN}-lib-agent ${PN}-lib-helpers \ |
| 184 | ${PN}-lib-mibs ${PN}-lib-trapd" |
| 185 | |
| 186 | # perl module |
| 187 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl-modules', '', d)}" |
| 188 | |
| 189 | ALLOW_EMPTY_${PN} = "1" |
| 190 | ALLOW_EMPTY_${PN}-server = "1" |
| 191 | ALLOW_EMPTY_${PN}-libs = "1" |
| 192 | |
| 193 | FILES_${PN}-perl-modules = "${libdir}/perl/*" |
| 194 | |
| 195 | FILES_${PN}-libs = "" |
| 196 | FILES_${PN}-mibs = "${datadir}/snmp/mibs" |
| 197 | FILES_${PN}-server-snmpd = "${sbindir}/snmpd \ |
| 198 | ${sysconfdir}/snmp/snmpd.conf \ |
| 199 | ${sysconfdir}/init.d \ |
| 200 | ${systemd_unitdir}/system/snmpd.service \ |
| 201 | " |
| 202 | |
| 203 | FILES_${PN}-server-snmptrapd = "${sbindir}/snmptrapd \ |
| 204 | ${sysconfdir}/snmp/snmptrapd.conf \ |
| 205 | ${systemd_unitdir}/system/snmptrapd.service \ |
| 206 | " |
| 207 | |
| 208 | FILES_${PN}-lib-netsnmp = "${libdir}/libnetsnmp${SOLIBS}" |
| 209 | FILES_${PN}-lib-agent = "${libdir}/libnetsnmpagent${SOLIBS}" |
| 210 | FILES_${PN}-lib-helpers = "${libdir}/libnetsnmphelpers${SOLIBS}" |
| 211 | FILES_${PN}-lib-mibs = "${libdir}/libnetsnmpmibs${SOLIBS}" |
| 212 | FILES_${PN}-lib-trapd = "${libdir}/libnetsnmptrapd${SOLIBS}" |
| 213 | |
| 214 | FILES_${PN} = "" |
| 215 | FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/" |
| 216 | FILES_${PN}-dbg += "${libdir}/.debug/ ${sbindir}/.debug/ ${bindir}/.debug/" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 217 | FILES_${PN}-dev += "${bindir}/mib2c \ |
| 218 | ${bindir}/mib2c-update \ |
| 219 | ${bindir}/net-snmp-config \ |
| 220 | ${bindir}/net-snmp-create-v3-user \ |
| 221 | " |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 222 | |
| 223 | CONFFILES_${PN}-server-snmpd = "${sysconfdir}/snmp/snmpd.conf" |
| 224 | CONFFILES_${PN}-server-snmptrapd = "${sysconfdir}/snmp/snmptrapd.conf" |
| 225 | |
| 226 | INITSCRIPT_PACKAGES = "${PN}-server-snmpd" |
| 227 | INITSCRIPT_NAME_${PN}-server-snmpd = "snmpd" |
| 228 | INITSCRIPT_PARAMS_${PN}-server-snmpd = "start 90 2 3 4 5 . stop 60 0 1 6 ." |
| 229 | |
| 230 | EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemd', '--without-systemd', d)}" |
| 231 | |
| 232 | SYSTEMD_PACKAGES = "${PN}-server-snmpd \ |
| 233 | ${PN}-server-snmptrapd" |
| 234 | |
| 235 | SYSTEMD_SERVICE_${PN}-server-snmpd = "snmpd.service" |
| 236 | SYSTEMD_SERVICE_${PN}-server-snmptrapd = "snmptrapd.service" |
| 237 | |
| 238 | RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'net-snmp-perl-modules', '', d)}" |
| 239 | RDEPENDS_${PN} += "net-snmp-client" |
| 240 | RDEPENDS_${PN}-server-snmpd += "net-snmp-mibs" |
| 241 | RDEPENDS_${PN}-server-snmptrapd += "net-snmp-server-snmpd ${PN}-lib-trapd" |
| 242 | RDEPENDS_${PN}-server += "net-snmp-server-snmpd net-snmp-server-snmptrapd" |
| 243 | RDEPENDS_${PN}-client += "net-snmp-mibs net-snmp-libs" |
| 244 | RDEPENDS_${PN}-libs += "libpci \ |
| 245 | ${PN}-lib-netsnmp \ |
| 246 | ${PN}-lib-agent \ |
| 247 | ${PN}-lib-helpers \ |
| 248 | ${PN}-lib-mibs \ |
| 249 | " |
| 250 | RDEPENDS_${PN}-ptest += "perl \ |
| 251 | perl-module-test \ |
| 252 | perl-module-file-basename \ |
| 253 | perl-module-getopt-long \ |
| 254 | perl-module-file-temp \ |
| 255 | perl-module-data-dumper \ |
| 256 | " |
| 257 | RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})" |
| 258 | RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPKGV}) net-snmp-server (= ${EXTENDPKGV})" |
| 259 | |
| 260 | RPROVIDES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd" |
| 261 | RREPLACES_${PN}-server-snmpd += "${PN}-server-snmpd-systemd" |
| 262 | RCONFLICTS_${PN}-server-snmpd += "${PN}-server-snmpd-systemd" |
| 263 | |
| 264 | RPROVIDES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd" |
| 265 | RREPLACES_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd" |
| 266 | RCONFLICTS_${PN}-server-snmptrapd += "${PN}-server-snmptrapd-systemd" |
| 267 | |
| 268 | LEAD_SONAME = "libnetsnmp.so" |