[packages/opencl-clang] up to 16.0.0
atler
atler at pld-linux.org
Sat May 20 22:26:28 CEST 2023
commit 91f591af16f16a77227c474d5adc8895ce3d448d
Author: Jan Palus <atler at pld-linux.org>
Date: Sat May 20 22:24:06 2023 +0200
up to 16.0.0
multiple upstream fixes for build failures/missing soname from:
https://github.com/intel/opencl-clang/pull/416
https://github.com/intel/opencl-clang/pull/419
https://github.com/intel/opencl-clang/pull/437
https://github.com/intel/opencl-clang/pull/439
cxx17.patch | 23 ++++++++++++
llvm16.patch | 36 ++++++++++++++++++
opencl-clang.spec | 26 ++++++++-----
soname.patch | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
standalone.patch | 28 ++++++++++++++
5 files changed, 212 insertions(+), 9 deletions(-)
---
diff --git a/opencl-clang.spec b/opencl-clang.spec
index 8338b5b..932f889 100644
--- a/opencl-clang.spec
+++ b/opencl-clang.spec
@@ -1,22 +1,26 @@
# requires the OpenCL patches
-%define llvm_version 15.0.0
-%define spirv_llvm_translator_version 15.0.0
+%define llvm_version 16.0.0
+%define spirv_llvm_translator_version 16.0.0
Summary: Intel Graphics Compute Runtime for OpenCL
Summary(pl.UTF-8): Biblioteki uruchomieniowe Intel Graphics Compute dla OpenCL
Name: opencl-clang
-Version: 15.0.0
-Release: 3
+Version: 16.0.0
+Release: 1
License: University of Illinois/NCSA Open Source License
Group: Libraries
Source0: https://github.com/intel/opencl-clang/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 9c11f058256917e48f1be64fe4dc6666
+# Source0-md5: f2eb3b9f9201349860f0e7ef0eb31d46
+Patch0: cxx17.patch
+Patch1: llvm16.patch
+Patch2: soname.patch
+Patch3: standalone.patch
URL: https://01.org/compute-runtime
BuildRequires: SPIRV-LLVM-Translator-devel >= %{spirv_llvm_translator_version}
BuildRequires: clang >= %{llvm_rpm_version}
BuildRequires: clang-devel >= %{llvm_version}
-BuildRequires: cmake >= 3.4.3
+BuildRequires: cmake >= 3.13.4
BuildRequires: llvm-devel >= %{llvm_version}
BuildRequires: pkgconfig
BuildRequires: rpmbuild(macros) >= 1.605
@@ -47,6 +51,10 @@ Pliki nagłówkowe biblioteki %{name}.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
install -d build
@@ -68,8 +76,8 @@ rm -rf $RPM_BUILD_ROOT
%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
-%{__mv} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.15 $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.%{llvm_version}
-ln -s libopencl-clang.so.%{llvm_version} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.15
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.16 $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.%{llvm_version}
+ln -s libopencl-clang.so.%{llvm_version} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.16
ln -sf libopencl-clang.so.%{llvm_version} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so
%post -p /sbin/ldconfig
@@ -82,7 +90,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(644,root,root,755)
%doc README.md
%attr(755,root,root) %{_libdir}/libopencl-clang.so.%{llvm_version}
-%ghost %attr(755,root,root) %{_libdir}/libopencl-clang.so.15
+%ghost %attr(755,root,root) %{_libdir}/libopencl-clang.so.16
%files devel
%defattr(644,root,root,755)
diff --git a/cxx17.patch b/cxx17.patch
new file mode 100644
index 0000000..a44624a
--- /dev/null
+++ b/cxx17.patch
@@ -0,0 +1,23 @@
+From 7eed60a0ccefe9354da1ab0e54a045df8b6b06e9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk at redhat.com>
+Date: Fri, 14 Apr 2023 12:02:13 +0200
+Subject: [PATCH] Bump CMAKE_CXX_STANDARD to 17
+
+Fixes build issues
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3d7eff1..efb2adf 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -58,7 +58,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ ${CMAKE_MODULE_PATH}
+ ${LLVM_CMAKE_DIR})
+
+- set(CMAKE_CXX_STANDARD 14)
++ set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+ option(LLVMSPIRV_INCLUDED_IN_LLVM
diff --git a/llvm16.patch b/llvm16.patch
new file mode 100644
index 0000000..b2fd3d2
--- /dev/null
+++ b/llvm16.patch
@@ -0,0 +1,36 @@
+From 1568bb95cbae480e15ef985ad2e0e695a65516c5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk at redhat.com>
+Date: Fri, 14 Apr 2023 19:07:42 +0200
+Subject: [PATCH] Support llvm headers in
+ ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}/
+
+Fedora places llvm include files into that directory instead of assumed
+${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/include/
+
+Try both, fail horribly when none of them exist
+---
+ cl_headers/CMakeLists.txt | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
+index 788adff..70aa321 100644
+--- a/cl_headers/CMakeLists.txt
++++ b/cl_headers/CMakeLists.txt
+@@ -15,8 +15,15 @@ add_custom_command(
+ endfunction(copy_file)
+
+ if(USE_PREBUILT_LLVM)
+- set(OPENCL_HEADERS_DIR
+- "${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/include/")
++ if(EXISTS "${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/")
++ set(OPENCL_HEADERS_DIR
++ "${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/include/")
++ elseif(EXISTS "${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}/")
++ set(OPENCL_HEADERS_DIR
++ "${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}/include/")
++ else()
++ message(FATAL_ERROR "[OPENCL-CLANG] Couldn't find prebuilt LLVM include directory.")
++ endif()
+ else(USE_PREBUILT_LLVM)
+ set(OPENCL_HEADERS_DIR "${CLANG_SOURCE_DIR}/lib/Headers")
+ endif(USE_PREBUILT_LLVM)
diff --git a/soname.patch b/soname.patch
new file mode 100644
index 0000000..09b1432
--- /dev/null
+++ b/soname.patch
@@ -0,0 +1,108 @@
+From 8102ee2f83c3bd87e5b6aa405d04b5c3abc5ef3b Mon Sep 17 00:00:00 2001
+From: Wenju He <wenju.he at intel.com>
+Date: Wed, 17 May 2023 08:54:44 +0800
+Subject: [PATCH] Revert to use add_llvm_library and revert linking LLVM
+ libraries
+
+Add cmake option EXCLUDE_LIBS_FROM_ALL to remove a specific llvm library
+from llvm 'all'.
+
+This PR partially reverts 743bd15.
+This PR addresses #401, #417, #418, #422, and brings back SONAME.
+---
+ CMakeLists.txt | 73 +++++++++++---------------------------------------
+ 1 file changed, 15 insertions(+), 58 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b1bde90..5b3c4b7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -292,21 +292,23 @@ else()
+ )
+ endif()
+
+-add_library(${TARGET_NAME} SHARED
+- ${TARGET_INCLUDE_FILES}
+- ${TARGET_SOURCE_FILES}
+- $<TARGET_OBJECTS:cl_headers>
+-)
+-
+-# Same CRT compile option are reqiured to avoid link errors on Windows.
+-# MD and MDd are choosed by default for release and debug build in LLVM.
+-# If users set MT or MTd flags, they also need to add the flags for
+-# opencl-clang sources using a custom macro set_msvc_crt_flags.
+-if(COMMAND set_msvc_crt_flags)
+- set_msvc_crt_flags(${TARGET_NAME})
++set(EXCLUDE_LIBS_FROM_ALL "" CACHE STRING "Space-separated list of LLVM libraries to exclude from all")
++llvm_map_components_to_libnames(ALL_LLVM_LIBS all)
++if (NOT "${EXCLUDE_LIBS_FROM_ALL}" STREQUAL "")
++ list(REMOVE_ITEM ALL_LLVM_LIBS ${EXCLUDE_LIBS_FROM_ALL})
+ endif()
++list(APPEND OPENCL_CLANG_LINK_LIBS ${ALL_LLVM_LIBS})
++
++add_llvm_library(${TARGET_NAME} SHARED
++ ${TARGET_INCLUDE_FILES}
++ ${TARGET_SOURCE_FILES}
++ $<TARGET_OBJECTS:cl_headers>
+
+-add_dependencies(${TARGET_NAME} CClangCompileOptions)
++ DEPENDS CClangCompileOptions
++
++ LINK_LIBS
++ ${OPENCL_CLANG_LINK_LIBS}
++ )
+
+ if (WIN32)
+ # Enable compiler generation of Control Flow Guard security checks.
+@@ -322,51 +324,6 @@ elseif(UNIX)
+ LINK_FLAGS " -Wl,--no-undefined")
+ endif(WIN32)
+
+-# Enable new IN_LIST operator.
+-cmake_policy(SET CMP0057 NEW)
+-set(OTHER_LIBRARIES)
+-if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
+- list(APPEND OTHER_LIBRARIES LLVMNVPTXCodeGen LLVMNVPTXDesc LLVMNVPTXInfo)
+-endif()
+-if ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD)
+- list(APPEND OTHER_LIBRARIES LLVMAMDGPUCodeGen LLVMAMDGPUAsmParser LLVMAMDGPUDesc LLVMAMDGPUInfo)
+-endif()
+-
+-target_link_libraries( ${TARGET_NAME}
+- LINK_PRIVATE
+- ${OPENCL_CLANG_LINK_LIBS}
+- LLVMX86CodeGen
+- LLVMX86AsmParser
+- LLVMX86Desc
+- LLVMX86Info
+- LLVMX86Disassembler
+- LLVMAnalysis
+- LLVMCodeGen
+- LLVMCore
+- LLVMipo
+- LLVMInstCombine
+- LLVMInstrumentation
+- LLVMMC
+- LLVMMCParser
+- LLVMObjCARCOpts
+- LLVMOption
+- LLVMScalarOpts
+- LLVMSupport
+- LLVMTransformUtils
+- LLVMVectorize
+- LLVMAsmPrinter
+- LLVMSelectionDAG
+- LLVMMCDisassembler
+- LLVMProfileData
+- LLVMObject
+- LLVMBitWriter
+- LLVMIRReader
+- LLVMAsmParser
+- LLVMTarget
+- LLVMBitReader
+- ${OTHER_LIBRARIES}
+- )
+-
+ install(FILES opencl_clang.h
+ DESTINATION include/cclang
+ COMPONENT ${TARGET_NAME})
diff --git a/standalone.patch b/standalone.patch
new file mode 100644
index 0000000..dba735e
--- /dev/null
+++ b/standalone.patch
@@ -0,0 +1,28 @@
+From 3efa0f5e1770dc082919adc8e8d48b19ecaaabaa Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <Zatloukal.Frantisek at gmail.com>
+Date: Fri, 21 Apr 2023 04:07:21 +0200
+Subject: [PATCH] Fix standalone build (#415)
+
+Fixes https://github.com/intel/opencl-clang/issues/406
+Fixes https://github.com/intel/opencl-clang/issues/374
+
+(cherry picked from commit 529a9188114bcbd8ed753d2276942384fa50d7a1)
+---
+ cl_headers/CMakeLists.txt | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
+index 788adff..86df76f 100644
+--- a/cl_headers/CMakeLists.txt
++++ b/cl_headers/CMakeLists.txt
+@@ -1,5 +1,9 @@
+ set(CL_HEADERS_LIB cl_headers)
+-set(CLANG_COMMAND $<TARGET_FILE:clang> )
++if(USE_PREBUILT_LLVM)
++ find_program(CLANG_COMMAND clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++else()
++ set(CLANG_COMMAND $<TARGET_FILE:clang>)
++endif()
+ if(LLVM_USE_HOST_TOOLS AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
+ build_native_tool(clang CLANG_COMMAND)
+ endif()
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/opencl-clang.git/commitdiff/91f591af16f16a77227c474d5adc8895ce3d448d
More information about the pld-cvs-commit
mailing list