blob: 80f009b7c3a4dc32e84e471260e5131ee0302b54 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001SUMMARY = "ntop is network top"
2DESCRIPTION = "ntop is a network traffic probe that shows the network usage, \
3similar to what the popular top Unix command does."
4
5SECTION = "console/network"
6
7LICENSE = "GPLv2+ & GPLv3 & OpenSSL"
8LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
9 file://LICENSE-OpenSSL.txt;md5=a409f902e447ddd889cffa0c70e7c7c2 \
10 "
11
12SRC_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 Bishop1a4b7ee2018-12-16 17:11:34 -080020 file://0001-plugins-Makefile.am-fix-for-automake-1.16.1.patch \
Brad Bishop26bdd442019-08-16 17:08:17 -040021 file://fix-missing-return-from-non-void-function.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050022 "
23SRC_URI[md5sum] = "01710b6925a8a5ffe1a41b8b512ebd69"
24SRC_URI[sha256sum] = "7e8e84cb14d2173beaca4d4cb991a14d84a4bef84ec37b2276bc363f45c52ef8"
25
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080026UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/ntop/files/ntop/Stable"
27
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028inherit autotools-brokensep useradd pythonnative pkgconfig systemd
29
30DEPENDS = "geoip rrdtool python zlib libpcap gdbm"
31
32PACKAGECONFIG ??= "openssl snmp plugins"
33PACKAGECONFIG[openssl] = "--with-ssl, --without-ssl, openssl, openssl"
34PACKAGECONFIG[snmp] = "--enable-snmp=yes NETSNMP=${STAGING_BINDIR_CROSS}/net-snmp-config, \
35--disable-snmp,net-snmp,"
36PACKAGECONFIG[plugins] = "--enable-plugins=yes, --disable-plugins, ,"
37
38EXTRA_OECONF += "ac_cv_file_aclocal_m4=yes ac_cv_file_depcomp=no"
39
40do_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
89do_compile_prepend() {
90 cd nDPI
91 oe_runmake
92 cd ..
93}
94
95do_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
126USERADD_PACKAGES = "${PN}"
127USERADD_PARAM_${PN} = "-M -g ntop -r -d ${localstatedir}/lib/ntop \
128-s /usr/sbin/nologin -c 'ntop' ntop"
129GROUPADD_PARAM_${PN} = "-r ntop"
130
131SYSTEMD_SERVICE_${PN} = "ntop.service"
132SYSTEMD_AUTO_ENABLE = "disable"
133
134FILES_${PN}_append = "${libdir}/ntop/plugins ${libdir}/libntop-*.so \
135 ${libdir}/libntopreport-*.so ${libdir}/lib*-${PV}.so"
136FILES_${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