# Conditional build options (1=enabled by default) %bcond openimageio 1 # OIIO plugin support %bcond python 0 # Python bindings %bcond viewer 0 # Graphical viewer (enabled by default) Name: materialx Version: 1.39.3 Release: %autorelease Summary: Open standard for material exchange in computer graphics License: MIT AND Apache-2.0 AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND CC0-1.0 URL: https://materialx.org/ Source0: https://github.com/AcademySoftwareFoundation/MaterialX/releases/download/v%{version}/MaterialX-%{version}.tar.gz # Add missing cstding.h declaration Patch: materialx-add-missing-cstdint.patch #======================================== # Build Requirements #======================================== # Core toolchain BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: pkgconfig # Graphics dependencies BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(oslcomp) BuildRequires: pkgconfig(wayland-client) >= 0.2.7 BuildRequires: pkgconfig(wayland-protocols) >= 1.15 BuildRequires: pkgconfig(xkbcommon) BuildRequires: pkgconfig(xrandr) BuildRequires: pkgconfig(xcursor) BuildRequires: pkgconfig(xi) BuildRequires: pkgconfig(xt) # Optional components %if %{with openimageio} BuildRequires: pkgconfig(OpenImageIO) %endif %if %{with python} BuildRequires: python3-devel BuildRequires: pkgconfig(pybind11) %endif %if %{with viewer} BuildRequires: desktop-file-utils %endif # Bundled components documentation Provides: bundled(nanogui) = 0.2.0^20221102gitf5020e2 #======================================== # Package Definitions #======================================== %description MaterialX standard for representing rich material and look-development content across applications and renderers. %package data Summary: MaterialX standard libraries and resources License: Apache-2.0 BuildArch: noarch %description data Standard libraries and resources for MaterialX. %package devel Summary: Development files for MaterialX Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Development files for building applications using MaterialX. %if %{with python} %package -n python3-%{name} Summary: Python 3 bindings for MaterialX Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python3-%{name} Python bindings for MaterialX material standard. %endif %if %{with viewer} %package viewer Summary: MaterialX graphical viewer Requires: %{name}%{?_isa} = %{version}-%{release} %description viewer Interactive viewer for MaterialX materials. %endif #======================================== # Build Preparation #======================================== %prep %autosetup -p1 -n MaterialX-%{version} # Standardize installation paths find source -type f \( -name '*.cpp' -o -name '*.h' -o -name 'CMakeLists.txt' \) \ -exec sed -i \ -e 's|resources|%{_datadir}/%{name}/resources|g' \ -e 's|"libraries"|"%{_datadir}/%{name}"|g' {} + # Remove bundled assets find . -type f \( -name '*.tt[cf]' -o -name '*.ot[cf]' -o -name '*.woff*' \) -delete #======================================== # Build Configuration #======================================== %build %cmake \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DMATERIALX_BUILD_SHARED_LIBS=ON \ -DMATERIALX_BUILD_TESTS=OFF \ %if %{with viewer} -DMATERIALX_BUILD_VIEWER=ON \ %endif %if %{with python} -DMATERIALX_PYTHON_LIBRARY=%{python3_sitearch}/%{name} \ -DPYTHON_EXECUTABLE=%{__python3} \ %endif -DMATERIALX_INSTALL_LIB_PATH=%{_libdir} \ -DMATERIALX_INSTALL_STDLIB_PATH=%{_datadir}/%{name} %cmake_build #======================================== # Installation #======================================== %install %cmake_install # Fedora filesystem layout install -d %{buildroot}%{_datadir}/%{name} mv %{buildroot}%{_prefix}/resources %{buildroot}%{_datadir}/%{name}/ # License documentation install -Dm644 LICENSE -t %{buildroot}%{_datadir}/licenses/%{name}/ %if %{with viewer} # Desktop integration install -Dm644 documents/Images/MaterialXLogo_200x155.png \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ --add-category Graphics \ --add-category 3DGraphics \ --set-key Exec --set-value MaterialXView \ --set-key Icon --set-value %{name} \ --set-key Comment --set-value "View MaterialX material files" \ %{name}.desktop %endif # Remove documentation from the wrong directory rm %{buildroot}%{_prefix}/{*.md,LICENSE} #======================================== # File Manifest #======================================== %files %license %{_datadir}/licenses/%{name}/LICENSE %doc README.md CHANGELOG.md THIRD-PARTY.md %dir %{_datadir}/%{name} %{_libdir}/libMaterialX*.so.* %files data %{_datadir}/%{name}/ %files devel %{_includedir}/MaterialX* %{_libdir}/libMaterialX*.so %{_libdir}/cmake/MaterialX/ %if %{with python} %files -n python3-%{name} %{python3_sitearch}/%{name}/ %{_bindir}/*.py %endif %if %{with viewer} %files viewer %{_bindir}/MaterialXView %{_datadir}/icons/hicolor/*/apps/%{name}.png %{_datadir}/applications/%{name}.desktop %endif %changelog %autochangelog