commit:     e8e90cbd18d713cb3e0fa8189cd411ef15b961b2
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 20 22:00:56 2024 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sat Apr 20 22:00:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8e90cbd

dev-libs/level-zero: fix compilation

Closes: https://bugs.gentoo.org/930157
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../files/level-zero-1.16.14-spdlog-libfmt.patch   | 60 ++++++++++++++++++++++
 ...1.16.14.ebuild => level-zero-1.16.14-r1.ebuild} |  8 ++-
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/dev-libs/level-zero/files/level-zero-1.16.14-spdlog-libfmt.patch 
b/dev-libs/level-zero/files/level-zero-1.16.14-spdlog-libfmt.patch
new file mode 100644
index 000000000000..4d9264e0c49c
--- /dev/null
+++ b/dev-libs/level-zero/files/level-zero-1.16.14-spdlog-libfmt.patch
@@ -0,0 +1,60 @@
+Find the system copy of spdlog which then tells us how to link
+against both it & libfmt correctly, rather than accidentally
+picking up system spdlog headers and nothing else (defines, needed
+libraries, etc) when (for some reason?) FetchContent fails and we don't
+realise it.
+
+TODO: Figure out why FetchContent(?) failing doesn't kill the build
+TODO: Add a proper option for this to use the system copy/not
+
+Bug: https://bugs.gentoo.org/930157
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -57,9 +57,6 @@ elseif(Git_FOUND)
+       endif()
+ endif()
+ 
+-include(FetchContent)
+-set(SPDLOG_ROOT "${FETCHCONTENT_BASE_DIR}/spdlog-src")
+-
+ # Update other relevant variables to include the patch
+ set(PROJECT_VERSION 
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
+ set(CMAKE_PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
+@@ -166,7 +163,6 @@ endif()
+ 
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source/wrapper/include)
+-include_directories(${SPDLOG_ROOT}/include)
+ 
+ include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
+ 
+diff --git a/source/utils/CMakeLists.txt b/source/utils/CMakeLists.txt
+index cb6cfb1..4e486d8 100644
+--- a/source/utils/CMakeLists.txt
++++ b/source/utils/CMakeLists.txt
+@@ -1,23 +1,11 @@
+ # Copyright (C) 2024 Intel Corporation
+ # SPDX-License-Identifier: MIT
+ 
+-include(FetchContent)
+-set(SPDLOG_REPO https://github.com/gabime/spdlog)
+-set(SPDLOG_TAG v1.13.0)
+-FetchContent_Declare(
+-    spdlog
+-    GIT_REPOSITORY ${SPDLOG_REPO}
+-    GIT_TAG ${SPDLOG_TAG}
+-)
+-FetchContent_makeAvailable(spdlog)
++find_package(spdlog)
+ 
+ add_library(utils
+-  STATIC
+   "logging.h"
+   "logging.cpp"
+ )
+ 
+-target_include_directories(utils
+-  PUBLIC
+-  ${FETCHCONTENT_BASE_DIR}/spdlog-src/include
+-)
++target_link_libraries(utils spdlog::spdlog)

diff --git a/dev-libs/level-zero/level-zero-1.16.14.ebuild 
b/dev-libs/level-zero/level-zero-1.16.14-r1.ebuild
similarity index 84%
rename from dev-libs/level-zero/level-zero-1.16.14.ebuild
rename to dev-libs/level-zero/level-zero-1.16.14-r1.ebuild
index 4afcd285ad24..64493a4f0926 100644
--- a/dev-libs/level-zero/level-zero-1.16.14.ebuild
+++ b/dev-libs/level-zero/level-zero-1.16.14-r1.ebuild
@@ -13,7 +13,13 @@ LICENSE="MIT"
 SLOT="0/${PV}"
 KEYWORDS="~amd64"
 
-DEPEND="dev-libs/spdlog:="
+RDEPEND="
+       dev-libs/libfmt:=
+       dev-libs/spdlog:=
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/${PN}-1.16.14-spdlog-libfmt.patch" )
 
 src_prepare() {
        # Don't hardcore -Werror

Reply via email to