%global cclang_commit_id 82481202297e69f619766df57ac3cce70a35d82f %global llvm_commit_id release_40 %global clang_commit_id release_40 %global headers_commit_id f039db6764d52388658ef15c30b2237bbda49803 %global package_version 4.0.16 %global package_release 1 Name: intel-opencl-clang Version: %{package_version} Release: %{package_release}%{?dist} Summary: Intel(R) OpenCL(TM) Clang Group: System Environment/Libraries License: MIT URL: https://github.com/intel/opencl-clang Source0: https://github.com/intel/opencl-clang/archive/%{cclang_commit_id}/opencl-clang.tar.gz Source1: https://github.com/llvm-mirror/llvm/archive/%{llvm_commit_id}/llvm-40.tar.gz Source2: https://github.com/llvm-mirror/clang/archive/%{clang_commit_id}/clang-40.tar.gz Source3: https://github.com/KhronosGroup/OpenCL-Headers/archive/%{headers_commit_id}/opencl-headers.tar.gz %if 0%{?el7} BuildRequires: centos-release-scl epel-release BuildRequires: gcc-c++ make patch devtoolset-4-gcc-c++ cmake3 ninja-build llvm-toolset-7-clang %else BuildRequires: cmake clang gcc-c++ make patch %endif %description %package devel Summary: Intel(R) OpenCL(TM) Clang development package Requires: %{name} = %{version}-%{release} %description devel %prep %build echo "==== BUILD ====" rm -rf * mkdir opencl_clang llvm_source clang_source opencl_headers tar xzf $RPM_SOURCE_DIR/opencl-clang.tar.gz -C opencl_clang --strip-components=1 tar xzf $RPM_SOURCE_DIR/llvm-40.tar.gz -C llvm_source --strip-components=1 tar xzf $RPM_SOURCE_DIR/clang-40.tar.gz -C clang_source --strip-components=1 tar xzf $RPM_SOURCE_DIR/opencl-headers.tar.gz -C opencl_headers --strip-components=1 ln -s ./opencl22/CL ./opencl_headers/ mkdir build cd build %if 0%{?el7} echo building for el7: %{el7} scl enable devtoolset-4 llvm-toolset-7 "cmake3 ../opencl_clang -DCMAKE_BUILD_TYPE=Release -DCOMMON_CLANG_LIBRARY_NAME=opencl_clang" scl enable devtoolset-4 llvm-toolset-7 "make -j `nproc` cclang" %else echo building for Fedora cmake ../opencl_clang -DCMAKE_BUILD_TYPE=Release -DCOMMON_CLANG_LIBRARY_NAME=opencl_clang make -j`nproc` cclang %endif %install echo "==== INSTALL ====" mkdir -p $RPM_BUILD_ROOT/usr/lib64 $RPM_BUILD_ROOT/usr/share/opencl-clang/ cp $RPM_BUILD_DIR/build/install/lib/libopencl_clang.so $RPM_BUILD_ROOT/usr/lib64/ strip $RPM_BUILD_ROOT/usr/lib64/libopencl_clang.so cp $RPM_BUILD_DIR/build/install/bin/clang $RPM_BUILD_ROOT/usr/share/opencl-clang/ strip $RPM_BUILD_ROOT/usr/share/opencl-clang/clang cp $RPM_BUILD_DIR/build/install/include/cclang/* $RPM_BUILD_ROOT/usr/share/opencl-clang/ echo "==== DONE ====" %files %defattr(-,root,root) /usr/lib64/libopencl_clang.so %files devel %defattr(-,root,root) /usr/share/opencl-clang/clang /usr/share/opencl-clang/common_clang.h /usr/share/opencl-clang/module.modulemap /usr/share/opencl-clang/opencl-c-20.h /usr/share/opencl-clang/opencl-c-common.h /usr/share/opencl-clang/opencl-c-intel.h /usr/share/opencl-clang/opencl-c-platform-12.h /usr/share/opencl-clang/opencl-c-platform-20.h /usr/share/opencl-clang/opencl-c-platform.h /usr/share/opencl-clang/opencl-c.h # %doc # %changelog