1eb8dc403SDave CobbleySUMMARY = "Tools for performance analysis"
2eb8dc403SDave CobbleyHOMEPAGE = "http://lmbench.sourceforge.net/"
3eb8dc403SDave CobbleySECTION = "console/utils"
49aee5003SAndrew GeisslerLICENSE = "GPL-2.0-only & GPL-2.0-with-lmbench-restriction"
5eb8dc403SDave CobbleyLIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
6eb8dc403SDave Cobbley                    file://COPYING-2;md5=8e9aee2ccc75d61d107e43794a25cdf9"
7eb8dc403SDave Cobbley
8d688a01eSAndrew Geisslerinherit autotools-brokensep update-alternatives
9eb8dc403SDave Cobbley
101a4b7ee2SBrad BishopDEPENDS += "libtirpc"
111a4b7ee2SBrad BishopCFLAGS += "-I${STAGING_INCDIR}/tirpc"
12eb8dc403SDave Cobbley
13eb8dc403SDave CobbleyPR = "r2"
14eb8dc403SDave Cobbley
15eb8dc403SDave CobbleySRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
16eb8dc403SDave Cobbley           file://lmbench-run \
17eb8dc403SDave Cobbley           file://rename-line-binary.patch \
18eb8dc403SDave Cobbley           file://update-results-script.patch \
19eb8dc403SDave Cobbley           file://obey-ranlib.patch \
20eb8dc403SDave Cobbley           file://update-config-script.patch \
21eb8dc403SDave Cobbley           file://lmbench_result_html_report.patch \
22eb8dc403SDave Cobbley           file://fix-lmbench-memory-check-failure.patch \
23eb8dc403SDave Cobbley           file://0001-avoid-gcc-optimize-away-the-loops.patch \
24eb8dc403SDave Cobbley           file://0001-lat_http.c-Add-printf-format.patch \
25eb8dc403SDave Cobbley           file://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \
261a4b7ee2SBrad Bishop           file://0001-src-Makefile-use-libdir-instead-of-hardcoded-lib.patch \
27eef6386cSAndrew Geissler           file://0001-lmbench-Point-webpage-lm-to-target-directory.patch \
28eef6386cSAndrew Geissler           file://0001-doc-Fix-typos-in-manual-pages.patch \
29eef6386cSAndrew Geissler           file://0001-lat_fifo-Fix-cleanup-sequence.patch \
3097771a30SAndrew Geissler           file://0001-doc-Fix-typos-in-lat_unix_connect-manual-page.patch \
31*87f5cff0SAndrew Geissler           file://0001-bench.h-Fix-typo-in-specifying-string.h.patch \
32*87f5cff0SAndrew Geissler           file://0001-scripts-build-Fix-the-tests-to-build-with-clang15.patch \
33eb8dc403SDave Cobbley           "
34eb8dc403SDave CobbleySRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
35eb8dc403SDave CobbleySRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
36eb8dc403SDave Cobbley
371a4b7ee2SBrad BishopUPSTREAM_CHECK_URI = "https://sourceforge.net/projects/lmbench/files/development/"
381a4b7ee2SBrad BishopUPSTREAM_CHECK_REGEX = "lmbench-(?P<pver>\d+(\.\d+)+-[a-z]+\d+)"
391a4b7ee2SBrad Bishop
40*87f5cff0SAndrew Geisslerexport OS = "${TARGET_SYS}"
41*87f5cff0SAndrew Geisslerexport TARGET = "${TARGET_OS}"
42*87f5cff0SAndrew Geissler
43eb8dc403SDave CobbleyEXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
44*87f5cff0SAndrew Geissler                LDFLAGS="${LDFLAGS}" LD="${LD}" OS="${TARGET_SYS}" \
45eb8dc403SDave Cobbley                TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"'
46eb8dc403SDave Cobbley
47eb8dc403SDave Cobbleydo_configure() {
48eb8dc403SDave Cobbley    :
49eb8dc403SDave Cobbley}
50eb8dc403SDave Cobbley
51eb8dc403SDave Cobbleydo_compile () {
52eb8dc403SDave Cobbley    for CONFIG_SITE_ITEM in $CONFIG_SITE; do
53eb8dc403SDave Cobbley        . $CONFIG_SITE_ITEM
54eb8dc403SDave Cobbley    done
55eb8dc403SDave Cobbley    if [ X"$ac_cv_uint" = X"yes" ]; then
56eb8dc403SDave Cobbley        CFLAGS="${CFLAGS} -DHAVE_uint"
57eb8dc403SDave Cobbley    fi
58eb8dc403SDave Cobbley    install -d ${S}/bin/${TARGET_SYS}
59*87f5cff0SAndrew Geissler    ${S}/scripts/build
60eb8dc403SDave Cobbley}
61eb8dc403SDave Cobbley
62eb8dc403SDave Cobbleydo_install () {
63eb8dc403SDave Cobbley    install -d ${D}${sysconfdir}/default/volatiles \
64c1d34338SBrad Bishop           ${D}${bindir} ${D}${mandir} \
65eb8dc403SDave Cobbley           ${D}${datadir}/lmbench/scripts
66eb8dc403SDave Cobbley
67eb8dc403SDave Cobbley    echo "d root root 0755 ${localstatedir}/run/${BPN} none" \
68eb8dc403SDave Cobbley           > ${D}${sysconfdir}/default/volatiles/99_lmbench
69eb8dc403SDave Cobbley    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
70eb8dc403SDave Cobbley        install -d ${D}${sysconfdir}/tmpfiles.d
71eb8dc403SDave Cobbley        echo "d /run/${BPN} - - - -" \
72eb8dc403SDave Cobbley              > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
73eb8dc403SDave Cobbley    fi
74eb8dc403SDave Cobbley
75eb8dc403SDave Cobbley    oe_runmake BASE="${D}${prefix}" MANDIR="${D}${mandir}" \
761a4b7ee2SBrad Bishop            DESTDIR="${D}" \
77eb8dc403SDave Cobbley            -C src install
78eb8dc403SDave Cobbley    mv ${D}${bindir}/line ${D}${bindir}/lm_line
79eb8dc403SDave Cobbley    install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
8097771a30SAndrew Geissler    install -m 0755 ${S}/bin/${TARGET_SYS}/cache ${D}${bindir}/
81eb8dc403SDave Cobbley    sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${BPN},;' \
82eb8dc403SDave Cobbley           -e 's,^CONFIG=.*$,CONFIG=`$SCRIPTSDIR/config`,;' \
83eb8dc403SDave Cobbley           ${D}${bindir}/lmbench-run
84eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/lmbench ${D}${bindir}
85eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/* ${D}${datadir}/lmbench/scripts
86eef6386cSAndrew Geissler    install -m 0644 ${S}/src/webpage-lm.tar ${D}${datadir}/lmbench
87eb8dc403SDave Cobbley}
88eb8dc403SDave Cobbley
89213cb269SPatrick Williamspkg_postinst:${PN} () {
90eb8dc403SDave Cobbley    if [ -z "$D" ]; then
91eb8dc403SDave Cobbley        if command -v systemd-tmpfiles >/dev/null; then
92eb8dc403SDave Cobbley            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/lmbench.conf
93eb8dc403SDave Cobbley        elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
94eb8dc403SDave Cobbley            ${sysconfdir}/init.d/populate-volatile.sh update
95eb8dc403SDave Cobbley        fi
96eb8dc403SDave Cobbley    fi
97eb8dc403SDave Cobbley}
98eb8dc403SDave Cobbley
99213cb269SPatrick WilliamsRDEPENDS:${PN} = "perl"
100213cb269SPatrick WilliamsFILES:${PN} += "${datadir}/lmbench"
101d688a01eSAndrew Geissler
102213cb269SPatrick WilliamsALTERNATIVE:${PN} = "stream"
103d688a01eSAndrew GeisslerALTERNATIVE_LINK_NAME[stream] = "${bindir}/stream"
104d688a01eSAndrew Geissler
105