From 98811d8232be969c0fb7003456cabcd3cd231f57 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Sun, 24 Oct 2021 04:55:49 +0200 Subject: [PATCH] dev-cpp/highway: add versioned ebuild, EAPI 8 Signed-off-by: Alessandro Barbieri --- dev-cpp/highway/Manifest | 1 + .../files/highway-shared-libraries.patch | 21 +++++++++++ dev-cpp/highway/highway-0.14.2.ebuild | 37 +++++++++++++++++++ dev-cpp/highway/highway-9999.ebuild | 16 ++++---- 4 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 dev-cpp/highway/Manifest create mode 100644 dev-cpp/highway/files/highway-shared-libraries.patch create mode 100644 dev-cpp/highway/highway-0.14.2.ebuild diff --git a/dev-cpp/highway/Manifest b/dev-cpp/highway/Manifest new file mode 100644 index 0000000000..1512a640d6 --- /dev/null +++ b/dev-cpp/highway/Manifest @@ -0,0 +1 @@ +DIST highway-0.14.2.tar.gz 1545892 BLAKE2B c19d040ea7bf6d5ee0ff87213f36bfe77759cc4cec514b972379490dbac5e8d55f99490b998f73133ca0ba3b34a98f2684b85206ae32d655aa574aeaabeaeb27 SHA512 fc1a35463c95c45b646c53f91a9996112726de1d588dcd4d25a7d366840f704ad9a4c0bb6e0a001e929409f04aad6922cbffcf93774a0c360aff875956c7cc8d diff --git a/dev-cpp/highway/files/highway-shared-libraries.patch b/dev-cpp/highway/files/highway-shared-libraries.patch new file mode 100644 index 0000000000..28149eba83 --- /dev/null +++ b/dev-cpp/highway/files/highway-shared-libraries.patch @@ -0,0 +1,21 @@ +--- a/CMakeLists.txt 2021-10-24 04:46:57.475685128 +0200 ++++ b/CMakeLists.txt 2021-10-24 04:45:56.218467838 +0200 +@@ -182,15 +182,16 @@ + + endif() # !MSVC + +-add_library(hwy STATIC ${HWY_SOURCES}) ++add_library(hwy SHARED ${HWY_SOURCES}) + target_compile_options(hwy PRIVATE ${HWY_FLAGS}) + set_property(TARGET hwy PROPERTY POSITION_INDEPENDENT_CODE ON) + target_include_directories(hwy PUBLIC ${CMAKE_CURRENT_LIST_DIR}) + +-add_library(hwy_contrib STATIC ${HWY_CONTRIB_SOURCES}) ++add_library(hwy_contrib SHARED ${HWY_CONTRIB_SOURCES}) + target_compile_options(hwy_contrib PRIVATE ${HWY_FLAGS}) + set_property(TARGET hwy_contrib PROPERTY POSITION_INDEPENDENT_CODE ON) + target_include_directories(hwy_contrib PUBLIC ${CMAKE_CURRENT_LIST_DIR}) ++target_link_libraries(hwy_contrib hwy) + + # -------------------------------------------------------- hwy_list_targets + # Generate a tool to print the compiled-in targets as defined by the current diff --git a/dev-cpp/highway/highway-0.14.2.ebuild b/dev-cpp/highway/highway-0.14.2.ebuild new file mode 100644 index 0000000000..683729d58c --- /dev/null +++ b/dev-cpp/highway/highway-0.14.2.ebuild @@ -0,0 +1,37 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +DESCRIPTION="Performance-portable, length-agnostic SIMD with runtime dispatch" +HOMEPAGE="https://github.com/google/highway" + +if [[ "${PV}" == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/google/highway.git" +else + SRC_URI="https://github.com/google/highway/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" +fi + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="test" + +DEPEND="test? ( dev-cpp/gtest )" + +PATCHES=( "${FILESDIR}/${PN}-shared-libraries.patch" ) +RESTRICT="!test? ( test )" + +src_configure() { + local mycmakeargs=( + -DBUILD_TESTING=$(usex test) + -DHWY_WARNINGS_ARE_ERRORS=OFF + ) + + use test && mycmakeargs+=( "-DHWY_SYSTEM_GTEST=ON" ) + + cmake_src_configure +} diff --git a/dev-cpp/highway/highway-9999.ebuild b/dev-cpp/highway/highway-9999.ebuild index 8d96668d7f..683729d58c 100644 --- a/dev-cpp/highway/highway-9999.ebuild +++ b/dev-cpp/highway/highway-9999.ebuild @@ -1,7 +1,7 @@ # Copyright 2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI="7" +EAPI=8 inherit cmake @@ -18,18 +18,20 @@ fi LICENSE="Apache-2.0" SLOT="0" -IUSE="" +IUSE="test" -DEPEND="" +DEPEND="test? ( dev-cpp/gtest )" -BDEPEND="" - -RDEPEND="${DEPEND}" +PATCHES=( "${FILESDIR}/${PN}-shared-libraries.patch" ) +RESTRICT="!test? ( test )" src_configure() { local mycmakeargs=( - -DBUILD_TESTING=OFF + -DBUILD_TESTING=$(usex test) + -DHWY_WARNINGS_ARE_ERRORS=OFF ) + use test && mycmakeargs+=( "-DHWY_SYSTEM_GTEST=ON" ) + cmake_src_configure }