Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 2025 18:42:34 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: 52a1f9bc0f19 - 2025Q1 - math/heyoka: fix build against devel/llvm18 and higher
Message-ID:  <202501221842.50MIgY1q069609@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2025Q1 has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=52a1f9bc0f19f2a8eb8741d09a138981dbc0a92f

commit 52a1f9bc0f19f2a8eb8741d09a138981dbc0a92f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-01-22 17:10:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-01-22 18:42:12 +0000

    math/heyoka: fix build against devel/llvm18 and higher
    
    When building with DEFAULT_VERSIONS+=llvm=18 or higher, math/heyoke
    fails to configure, with the following error:
    
      CMake Error at CMakeLists.txt:159 (find_package):
        Could not find a configuration file for package "LLVM" that is compatible
        with requested version "18".
    
        The following configuration files were considered but not accepted:
    
          /usr/local/llvm15/lib/cmake/llvm/LLVMConfig.cmake, version: 15.0.7
          /usr/local/llvm17/lib/cmake/llvm/LLVMConfig.cmake, version: 17.0.6
          /usr/local/llvm16/lib/cmake/llvm/LLVMConfig.cmake, version: 16.0.6
          /usr/local/llvm18/lib/cmake/llvm/LLVMConfig.cmake, version: 18.1.8
    
    This is because llvm18 and higher use 1 for their minor version numbers,
    while llvm17 and earlier use 0. CMake's find_package() needs the minor
    version number set correctly, otherwise it will not be able to find the
    LLVM package.
    
    PR:             284266
    Approved by:    yuri (maintainer)
    MFH:            2025Q1
    
    (cherry picked from commit 12bf8b3dabdeb7a9b9c9a2665938b3f518ebb3f8)
---
 math/heyoka/Makefile | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/math/heyoka/Makefile b/math/heyoka/Makefile
index b18004faa20d..2193737b957d 100644
--- a/math/heyoka/Makefile
+++ b/math/heyoka/Makefile
@@ -32,11 +32,23 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	bluescarni
 
 CMAKE_ON=		HEYOKA_WITH_MPPP HEYOKA_WITH_SLEEF
-CMAKE_ARGS=		-DFREEBSD_LLVM_VERSION=${LLVM_VERSION}
 CMAKE_TESTING_ON=	HEYOKA_BUILD_TESTS # 1 test fails, see https://github.com/bluescarni/heyoka/issues/338
 
 # 2 tests fail:
 # * https://github.com/bluescarni/heyoka/issues/429
 # * https://github.com/bluescarni/heyoka/issues/430
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+# LLVM 18 and later use 1 for their minor version, while 17 and earlier use 0.
+# CMake's find_package() needs the minor version set correctly, otherwise it
+# will not be able to find the LLVM package.
+.if ${LLVM_VERSION} >= 18
+LLVM_VERSION_MINOR=     1
+.else
+LLVM_VERSION_MINOR=     0
+.endif
+
+CMAKE_ARGS+=		-DFREEBSD_LLVM_VERSION=${LLVM_VERSION}.${LLVM_VERSION_MINOR}
+
+.include <bsd.port.post.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501221842.50MIgY1q069609>