git: 4ef844c201fe - main - lang/cling: Fix build

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 18 Jul 2024 16:50:12 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4ef844c201fe2c1b94556aabd9aa5fd2178cf034

commit 4ef844c201fe2c1b94556aabd9aa5fd2178cf034
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-07-18 16:47:54 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-07-18 16:47:54 +0000

    lang/cling: Fix build
    
    - While I'm here:
      - Use = instead of += for CMAKE_ARGS, PLIST_SUB and SUB_LIST
      - Remove CMAKE_BUILD_TYPE
      - Clean up Makefile
      - Cosmetic change
    
    ld: error: version script assignment of 'LLVM_5.0' to symbol 'LLVMCreateDisasm' failed: symbol not defined
    ld: error: version script assignment of 'LLVM_5.0' to symbol 'LLVMCreateDisasmCPU' failed: symbol not defined
    ld: error: version script assignment of 'LLVM_5.0' to symbol 'LLVMDisasmDispose' failed: symbol not defined
    ld: error: version script assignment of 'LLVM_5.0' to symbol 'LLVMDisasmInstruction' failed: symbol not defined
    ld: error: version script assignment of 'LLVM_5.0' to symbol 'LLVMSetDisasmOptions' failed: symbol not defined
    c++: error: linker command failed with exit code 1 (use -v to see invocation)
    
    Reference:      https://pkg-status.freebsd.org/beefy16/data/133amd64-default/a71eaeb3e54e/logs/cling-0.5.2018.08.13_12.log
---
 lang/cling/Makefile | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/lang/cling/Makefile b/lang/cling/Makefile
index 4953fbd66790..57ecda8dcaf3 100644
--- a/lang/cling/Makefile
+++ b/lang/cling/Makefile
@@ -23,39 +23,32 @@ BROKEN_riscv64=		fails to build: CMake Error at cmake/config-ix.cmake:407: Unkno
 LIB_DEPENDS=	libgtest.so:devel/googletest \
 		libz3.so:math/z3
 
+USES=		cmake compiler:c++11-lib compiler:c11 gnome libedit ncurses python:build shebangfix tar:bzip2
+USE_GNOME=	libxml2
+
+CMAKE_ARGS=	-DINSTALL_LAYOUT=FREEBSD
+CMAKE_INSTALL_PREFIX=	${LLVM_PREFIX}
+CMAKE_OFF=	LLVM_BUILD_EXAMPLES LLVM_INCLUDE_TESTS LLVM_INCLUDE_GO_TESTS
+CMAKE_ON=	BUILD_SHARED_LIBS
+LDFLAGS+=	-Wl,--undefined-version
+USE_LDCONFIG=	${LLVM_PREFIX}/lib
 WRKSRC=		${WRKDIR}/src
 
+SUB_LIST=	LLVM_PREFIX="${LLVM_PREFIX}" LLVM_SUFFIX="${LLVM_SUFFIX}"
+PLIST_SUB=	LLVM_SUFFIX=${LLVM_SUFFIX} LLVM_RELEASE=${LLVM_RELEASE}
+
 LLVM_RELEASE=	5.0.0
 LLVM_SUFFIX=	50_cern-root
 LLVM_PREFIX=	${PREFIX}/llvm${LLVM_SUFFIX}
 
-USES=		cmake compiler:c++11-lib compiler:c11 gnome libedit ncurses \
-		python:build shebangfix tar:bzip2
-USE_GNOME=	libxml2
-USE_LDCONFIG=	${LLVM_PREFIX}/lib
-
-CONFLICTS_INSTALL=	llvm zapcc # # bin/bugpoint bin/c-index-test bin/clang bin/clang++ bin/clang-5.0 bin/clang-check bin/clang-cl bin/clang-cpp bin/clang-format bin/clang-import-test bin/clang-offload-bundler bin/clang-rename bin/git-clang-format
+CONFLICTS_INSTALL=	llvm zapcc # bin/bugpoint bin/c-index-test bin/clang bin/clang++ bin/clang-5.0 bin/clang-check bin/clang-cl bin/clang-cpp bin/clang-format bin/clang-import-test bin/clang-offload-bundler bin/clang-rename bin/git-clang-format
 
 SHEBANG_FILES=	tools/clang/tools/clang-format/clang-format-diff.py \
 		tools/clang/tools/clang-format/git-clang-format \
 		tools/clang/tools/scan-view/bin/scan-view
 
-CMAKE_ON=	BUILD_SHARED_LIBS
-CMAKE_OFF=	LLVM_BUILD_EXAMPLES LLVM_INCLUDE_TESTS LLVM_INCLUDE_GO_TESTS
-
-SUB_LIST+=	LLVM_PREFIX="${LLVM_PREFIX}" LLVM_SUFFIX="${LLVM_SUFFIX}"
-PLIST_SUB+=		LLVM_SUFFIX=${LLVM_SUFFIX} LLVM_RELEASE=${LLVM_RELEASE}
-
-CMAKE_BUILD_TYPE=	Release
-CMAKE_INSTALL_PREFIX=	${LLVM_PREFIX}
-
-CMAKE_ARGS+=	-DINSTALL_LAYOUT=FREEBSD
-
 post-patch:
-	@${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g' \
-	    ${PATCH_WRKSRC}/tools/cling/tools/driver/cling.cpp
-	@${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g' \
-	    ${PATCH_WRKSRC}/tools/cling/lib/Interpreter/CIFactory.cpp
+	@${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g' ${WRKSRC}/tools/cling/lib/Interpreter/CIFactory.cpp ${WRKSRC}/tools/cling/tools/driver/cling.cpp
 
 post-install:
 	for e in $$(cd ${STAGEDIR}${PREFIX}/llvm50_cern-root/bin && ls *); do \