From: Jacek Konieczny Date: Mon, 1 Jul 2019 13:58:31 +0000 (+0200) Subject: new package X-Git-Tag: auto/th/opencl-clang-8.0.1-1~2 X-Git-Url: https://git.pld-linux.org/?p=packages%2Fopencl-clang.git;a=commitdiff_plain;h=c7dfe9a1fc0d6232cf4ec375a6c7bc5c57e28d3d new package --- c7dfe9a1fc0d6232cf4ec375a6c7bc5c57e28d3d diff --git a/llvm_clang_vfs.patch b/llvm_clang_vfs.patch new file mode 100644 index 0000000..f64fdf8 --- /dev/null +++ b/llvm_clang_vfs.patch @@ -0,0 +1,25 @@ +diff -dur opencl-clang-8.0.1.orig/common_clang.cpp opencl-clang-8.0.1/common_clang.cpp +--- opencl-clang-8.0.1.orig/common_clang.cpp 2019-06-04 15:59:30.000000000 +0200 ++++ opencl-clang-8.0.1/common_clang.cpp 2019-06-27 10:24:52.000000000 +0200 +@@ -40,7 +40,7 @@ + #include "llvm/Support/TargetSelect.h" + #include "llvm/Support/ManagedStatic.h" + #include "llvm/Support/Mutex.h" +-#include "llvm/Support/VirtualFileSystem.h" ++#include "clang/Basic/VirtualFileSystem.h" + #include "clang/Basic/LangOptions.h" + #include "clang/Basic/Diagnostic.h" + #include "clang/Basic/DiagnosticIDs.h" +@@ -215,9 +215,9 @@ + + compiler->setDiagnostics(&*Diags); + +- auto OverlayFS = new llvm::vfs::OverlayFileSystem( +- llvm::vfs::getRealFileSystem()); +- auto MemFS = new llvm::vfs::InMemoryFileSystem(); ++ auto OverlayFS = new clang::vfs::OverlayFileSystem( ++ clang::vfs::getRealFileSystem()); ++ auto MemFS = new clang::vfs::InMemoryFileSystem(); + OverlayFS->pushOverlay(MemFS); + + compiler->setVirtualFileSystem(OverlayFS); diff --git a/opencl-clang.spec b/opencl-clang.spec new file mode 100644 index 0000000..4d40b63 --- /dev/null +++ b/opencl-clang.spec @@ -0,0 +1,85 @@ + +%define llvm_version 7.0.1 +%define spirv_llvm_translator_version 7.0.1 + +Summary: Intel Graphics Compute Runtime for OpenCL +Name: opencl-clang +Version: 8.0.1 +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: cb6b746c837a6cac6c8906911b2ea9de +Patch0: llvm_clang_vfs.patch +URL: https://01.org/compute-runtime +BuildRequires: SPIRV-LLVM-Translator >= %{spirv_llvm_translator_version} +BuildRequires: clang >= %{llvm_version} +BuildRequires: clang-devel >= %{llvm_version} +BuildRequires: cmake >= 3.4.3 +BuildRequires: llvm-devel >= %{llvm_version} +BuildRequires: pkgconfig +%requires_eq clang +%requires_eq clang-devel +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +Common clang is a thin wrapper library around clang. Common clang has +OpenCL-oriented API and is capable to compile OpenCL C kernels to +SPIR-V modules. + +%package devel +Summary: Header files for %{name} library +Summary(pl.UTF-8): Pliki nagłówkowe biblioteki %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Header files for %{name} library. + +%description devel -l pl.UTF-8 +Pliki nagłówkowe biblioteki %{name}. + +%prep +%setup -q + +%patch0 -p1 + +%build +install -d build +cd build +%cmake \ + -DUSE_PREBUILT_LLVM=ON \ + -DPREFERRED_LLVM_VERSION="%{llvm_version}" \ + -DLLVMSPIRV_INCLUDED_IN_LLVM=OFF \ + -DSPIRV_TRANSLATOR_DIR="%{_prefix}" \ + ../ +%{__make} + +cd .. + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} -C build install \ + DESTDIR=$RPM_BUILD_ROOT + +mv $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.7 $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.%{llvm_version} +ln -s libopencl-clang.so.%{llvm_version} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so.7 +ln -sf libopencl-clang.so.%{llvm_version} $RPM_BUILD_ROOT%{_libdir}/libopencl-clang.so + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%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.7 + +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libopencl-clang.so +%{_includedir}/cclang