1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic multilib-minimal multilib multibuild toolchain-funcs
10 MY_PV="${PV1}_U${PV2}"
12 DESCRIPTION="High level abstract threading library"
13 HOMEPAGE="https://github.com/oneapi-src/oneTBB"
14 SRC_URI="https://github.com/intel/${PN}/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
17 KEYWORDS="~alpha amd64 arm arm64 ~hppa ppc ppc64 ~riscv ~sparc x86 ~amd64-linux ~x86-linux"
20 S="${WORKDIR}/oneTBB-${MY_PV}"
22 DOCS=( CHANGES README README.md doc/Release_Notes.txt )
25 "${FILESDIR}"/${PN}-2020.1-makefile-debug.patch
26 "${FILESDIR}"/${PN}-2020.3-gcc13.patch
32 find include -name \*.html -delete || die
34 # Give it a soname on FreeBSD
35 echo 'LIB_LINK_FLAGS += -Wl,-soname=$(BUILDING_LIBRARY)' >> build/FreeBSD.gcc.inc
36 # Set proper versionning on FreeBSD
37 sed -i -e '/.DLL =/s/$/.1/' build/FreeBSD.inc || die
39 use debug || sed -i -e '/_debug/d' Makefile
42 multilib_src_configure() {
43 # Workaround for bug #912210
44 append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
46 # pc files are for debian and fedora compatibility
48 cat <<-EOF > ${PN}.pc.template
50 libdir=\${prefix}/$(get_libdir)
51 includedir=\${prefix}/include
53 Description: ${DESCRIPTION}
56 Cflags: -I\${includedir}
58 cp ${PN}.pc.template ${PN}.pc || die
59 cat <<-EOF >> ${PN}.pc
60 Libs: -L\${libdir} -ltbb
61 Libs.private: -lm -lrt
63 cp ${PN}.pc.template ${PN}malloc.pc || die
64 cat <<-EOF >> ${PN}malloc.pc
65 Libs: -L\${libdir} -ltbbmalloc
66 Libs.private: -lm -lrt
68 cp ${PN}.pc.template ${PN}malloc_proxy.pc || die
69 cat <<-EOF >> ${PN}malloc_proxy.pc
70 Libs: -L\${libdir} -ltbbmalloc_proxy
82 case ${MULTILIB_ABI_FLAG} in
83 abi_x86_64) arch=x86_64 ;;
84 abi_x86_32) arch=ia32 ;;
85 # abi_ppc_64) arch=ppc64 ;;
86 # abi_ppc_32) arch=ppc32 ;;
89 case "$(tc-getCXX)" in
90 *clang*) comp="clang" ;;
93 *) die "compiler $(tc-getCXX) not supported by build system" ;;
97 buildtypes="release debug"
102 for bt in ${buildtypes}; do
107 CPLUS_FLAGS="${CXXFLAGS}" \
108 emake compiler=${comp} work_dir="${BUILD_DIR}" tbb_root="${S}" cfg=${bt} $@
112 multilib_src_compile() {
113 local_src_compile tbb tbbmalloc
116 multilib_src_test() {
117 local_src_compile test
120 multilib_src_install() {
124 buildtypes="release debug"
128 for bt in ${buildtypes}; do
129 cd "${BUILD_DIR}_${bt}" || die
131 for l in $(find . -name lib\*$(get_libname \*)); do
133 local bl=$(basename ${l})
134 dosym ${bl} /usr/$(get_libdir)/${bl%%.*}$(get_libname)
138 cd "${BUILD_DIR}" || die
139 insinto /usr/$(get_libdir)/pkgconfig
143 multilib_src_install_all() {
144 doheader -r include/*
148 if use examples ; then
150 docinto examples/build
152 docompress -x /usr/share/doc/${PF}/examples