summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/jemalloc/jemalloc_5.3.1.bb
blob: f3a310029f993ee750febd57f6623710198bc596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright (C) 2021 Mingli Yu <mingli.yu@windriver.com>
# Released under the MIT license (see COPYING.MIT for the terms)

SUMMARY = "General-purpose scalable concurrent malloc implementation"

DESCRIPTION = "jemalloc is a general purpose malloc(3) implementation that emphasizes \
fragmentation avoidance and scalable concurrency support."

HOMEPAGE = "https://github.com/jemalloc/jemalloc"
LICENSE = "BSD-2-Clause"

SECTION = "libs"

LIC_FILES_CHKSUM = "file://COPYING;md5=ea061f8731d5e6a5761dfad951ef5f5f"

SRC_URI = "git://github.com/jemalloc/jemalloc.git;branch=master;protocol=https;tag=${PV} \
	   file://1a15fe33a48c52bfe26ea83e49f0d317a47da3ea.patch \
           file://run-ptest \
           "
SRCREV = "81034ce1f1373e37dc865038e1bc8eeecf559ce8"
PV_LONG := "${PV}-0-g${SRCREV}"

inherit autotools ptest

EXTRA_AUTORECONF += "--exclude=autoheader"

EXTRA_OECONF:append:libc-musl = " --with-jemalloc-prefix=je_"
# For some reason VERSION file populated only in tarball distribution.
# Adding jemalloc version since this recipe is using source code from git tag
EXTRA_OECONF:append = " --with-version=${PV_LONG} --enable-xmalloc"
# Enable jemalloc debug build flag if DEBUG_BUILD is enabled
EXTRA_OECONF:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '--enable-debug=yes', '', d)}"

do_install:append() {
	sed -i -e 's@${STAGING_DIR_HOST}@@g' \
               -e 's@${STAGING_DIR_NATIVE}@@g' \
               -e 's@${WORKDIR}@@g' ${D}${bindir}/jemalloc-config
}

do_compile_ptest() {
	oe_runmake tests
}

do_install_ptest() {
	install -d ${D}${PTEST_PATH}/tests
	subdirs="unit integration stress "
	for tooltest in ${subdirs}
	do
		cp -r ${B}/test/${tooltest} ${D}${PTEST_PATH}/tests
        if find ${S}/test/${tooltest}/ -name '*.sh' -print -quit | grep -q .; then
		    cp ${S}/test/${tooltest}/*.sh ${D}${PTEST_PATH}/tests/${tooltest}
        fi
	done
	find ${D}${PTEST_PATH}/tests \( -name "*.d" -o -name "*.o" \) -exec rm -f {} \;
}