app-metrics/prometheus: add 3.1.0
[gentoo/gentoo.git] / dev-cpp / tbb / tbb-2020.3.ebuild
bloba4a8523b1c41fd7bcfcf41d45a0077cec768b027
1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=7
6 inherit flag-o-matic multilib-minimal multilib multibuild toolchain-funcs
8 PV1="$(ver_cut 1)"
9 PV2="$(ver_cut 2)"
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"
15 LICENSE="Apache-2.0"
16 SLOT="0"
17 KEYWORDS="~alpha amd64 arm arm64 ~hppa ppc ppc64 ~riscv ~sparc x86 ~amd64-linux ~x86-linux"
18 IUSE="debug examples"
20 S="${WORKDIR}/oneTBB-${MY_PV}"
22 DOCS=( CHANGES README README.md doc/Release_Notes.txt )
24 PATCHES=(
25         "${FILESDIR}"/${PN}-2020.1-makefile-debug.patch
26         "${FILESDIR}"/${PN}-2020.3-gcc13.patch
29 src_prepare() {
30         default
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
47         # some deps use them
48         cat <<-EOF > ${PN}.pc.template
49                 prefix=${EPREFIX}/usr
50                 libdir=\${prefix}/$(get_libdir)
51                 includedir=\${prefix}/include
52                 Name: ${PN}
53                 Description: ${DESCRIPTION}
54                 Version: ${PV}
55                 URL: ${HOMEPAGE}
56                 Cflags: -I\${includedir}
57         EOF
58         cp ${PN}.pc.template ${PN}.pc || die
59         cat <<-EOF >> ${PN}.pc
60                 Libs: -L\${libdir} -ltbb
61                 Libs.private: -lm -lrt
62         EOF
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
67         EOF
68         cp ${PN}.pc.template ${PN}malloc_proxy.pc || die
69         cat <<-EOF >> ${PN}malloc_proxy.pc
70                 Libs: -L\${libdir} -ltbbmalloc_proxy
71                 Libs.private: -lrt
72                 Requires: tbbmalloc
73         EOF
76 local_src_compile() {
77         cd "${S}"
79         local comp arch
80         local bt buildtypes
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 ;;
87         esac
89         case "$(tc-getCXX)" in
90                 *clang*) comp="clang" ;;
91                 *g++*) comp="gcc" ;;
92                 *ic*c) comp="icc" ;;
93                 *) die "compiler $(tc-getCXX) not supported by build system" ;;
94         esac
96         if use debug ; then
97                 buildtypes="release debug"
98         else
99                 buildtypes="release"
100         fi
102         for bt in ${buildtypes}; do
103                 CXX="$(tc-getCXX)" \
104                 CC="$(tc-getCC)" \
105                 AS="$(tc-getAS)" \
106                 arch=${arch} \
107                 CPLUS_FLAGS="${CXXFLAGS}" \
108                 emake compiler=${comp} work_dir="${BUILD_DIR}" tbb_root="${S}" cfg=${bt} $@
109         done
112 multilib_src_compile() {
113         local_src_compile tbb tbbmalloc
116 multilib_src_test() {
117         local_src_compile test
120 multilib_src_install() {
121         local bt
122         local buildtypes
123         if use debug ; then
124                 buildtypes="release debug"
125         else
126                 buildtypes="release"
127         fi
128         for bt in ${buildtypes}; do
129                 cd "${BUILD_DIR}_${bt}" || die
130                 local l
131                 for l in $(find . -name lib\*$(get_libname \*)); do
132                         dolib.so ${l}
133                         local bl=$(basename ${l})
134                         dosym ${bl} /usr/$(get_libdir)/${bl%%.*}$(get_libname)
135                 done
136         done
138         cd "${BUILD_DIR}" || die
139         insinto /usr/$(get_libdir)/pkgconfig
140         doins *.pc
143 multilib_src_install_all() {
144         doheader -r include/*
146         einstalldocs
148         if use examples ; then
149                 dodoc -r examples
150                 docinto examples/build
151                 dodoc build/*.inc
152                 docompress -x /usr/share/doc/${PF}/examples
153         fi