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