1# Copyright (C) 2021 Mingli Yu <mingli.yu@windriver.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "General-purpose scalable concurrent malloc implementation"
5
6DESCRIPTION = "jemalloc is a general purpose malloc(3) implementation that emphasizes \
7fragmentation avoidance and scalable concurrency support."
8
9HOMEPAGE = "https://github.com/jemalloc/jemalloc"
10LICENSE = "BSD-2-Clause"
11
12SECTION = "libs"
13
14LIC_FILES_CHKSUM = "file://COPYING;md5=ea061f8731d5e6a5761dfad951ef5f5f"
15
16SRC_URI = "git://github.com/jemalloc/jemalloc.git;branch=master;protocol=https \
17           file://run-ptest \
18           "
19
20# Workaround for https://github.com/llvm/llvm-project/issues/52765
21SRC_URI:append:libc-glibc:toolchain-clang = " file://0001-test-Disable-optimization-with-clang-for-aligned_all.patch "
22
23SRCREV = "54eaed1d8b56b1aa528be3bdd1877e59c56fa90c"
24
25S = "${WORKDIR}/git"
26
27inherit autotools ptest
28
29EXTRA_AUTORECONF += "--exclude=autoheader"
30
31EXTRA_OECONF:append:libc-musl = " --with-jemalloc-prefix=je_"
32
33do_install:append() {
34	sed -i -e 's@${STAGING_DIR_HOST}@@g' \
35               -e 's@${STAGING_DIR_NATIVE}@@g' \
36               -e 's@${WORKDIR}@@g' ${D}${bindir}/jemalloc-config
37}
38
39do_compile_ptest() {
40	oe_runmake tests
41}
42
43do_install_ptest() {
44	install -d ${D}${PTEST_PATH}/tests
45	subdirs="test/unit test/integration test/stress "
46	for tooltest in ${subdirs}
47	do
48		cp -r ${B}/${tooltest} ${D}${PTEST_PATH}/tests
49	done
50	find ${D}${PTEST_PATH}/tests \( -name "*.d" -o -name "*.o" \) -exec rm -f {} \;
51}
52