# Conditional build options (1=enabled by default) %bcond openimageio 1 # OIIO plugin support %bcond python 1 # Python bindings %bcond viewer 0 # Graphical viewer Name: materialx Version: 1.39.4 Release: %autorelease Summary: Vendor-neutral specification for 3D material interchange # All software under Apache 2.0 License expect the following # Boost Software License 1.0 for Catch # BSD 3-Clause License for geglsl, genosl and PyBind11 # ISC License for MaterialXTest and MaterialXView # Khronos License (MIT-Khronos-old) for Glad within MaterialXRenderGlsl # MIT License for Cgltf, PugiXML and TinyObjLoader # Zlib License for Glfw within MaterialXGraphEditor License: %{shrink: MIT AND Apache-2.0 AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND CC0-1.0 AND ISC AND MIT-Khronos-old AND Zlib } URL: https://materialx.org/ Source0: https://github.com/AcademySoftwareFoundation/MaterialX/releases/download/v%{version}/MaterialX-%{version}.tar.gz #======================================== # Build Requirements #======================================== # Core toolchain BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: help2man BuildRequires: ninja-build BuildRequires: pkgconfig # Graphics dependencies BuildRequires: pkgconfig(catch2) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(glfw3) 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 # Viewer needs access to upstream git submodule %if %{with viewer} BuildRequires: desktop-file-utils BuildRequires: hicolor-icon-theme %endif # Only 64-bits architectures supported ExcludeArch: %{ix86} %{arm} #======================================== # Package Definitions #======================================== %description Physically-based material interchange specification for 3D rendering workflows. %package data Summary: MaterialX standard libraries and resources License: Apache-2.0 BuildArch: noarch Requires: %{name}%{?_isa} = %{version}-%{release} %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 # Change non-writable destination for setup.py.tmp sed -i 's|CMAKE_INSTALL_PREFIX|CMAKE_BINARY_DIR|g' \ python/CMakeLists.txt # Fix executable %py3_shebang_fix . #======================================== # Build Configuration #======================================== %build %cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DMATERIALX_BUILD_SHARED_LIBS=ON \ -DMATERIALX_BUILD_TESTS=OFF \ %if %{with viewer} -DMATERIALX_BUILD_VIEWER=ON \ -DMATERIALX_BUILD_GRAPH_EDITOR=ON \ %endif %if %{with python} -DMATERIALX_BUILD_PYTHON=ON \ -DMATERIALX_PYTHON_FOLDER_NAME=%{python3_sitelib}/%{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 -dp %{buildroot}%{_datadir}/%{name} mv %{buildroot}%{_prefix}/resources %{buildroot}%{_datadir}/%{name}/ %if %{with python} install -dp %{buildroot}%{_bindir} rm %{buildroot}%{_prefix}/python/Scripts/README.md for file in %{buildroot}%{_prefix}/python/Scripts/*.py; do name="${file%.py}" chmod +x "$file" mv "$file" $name done chmod +x %{buildroot}%{_prefix}/python/MaterialX/*.py mv %{buildroot}%{_prefix}/python/Scripts/* %{buildroot}%{_bindir} mv %{buildroot}%{_prefix}/python/MaterialX/* %{buildroot}%{python3_sitelib}/%{name} rm -r %{buildroot}%{_prefix}/python rm -r %{buildroot}%{python3_sitelib}/%{name}/%{_prefix} %endif # Remove demo devel files rm -rvf %{buildroot}%{_datadir}/%{name}/stdlib/genosl/include # License documentation install -Dpm644 LICENSE -t %{buildroot}%{_licensedir}/%{name}/ %if %{with viewer} # Desktop integration install -Dpm644 documents/Images/MaterialXLogo_200x155.png \ %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/%{name}.png # Generate desktop files for app in viewer graph-editor; do desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ --add-category Graphics \ --add-category 3DGraphics \ --set-key Name --set-value "MaterialX ${app%-*}" \ --set-key Exec --set-value "MaterialX${app//-}" \ --set-key Icon --set-value "%{name}" \ --set-key Comment --set-value "MaterialX ${app%-*}" \ %{name}-${app}.desktop done"A simple MaterialX Editor" \ %{name}-graph-editor.desktop %endif # Generate and install man pages. install -d '%{buildroot}%{_mandir}/man1' for cmd in %{buildroot}%{_bindir}/* do LD_LIBRARY_PATH='%{buildroot}%{_libdir}' \ help2man \ --no-info --no-discard-stderr --version-string='%{version}' \ --output="%{buildroot}%{_mandir}/man1/$(basename "${cmd}").1" \ "${cmd}" done # Clean up incorrectly installed docs rm -f %{buildroot}%{_prefix}/{*.md,LICENSE} #======================================== # Test #======================================== %check %ctest #======================================== # File Manifest #======================================== %files %license %{_licensedir}/%{name}/LICENSE %doc README.md CHANGELOG.md THIRD-PARTY.md %dir %{_datadir}/%{name} %if %{with openimageio} %{_bindir}/baketextures %{_bindir}/creatematerial %{_bindir}/generateshader %{_bindir}/genmdl %{_bindir}/mxdoc %{_bindir}/mxformat %{_bindir}/mxvalidate %{_bindir}/translateshader %{_bindir}/writenodegraphs %endif %{_libdir}/libMaterialX*.so.{1,%{version}} %{_mandir}/man1/*.1.gz %files data %{_datadir}/%{name}/ %files devel %{_includedir}/MaterialX* %{_libdir}/libMaterialX*.so %{_libdir}/cmake/MaterialX/ %if %{with python} %files -n python3-%{name} %doc README.md %{python3_sitelib}/%{name} %endif %if %{with viewer} %files viewer %{_bindir}/MaterialX{View,GraphEditor} %{_datadir}/icons/hicolor/*/apps/%{name}.png %{_datadir}/applications/%{name}-{graph-editor,viewer}.desktop %endif %changelog %autochangelog