# Note for packagers: this package is primarily intended for use with Blender. # Ensure its versioning remains synchronized with the USD's Blender version. # Before updating this package, please verify its compatibility with the USD # used internally in upstream Blender sources (Blender uses custom patches on # USD, also included here), as Blender is particularly sensitive to this. %dnl %global debug_package %{nil} %define fname OpenUSD %define pkgname openusd %define libmajor 0 %define libname %mklibname usd %{libmajor} %define develname %mklibname usd -d %define staticdevname %mklibname usd -d -s %define oslapi 1.14 %define spirvreflectver 1.4.321.0 %bcond_without alembic %bcond_without embree %bcond_without jemalloc %bcond_without hdf5 %bcond_with materialx %bcond_without ninja # only cycles uses OSL in blender %bcond_with openshading %bcond_without openvdb %bcond_without opencolorio %bcond_without openimageio %if %{mgaversion} >= 10 %bcond_without ptex %else %bcond_with ptex %endif %bcond_with usdview %if %{mgaversion} >= 10 %bcond_without vulkan %else %bcond_with vulkan %endif %bcond_without draft %if %{with draft} # Speed-up package building %global _binary_payload w7T0.zstdio # Disable dwz debug optimization to speed-up building %define _find_debuginfo_dwz_opts %{nil} %endif Name: %{pkgname} Version: 25.02 Release: %mkrel 2.11 Summary: A scalable system for authoring, reading, and streaming time-sampled 3D scene description Group: Graphics/3D License: ASL 2.0 URL: https://openusd.org Source: https://github.com/PixarAnimationStudios/OpenUSD/archive/v%{version}/%{fname}-%{version}.tar.gz # Source1: org.openusd.usdview.desktop # https://github.com/KhronosGroup/SPIRV-Reflect Source2: SPIRV-Reflect-vulkan-sdk-%{spirvreflectver}.tar.gz # # from git upstream # https://github.com/PixarAnimationStudios/OpenUSD/ Patch011: 0001-Fix-one-reference-to-mx-Type-VECTOR2-which-changed-t.patch Patch012: 0002-This-change-addresses-a-crash-that-resulted-when-add.patch Patch013: 0003-Add-ZLIB-to-requiredDependencies-if-HDF5-is-enabled.patch Patch014: 0004-This-change-fixes-a-coding-error-that-is-triggered-w.patch # https://github.com/PixarAnimationStudios/OpenUSD/pull/3392 Patch101: USD-25.02-work_account_for_task_group_base_interface_cange_in_oneTBB_2022.0.0.patch # Patch102: USD_25.02-Add-missing-include-cstdint.patch # from blender # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd.diff Patch200: usd.patch # https://github.com/PixarAnimationStudios/OpenUSD/pull/2550 # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_core_profile.diff Patch201: usd_core_profile.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_ctor.diff Patch202: usd_ctor.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_3243.diff Patch203: usd_3243.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_forward_compat.diff Patch204: usd_forward_compat.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_noboost.diff Patch205: usd_noboost.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_no_vulkan_sdk.diff Patch206: usd_no_vulkan_sdk_p1.patch Patch207: usd_no_vulkan_sdk_p2.patch # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_storm_vulkan.diff Patch208: usd_storm_vulkan.diff # https://projects.blender.org/blender/blender/src/commit/bd3228d3684ada01450c315e72d577bcfbd104ed/build_files/build_environment/patches/usd_3666_vulkan_amd.diff Patch209: usd_3666_vulkan_amd.diff # From FC # port to embree4 # https://github.com/PixarAnimationStudios/OpenUSD/pull/2266 # See also: # https://github.com/PixarAnimationStudios/USD/pull/2313 Patch300: 2266.patch # # https://github.com/PixarAnimationStudios/USD/issues/1259#issuecomment-657120216 # See also https://github.com/PixarAnimationStudios/USD/issues/1387 # Patch301: 0001-Downstream-only-add-an-SONAME-version.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: git-core %if %{with ninja} BuildRequires: ninja-build %endif BuildRequires: dos2unix BuildRequires: help2man BuildRequires: pkgconfig(blosc) BuildRequires: pkgconfig(dri) %if %{with hdf5} BuildRequires: hdf5-devel BuildRequires: pkgconfig(zlib) %endif BuildRequires: pkgconfig(tbb) BuildRequires: cmake(Imath) >= 3.0 %if %{with alembic} BuildRequires: cmake(Alembic) %endif %if %{with embree} BuildRequires: embree4-devel %endif %if %{with jemalloc} BuildRequires: pkgconfig(jemalloc) %endif %if %{with opencolorio} BuildRequires: pkgconfig(OpenColorIO) %endif %if %{with openimageio} BuildRequires: cmake(OpenImageIO) %endif %if %{with openshading} BuildRequires: openshadinglanguage%{oslapi} BuildRequires: libopenshadinglanguage%{oslapi}-devel %endif BuildRequires: opensubdiv-devel %if %{with openvdb} BuildRequires: openvdb-devel %endif %if %{with ptex} BuildRequires: pkgconfig(ptex) %endif # python3 BuildRequires: pkgconfig(python3) BuildRequires: python3dist(jinja2) # python3 with usdbiew %if %{with usdview} #BuildRequires: python3-pyside6-core BuildRequires: python3dist(pyopengl) BuildRequires: python3dist(pyside6) BuildRequires: pyside6-tools %endif %if %{with vulkan} BuildRequires: pkgconfig(vulkan) BuildRequires: cmake(VulkanHeaders) BuildRequires: cmake(VulkanMemoryAllocator) BuildRequires: cmake(VulkanUtilityLibraries) BuildRequires: pkgconfig(shaderc) # todo: package SPIRV-Reflect %endif Requires: python3-usd = %{version}-%{release} # 32-bit is not supported ExclusiveArch: x86_64 aarch64 %description Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. %package -n %{libname} Summary: A collection of high-performance ray tracing kernels Group: System/Libraries %description -n %{libname} Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. This package contains the library needed to run programs dynamically linked with USD. %package -n %{develname} Summary: Headers and development files of the openusd library Group: Development/C Requires: %{libname} = %{version}-%{release} Provides: usd-devel = %{version}-%{release} %description -n %{develname} Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. Development files for the openusd library. Install this package if you want to compile applications using the usd library. %package -n %{staticdevname} Summary: Headers and development files of the openusd library Group: Development/C Requires: %{libname} = %{version}-%{release} Provides: usd-devel = %{version}-%{release} %description -n %{staticdevname} Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications. Development files for the openusd library. Install this package if you want to compile applications using the usd library. %package -n python3-usd Summary: %{summary} Requires: python3dist(jinja2) %py_provides python-pxr %if %{with usdview} Requires: python3dist(pyside6) Requires: python3dist(pyopengl) %endif Requires: font(roboto) Requires: font(robotoblack) Requires: font(robotolight) # this seems missed in distro #Requires: font(robotomono) %description -n python3-usd Python language bindings for the Universal Scene Description (USD) C++ API. %prep %autosetup -p1 -n %{fname}-%{version} -a 2 -S git # Convert NOTICE.txt from CRNL line encoding dos2unix NOTICE.txt # Fix all Python shebangs recursively in . %py3_shebang_fix . # Fix libdir installation sed -i 's|lib/usd|%{_libdir}/usd|g' \ cmake/macros/{Private,Public}.cmake sed -i 's|plugin/usd|%{_libdir}/usd/plugin|g' \ cmake/macros/{Private,Public}.cmake sed -i 's|"lib"|%{_libdir}|g' \ cmake/macros/{Private,Public}.cmake sed -i 's|/python|/python%{python3_version}/site-packages|g' \ cmake/macros/{Private,Public}.cmake pxr/usdImaging/usdviewq/CMakeLists.txt sed -i 's|/pxrConfig.cmake|%{_libdir}/cmake/pxr/pxrConfig.cmake|g' \ pxr/CMakeLists.txt sed -i 's|"cmake"|"%{_libdir}/cmake/pxr"|g' \ pxr/CMakeLists.txt sed -i 's|${PXR_CMAKE_DIR}/cmake|${PXR_CMAKE_DIR}|g' \ pxr/pxrConfig.cmake.in sed -i 's|${PXR_CMAKE_DIR}/include|/usr/include|g' \ pxr/pxrConfig.cmake.in sed -i 's|EXACT COMPONENTS|COMPONENTS|g' \ pxr/pxrConfig.cmake.in # Fix cmake directory destination sed -i 's|"${CMAKE_INSTALL_PREFIX}"|%{_libdir}/cmake/pxr|g' pxr/CMakeLists.txt # fix embree3 to embree4 file patterns. find . -type f -exec gawk '/embree3/ { print FILENAME }' '{}' '+' | xargs -r sed -r -i 's/(embree)3/\14/' %build # build SPIRV-Reflect pushd SPIRV-Reflect-vulkan-sdk-%{spirvreflectver} %cmake -DSPIRV_REFLECT_STATIC_LIB=ON %cmake_build DESTDIR=../../SPIRV-Reflect_installed make install -C build popd %cmake \ %if %{with ninja} -G Ninja \ %endif %if %{with alembic} -DPXR_BUILD_ALEMBIC_PLUGIN:BOOL=ON \ %else -DPXR_BUILD_ALEMBIC_PLUGIN:BOOL=OFF \ %endif %if %{with embree} -DPXR_BUILD_EMBREE_PLUGIN:BOOL=ON \ %endif -DPXR_BUILD_EXAMPLES:BOOL=OFF \ -DPXR_BUILD_HTML_DOCUMENTATION:BOOL=OFF \ -DPXR_BUILD_IMAGING:BOOL=ON \ %if %{with jemalloc} -DPXR_MALLOC_LIBRARY="%{_libdir}/libjemalloc.so" \ %endif -DPXR_BUILD_MONOLITHIC:BOOL=ON \ %if %{with openimageio} -DPXR_BUILD_OPENIMAGEIO_PLUGIN:BOOL=ON \ %else -DPXR_BUILD_OPENIMAGEIO_PLUGIN:BOOL=OFF \ %endif %if %{with opencolorio} -DPXR_BUILD_OPENCOLORIO_PLUGIN:BOOL=ON \ %else -DPXR_BUILD_OPENCOLORIO_PLUGIN:BOOL=OFF \ %endif -DPXR_BUILD_TESTS:BOOL=OFF \ -DPXR_BUILD_TUTORIALS:BOOL=OFF \ -DPXR_BUILD_USD_TOOLS:BOOL=ON \ %if %{with usdview} -DPXR_BUILD_USDVIEW:BOOL=ON \ %else -DPXR_BUILD_USDVIEW:BOOL=OFF \ %endif -DPXR_ENABLE_GL_SUPPORT:BOOL=ON \ %if %{with hdf5} -DPXR_ENABLE_HDF5_SUPPORT:BOOL=ON \ %else -DPXR_ENABLE_HDF5_SUPPORT:BOOL=OFF \ %endif %if %{with materialx} -DPXR_ENABLE_MATERIALX_SUPPORT:BOOL=ON \ %else -DPXR_ENABLE_MATERIALX_SUPPORT:BOOL=OFF \ %endif %if %{with openvdb} -DPXR_ENABLE_OPENVDB_SUPPORT:BOOL=ON \ %endif %if %{with openshading} -DPXR_ENABLE_OSL_SUPPORT:BOOL=ON \ %else -DPXR_ENABLE_OSL_SUPPORT:BOOL=OFF \ %endif %if %{with ptex} -DPXR_ENABLE_PTEX_SUPPORT:BOOL=ON \ %else -DPXR_ENABLE_PTEX_SUPPORT:BOOL=OFF \ %endif -DPXR_SET_INTERNAL_NAMESPACE:STRING="pxrBlender" \ -DTBB_tbb_LIBRARY="%{_libdir}/libtbb.so" \ -DTBB_LIBRARIES="%{_libdir}/libtbb.so" \ -DTBB_LIBRARIES_DEBUG="%{_libdir}/libtbb.so" \ -DTBB_LIBRARIES_RELEASE="%{_libdir}/libtbb.so" \ -DPXR_INSTALL_LOCATION="%{_libdir}/usd_%{libmajor}/plugin" \ -DPXR_VALIDATE_GENERATED_CODE=OFF \ %if %{with vulkan} -DPXR_ENABLE_VULKAN_SUPPORT=ON \ -Dshaderc_combined_LIBRARY:FILEPATH=%{_libdir}/libshaderc_shared.so \ -Dspirv-reflect_INCLUDE_DIR:PATH=$(pwd)/SPIRV-Reflect_installed/usr/include/ \ -Dspirv-reflect_LIBRARY:FILEPATH=$(pwd)/SPIRV-Reflect_installed/usr/lib/libspirv-reflect-static.a \ %endif \ -DPXR_ENABLE_PYTHON_SUPPORT:BOOL=ON \ -DPYTHON_EXECUTABLE=%{python3} \ -DPYSIDE_AVAILABLE=ON \ -DPYSIDEUICBINARY:PATH=%{_bindir}/pyside6-uic %cmake_build # preserve static lib cp -p ./build/pxr/libusd_m.a ./ %install %cmake_install if [ ! -e %{buildroot}%{_libdir}/libusd_m.a ]; then install -m 644 ./libusd_m.a %{buildroot}%{_libdir}/ fi # Fix python3 files installation mkdir -p %{buildroot}%{python3_sitearch} mv %{buildroot}%{python3_sitelib}/* %{buildroot}%{python3_sitearch} %if %{with usdview} # Install a desktop icon for usdview desktop-file-install \ --dir=%{buildroot}%{_datadir}/applications \ %{SOURCE1} %endif # Little hack until this issue is resolved # https://github.com/PixarAnimationStudios/OpenUSD/issues/3310 sed -i 's|OpenGL::GL|${OPENGL_gl_LIBRARY}|g' \ %{buildroot}%{_libdir}/cmake/pxr/pxrTargets.cmake # Generate and install man pages. install -d '%{buildroot}%{_mandir}/man1' for cmd in %{buildroot}%{_bindir}/* do PYTHONPATH='%{buildroot}%{python3_sitearch}' \ LD_LIBRARY_PATH='%{buildroot}%{_libdir}' \ help2man \ --no-info --no-discard-stderr --version-string='%{version}' \ --output="%{buildroot}%{_mandir}/man1/$(basename "${cmd}").1" \ "${cmd}" done %check #ctest %files -n %{libname} %license LICENSE.txt %doc NOTICE.txt README.md %{_libdir}/lib*.so.%{libmajor}{,.*} # these are not -devel packages, but used as data templates by the main lib %{_libdir}/usd/ %files -n %{develname} %doc BUILDING.md CHANGELOG.md VERSIONS.md %{_includedir}/pxr/ %{_libdir}/lib*.so %{_libdir}/cmake/pxr/*.cmake %files -n %{staticdevname} %{_libdir}/lib*.a %files %doc NOTICE.txt README.md %{_bindir}/* %{_mandir}/man1/*.1* %files -n python3-usd %{python3_sitearch}/pxr/