Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | SUMMARY = "ntop is network top" |
| 2 | DESCRIPTION = "ntop is a network traffic probe that shows the network usage, \ |
| 3 | similar to what the popular top Unix command does." |
| 4 | |
| 5 | SECTION = "console/network" |
| 6 | |
| 7 | LICENSE = "GPLv2+ & GPLv3 & OpenSSL" |
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ |
| 9 | file://LICENSE-OpenSSL.txt;md5=a409f902e447ddd889cffa0c70e7c7c2 \ |
| 10 | " |
| 11 | |
| 12 | SRC_URI = "${SOURCEFORGE_MIRROR}/ntop/ntop-${PV}.tar.gz \ |
| 13 | file://ntop_configure_in.patch \ |
| 14 | file://ntop_init.patch \ |
| 15 | file://ntop_webInterface.patch \ |
| 16 | file://ntop_configure_in_net_snmp_config_exist.patch \ |
| 17 | file://ntop.service \ |
| 18 | file://use-static-inline.patch \ |
| 19 | file://0001-nDPI-Include-sys-types.h.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | file://0001-plugins-Makefile.am-fix-for-automake-1.16.1.patch \ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 21 | file://fix-missing-return-from-non-void-function.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 22 | " |
| 23 | SRC_URI[md5sum] = "01710b6925a8a5ffe1a41b8b512ebd69" |
| 24 | SRC_URI[sha256sum] = "7e8e84cb14d2173beaca4d4cb991a14d84a4bef84ec37b2276bc363f45c52ef8" |
| 25 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 26 | UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/ntop/files/ntop/Stable" |
| 27 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | inherit autotools-brokensep useradd pythonnative pkgconfig systemd |
| 29 | |
| 30 | DEPENDS = "geoip rrdtool python zlib libpcap gdbm" |
| 31 | |
| 32 | PACKAGECONFIG ??= "openssl snmp plugins" |
| 33 | PACKAGECONFIG[openssl] = "--with-ssl, --without-ssl, openssl, openssl" |
| 34 | PACKAGECONFIG[snmp] = "--enable-snmp=yes NETSNMP=${STAGING_BINDIR_CROSS}/net-snmp-config, \ |
| 35 | --disable-snmp,net-snmp," |
| 36 | PACKAGECONFIG[plugins] = "--enable-plugins=yes, --disable-plugins, ," |
| 37 | |
| 38 | EXTRA_OECONF += "ac_cv_file_aclocal_m4=yes ac_cv_file_depcomp=no" |
| 39 | |
| 40 | do_configure() { |
| 41 | cp ${STAGING_DATADIR_NATIVE}/aclocal/libtool.m4 libtool.m4.in |
| 42 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} |
| 43 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} |
| 44 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/nDPI |
| 45 | install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/nDPI |
| 46 | cat acinclude.m4.in acinclude.m4.ntop libtool.m4.in > acinclude.m4 |
| 47 | cp 3rd_party/* ./ |
| 48 | |
| 49 | # config nDPI |
| 50 | cd nDPI |
| 51 | ./configure ${CONFIGUREOPTS} --with-pic |
| 52 | cd .. |
| 53 | |
| 54 | sed -i -e 's:^CFG_DBFILE_DIR=$localstatedir/ntop:CFG_DBFILE_DIR=$localstatedir/lib/ntop:' ${S}/configure.in |
| 55 | |
| 56 | # fix the CFLAGS, CPPFLAGS, LDFLAGS, remove the host include |
| 57 | sed -i \ |
| 58 | -e 's:\(^CFLAGS="\$.*\) -I/usr/local/include -I/opt/local/include":\1":' \ |
| 59 | -e 's:\(^CPPFLAGS="\$.*\) -I/usr/local/include -I/opt/local/include":\1":' \ |
| 60 | -e 's:\(^LDFLAGS="\$.*\) -L/usr/local/lib -L/opt/local/lib":\1":' \ |
| 61 | ${S}/configure.in |
| 62 | |
| 63 | # replace the DISTRO RELEASE in configure.in which are host's |
| 64 | # with our release, although those doesn't affect functionality |
| 65 | sed -i -e \ |
| 66 | '/DEFINEOS="LINUX"/{N;s/DISTRO=.*/DISTRO="${DISTRO}"/;N;s/RELEASE=.*/RELEASE="${DISTRO_VERSION}"/;}' \ |
| 67 | ${S}/configure.in |
| 68 | |
| 69 | # osName in original configure.in should be ${TARGET_SYS} |
| 70 | # which will show in ntop's "show configuration" |
| 71 | sed -i -e \ |
| 72 | 's:^osName=.*:osName=${TARGET_SYS}:' \ |
| 73 | ${S}/configure.in |
| 74 | |
| 75 | # rename configureextra to configureextra_rename to avoid |
| 76 | # configure.in to guess host OS and pull in more configure, non needed |
| 77 | # which will cause some cross-compiling failure on specific host |
| 78 | # e.g. SUSE(SLED...) |
| 79 | test ! -f configureextra || mv -f configureextra configureextra_rename |
| 80 | |
| 81 | # make sure configure finds python includdirs/libs with these envs |
| 82 | export BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ |
| 83 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 84 | STAGING_LIBDIR=${STAGING_LIBDIR} |
| 85 | |
| 86 | autotools_do_configure |
| 87 | } |
| 88 | |
| 89 | do_compile_prepend() { |
| 90 | cd nDPI |
| 91 | oe_runmake |
| 92 | cd .. |
| 93 | } |
| 94 | |
| 95 | do_install_append() { |
| 96 | # remove the empty dirs |
| 97 | rm -rf ${D}${libdir}/plugins |
| 98 | |
| 99 | install -D -m 0755 ${S}/packages/RedHat/ntop.init \ |
| 100 | ${D}${sysconfdir}/init.d/ntop |
| 101 | install -D -m 0644 ${S}/packages/RedHat/ntop.conf.sample \ |
| 102 | ${D}${sysconfdir}/ntop.conf |
| 103 | |
| 104 | # change ntop dir in ntop.conf |
| 105 | # don't use the -P as the ntop.init didn't support it |
| 106 | sed -i -e "s:^--db-file-path /usr/share/ntop:--db-file-path /var/lib/ntop:" \ |
| 107 | -e "s:^#? -P /var/ntop:#? -P /var/lib/ntop:" \ |
| 108 | ${D}${sysconfdir}/ntop.conf |
| 109 | |
| 110 | # For systemd |
| 111 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 112 | install -D -m 0755 ${S}/packages/RedHat/ntop.init ${D}${libexecdir}/ntop-helper |
| 113 | install -D -m 0644 ${WORKDIR}/ntop.service ${D}${systemd_system_unitdir}/ntop.service |
| 114 | sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' \ |
| 115 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ |
| 116 | ${D}${systemd_system_unitdir}/ntop.service |
| 117 | fi |
| 118 | |
| 119 | # Fix host-user-contaminated issue |
| 120 | chown -R root:root ${D} |
| 121 | |
| 122 | chown -R ntop.ntop ${D}${datadir}/ntop |
| 123 | chown -R ntop:ntop ${D}${localstatedir}/lib/ntop |
| 124 | } |
| 125 | |
| 126 | USERADD_PACKAGES = "${PN}" |
| 127 | USERADD_PARAM_${PN} = "-M -g ntop -r -d ${localstatedir}/lib/ntop \ |
| 128 | -s /usr/sbin/nologin -c 'ntop' ntop" |
| 129 | GROUPADD_PARAM_${PN} = "-r ntop" |
| 130 | |
| 131 | SYSTEMD_SERVICE_${PN} = "ntop.service" |
| 132 | SYSTEMD_AUTO_ENABLE = "disable" |
| 133 | |
| 134 | FILES_${PN}_append = "${libdir}/ntop/plugins ${libdir}/libntop-*.so \ |
| 135 | ${libdir}/libntopreport-*.so ${libdir}/lib*-${PV}.so" |
| 136 | FILES_${PN}-dev = "${includedir} ${libdir}/libntop.so \ |
| 137 | ${libdir}/libntopreport.so \ |
| 138 | ${libdir}/libnetflowPlugin.so ${libdir}/libsflowPlugin.so \ |
| 139 | ${libdir}/librrdPlugin.so \ |
| 140 | ${libdir}/*.a ${libdir}/libntopreport.a ${libdir}/*.la" |
| 141 | |