File clspv.spec of Package clspv

#
# spec file for package clspv
#
# Copyright (c) 2026 Eyad Issa <eyadlorenzo@gmail.com>
#
# 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 gitver 20260109~e00c535
%global gitrev  e00c5355ce7739f9347a057401510b739774de59

%global llvm_rev      53f84636eb86e6c64c1ec405f70b3dd2b27f4ddc
%global spirv_headers b824a462d4256d720bebb40e78b9eb8f78bbb305
%global spirv_tools   fb7471844504abb16b732dc4fc0837119a32ec24

Name:           clspv
Version:        0~git%{gitver}
Release:        0
Summary:        A compiler for OpenCL C to Vulkan compute shaders
License:        Apache-2.0
URL:            https://github.com/google/clspv
Source0:        %{url}/archive/%{gitrev}/%{name}-%{version}.tar.gz
Source1:        https://github.com/llvm/llvm-project/archive/%{llvm_rev}/llvm-project-%{llvm_rev}.tar.gz
Source2:        https://github.com/KhronosGroup/SPIRV-Headers/archive/%{spirv_headers}/SPIRV-Headers-%{spirv_headers}.tar.gz
Source3:        https://github.com/KhronosGroup/SPIRV-Tools/archive/%{spirv_tools}/SPIRV-Tools-%{spirv_tools}.tar.gz
BuildRequires:  cmake
BuildRequires:  ninja
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  python3

%description
Clspv is a compiler for OpenCL C targeting Vulkan compute shaders.
It consists of:
- A set of LLVM Module passes to transform a dialect of LLVM IR into
  a SPIR-V module containing Vulkan compute shaders.
- A command line compiler tool called 'clspv' to compile a subset of
  OpenCL C into a Vulkan compute shader.

%prep
%autosetup -n %{name}-%{gitrev}

mkdir -p third_party/llvm
tar -xf %{SOURCE1} -C third_party/llvm --strip-components=1

mkdir -p third_party/SPIRV-Headers
tar -xf %{SOURCE2} -C third_party/SPIRV-Headers --strip-components=1

mkdir -p third_party/SPIRV-Tools
tar -xf %{SOURCE3} -C third_party/SPIRV-Tools --strip-components=1

%build
%global __builder ninja
%cmake
%cmake_build

%install
%cmake_install

%files
%license add-license-file-here
%doc add-docs-here

%changelog
openSUSE Build Service is sponsored by