%bcond openimageio 1 %bcond python 0 %bcond viewer 0 Name: materialx Version: 1.39.1 Release: %autorelease Summary: Open standard of rich material # All third-party components imported or incorporated are under MIT except the following: # ambientcg CC0-1.0 (content asset) # catch BSL-1.0 # nanogui BSD-3-Clause-LBNL # poly-haven CC0-1.0 (content asset) # License: MIT AND Apache-2.0 AND BSD-4-Clause AND CC0-1.0 AND BSD-3-Clause AND BSL-1.0 URL: https://materialx.org/ Source0: https://github.com/AcademySoftwareFoundation/MaterialX/releases/download/v%{version}/MaterialX-%{version}.tar.gz BuildRequires: chrpath BuildRequires: cmake(pybind11) BuildRequires: dos2unix BuildRequires: gcc-c++ BuildRequires: pkgconfig(gl) %if %{with openimageio} BuildRequires: pkgconfig(OpenImageIO) %endif BuildRequires: pkgconfig(oslcomp) %if %{with python} BuildRequires: pkgconfig(python3) >= 3.7 BuildRequires: pkgconfig(pybind11) %endif %if %{with viewer} BuildRequires: desktop-file-utils BuildRequires: pkgconfig(wayland-client) >= 0.2.7 BuildRequires: pkgconfig(wayland-protocols) >= 1.15 BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(xrandr) BuildRequires: pkgconfig(xinerama) BuildRequires: pkgconfig(xcursor) BuildRequires: pkgconfig(xi) %endif BuildRequires: pkgconfig(xt) Requires: %{name}-data = %{version}-%{release} # x86 architecture no longer supported ExcludeArch: %{ix86} Provides: bundled(nanogui) = 0.2.0^20221102gitf5020e2 %description MaterialX is an open standard for the exchange of rich material and look-development content across applications and renderings. %package data Summary: Data files for %{name} License: Apache-2.0 BuildArch: noarch %description data The %{name}-data package contains data files for %{name}. %package devel Summary: Development files for %{name} License: MIT AND Apache-2.0 AND BSD-4-Clause AND CC0-1.0 AND BSD-3-Clause AND BSL-1.0 Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package tools Summary: Tools for handling MaterialX License: Apache-2.0 Requires: python3-%{name}%{?_isa} = %{version}-%{release} %description tools Tools for handling MaterialX %prep %autosetup -n MaterialX-%{version} # Fix path sed -i 's|CMAKE_INSTALL_PREFIX|CMAKE_BINARY_DIR|g' python/CMakeLists.txt sed -i 's|"DESTINATION ."|"DESTINATION %{_datadir}/%{name}"|g' CMakeLists.txt sed -i 's|resources|%{_datadir}/%{name}/resources|g' source/MaterialXView/{Main.cpp,Viewer.cpp} sed -i 's|"libraries"|"%{_datadir}/%{name}"|g' source/MaterialXView/Main.cpp sed -i 's|resources|%{_datadir}/%{name}/resources|g' source/MaterialXGraphEditor/{Main.cpp,Graph.cpp} sed -i 's|"libraries"|"%{_datadir}/%{name}"|g' source/MaterialXGraphEditor/{Main.cpp,Graph.cpp} sed -i 's|"libraries"|"%{_datadir}/%{name}"|g' source/MaterialXGenShader/GenOptions.h sed -i 's|@PACKAGE_CMAKE_INSTALL_PREFIX@/libraries|%{_datadir}/%{name}|g' cmake/modules/MaterialXConfig.cmake.in sed -i 's|@PACKAGE_CMAKE_INSTALL_PREFIX@/python|%{python3_sitearch}/MaterialX|g' cmake/modules/MaterialXConfig.cmake.in sed -i 's|@PACKAGE_CMAKE_INSTALL_PREFIX@/resources|%{_datadir}/%{name}/resources|g' cmake/modules/MaterialXConfig.cmake.in # Fix all Python shebangs recursively in . %py3_shebang_fix . sed -r -i '1{/^#!/d}' python/MaterialX/{colorspace,datatype,main}.py dos2unix python/Scripts/* dos2unix --keepdate LICENSE *.md # Ensure there are no bundled fonts # https://docs.fedoraproject.org/en-US/packaging-guidelines/#_avoid_bundling_of_fonts_in_other_packages find . -type f \( \ -name '*.tt[cf]' -o -name '*.ot[cf]' \ -o -name '*.eot' -o -name '*.woff' -o -name '*.woff2' \ \) -print -delete %build %cmake \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DCMAKE_SKIP_RPATH=ON \ -DMATERIALX_BUILD_TESTS=OFF \ -DMATERIALX_BUILD_SHARED_LIBS=ON \ %if %{with viewer} -DMATERIALX_BUILD_VIEWER=ON \ -DMATERIALX_BUILD_GRAPH_EDITOR=ON \ %endif %if %{with openimageio} -DMATERIALX_BUILD_OIIO=ON \ %endif %if %{with python} -DMATERIALX_PYTHON_FOLDER_NAME=%{python3_sitearch}/%{name}/ \ -DMATERIALX_BUILD_PYTHON=ON \ %else -DMATERIALX_BUILD_PYTHON=OFF \ %endif -DMATERIALX_INSTALL_INCLUDE_PATH=%{_includedir} \ -DMATERIALX_INSTALL_LIB_PATH=%{_libdir} \ -DMATERIALX_INSTALL_STDLIB_PATH=%{_datadir}/%{name}/libraries/ %cmake_build %install %cmake_install # Relocate resources folder cp -pr %{buildroot}%{_prefix}/resources %{buildroot}%{_datadir}/%{name}/ rm -rf %{buildroot}%{_prefix}/resources %if %{with viewer} # Install viewers icon install -Dm755 documents/Images/MaterialXLogo_200x155.png %{buildroot}/usr/share/icons/hicolor/256x256/apps/materialx.png install -Dm755 documents/Images/MaterialXLogo.png %{buildroot}/usr/share/icons/hicolor/1024x1024/apps/materialx.png chrpath -d %{buildroot}%{_bindir}/MaterialXView # Generate desktop application files # MaterialX viewer cat >> %{name}-view.desktop << FOE [Desktop Entry] Comment=Default Viewer for MaterialX Shaders Exec=MaterialXView --material GenericName=MaterialX Viewer Icon=materialx MimeType=model/materialx; Name=MaterialX Viewer NoDisplay=true StartupNotify=true Terminal=false Type=Application EOF # Graph editor cat >> %{name}-graph-editor.desktop << FOE [Desktop Entry] Comment=A simple MaterialX Editor Exec=MaterialXGraphEditor --material GenericName=MaterialX Graph Editor Icon=materialx MimeType=model/materialx; Name[en_US]=MaterialX Graph Editor Name=MaterialX Graph Editor NoDisplay=true StartupNotify=true Terminal=false Type=Application EOF desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ %{name}-{viewer,graph-editor}.desktop %endif # Remove empty dirs find %{buildroot}%{_prefix} -empty -type d -delete -print #Fix location of licenses mkdir -p %{buildroot}%{_datadir}/{doc,licenses}/%{name}/ mv %{buildroot}%{_prefix}/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/ # Relocate changelog, licenses and remove executable permission chmod -x %{buildroot}%{_prefix}/*.md mv %{buildroot}%{_prefix}/{CHANGELOG,README}.md %{buildroot}%{_docdir}/%{name}/ mv %{buildroot}%{_prefix}/THIRD-PARTY.md %{buildroot}%{_datadir}/licenses/%{name}/ %if %{with viewer} %check desktop-file-validate %{buildroot}/%{_datadir}/applications/-{viewer,graph-editor}.desktop %endif %files %license LICENSE THIRD-PARTY.md %doc CHANGELOG.md README.md SECURITY.md %if %{with viewer} %{_bindir}/MaterialXGraphEditor %{_bindir}/MaterialXView %{_datadir}/icons/hicolor/*/apps/%{name}.png %{_datadir}/applications/*.desktop %endif %{_libdir}/libMaterialXCore.so.{1,%{version}} %{_libdir}/libMaterialXFormat.so.{1,%{version}} %{_libdir}/libMaterialXGen{,Glsl,Mdl,Msl,Osl,Shader}.so.{1,%{version}} %{_libdir}/libMaterialXRender{,Glsl,Hw,Osl}.so.{1,%{version}} %files data %{_datadir}/%{name} %files devel %doc README.md %{_includedir}/MaterialX{Core,Format}/ %{_includedir}/MaterialXGen{Glsl,Mdl,Msl,Osl,Shader}/ %{_includedir}/MaterialXRender{,Glsl,Hw,Osl} %{_libdir}/cmake/MaterialX/ %{_libdir}/libMaterialXCore.so %{_libdir}/libMaterialXFormat.so %{_libdir}/libMaterialXGen{,Glsl,Mdl,Msl,Osl,Shader}.so %{_libdir}/libMaterialXRender{,Glsl,Hw,Osl}.so %if %{with python} %files tools %{_bindir}/baketextures.py %{_bindir}/{generate,translate}shader.py %{_bindir}/genmdl.py %{_bindir}/mxdoc.py %{_bindir}/mx{format,validate}.py %{_bindir}/writenodegraphs.py %endif %changelog %autochangelog