%global forgeurl https://github.com/dreamworksanimation %global cmodver 1.0.0.5 %bcond tests 1 Name: moonshine Version: 13.36.0.0 Release: %{autorelease} Summary: Moonray Shaders License: Apache-2.0 URL: https://openmoonray.org/ Source0: %{forgeurl}/%{name}/archive/refs/tags/%{name}-%{version}.tar.gz Source1: %{forgeurl}/cmake_modules/archive/refs/tags/cmake_modules-%{cmodver}.tar.gz Patch0: %{name}-includes.patch Patch1: %{name}-ispc-ambiguous.patch BuildRequires: cmake >= 3.23.1 BuildRequires: gcc-c++ BuildRequires: ispc BuildRequires: python3 BuildRequires: cppunit-devel BuildRequires: tbb-devel BuildRequires: cmake(OpenImageIO) BuildRequires: cmake(Moonray) = 16.36.0.0 BuildRequires: cmake(SceneRdl2) = 14.22.0.0 Requires: Moonray = 16.36.0.0 Requires: SceneRdl2 = 14.22.0.0 Provides: Moonshine = %{version} %description Shaders and procedurals for MoonRay %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: cppunit-devel Requires: tbb-devel Requires: cmake(OpenImageIO) Requires: cmake(Moonray) = 16.36.0.0 Requires: cmake(SceneRdl2) = 14.22.0.0 %description devel The %{name}-devel package contains libraries and header files of %{name}, required to build other parts of OpenMoonRay. %prep %autosetup -p1 -n %{name}-%{name}-%{version} mkdir -p cmake_modules tar -xzf %{SOURCE1} --strip-components=1 -C $_ # Restructure sed -i 's|\bcoredata\b|%{_libdir}/openmoonray/coredata|g' \ cmake_modules/cmake/MoonrayDso.cmake sed -i 's|rdl2dso)|%{_libdir}/openmoonray/rdl2dso)|g' \ CMakeLists.txt %build ARRAS_SESSION_PATH=%{_libdir}/openmoonray/sessions \ %cmake \ -DCMAKE_MODULE_PATH=%{_builddir}/%{buildsubdir}/cmake_modules/cmake \ -DBUILD_TESTING=%{expr:%{with tests}?"ON":"OFF"} \ -DMOONRAY_USE_OPTIX=OFF \ -DCMAKE_EXE_LINKER_FLAGS:STRING='-Wl,-O1,--sort-common,-z,relro,-z,now' %cmake_build %install %cmake_install # List shaders. It will be used to remove the generated json files on post-uninstall scriptlet. ls %{buildroot}%{_libdir}/openmoonray/rdl2dso \ | grep -v '\.proxy$' \ | sed 's/\.[^.]*$/.json/' \ > %{buildroot}%{_libdir}/openmoonray/%{name}_shaders.txt %post # Build shader class descriptions RDL2_DSO_PATH=%{_libdir}/openmoonray/rdl2dso \ %{_bindir}/rdl2_json_exporter --rdl2_version "14.22.0.0" --moonray_version "16.36.0.0" --out %{_libdir}/openmoonray/shader_json/ --sparse %preun cd %{_libdir}/openmoonray/shader_json xargs rm < %{_libdir}/openmoonray/%{name}_shaders.txt find %{_libdir}/openmoonray -maxdepth 0 -type d -empty -exec rmdir {} \; %files %license LICENSE %{_libdir}/libcommon_{interpolation,noise}.so %{_libdir}/lib{geometry_data,map_projection}.so %{_libdir}/libmaterial_{dwabase,glitter}.so %{_libdir}/openmoonray/{coredata,rdl2dso} %{_libdir}/openmoonray/%{name}_shaders.txt %files devel %{_includedir}/%{name} %{_libdir}/cmake/Moonshine-%(echo %{version} | sed 's/\(.*\)\.[0-9]*$/\1/').0 %changelog %autochangelog