From e66e711283b0fcfe6da006be65922d47e013ef20 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Mon, 21 Jul 2025 08:52:03 -0700 Subject: [PATCH] feat: DirectXShaderCompiler (#5894) (#5908) * feat: DirectXShaderCompiler * chore(DirectXShaderCompiler): refactor, use subpackages * fix(DirectXShaderCompiler): proper changelog versions * fix(DirectXShaderCompiler): proper changelog date * fix(DirectXShaderCompiler): quiet setup * feat(DirectXShaderCompiler): external libraries bcond * feat(DirectXShaderCompiler)!: bump, remove some subpackages BREAKING CHANGE: The `tools` and the `cmake-utils` subpackages no longer exist. * chore(DirectXShaderCompiler): use git_setup macro * chore(DirectXShaderCompiler): auto-update (cherry picked from commit 37c5999067f6e7f0023a92873b5dda7ba2e068d9) Co-authored-by: VirtualFreeEx <122599332+VirtualFreeEx@users.noreply.github.com> --- .../DirectXShaderCompiler.spec | 152 ++++++++++++++++++ anda/lib/directxshadercompiler/anda.hcl | 5 + anda/lib/directxshadercompiler/update.rhai | 1 + 3 files changed, 158 insertions(+) create mode 100644 anda/lib/directxshadercompiler/DirectXShaderCompiler.spec create mode 100644 anda/lib/directxshadercompiler/anda.hcl create mode 100644 anda/lib/directxshadercompiler/update.rhai diff --git a/anda/lib/directxshadercompiler/DirectXShaderCompiler.spec b/anda/lib/directxshadercompiler/DirectXShaderCompiler.spec new file mode 100644 index 0000000000..98a8837bc1 --- /dev/null +++ b/anda/lib/directxshadercompiler/DirectXShaderCompiler.spec @@ -0,0 +1,152 @@ +# Disable in-source build. +%undefine __cmake_in_source_build + +# Metadata. +Name: DirectXShaderCompiler +Version: 1.8.2505.1 +Release: 5%?dist +Summary: A Direct X Shader compiler. +License: MIT +Packager: libffi + +# Project URL. +URL: https://github.com/microsoft/DirectXShaderCompiler + +# Build dependencies - tooling. +BuildRequires: gcc-c++ +BuildRequires: cmake >= 3.17.2 +BuildRequires: python3 +BuildRequires: git + +Provides: dxc = %{version}-%{release} +Requires: %{name}-libs + +# Sub-packages. + +%package devel +Summary: Development files for %{name}. +Requires: %{name}-libs +Requires: %{name}-static + +%package libs +Summary: Runtime shared libraries for %{name}. + +%package static +Summary: Static libraries for %{name}. + +# Descriptions. + +%description +The DirectX Shader Compiler project includes a compiler and related tools used +to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate +Language (DXIL) representation. Applications that make use of DirectX for +graphics, games, and computation can use it to generate shader programs. + +%description devel +This package contains library and header files needed to develop new native +programs that use %{name}. + +%description libs +This package contains runtime shared libraries needed to link with native +programs that use %{name}. + +Provided files include: +* libdxcompiler.so, a .so providing a componentized compiler, assembler, +disassembler, and validator. +* and some other ones! + +%description static +Static libraries / binaries to link with applications at compile-time +for %{name}. + +# Prepare. + +%prep +%git_clone %{url} v%{version} + +# Build. +# Attribution: https://github.com/gentoo/guru/blob/master/dev-util/DirectXShaderCompiler/DirectXShaderCompiler-1.8.2407.ebuild +# Attribution: https://github.com/negativo17/DirectXShaderCompiler/blob/master/DirectXShaderCompiler.spec +%build +%cmake \ + -C ./cmake/caches/PredefinedParams.cmake \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DSPIRV_BUILD_TESTS=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_BUILD_TYPE=Fedora + +%cmake_build + +# Install. +# Attribution: https://github.com/negativo17/DirectXShaderCompiler/blob/master/DirectXShaderCompiler.spec +%install +mkdir %{buildroot}%{_bindir} -p +# Binaries. +install -m755 %{_vpath_builddir}/bin/dx{a,c,l,opt,r,v} \ + %{buildroot}%{_bindir}/ + +# Static libraries. +mkdir -p %{buildroot}%{_libdir} +for STATIC in libdxclib libdxcvalidator; do +install -m644 %{_vpath_builddir}/lib/$STATIC.a \ + %{buildroot}%{_libdir}/; done + +# Shared libraries. +install -m755 %{_vpath_builddir}/lib/*.so \ + %{buildroot}%{_libdir}/ + +# Headers. +mkdir -p %{buildroot}%{_includedir}/dxc +install -m644 include/dxc/*.h \ + %{buildroot}%{_includedir}/dxc/ + +# Test. +%check +%ctest + +# Files. +%files +%license LICENSE.TXT +%doc CONTRIBUTING.md README.md SECURITY.md ThirdPartyNotices.txt +%{_bindir}/dxa +%{_bindir}/dxc +%{_bindir}/dxl +%{_bindir}/dxopt +%{_bindir}/dxr +%{_bindir}/dxv + +%files libs +%{_libdir}/libdxcompiler.so +%{_libdir}/libdxil.so +%{_libdir}/libdxildll.so + +%files static +%{_libdir}/*.a + +%files devel +%{_includedir}/dxc/*.h + +# Changelog. +%changelog +* Sun Jul 20 2025 libffi - 1.8.2505.1-5 +- Removed support for building with external libraries. +- Internal changes to the build process. + +* Fri Jul 18 2025 libffi - 1.8.2505.1-4 +- Remove the `tools` and `cmake-utils` subpackages. +- Make the package provide the `dxc` package. +- Add license and some docs. +- Internal package changes. +- Bump upstream. + +* Mon May 5 2025 libffi - 1.8.2502-3 +- Provide unsupported build conditional for building with(out) + external libraries. + +* Sun May 4 2025 libffi - 1.8.2502-2 +- Refactor. +- Use subpackages. + +* Wed Apr 30 2025 libffi - 1.8.2502-1 +- Initial build. diff --git a/anda/lib/directxshadercompiler/anda.hcl b/anda/lib/directxshadercompiler/anda.hcl new file mode 100644 index 0000000000..75129ebe52 --- /dev/null +++ b/anda/lib/directxshadercompiler/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "DirectXShaderCompiler.spec" + } +} diff --git a/anda/lib/directxshadercompiler/update.rhai b/anda/lib/directxshadercompiler/update.rhai new file mode 100644 index 0000000000..ab0688829d --- /dev/null +++ b/anda/lib/directxshadercompiler/update.rhai @@ -0,0 +1 @@ +rpm.version(gh_tag("microsoft/DirectXShaderCompiler"));