libomp-8.0.1.ebuild (3261B)
1 # Copyright 1999-2020 Gentoo Authors 2 # Distributed under the terms of the GNU General Public License v2 3 4 EAPI=7 5 6 : ${CMAKE_MAKEFILE_GENERATOR:=ninja} 7 # (needed due to CMAKE_BUILD_TYPE != Gentoo) 8 CMAKE_MIN_VERSION=3.7.0-r1 9 PYTHON_COMPAT=( python2_7 ) 10 11 inherit cmake-multilib linux-info multiprocessing python-any-r1 12 13 MY_P=openmp-${PV}.src 14 DESCRIPTION="OpenMP runtime library for LLVM/clang compiler" 15 HOMEPAGE="https://openmp.llvm.org" 16 SRC_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/${MY_P}.tar.xz" 17 18 # Additional licenses: 19 # - MIT-licensed Intel code, 20 # - LLVM Software Grant from Intel. 21 22 LICENSE="|| ( UoI-NCSA MIT ) MIT LLVM-Grant" 23 SLOT="0" 24 KEYWORDS="amd64 arm arm64 ppc64 x86 ~amd64-linux ~x64-macos" 25 IUSE="cuda hwloc kernel_linux offload ompt test" 26 # CUDA works only with the x86_64 ABI 27 REQUIRED_USE="offload? ( cuda? ( abi_x86_64 ) )" 28 RESTRICT="!test? ( test )" 29 30 RDEPEND=" 31 hwloc? ( sys-apps/hwloc:0=[${MULTILIB_USEDEP}] ) 32 offload? ( 33 virtual/libelf:=[${MULTILIB_USEDEP}] 34 dev-libs/libffi:=[${MULTILIB_USEDEP}] 35 cuda? ( dev-util/nvidia-cuda-toolkit:= ) 36 )" 37 # tests: 38 # - dev-python/lit provides the test runner 39 # - sys-devel/llvm provide test utils (e.g. FileCheck) 40 # - sys-devel/clang provides the compiler to run tests 41 DEPEND="${RDEPEND} 42 dev-lang/perl 43 offload? ( virtual/pkgconfig ) 44 test? ( 45 $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') 46 >=sys-devel/clang-6 47 )" 48 49 S=${WORKDIR}/${MY_P} 50 51 # least intrusive of all 52 CMAKE_BUILD_TYPE=RelWithDebInfo 53 54 python_check_deps() { 55 has_version "dev-python/lit[${PYTHON_USEDEP}]" 56 } 57 58 kernel_pds_check() { 59 if use kernel_linux && kernel_is -lt 4 15 && kernel_is -ge 4 13; then 60 local CONFIG_CHECK="~!SCHED_PDS" 61 local ERROR_SCHED_PDS="\ 62 PDS scheduler versions >= 0.98c < 0.98i (e.g. used in kernels >= 4.13-pf11 63 < 4.14-pf9) do not implement sched_yield() call which may result in horrible 64 performance problems with libomp. If you are using one of the specified 65 kernel versions, you may want to disable the PDS scheduler." 66 67 check_extra_config 68 fi 69 } 70 71 pkg_pretend() { 72 kernel_pds_check 73 } 74 75 pkg_setup() { 76 use test && python-any-r1_pkg_setup 77 } 78 79 multilib_src_configure() { 80 local libdir="$(get_libdir)" 81 local mycmakeargs=( 82 -DOPENMP_LIBDIR_SUFFIX="${libdir#lib}" 83 84 -DLIBOMP_USE_HWLOC=$(usex hwloc) 85 -DLIBOMP_OMPT_SUPPORT=$(usex ompt) 86 87 -DOPENMP_ENABLE_LIBOMPTARGET=$(usex offload) 88 89 # do not install libgomp.so & libiomp5.so aliases 90 -DLIBOMP_INSTALL_ALIASES=OFF 91 # disable unnecessary hack copying stuff back to srcdir 92 -DLIBOMP_COPY_EXPORTS=OFF 93 ) 94 use offload && mycmakeargs+=( 95 # this is non-fatal and libomp checks for CUDA conditionally 96 # to ABI, so we can just ignore passing the wrong value 97 # on non-amd64 ABIs 98 -DCMAKE_DISABLE_FIND_PACKAGE_CUDA=$(usex !cuda) 99 ) 100 use test && mycmakeargs+=( 101 # this project does not use standard LLVM cmake macros 102 -DOPENMP_LLVM_LIT_EXECUTABLE="${EPREFIX}/usr/bin/lit" 103 -DOPENMP_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" 104 105 -DOPENMP_TEST_C_COMPILER="$(type -P "${CHOST}-clang")" 106 -DOPENMP_TEST_CXX_COMPILER="$(type -P "${CHOST}-clang++")" 107 ) 108 cmake-utils_src_configure 109 } 110 111 multilib_src_test() { 112 # respect TMPDIR! 113 local -x LIT_PRESERVES_TMP=1 114 115 cmake-utils_src_make check-libomp 116 }