diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d7072c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/shaderc-7a23a01.tar.gz +/shaderc-7d8582b.tar.gz +/shaderc-34c412f.tar.gz diff --git a/0001-Drop-third-party-code-in-CMakeLists.txt.patch b/0001-Drop-third-party-code-in-CMakeLists.txt.patch new file mode 100644 index 0000000..32ea680 --- /dev/null +++ b/0001-Drop-third-party-code-in-CMakeLists.txt.patch @@ -0,0 +1,24 @@ +diff -up shaderc-34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4/CMakeLists.txt.unbundle shaderc-34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4/CMakeLists.txt +--- shaderc-34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4/CMakeLists.txt.unbundle 2019-06-10 00:30:41.954316517 +0200 ++++ shaderc-34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4/CMakeLists.txt 2019-06-10 01:10:11.672758769 +0200 +@@ -70,7 +70,6 @@ endif(MSVC) + + # Configure subdirectories. + # We depend on these for later projects, so they should come first. +-add_subdirectory(third_party) + + if(SHADERC_ENABLE_SPVC) + add_subdirectory(libshaderc_spvc) +@@ -81,12 +80,6 @@ add_subdirectory(libshaderc) + add_subdirectory(glslc) + add_subdirectory(examples) + +-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} +- 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 + COMMAND ${CMAKE_COMMAND} diff --git a/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch b/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch new file mode 100644 index 0000000..ad7de1f --- /dev/null +++ b/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch @@ -0,0 +1,44 @@ +From 21c8be385b3fab5edcb934a6d99f69fd389c4e67 Mon Sep 17 00:00:00 2001 +From: Niklas Haas +Date: Tue, 29 May 2018 07:34:00 +0200 +Subject: [PATCH] Fix the link order of libglslang and libHLSL + +libglslang depends on libHLSL, so the latter needs to be specified last. +This fixes an issue when trying to build shaderc against system-wide +versions of libglslang/libHLSL, rather than the in-tree versions from +third_party. + +Additionally, libshaderc_util also depends on SPIRV-Tools +--- + glslc/CMakeLists.txt | 2 +- + libshaderc_util/CMakeLists.txt | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt +index acf6fb0..0f5d888 100644 +--- a/glslc/CMakeLists.txt ++++ b/glslc/CMakeLists.txt +@@ -18,7 +18,7 @@ add_library(glslc STATIC + shaderc_default_compile_options(glslc) + target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) + target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler +- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) ++ glslang SPIRV HLSL ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(glslc PRIVATE shaderc_util shaderc) + + add_executable(glslc_exe src/main.cc) +diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt +index 873540a..6d0c465 100644 +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -34,8 +34,8 @@ endif(SHADERC_ENABLE_INSTALL) + + find_package(Threads) + target_link_libraries(shaderc_util PRIVATE +- glslang OSDependent OGLCompiler HLSL glslang SPIRV +- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) ++ glslang OSDependent OGLCompiler glslang HLSL SPIRV ++ SPIRV-Tools-opt SPIRV-Tools ${CMAKE_THREAD_LIBS_INIT}) + + shaderc_add_tests( + TEST_PREFIX shaderc_util diff --git a/package.cfg b/package.cfg new file mode 100644 index 0000000..66ea79d --- /dev/null +++ b/package.cfg @@ -0,0 +1,2 @@ +[koji] +targets = epel8 epel8-playground \ No newline at end of file diff --git a/shaderc.spec b/shaderc.spec new file mode 100644 index 0000000..3898430 --- /dev/null +++ b/shaderc.spec @@ -0,0 +1,157 @@ +# Release 2019.0 +%global commit 34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global snapshotdate 20190609 +%global gitversion v2019.0 + +# Need to keep this in sync with spirv-tools +%global spirv_commit 2297d4a3dfcbfd2a8b4312fab055ae26e3289fd3 +%global spirv_version v2019.1 + +Name: shaderc +Version: 2019.0 +Release: 2%{?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 + +# https://github.com/google/shaderc/pull/463 +Patch0: https://patch-diff.githubusercontent.com/raw/google/shaderc/pull/463.patch#/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch +# Patch to unbundle 3rd party code +Patch1: 0001-Drop-third-party-code-in-CMakeLists.txt.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\)\?' CHANGES) %{gitversion}\" \ + > glslc/src/build-version.inc +echo \"spirv-tools $(grep -m1 -o '^v[[:digit:]]\{4\}\.[[:digit:]]\(-dev\)\?' /usr/share/doc/spirv-tools/CHANGES) %{spirv_version}\" \ + >> glslc/src/build-version.inc +echo \"glslang \'\'\" >> glslc/src/build-version.inc + + +%build +mkdir %_target_platform +cd %_target_platform +# 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 .. +%ninja_build + + +%install +%ninja_install -C %_target_platform + + +%check +ctest -V + + +%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 +* 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 + diff --git a/sources b/sources new file mode 100644 index 0000000..1728654 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (shaderc-34c412f.tar.gz) = bbc17c350e094230c53b22f80eef95d9dfac3716d3653764862fffe210f3d0fbaa60f204c9aa93e91390f60b4a8a5f153d940ba1e450eff89ff53b587f295ce7