1eb8dc403SDave CobbleySUMMARY = "Tools for performance analysis"
2eb8dc403SDave CobbleyHOMEPAGE = "http://lmbench.sourceforge.net/"
3eb8dc403SDave CobbleySECTION = "console/utils"
4eb8dc403SDave CobbleyLICENSE = "GPLv2 & 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"
121a4b7ee2SBrad BishopLDLIBS += " -ltirpc "
13eb8dc403SDave Cobbley
14eb8dc403SDave CobbleyPR = "r2"
15eb8dc403SDave Cobbley
16eb8dc403SDave CobbleySRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
17eb8dc403SDave Cobbley           file://lmbench-run \
18eb8dc403SDave Cobbley           file://rename-line-binary.patch \
19eb8dc403SDave Cobbley           file://update-results-script.patch \
20eb8dc403SDave Cobbley           file://obey-ranlib.patch \
21eb8dc403SDave Cobbley           file://update-config-script.patch \
22eb8dc403SDave Cobbley           file://lmbench_result_html_report.patch \
23eb8dc403SDave Cobbley           file://fix-lmbench-memory-check-failure.patch \
24eb8dc403SDave Cobbley           file://0001-avoid-gcc-optimize-away-the-loops.patch \
25eb8dc403SDave Cobbley           file://0001-lat_http.c-Add-printf-format.patch \
26eb8dc403SDave Cobbley           file://0001-Check-for-musl-define-guard-before-redefining-sockle.patch \
27eb8dc403SDave Cobbley           file://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \
281a4b7ee2SBrad Bishop           file://0001-src-Makefile-use-libdir-instead-of-hardcoded-lib.patch \
29eef6386cSAndrew Geissler           file://0001-lmbench-Point-webpage-lm-to-target-directory.patch \
30eef6386cSAndrew Geissler           file://0001-doc-Fix-typos-in-manual-pages.patch \
31eef6386cSAndrew Geissler           file://0001-lat_fifo-Fix-cleanup-sequence.patch \
32*97771a30SAndrew Geissler           file://0001-doc-Fix-typos-in-lat_unix_connect-manual-page.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
40eb8dc403SDave CobbleyEXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
41eb8dc403SDave Cobbley                LDFLAGS="${LDFLAGS}" LDLIBS="${LDLIBS}" LD="${LD}" OS="${TARGET_SYS}" \
42eb8dc403SDave Cobbley                TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"'
43eb8dc403SDave Cobbley
44eb8dc403SDave Cobbleydo_configure() {
45eb8dc403SDave Cobbley    :
46eb8dc403SDave Cobbley}
47eb8dc403SDave Cobbley
48eb8dc403SDave Cobbleydo_compile () {
49eb8dc403SDave Cobbley    for CONFIG_SITE_ITEM in $CONFIG_SITE; do
50eb8dc403SDave Cobbley        . $CONFIG_SITE_ITEM
51eb8dc403SDave Cobbley    done
52eb8dc403SDave Cobbley    if [ X"$ac_cv_uint" = X"yes" ]; then
53eb8dc403SDave Cobbley        CFLAGS="${CFLAGS} -DHAVE_uint"
54eb8dc403SDave Cobbley    fi
55eb8dc403SDave Cobbley    install -d ${S}/bin/${TARGET_SYS}
56eb8dc403SDave Cobbley    oe_runmake -C src
57eb8dc403SDave Cobbley}
58eb8dc403SDave Cobbley
59eb8dc403SDave Cobbleydo_install () {
60eb8dc403SDave Cobbley    install -d ${D}${sysconfdir}/default/volatiles \
61c1d34338SBrad Bishop           ${D}${bindir} ${D}${mandir} \
62eb8dc403SDave Cobbley           ${D}${datadir}/lmbench/scripts
63eb8dc403SDave Cobbley
64eb8dc403SDave Cobbley    echo "d root root 0755 ${localstatedir}/run/${BPN} none" \
65eb8dc403SDave Cobbley           > ${D}${sysconfdir}/default/volatiles/99_lmbench
66eb8dc403SDave Cobbley    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
67eb8dc403SDave Cobbley        install -d ${D}${sysconfdir}/tmpfiles.d
68eb8dc403SDave Cobbley        echo "d /run/${BPN} - - - -" \
69eb8dc403SDave Cobbley              > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
70eb8dc403SDave Cobbley    fi
71eb8dc403SDave Cobbley
72eb8dc403SDave Cobbley    oe_runmake BASE="${D}${prefix}" MANDIR="${D}${mandir}" \
731a4b7ee2SBrad Bishop            DESTDIR="${D}" \
74eb8dc403SDave Cobbley            -C src install
75eb8dc403SDave Cobbley    mv ${D}${bindir}/line ${D}${bindir}/lm_line
76eb8dc403SDave Cobbley    install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
77*97771a30SAndrew Geissler    install -m 0755 ${S}/bin/${TARGET_SYS}/cache ${D}${bindir}/
78eb8dc403SDave Cobbley    sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${BPN},;' \
79eb8dc403SDave Cobbley           -e 's,^CONFIG=.*$,CONFIG=`$SCRIPTSDIR/config`,;' \
80eb8dc403SDave Cobbley           ${D}${bindir}/lmbench-run
81eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/lmbench ${D}${bindir}
82eb8dc403SDave Cobbley    install -m 0755 ${S}/scripts/* ${D}${datadir}/lmbench/scripts
83eef6386cSAndrew Geissler    install -m 0644 ${S}/src/webpage-lm.tar ${D}${datadir}/lmbench
84eb8dc403SDave Cobbley}
85eb8dc403SDave Cobbley
86eb8dc403SDave Cobbleypkg_postinst_${PN} () {
87eb8dc403SDave Cobbley    if [ -z "$D" ]; then
88eb8dc403SDave Cobbley        if command -v systemd-tmpfiles >/dev/null; then
89eb8dc403SDave Cobbley            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/lmbench.conf
90eb8dc403SDave Cobbley        elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
91eb8dc403SDave Cobbley            ${sysconfdir}/init.d/populate-volatile.sh update
92eb8dc403SDave Cobbley        fi
93eb8dc403SDave Cobbley    fi
94eb8dc403SDave Cobbley}
95eb8dc403SDave Cobbley
96eb8dc403SDave CobbleyRDEPENDS_${PN} = "perl"
97c1d34338SBrad BishopFILES_${PN} += "${datadir}/lmbench"
98d688a01eSAndrew Geissler
99d688a01eSAndrew GeisslerALTERNATIVE_${PN} = "stream"
100d688a01eSAndrew GeisslerALTERNATIVE_LINK_NAME[stream] = "${bindir}/stream"
101d688a01eSAndrew Geissler
102