diff options
author | Sam James <sam@gentoo.org> | 2022-06-08 06:05:57 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-06-08 06:06:05 +0100 |
commit | 95cae20e05d591fbb744f6e4921e46f996811b40 (patch) | |
tree | ec955ea76a6267ebc837f3cba145dbad47b52440 /sci-libs/symengine | |
parent | www-apache/passenger: enable ruby31 (diff) | |
download | gentoo-95cae20e05d591fbb744f6e4921e46f996811b40.tar.gz gentoo-95cae20e05d591fbb744f6e4921e46f996811b40.tar.bz2 gentoo-95cae20e05d591fbb744f6e4921e46f996811b40.zip |
sci-libs/symengine: fix pthread detection
Closes: https://bugs.gentoo.org/849803
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sci-libs/symengine')
-rw-r--r-- | sci-libs/symengine/files/symengine-0.9.0-pthread-cmake.patch | 63 | ||||
-rw-r--r-- | sci-libs/symengine/symengine-0.9.0-r1.ebuild | 98 | ||||
-rw-r--r-- | sci-libs/symengine/symengine-0.9.0.ebuild | 1 |
3 files changed, 162 insertions, 0 deletions
diff --git a/sci-libs/symengine/files/symengine-0.9.0-pthread-cmake.patch b/sci-libs/symengine/files/symengine-0.9.0-pthread-cmake.patch new file mode 100644 index 000000000000..0fa049dbf218 --- /dev/null +++ b/sci-libs/symengine/files/symengine-0.9.0-pthread-cmake.patch @@ -0,0 +1,63 @@ +From 6ad9620ffc578abdb920b84ea5e393c726389ac0 Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Wed, 8 Jun 2022 06:02:25 +0100 +Subject: [PATCH] cmake: fix pthread detection + +The homebrew FindPTHREAD.cmake module was hardcoding the path to libpthread +in the installed CMake config file which broke consumers when upgrading from +< glibc-2.34 (e.g. glibc-2.33 -> glibc-2.34). + +CMake provides FindThreads which does the job fine for us. Tested with both +glibc-2.33 (with a previously bad generated file, and then fixed) and glibc-2.35. + +This should be fine on musl and friends too. This brings symengine in line +with most CMake packages. + +Bug: https://bugs.gentoo.org/849803 +Fixes: https://github.com/symengine/symengine/issues/1910 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -335,11 +335,10 @@ if (WITH_PIRANHA) + endif() + + if (WITH_PTHREAD) +- find_package(PTHREAD REQUIRED) +- include_directories(SYSTEM ${PTHREAD_INCLUDE_DIRS}) +- set(LIBS ${LIBS} ${PTHREAD_TARGETS}) ++ find_package(Threads) ++ set(THREADS_PREFER_PTHREAD_FLAG ON) ++ set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) + set(HAVE_SYMENGINE_PTHREAD yes) +- set(PKGS ${PKGS} "PTHREAD") + endif() + + if (WITH_MPFR) +@@ -761,10 +760,6 @@ if (WITH_BOOST) + endif() + + message("WITH_PTHREAD: ${WITH_PTHREAD}") +-if (WITH_PTHREAD) +- message("PTHREAD_INCLUDE_DIRS: ${PTHREAD_INCLUDE_DIRS}") +- message("PTHREAD_LIBRARIES: ${PTHREAD_LIBRARIES}") +-endif() + + message("WITH_MPC: ${WITH_MPC}") + if (WITH_MPC) +--- a/cmake/FindPTHREAD.cmake ++++ /dev/null +@@ -1,14 +0,0 @@ +-include(LibFindMacros) +- +-libfind_include(pthread.h pthread) +-libfind_library(pthread pthread) +- +-set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY}) +-set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR}) +-set(PTHREAD_TARGETS pthread) +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(PTHREAD DEFAULT_MSG PTHREAD_LIBRARIES +- PTHREAD_INCLUDE_DIRS) +- +-mark_as_advanced(PTHREAD_INCLUDE_DIR PTHEARD_LIBRARY) + diff --git a/sci-libs/symengine/symengine-0.9.0-r1.ebuild b/sci-libs/symengine/symengine-0.9.0-r1.ebuild new file mode 100644 index 000000000000..d0cb975cca8a --- /dev/null +++ b/sci-libs/symengine/symengine-0.9.0-r1.ebuild @@ -0,0 +1,98 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_MAX_SLOT=13 +inherit cmake llvm toolchain-funcs + +DESCRIPTION="Fast symbolic manipulation library, written in C++" +HOMEPAGE="https://github.com/symengine/symengine" +SRC_URI="https://github.com/symengine/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0/$(ver_cut 1-2)" +KEYWORDS="amd64 ~arm ~arm64 ~riscv x86" +# BUILD_FOR_DISTRIBUTION enables threads by default so do it here +IUSE="arb benchmarks boost debug doc ecm +flint llvm +mpc +mpfr openmp test tcmalloc +threads" +RESTRICT="!test? ( test )" + +RDEPEND="dev-libs/gmp:= + sys-libs/binutils-libs:= + arb? ( sci-mathematics/arb:= ) + boost? ( dev-libs/boost:= ) + ecm? ( sci-mathematics/gmp-ecm ) + flint? ( sci-mathematics/flint:= ) + mpc? ( dev-libs/mpc:= ) + llvm? ( <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):= ) + tcmalloc? ( dev-util/google-perftools )" +DEPEND="${RDEPEND} + dev-libs/cereal" +BDEPEND="doc? ( app-doc/doxygen[dot] )" + +PATCHES=( + "${FILESDIR}"/${PN}-0.7.0-cmake-build-type.patch + "${FILESDIR}"/${PN}-0.9.0-pthread-cmake.patch +) + +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp + + use llvm && llvm_pkg_setup +} + +src_prepare() { + cmake_src_prepare + + sed -e "s|DESTINATION doc| DESTINATION share/doc/${PF}/html|" \ + -e "s|/lib|/$(get_libdir)|g" \ + -e "s|lib/|$(get_libdir)/|g" \ + -e "/DESTINATION/s|lib|$(get_libdir)|g" \ + -i CMakeLists.txt symengine/CMakeLists.txt \ + symengine/utilities/teuchos/CMakeLists.txt || die +} + +src_configure() { + # not in portage yet: piranha + local int_class + + if use arb || use flint; then + int_class=flint + elif use mpfr; then + int_class=gmpxx + elif use boost; then + int_class=boostmp + else + int_class=gmp + fi + + einfo "Building with integer class: ${int_class}" + + local mycmakeargs=( + -DINTEGER_CLASS=${int_class} + -DBUILD_BENCHMARKS=$(usex benchmarks) + -DBUILD_DOXYGEN=$(usex doc) + -DBUILD_TESTS=$(usex test) + -DWITH_ARB=$(usex arb) + -DWITH_BFD=$(usex debug) + -DWITH_SYMENGINE_ASSERT=$(usex debug) + -DWITH_SYMENGINE_THREAD_SAFE=$(usex threads) + -DWITH_FLINT=$(usex flint) + -DWITH_OPENMP=$(usex openmp) + -DWITH_MPFR=$(usex mpfr) + -DWITH_MPC=$(usex mpc) + -DWITH_LLVM=$(usex llvm) + -DWITH_PTHREAD=$(usex threads) + -DWITH_TCMALLOC=$(usex tcmalloc) + -DWITH_ECM=$(usex ecm) + -DWITH_SYSTEM_CEREAL=ON + ) + + use arb && mycmakeargs+=( -DARB_INCLUDE_DIR="${ESYSROOT}"/usr/include ) + + cmake_src_configure +} diff --git a/sci-libs/symengine/symengine-0.9.0.ebuild b/sci-libs/symengine/symengine-0.9.0.ebuild index bf374c6ddaca..98e672759860 100644 --- a/sci-libs/symengine/symengine-0.9.0.ebuild +++ b/sci-libs/symengine/symengine-0.9.0.ebuild @@ -32,6 +32,7 @@ BDEPEND="doc? ( app-doc/doxygen[dot] )" PATCHES=( "${FILESDIR}/${PN}-0.7.0-cmake-build-type.patch" + "${FILESDIR}"/symengine-0.9.0-pthread-cmake.patch ) pkg_pretend() { |