4987ecd
# Glslang revision from packaged version
e319f19
%global glslang_version 436237a4ab2be3225acedc66016ea2aa82946b37
0862c53
0862c53
Name:           shaderc
e319f19
Version:        2024.0
1150544
Release:        %autorelease
4a5f8f6
Summary:        Collection of tools, libraries, and tests for Vulkan shader compilation
0862c53
d0f8d4b
License:        Apache-2.0
0862c53
URL:            https://github.com/google/shaderc
4a5f8f6
Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
0862c53
# Patch to unbundle 3rd party code
4a5f8f6
Patch:          0001-Drop-third-party-code-in-CMakeLists.txt.patch
4a5f8f6
Patch:          glslang_linker_flags.patch
0862c53
4a5f8f6
BuildRequires:  cmake
0862c53
BuildRequires:  gcc-c++
0862c53
BuildRequires:  ninja-build
4a5f8f6
BuildRequires:  sed
4a5f8f6
BuildRequires:  spirv-tools
4a5f8f6
0862c53
BuildRequires:  glslang-devel
4a5f8f6
BuildRequires:  python3-devel
0862c53
BuildRequires:  spirv-headers-devel
0862c53
BuildRequires:  spirv-tools-devel
0862c53
0862c53
%description
81471bb
A collection of tools, libraries and tests for shader compilation.
0862c53
0862c53
Shaderc aims to to provide:
81471bb
 - a command line compiler with GCC- and Clang-like usage, for better
0862c53
   integration with build systems
0862c53
 - an API where functionality can be added without breaking existing clients
81471bb
 - an API supporting standard concurrency patterns across multiple
0862c53
   operating systems
0862c53
 - increased functionality such as file #include support
0862c53
0862c53
%package    -n  glslc
0862c53
Summary:        A command line compiler for GLSL/HLSL to SPIR-V
0862c53
0862c53
%description -n glslc
0862c53
A command line compiler for GLSL/HLSL to SPIR-V.
0862c53
0862c53
%package    -n  libshaderc
0862c53
Summary:        A library for compiling shader strings into SPIR-V
0862c53
0862c53
%description -n libshaderc
0862c53
A library for compiling shader strings into SPIR-V.
0862c53
0862c53
%package -n     libshaderc-devel
0862c53
Summary:        Development files for libshaderc
0862c53
Requires:       libshaderc%{?_isa} = %{version}-%{release}
0862c53
0862c53
%description -n libshaderc-devel
0862c53
A library for compiling shader strings into SPIR-V.
0862c53
0862c53
Development files for libshaderc.
0862c53
0862c53
%package -n     libshaderc-static
0862c53
Summary:        A library for compiling shader strings into SPIR-V (static libraries)
0862c53
0862c53
%description -n libshaderc-static
0862c53
A library for compiling shader strings into SPIR-V.
0862c53
0862c53
Static libraries for libshaderc.
0862c53
0862c53
%prep
4a5f8f6
%autosetup -p1
0862c53
4a5f8f6
rm -r third_party
0862c53
0862c53
# Stolen from Gentoo
81471bb
# Create build-version.inc since we want to use our packaged
0862c53
# SPIRV-Tools and glslang
e372b75
sed -i -e '/build-version/d' glslc/CMakeLists.txt
180856c
echo \"shaderc $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\? [[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}$' CHANGES)\" \
0862c53
        > glslc/src/build-version.inc
180856c
echo \"spirv-tools $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\? [[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}$' /usr/share/doc/spirv-tools/CHANGES)\" \
0862c53
        >> glslc/src/build-version.inc
180856c
echo \"glslang %{glslang_version}\" >> glslc/src/build-version.inc
180856c
180856c
# Point to correct include
180856c
sed -i 's|SPIRV/GlslangToSpv.h|glslang/SPIRV/GlslangToSpv.h|' libshaderc_util/src/compiler.cc
0862c53
0862c53
%build
0862c53
# We disable the tests because they don't work with our unbundling of 3rd party.
0862c53
# See https://github.com/google/shaderc/issues/470
4a5f8f6
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
4a5f8f6
       -DCMAKE_SKIP_RPATH=True \
4a5f8f6
       -DSHADERC_SKIP_TESTS=True \
66374dd
       -DPYTHON_EXECUTABLE=%{python3} \
4a5f8f6
       -GNinja
4a5f8f6
%cmake_build
0862c53
0862c53
%install
4a5f8f6
%cmake_install
0862c53
0862c53
%check
4a5f8f6
%ctest
0862c53
0862c53
%files -n glslc
0862c53
%doc glslc/README.asciidoc
0862c53
%license LICENSE
0862c53
%{_bindir}/glslc
0862c53
0862c53
%files -n libshaderc
0862c53
%doc AUTHORS CHANGES CONTRIBUTORS README.md
0862c53
%license LICENSE
0862c53
%{_libdir}/libshaderc_shared.so.1*
0862c53
0862c53
%files -n libshaderc-devel
0862c53
%{_includedir}/%{name}/
0862c53
%{_libdir}/libshaderc_shared.so
81471bb
%{_libdir}/pkgconfig/shaderc.pc
0862c53
0862c53
%files -n libshaderc-static
0862c53
%license LICENSE
0862c53
%{_libdir}/libshaderc.a
0862c53
%{_libdir}/libshaderc_combined.a
81471bb
%{_libdir}/pkgconfig/shaderc_static.pc
81471bb
%{_libdir}/pkgconfig/shaderc_combined.pc
81471bb
0862c53
%changelog
1150544
%autochangelog