diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56d30c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/shaderc-1bbf43f.tar.gz diff --git a/.shaderc.metadata b/.shaderc.metadata new file mode 100644 index 0000000..8a4ce8e --- /dev/null +++ b/.shaderc.metadata @@ -0,0 +1 @@ +b0edee5bc60d60bb8bbf5fcef4283f1f3e30170b SOURCES/shaderc-1bbf43f.tar.gz diff --git a/SOURCES/0001-Drop-third-party-code-in-CMakeLists.txt.patch b/SOURCES/0001-Drop-third-party-code-in-CMakeLists.txt.patch new file mode 100644 index 0000000..b49b925 --- /dev/null +++ b/SOURCES/0001-Drop-third-party-code-in-CMakeLists.txt.patch @@ -0,0 +1,24 @@ +diff -up shaderc-24275a11d81a6b33ef345878f8a4ef929c95a116/CMakeLists.txt.orig shaderc-24275a11d81a6b33ef345878f8a4ef929c95a116/CMakeLists.txt +--- shaderc-24275a11d81a6b33ef345878f8a4ef929c95a116/CMakeLists.txt.orig 2021-03-05 13:50:35.469018657 +0100 ++++ shaderc-24275a11d81a6b33ef345878f8a4ef929c95a116/CMakeLists.txt 2021-03-05 13:52:02.679524176 +0100 +@@ -112,20 +112,10 @@ endif(MSVC) + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) + + add_subdirectory(libshaderc_util) + add_subdirectory(libshaderc) + add_subdirectory(glslc) +-if(${SHADERC_ENABLE_EXAMPLES}) +- add_subdirectory(examples) +-endif() +- +-add_custom_target(build-version +- ${PYTHON_EXECUTABLE} +- ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py +- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc +- COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") + + function(define_pkg_config_file NAME LIBS) + add_custom_target(${NAME}-pkg-config ALL diff --git a/SOURCES/glslang_linker_flags.patch b/SOURCES/glslang_linker_flags.patch new file mode 100644 index 0000000..9324f21 --- /dev/null +++ b/SOURCES/glslang_linker_flags.patch @@ -0,0 +1,24 @@ +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -47,7 +47,7 @@ + find_package(Threads) + target_link_libraries(shaderc_util PRIVATE + glslang OSDependent OGLCompiler HLSL glslang SPIRV +- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) ++ SPIRV-Tools-opt MachineIndependent GenericCodeGen ${CMAKE_THREAD_LIBS_INIT}) + + shaderc_add_tests( + TEST_PREFIX shaderc_util + +--- a/glslc/CMakeLists.txt ++++ b/glslc/CMakeLists.txt +@@ -43,7 +43,7 @@ + endif(SHADERC_ENABLE_WGSL_OUTPUT) + + target_link_libraries(glslc PRIVATE +- glslang OSDependent OGLCompiler HLSL glslang SPIRV # Glslang libraries ++ glslang OSDependent OGLCompiler HLSL glslang SPIRV MachineIndependent GenericCodeGen # Glslang libraries + $<$:libtint> # Tint libraries, optional + shaderc_util shaderc # internal Shaderc libraries + ${CMAKE_THREAD_LIBS_INIT}) + diff --git a/SPECS/shaderc.spec b/SPECS/shaderc.spec new file mode 100644 index 0000000..b44f9f9 --- /dev/null +++ b/SPECS/shaderc.spec @@ -0,0 +1,190 @@ +# Force out of source build +%undefine __cmake_in_source_build + +# Release 1.3.204.0 sdk +%global commit 1bbf43f210941ba69a2cd05cf3529063f1ff5bb9 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global snapshotdate 20220202 + +# Glslang revision from packaged version +%global glslang_version 0c4c93bf615b51be9ec057ba830c0207bdedae80 + +Name: shaderc +Version: 2022.1 +Release: 1%{?dist} +Summary: A collection of tools, libraries, and tests for Vulkan shader compilation + +License: ASL 2.0 +URL: https://github.com/google/shaderc +Source0: %url/archive/%{commit}/%{name}-%{shortcommit}.tar.gz +# Patch to unbundle 3rd party code +Patch1: 0001-Drop-third-party-code-in-CMakeLists.txt.patch +Patch2: glslang_linker_flags.patch + +BuildRequires: cmake3 +BuildRequires: gcc-c++ +BuildRequires: ninja-build +BuildRequires: python3-devel +BuildRequires: glslang-devel +BuildRequires: spirv-headers-devel +BuildRequires: spirv-tools +BuildRequires: spirv-tools-devel + +%description +A collection of tools, libraries and tests for shader compilation. + +Shaderc aims to to provide: + - a command line compiler with GCC- and Clang-like usage, for better + integration with build systems + - an API where functionality can be added without breaking existing clients + - an API supporting standard concurrency patterns across multiple + operating systems + - increased functionality such as file #include support + +%package -n glslc +Summary: A command line compiler for GLSL/HLSL to SPIR-V + +%description -n glslc +A command line compiler for GLSL/HLSL to SPIR-V. + +%package -n libshaderc +Summary: A library for compiling shader strings into SPIR-V + +%description -n libshaderc +A library for compiling shader strings into SPIR-V. + +%package -n libshaderc-devel +Summary: Development files for libshaderc +Requires: libshaderc%{?_isa} = %{version}-%{release} + +%description -n libshaderc-devel +A library for compiling shader strings into SPIR-V. + +Development files for libshaderc. + +%package -n libshaderc-static +Summary: A library for compiling shader strings into SPIR-V (static libraries) + +%description -n libshaderc-static +A library for compiling shader strings into SPIR-V. + +Static libraries for libshaderc. + +%prep +%autosetup -p1 -n %{name}-%{commit} + +rm -rf third_party + +# Stolen from Gentoo +# Create build-version.inc since we want to use our packaged +# SPIRV-Tools and glslang +echo \"shaderc $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\? [[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}$' CHANGES)\" \ + > glslc/src/build-version.inc +echo \"spirv-tools $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\? [[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}$' /usr/share/doc/spirv-tools/CHANGES)\" \ + >> glslc/src/build-version.inc +echo \"glslang %{glslang_version}\" >> glslc/src/build-version.inc + +# Point to correct include +sed -i 's|SPIRV/GlslangToSpv.h|glslang/SPIRV/GlslangToSpv.h|' libshaderc_util/src/compiler.cc + +%build +# We disable the tests because they don't work with our unbundling of 3rd party. +# See https://github.com/google/shaderc/issues/470 +%cmake3 -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_SKIP_RPATH=True \ + -DSHADERC_SKIP_TESTS=True \ + -DPYTHON_EXE=%{__python3} \ + -GNinja +%cmake3_build + +%install +%cmake3_install + +%check +%ctest3 + +%files -n glslc +%doc glslc/README.asciidoc +%license LICENSE +%{_bindir}/glslc + +%files -n libshaderc +%doc AUTHORS CHANGES CONTRIBUTORS README.md +%license LICENSE +%{_libdir}/libshaderc_shared.so.1* + +%files -n libshaderc-devel +%{_includedir}/%{name}/ +%{_libdir}/libshaderc_shared.so +%{_libdir}/pkgconfig/shaderc.pc + +%files -n libshaderc-static +%license LICENSE +%{_libdir}/libshaderc.a +%{_libdir}/libshaderc_combined.a +%{_libdir}/pkgconfig/shaderc_static.pc +%{_libdir}/pkgconfig/shaderc_combined.pc + +%changelog +* Mon Feb 28 2022 Dave Airlie - 2022.1-1 +- Update for 1.3.204.0 sdk release + +* Tue Aug 10 2021 Mohan Boddu - 2020.5-4 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Jul 30 2021 Dave Airlie - 2020.5-3 +- Update for 1.2.182.0 sdk release + +* Fri Apr 16 2021 Mohan Boddu - 2020.5-2 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Fri Mar 5 13:43:44 CET 2021 Robert-André Mauchin - 2020.5-1 +- Update to 2020.5 +- Close: rhbz#1931006 + +* Wed Jan 27 2021 Fedora Release Engineering - 2020.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Dec 26 15:21:39 CET 2020 Robert-André Mauchin - 2020.4-1 +- Update to 2020.4 +- Close: rhbz#1906260 + +* Sat Dec 05 2020 Robert-André Mauchin - 2020.3-1 +- Update to 2020.3 +- Close: rhbz#1875183 + +* Sat Aug 08 2020 Robert-André Mauchin - 2020.2-1 +- Update to 2020.2 + +* Sat Aug 01 2020 Fedora Release Engineering - 2020.1-3 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 2020.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jun 17 20:15:27 CEST 2020 Robert-André Mauchin - 2020.1-1 +- Update to 2020.1 + +* Sun Feb 02 20:53:01 CET 2020 Robert-André Mauchin - 2019.1-1 +- Update to 2019.1 + +* Thu Jan 30 2020 Fedora Release Engineering - 2019.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 2019.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jun 10 00:18:18 CEST 2019 Robert-André Mauchin - 2019.0-1 +- Release 2019.0 + +* Sat Feb 02 2019 Fedora Release Engineering - 2018.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Oct 03 2018 Robert-André Mauchin - 2018.0-1 +- Release 2018.0 + +* Mon Sep 24 2018 Robert-André Mauchin - 2017.2-1 +- Initial build +