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 Cobbley
14eb8dc403SDave CobbleySRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
15eb8dc403SDave Cobbley           file://lmbench-run \
16eb8dc403SDave Cobbley           file://rename-line-binary.patch \
17eb8dc403SDave Cobbley           file://update-results-script.patch \
18eb8dc403SDave Cobbley           file://obey-ranlib.patch \
19eb8dc403SDave Cobbley           file://update-config-script.patch \
20eb8dc403SDave Cobbley           file://lmbench_result_html_report.patch \
21eb8dc403SDave Cobbley           file://fix-lmbench-memory-check-failure.patch \
22eb8dc403SDave Cobbley           file://0001-avoid-gcc-optimize-away-the-loops.patch \
23eb8dc403SDave Cobbley           file://0001-lat_http.c-Add-printf-format.patch \
24eb8dc403SDave Cobbley           file://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \
251a4b7ee2SBrad Bishop           file://0001-src-Makefile-use-libdir-instead-of-hardcoded-lib.patch \
26eef6386cSAndrew Geissler           file://0001-lmbench-Point-webpage-lm-to-target-directory.patch \
27eef6386cSAndrew Geissler           file://0001-doc-Fix-typos-in-manual-pages.patch \
28eef6386cSAndrew Geissler           file://0001-lat_fifo-Fix-cleanup-sequence.patch \
2997771a30SAndrew Geissler           file://0001-doc-Fix-typos-in-lat_unix_connect-manual-page.patch \
3087f5cff0SAndrew Geissler           file://0001-bench.h-Fix-typo-in-specifying-string.h.patch \
3187f5cff0SAndrew Geissler           file://0001-scripts-build-Fix-the-tests-to-build-with-clang15.patch \
32eb8dc403SDave Cobbley           "
33eb8dc403SDave CobbleySRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
34eb8dc403SDave CobbleySRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
35eb8dc403SDave Cobbley
361a4b7ee2SBrad BishopUPSTREAM_CHECK_URI = "https://sourceforge.net/projects/lmbench/files/development/"
371a4b7ee2SBrad BishopUPSTREAM_CHECK_REGEX = "lmbench-(?P<pver>\d+(\.\d+)+-[a-z]+\d+)"
381a4b7ee2SBrad Bishop
3987f5cff0SAndrew Geisslerexport OS = "${TARGET_SYS}"
4087f5cff0SAndrew Geisslerexport TARGET = "${TARGET_OS}"
4187f5cff0SAndrew Geissler
42eb8dc403SDave CobbleyEXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
4387f5cff0SAndrew Geissler                LDFLAGS="${LDFLAGS}" LD="${LD}" OS="${TARGET_SYS}" \
44eb8dc403SDave Cobbley                TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"'
45eb8dc403SDave Cobbley
46eb8dc403SDave Cobbleydo_configure() {
47eb8dc403SDave Cobbley    :
48eb8dc403SDave Cobbley}
49eb8dc403SDave Cobbley
50eb8dc403SDave Cobbleydo_compile () {
51eb8dc403SDave Cobbley    for CONFIG_SITE_ITEM in $CONFIG_SITE; do
52eb8dc403SDave Cobbley        . $CONFIG_SITE_ITEM
53eb8dc403SDave Cobbley    done
54eb8dc403SDave Cobbley    if [ X"$ac_cv_uint" = X"yes" ]; then
55eb8dc403SDave Cobbley        CFLAGS="${CFLAGS} -DHAVE_uint"
56eb8dc403SDave Cobbley    fi
57eb8dc403SDave Cobbley    install -d ${S}/bin/${TARGET_SYS}
5887f5cff0SAndrew Geissler    ${S}/scripts/build
59eb8dc403SDave Cobbley}
60eb8dc403SDave Cobbley
61eb8dc403SDave Cobbleydo_install () {
62eb8dc403SDave Cobbley    install -d ${D}${sysconfdir}/default/volatiles \
63c1d34338SBrad Bishop           ${D}${bindir} ${D}${mandir} \
64eb8dc403SDave Cobbley           ${D}${datadir}/lmbench/scripts
65eb8dc403SDave Cobbley
66eb8dc403SDave Cobbley    echo "d root root 0755 ${localstatedir}/run/${BPN} none" \
67eb8dc403SDave Cobbley           > ${D}${sysconfdir}/default/volatiles/99_lmbench
68eb8dc403SDave Cobbley    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
69eb8dc403SDave Cobbley        install -d ${D}${sysconfdir}/tmpfiles.d
70eb8dc403SDave Cobbley        echo "d /run/${BPN} - - - -" \
71eb8dc403SDave Cobbley              > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
72eb8dc403SDave Cobbley    fi
73eb8dc403SDave Cobbley
74eb8dc403SDave Cobbley    oe_runmake BASE="${D}${prefix}" MANDIR="${D}${mandir}" \
751a4b7ee2SBrad Bishop            DESTDIR="${D}" \
76eb8dc403SDave Cobbley            -C src install
77eb8dc403SDave Cobbley    mv ${D}${bindir}/line ${D}${bindir}/lm_line
78eb8dc403SDave Cobbley    install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
7997771a30SAndrew Geissler    install -m 0755 ${S}/bin/${TARGET_SYS}/cache ${D}${bindir}/
80eb8dc403SDave Cobbley    sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${BPN},;' \
81eb8dc403SDave Cobbley           -e 's,^CONFIG=.*$,CONFIG=`$SCRIPTSDIR/config`,;' \
82eb8dc403SDave Cobbley           ${D}${bindir}/lmbench-run
83eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/lmbench ${D}${bindir}
84eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/* ${D}${datadir}/lmbench/scripts
85eef6386cSAndrew Geissler    install -m 0644 ${S}/src/webpage-lm.tar ${D}${datadir}/lmbench
86eb8dc403SDave Cobbley}
87eb8dc403SDave Cobbley
88213cb269SPatrick Williamspkg_postinst:${PN} () {
89eb8dc403SDave Cobbley    if [ -z "$D" ]; then
90eb8dc403SDave Cobbley        if command -v systemd-tmpfiles >/dev/null; then
91eb8dc403SDave Cobbley            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/lmbench.conf
92eb8dc403SDave Cobbley        elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
93eb8dc403SDave Cobbley            ${sysconfdir}/init.d/populate-volatile.sh update
94eb8dc403SDave Cobbley        fi
95eb8dc403SDave Cobbley    fi
96eb8dc403SDave Cobbley}
97eb8dc403SDave Cobbley
98213cb269SPatrick WilliamsRDEPENDS:${PN} = "perl"
99213cb269SPatrick WilliamsFILES:${PN} += "${datadir}/lmbench"
100d688a01eSAndrew Geissler
101*6aa7eec5SAndrew GeisslerALTERNATIVE:${PN} = "stream hello"
102d688a01eSAndrew GeisslerALTERNATIVE_LINK_NAME[stream] = "${bindir}/stream"
103*6aa7eec5SAndrew GeisslerALTERNATIVE_LINK_NAME[hello] = "${bindir}/hello"
104