File intel-graphics-compiler.spec of Package intel-graphics-compiler

#
# spec file for package intel-graphics-compiler
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global llvm_commit llvmorg-10.0.0
%global opencl_clang_commit c8cd72e32b6abc18ce6da71c357ea45ba78b52f0
%global spirv_llvm_translator_commit 424e375edc4b915218ab5d1f08670a8d1e92c9d3
%global vc_intrinsics_commit d9ffe1f9cbe45b296f098669173bcaeff12bfe99
Name:           intel-graphics-compiler
Version:        1.0.8517
Release:        1%{?dist}
Summary:        Intel(R) Graphics Compiler for OpenCL(TM)
License:        MIT
Group:          Development/Libraries/C and C++
URL:            https://github.com/intel/intel-graphics-compile
Source0:        https://github.com/intel/intel-graphics-compiler/archive/igc-%{version}.tar.gz
Source1:        https://github.com/intel/opencl-clang/archive/%{opencl_clang_commit}/intel-opencl-clang.tar.gz
# spirv-llvm-translator must be the actual git repository
Source2:        https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/%{spirv_llvm_translator_commit}/spirv-llvm-translator.tar.gz
Source3:        https://github.com/llvm/llvm-project/archive/%{llvm_commit}/llvm-project.tar.gz
Source4:        https://github.com/intel/vc-intrinsics/archive/%{vc_intrinsics_commit}/vc-intrinsics.zip
Patch0:         Make-IGC-compile-with-gcc-11.patch
BuildRequires:  memory-constraints
BuildRequires:  bison
BuildRequires:  cmake
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  unzip

%description
Intel(R) Graphics Compiler for OpenCL(TM).

%package        core
Summary:        Intel(R) Graphics Compiler Core

%description   core
Core components of Intel Graphics Compiler

%package       opencl
Summary:        Intel(R) Graphics Compiler Frontend
Requires:       %{name}-core = %{version}-%{release}

%description   opencl
OpenCL related libraries for Intel Graphics Compiler

%package       opencl-devel
Summary:        Intel(R) Graphics Compiler development package
Requires:       %{name}-opencl = %{version}-%{release}

%description   opencl-devel
Development files for OpenCL with the Intel Graphics Compiler

%prep

mkdir llvm-project
tar xzf %{_sourcedir}/llvm-project.tar.gz -C llvm-project --strip-components=1
mv llvm-project/clang llvm-project/llvm/tools/

unzip %{_sourcedir}/vc-intrinsics.zip
mv vc-intrinsics* vc-intrinsics

pushd llvm-project/llvm/projects
mkdir opencl-clang llvm-spirv
tar xzf %{_sourcedir}/intel-opencl-clang.tar.gz -C opencl-clang --strip-components=1
tar xzf %{_sourcedir}/spirv-llvm-translator.tar.gz -C llvm-spirv --strip-components=1
popd

mkdir igc
tar xzf %{_sourcedir}/igc-%{version}.tar.gz -C igc --strip-components=1

%patch0 -p 1

%build
%limit_build -m 900

mkdir build
pushd build

# FIXME: you should use %%cmake macros
cmake ../igc -Wno-dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix}

%make_build
popd

%install
cd build
%make_install

rm -fv %{buildroot}%{_bindir}/GenX_IR
rm -fv %{buildroot}%{_bindir}/clang-10
rm -fv %{buildroot}%{_bindir}/lld
rm -fv %{buildroot}%{_includedir}/opencl-c.h
rm -fv %{buildroot}%{_includedir}/opencl-c-base.h
rm -fv %{buildroot}%{_prefix}/lib/debug
chmod +x %{buildroot}%{_libdir}/libopencl-clang.so.10

%post -n intel-graphics-compiler-core -p /sbin/ldconfig
%postun -n intel-graphics-compiler-core -p /sbin/ldconfig
%post -n intel-graphics-compiler-opencl -p /sbin/ldconfig
%postun -n intel-graphics-compiler-opencl -p /sbin/ldconfig

%files core
%{_libdir}/libiga64.so.*
%{_libdir}/libigc.so.*
%{_libdir}/libSPIRVDLL.so
%{_bindir}/iga64
%dir %{_libdir}/igc

%files opencl
%{_libdir}/libigdfcl.so.*
%{_libdir}/libopencl-clang.so.*

%files opencl-devel
%{_includedir}/igc
%{_includedir}/iga
%{_includedir}/visa
%{_libdir}/libiga64.so
%{_libdir}/libigc.so
%{_libdir}/libigdfcl.so
%{_libdir}/pkgconfig/*

%license %{_libdir}/igc/NOTICES.txt

%changelog
openSUSE Build Service is sponsored by