1SUMMARY = "A networking benchmarking tool"
2DESCRIPTION = "Network performance benchmark including tests for TCP, UDP, sockets, ATM and more."
3SECTION = "net"
4HOMEPAGE = "http://www.netperf.org/"
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://COPYING;md5=e661ab33a2a71ad6652c178dedf8aaa2"
7
8PV = "2.7.0+git"
9
10SRC_URI = "git://github.com/HewlettPackard/netperf.git;branch=master;protocol=https \
11           file://cpu_set.patch \
12           file://vfork.patch \
13           file://init \
14           file://netserver.service \
15           file://0001-netlib.c-Move-including-sched.h-out-og-function.patch \
16           file://0001-nettest_omni-Remove-duplicate-variable-definitions.patch \
17           file://netserver_permissions.patch \
18           "
19
20SRCREV = "3bc455b23f901dae377ca0a558e1e32aa56b31c4"
21
22S = "${WORKDIR}/git"
23
24inherit update-rc.d autotools texinfo systemd
25
26# cpu_set.patch plus _GNU_SOURCE makes src/netlib.c compile with CPU_ macros
27CFLAGS:append = " -DDO_UNIX -DDO_IPV6 -D_GNU_SOURCE"
28
29# set the "_FILE_OFFSET_BITS" preprocessor symbol to 64 to support files
30# larger than 2GB
31CFLAGS:append = " -D_FILE_OFFSET_BITS=64"
32
33PACKAGECONFIG ??= ""
34PACKAGECONFIG[sctp] = "--enable-sctp,--disable-sctp,lksctp-tools,"
35PACKAGECONFIG[intervals] = "--enable-intervals,--disable-intervals,,"
36PACKAGECONFIG[histogram] = "--enable-histogram,--disable-histogram,,"
37
38# autotools.bbclass attends to include m4 files with path depth <= 2 by
39# "find ${S} -maxdepth 2 -name \*.m4", so move m4 files from m4/m4.
40do_configure:prepend() {
41    test -d ${S}/m4/m4 && mv -f ${S}/m4/m4 ${S}/m4-files
42}
43
44do_install() {
45    sed -e 's#/usr/sbin/#${sbindir}/#g' -i ${WORKDIR}/init
46    install -d ${D}${sbindir} ${D}${bindir} ${D}${sysconfdir}/init.d ${D}${systemd_system_unitdir}
47    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
48        sed -e 's#/usr/sbin/#${sbindir}/#g' ${WORKDIR}/netserver.service > ${D}${systemd_system_unitdir}/netserver.service
49    fi
50    install -m 4755 src/netperf ${D}${bindir}
51    install -m 4755 src/netserver ${D}${sbindir}
52    install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/netperf
53
54    # man
55    install -d ${D}${mandir}/man1/
56    install -m 0644 ${S}/doc/netserver.man ${D}${mandir}/man1/netserver.1
57    install -m 0644 ${S}/doc/netperf.man ${D}${mandir}/man1/netperf.1
58
59    # move scripts to examples directory
60    install -d ${D}${docdir}/netperf/examples
61    install -m 0644 ${S}/doc/examples/*_script ${D}${docdir}/netperf/examples/
62
63    # docs ..
64    install -m 0644 ${S}/COPYING ${D}${docdir}/netperf
65    install -m 0644 ${S}/Release_Notes ${D}${docdir}/netperf
66    install -m 0644 ${S}/README ${D}${docdir}/netperf
67    install -m 0644 ${S}/doc/netperf_old.ps ${D}${docdir}/netperf
68}
69
70RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'sctp', 'kernel-module-sctp', '', d)}"
71
72INITSCRIPT_NAME="netperf"
73INITSCRIPT_PARAMS="defaults"
74SYSTEMD_SERVICE:${PN} = "netserver.service"
75