From 55a7da2e1d8ed2bfa3be4224034051cccd570aa1 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 17:46:13 +0100 Subject: [PATCH] package created using the webbuild interface [release 2023.6-1mamba;Sun Aug 20 2023] --- README.md | 2 + ...p-third-party-code-in-CMakeLists.txt.patch | 24 ++++ shaderc-2023.6-glslang_linker_flags.patch | 24 ++++ shaderc.spec | 116 ++++++++++++++++++ 4 files changed, 166 insertions(+) create mode 100644 shaderc-2023.6-Drop-third-party-code-in-CMakeLists.txt.patch create mode 100644 shaderc-2023.6-glslang_linker_flags.patch create mode 100644 shaderc.spec diff --git a/README.md b/README.md index f165fda..11cbc53 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # shaderc +A collection of tools, libraries, and tests for Vulkan shader compilation. + diff --git a/shaderc-2023.6-Drop-third-party-code-in-CMakeLists.txt.patch b/shaderc-2023.6-Drop-third-party-code-in-CMakeLists.txt.patch new file mode 100644 index 0000000..b49b925 --- /dev/null +++ b/shaderc-2023.6-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/shaderc-2023.6-glslang_linker_flags.patch b/shaderc-2023.6-glslang_linker_flags.patch new file mode 100644 index 0000000..9324f21 --- /dev/null +++ b/shaderc-2023.6-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/shaderc.spec b/shaderc.spec new file mode 100644 index 0000000..fc881cf --- /dev/null +++ b/shaderc.spec @@ -0,0 +1,116 @@ +# Glslang revision from packaged version +%global glslang_version ca8d07d0bc1c6390b83915700439fa7719de6a2a + +Name: shaderc +Version: 2023.6 +Release: 1mamba +Summary: A collection of tools, libraries, and tests for Vulkan shader compilation +Group: System/Tools +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://github.com/google/shaderc +Source: https://github.com/google/shaderc.git/v%{version}/shaderc-%{version}.tar.bz2 +Patch0: shaderc-2023.6-Drop-third-party-code-in-CMakeLists.txt.patch +Patch1: shaderc-2023.6-glslang_linker_flags.patch +License: Apache License 2.0 +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libgcc +BuildRequires: libglslang-devel +BuildRequires: libspirv-tools-devel +BuildRequires: libstdc++6-devel +## AUTOBUILDREQ-END +BuildRequires: cmake +BuildRequires: libglslang-devel +BuildRequires: spirv-headers +BuildRequires: libspirv-tools-devel +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description +A collection of tools, libraries, and tests for Vulkan shader compilation. + +%package -n lib%{name} +Group: System/Libraries +Summary: Shared libraries for %{name} + +%description -n lib%{name} +This package contains shared libraries for %{name}. + +%package -n lib%{name}-devel +Group: Development/Libraries +Summary: Development files for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +Requires: pkg-config + +%description -n lib%{name}-devel +This package contains libraries and header files for developing applications that use %{name}. + +%debug_package + +%prep +%setup -q +%patch 0 -p1 -b .Drop-third-party-code-in-CMakeLists.txt +%patch 1 -p1 -b .glslang_linker_flags + +rm -r third_party + +# Stolen from Gentoo +# Create build-version.inc since we want to use our packaged +# SPIRV-Tools and glslang +sed -i -e '/build-version/d' glslc/CMakeLists.txt +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 +%cmake -d build \ + -Wno-dev \ + -DCMAKE_SKIP_RPATH=True \ + -DSHADERC_SKIP_TESTS=True \ + -DPYTHON_EXE=%{__python310} \ + -GNinja + +ninja + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +DESTDIR=%{buildroot} ninja -C build install + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -n lib%{name} -p /sbin/ldconfig +%postun -n lib%{name} -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_bindir}/glslc + +%files -n lib%{name} +%defattr(-,root,root) +%{_libdir}/libshaderc_shared.so.* +%doc AUTHORS LICENSE + +%files -n lib%{name}-devel +%defattr(-,root,root) +%dir %{_includedir}/shaderc +%{_includedir}/shaderc/* +%{_libdir}/libshaderc.a +%{_libdir}/libshaderc_combined.a +%{_libdir}/libshaderc_shared.so +%{_libdir}/pkgconfig/shaderc.pc +%{_libdir}/pkgconfig/shaderc_combined.pc +%{_libdir}/pkgconfig/shaderc_static.pc +%doc CHANGES README.md + +%changelog +* Sun Aug 20 2023 Silvan Calarco 2023.6-1mamba +- package created using the webbuild interface