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