xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-networking/recipes-support/netperf/netperf_git.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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${SRCPV}"
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 = "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', \
32    ' -D_FILE_OFFSET_BITS=64', '', d)}"
33
34PACKAGECONFIG ??= ""
35PACKAGECONFIG[sctp] = "--enable-sctp,--disable-sctp,lksctp-tools,"
36PACKAGECONFIG[intervals] = "--enable-intervals,--disable-intervals,,"
37PACKAGECONFIG[histogram] = "--enable-histogram,--disable-histogram,,"
38
39# autotools.bbclass attends to include m4 files with path depth <= 2 by
40# "find ${S} -maxdepth 2 -name \*.m4", so move m4 files from m4/m4.
41do_configure:prepend() {
42    test -d ${S}/m4/m4 && mv -f ${S}/m4/m4 ${S}/m4-files
43}
44
45do_install() {
46    sed -e 's#/usr/sbin/#${sbindir}/#g' -i ${WORKDIR}/init
47    install -d ${D}${sbindir} ${D}${bindir} ${D}${sysconfdir}/init.d ${D}${systemd_system_unitdir}
48    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
49        sed -e 's#/usr/sbin/#${sbindir}/#g' ${WORKDIR}/netserver.service > ${D}${systemd_system_unitdir}/netserver.service
50    fi
51    install -m 4755 src/netperf ${D}${bindir}
52    install -m 4755 src/netserver ${D}${sbindir}
53    install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/netperf
54
55    # man
56    install -d ${D}${mandir}/man1/
57    install -m 0644 ${S}/doc/netserver.man ${D}${mandir}/man1/netserver.1
58    install -m 0644 ${S}/doc/netperf.man ${D}${mandir}/man1/netperf.1
59
60    # move scripts to examples directory
61    install -d ${D}${docdir}/netperf/examples
62    install -m 0644 ${S}/doc/examples/*_script ${D}${docdir}/netperf/examples/
63
64    # docs ..
65    install -m 0644 ${S}/COPYING ${D}${docdir}/netperf
66    install -m 0644 ${S}/Release_Notes ${D}${docdir}/netperf
67    install -m 0644 ${S}/README ${D}${docdir}/netperf
68    install -m 0644 ${S}/doc/netperf_old.ps ${D}${docdir}/netperf
69}
70
71RRECOMMENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'sctp', 'kernel-module-sctp', '', d)}"
72
73INITSCRIPT_NAME="netperf"
74INITSCRIPT_PARAMS="defaults"
75SYSTEMD_SERVICE:${PN} = "netserver.service"
76