From 5084bed9de00d6a8c1399419f13abee888e42819 Mon Sep 17 00:00:00 2001 From: Luya Tshimbalanga Date: Mon, 2 Jan 2023 16:24:42 -0800 Subject: [PATCH 01/20] Rebuild for openvdb 10.0.1 From 775ace756847ef23531d27010e0bfa8bba0aa010 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 29 Jan 2023 18:21:54 -0500 Subject: [PATCH 02/20] Fix patch to work with stb_image 2.28 --- stb_image.patch | 155 ++++++++++++++++++++++++++++++++++++++++++++++++ usd.spec | 20 +++++-- 2 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 stb_image.patch diff --git a/stb_image.patch b/stb_image.patch new file mode 100644 index 0000000..a8a3a30 --- /dev/null +++ b/stb_image.patch @@ -0,0 +1,155 @@ +--- stb/stb_image.h 2021-09-16 11:52:38.284782000 -0700k ++++ stb_image.h 2021-09-16 13:45:48.159770000 -0700 +@@ -488,14 +488,14 @@ + STBIDEF void stbi_image_free (void *retval_from_stbi_load); + + // get image dimensions & components without fully decoding +-STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); +-STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp); ++STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, float *gamma); ++STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, float *gamma); + STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len); + STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user); + + #ifndef STBI_NO_STDIO +-STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp); +-STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); ++STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp, float *gamma); ++STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp, float *gamma); + STBIDEF int stbi_is_16_bit (char const *filename); + STBIDEF int stbi_is_16_bit_from_file(FILE *f); + #endif +@@ -911,7 +911,7 @@ + #ifndef STBI_NO_PNG + static int stbi__png_test(stbi__context *s); + static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +-static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp); ++static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp, float *gamma); + static int stbi__png_is16(stbi__context *s); + #endif + +@@ -4554,6 +4554,7 @@ + stbi__context *s; + stbi_uc *idata, *expanded, *out; + int depth; ++ float gamma = 0; + } stbi__png; + + +@@ -5112,6 +5113,13 @@ + break; + } + ++ case STBI__PNG_TYPE('g','A','M','A'): { ++ if (first) return stbi__err("first not IHDR", "Corrupt PNG"); ++ if (4 != c.length) return stbi__err("invalid gAMA","Corrupt PNG"); ++ z->gamma = stbi__get32be(s) / 100000.0f; ++ break; ++ } ++ + case STBI__PNG_TYPE('I','D','A','T'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG"); +@@ -5243,7 +5251,7 @@ + return r; + } + +-static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) ++static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp, float *gamma) + { + if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) { + stbi__rewind( p->s ); +@@ -5252,21 +5260,22 @@ + if (x) *x = p->s->img_x; + if (y) *y = p->s->img_y; + if (comp) *comp = p->s->img_n; ++ if (gamma) *gamma = p->gamma; + return 1; + } + +-static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) ++static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp, float *gamma) + { + stbi__png p; + p.s = s; +- return stbi__png_info_raw(&p, x, y, comp); ++ return stbi__png_info_raw(&p, x, y, comp, gamma); + } + + static int stbi__png_is16(stbi__context *s) + { + stbi__png p; + p.s = s; +- if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) ++ if (!stbi__png_info_raw(&p, NULL, NULL, NULL, NULL)) + return 0; + if (p.depth != 16) { + stbi__rewind(p.s); +@@ -7538,14 +7547,14 @@ + } + #endif + +-static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) ++static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp, float *gamma) + { + #ifndef STBI_NO_JPEG + if (stbi__jpeg_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PNG +- if (stbi__png_info(s, x, y, comp)) return 1; ++ if (stbi__png_info(s, x, y, comp, gamma)) return 1; + #endif + + #ifndef STBI_NO_GIF +@@ -7597,23 +7606,23 @@ + } + + #ifndef STBI_NO_STDIO +-STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) ++STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp, float *gamma) + { + FILE *f = stbi__fopen(filename, "rb"); + int result; + if (!f) return stbi__err("can't fopen", "Unable to open file"); +- result = stbi_info_from_file(f, x, y, comp); ++ result = stbi_info_from_file(f, x, y, comp, gamma); + fclose(f); + return result; + } + +-STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) ++STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp, float *gamma) + { + int r; + stbi__context s; + long pos = ftell(f); + stbi__start_file(&s, f); +- r = stbi__info_main(&s,x,y,comp); ++ r = stbi__info_main(&s,x,y,comp, gamma); + fseek(f,pos,SEEK_SET); + return r; + } +@@ -7640,18 +7649,18 @@ + } + #endif // !STBI_NO_STDIO + +-STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp) ++STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, float *gamma) + { + stbi__context s; + stbi__start_mem(&s,buffer,len); +- return stbi__info_main(&s,x,y,comp); ++ return stbi__info_main(&s,x,y,comp, gamma); + } + +-STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp) ++STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp, float *gamma) + { + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); +- return stbi__info_main(&s,x,y,comp); ++ return stbi__info_main(&s,x,y,comp, gamma); + } + + STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len) diff --git a/usd.spec b/usd.spec index 3da41cb..9f2c6b2 100644 --- a/usd.spec +++ b/usd.spec @@ -56,6 +56,13 @@ URL: http://www.openusd.org/ %global forgeurl https://github.com/PixarAnimationStudios/%{name} Source0: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: org.open%{name}.%{name}view.desktop +# Latest stb_image.patch that applies cleanly against 2.27: +# %%{forgeurl}/raw/8f9bb9563980b41e7695148b63bf09f7abd38a41/pxr/imaging/hio/stb/stb_image.patch +# We treat this as a source file because it is applied separately during +# unbundling. It has been hand-edited to apply to 2.28, where +# stbi__unpremultiply_on_load_thread is already renamed to +# stbi_set_unpremultiply_on_load_thread. +Source2: stb_image.patch # Upstream was asked about .so versioning and setting SONAME properly and # seemed unprepared to handle the request: @@ -160,11 +167,11 @@ BuildRequires: hdf5-devel # # stb_image 2.27^20210910gitaf1a5bc-0.2 is the minimum EVR to contain fixes for # all of CVE-2021-28021, CVE-2021-42715, CVE-2021-42716, and CVE-2022-28041. -BuildRequires: stb_image-devel >= 2.27^20210910gitaf1a5bc-0.2 +BuildRequires: stb_image-devel >= 2.28 BuildRequires: stb_image-static -BuildRequires: stb_image_write-devel +BuildRequires: stb_image_write-devel >= 1.16 BuildRequires: stb_image_write-static -BuildRequires: stb_image_resize-devel +BuildRequires: stb_image_resize-devel >= 0.97 BuildRequires: stb_image_resize-static Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -288,9 +295,10 @@ ln -s %{_datadir}/fonts/google-roboto-mono \ # Unbundle stb_image, stb_image_write, stb_image_resize: pushd pxr/imaging/hio/stb -cp -p %{_includedir}/stb_image.h %{_includedir}/stb_image_write.h . -cat stb_image.patch stb_image_write.patch | patch -p1 -ln -svf %{_includedir}/stb_image_resize.h ./ +cp -p %{_includedir}/stb_image.h . +patch -p1 < '%{SOURCE2}' +ln -svf %{_includedir}/stb_image_resize.h \ + %{_includedir}/stb_image_write.h ./ popd # Use c++17 standard otherwise build fails From fec1893bb0c98fc8a878223bb0da98008d457bf1 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Feb 2023 18:37:09 -0500 Subject: [PATCH 03/20] Update minimum stb_image versions Ensure we have a fix for null pointer dereference bug https://github.com/nothings/stb/issues/1452. --- usd.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usd.spec b/usd.spec index 9f2c6b2..be8d581 100644 --- a/usd.spec +++ b/usd.spec @@ -165,9 +165,10 @@ BuildRequires: hdf5-devel # Header-only library: -static is for tracking per guidelines # -# stb_image 2.27^20210910gitaf1a5bc-0.2 is the minimum EVR to contain fixes for -# all of CVE-2021-28021, CVE-2021-42715, CVE-2021-42716, and CVE-2022-28041. -BuildRequires: stb_image-devel >= 2.28 +# Enforce the the minimum EVR to contain fixes for all of CVE-2021-28021, +# CVE-2021-42715, CVE-2021-42716, and CVE-2022-28041, plus the null-pointer +# dereference bug https://github.com/nothings/stb/issues/1452. +BuildRequires: stb_image-devel >= 2.28^20230129git5736b15-0.2 BuildRequires: stb_image-static BuildRequires: stb_image_write-devel >= 1.16 BuildRequires: stb_image_write-static From 21e907dd816a74f2d5593e1d045033b69a0d430a Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 20 Mar 2023 10:32:11 -0400 Subject: [PATCH 04/20] Drop manual dependency on cmake-filesystem, now automatic --- usd.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/usd.spec b/usd.spec index be8d581..4a84154 100644 --- a/usd.spec +++ b/usd.spec @@ -226,7 +226,6 @@ interchange between graphics applications. %package devel Summary: Development files for USD -Requires: cmake-filesystem Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel From ccf37b0ee20e86002e31b62e59a6d9c1768d4a28 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 20 Mar 2023 10:32:29 -0400 Subject: [PATCH 05/20] Re-enable OpenShadingLanguage and OpenVDB support --- usd.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usd.spec b/usd.spec index 4a84154..690f5e8 100644 --- a/usd.spec +++ b/usd.spec @@ -9,8 +9,8 @@ %bcond_without embree %bcond_without imaging %bcond_with jemalloc -%bcond_with openshading -%bcond_with openvdb +%bcond_without openshading +%bcond_without openvdb %bcond_without ocio %bcond_without oiio %bcond_without python3 From 3bd2fd5d8ffff132a93e41a7e93af7b66842ec8d Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 17 Apr 2023 10:11:01 -0400 Subject: [PATCH 06/20] Build with the draco plugin --- usd.spec | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/usd.spec b/usd.spec index 690f5e8..7a8bd23 100644 --- a/usd.spec +++ b/usd.spec @@ -6,6 +6,7 @@ %bcond_without alembic %bcond_with documentation +%bcond_without draco %bcond_without embree %bcond_without imaging %bcond_with jemalloc @@ -128,6 +129,10 @@ BuildRequires: graphviz # For imaging and usd imaging %if %{with imaging} + +%if %{with draco} +BuildRequires: draco-devel +%endif %if %{with embree} BuildRequires: embree-devel %endif @@ -233,7 +238,7 @@ This package contains the C++ header files and symbolic links to the shared libraries for %{name}. If you would like to develop programs using %{name}, you will need to install %{name}-devel. -# For usdview +# For usdview, usdcompress %if %{with python3} %package -n python3-%{name} Summary: %{summary} @@ -363,6 +368,9 @@ flags="${flags} $(pkgconf --cflags Imath)" -DOPENEXR_LOCATION=%{_includedir} \ -DPXR_BUILD_ALEMBIC_PLUGIN=ON \ %endif +%if %{with draco} + -DPXR_BUILD_DRACO_PLUGIN=ON \ +%endif %if %{with embree} -DPXR_BUILD_EMBREE_PLUGIN=ON \ -DEMBREE_LOCATION=%{_prefix} \ @@ -448,7 +456,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %if %{with python3} %files -n python3-%{name} -%{python3_sitearch}/pxr +%{python3_sitearch}/pxr/ +%if %{with draco} +%{_bindir}/usdcompress +%endif %if %{with usdview} %{_datadir}/applications/org.open%{name}.%{name}view.desktop %{_bindir}/testusdview From 6708320517e071d17b6cb4c53009400f3ea7df5c Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 17 Apr 2023 10:51:14 -0400 Subject: [PATCH 07/20] Stop conditionalizing Python --- usd.spec | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/usd.spec b/usd.spec index 7a8bd23..d2b97d0 100644 --- a/usd.spec +++ b/usd.spec @@ -14,7 +14,6 @@ %bcond_without openvdb %bcond_without ocio %bcond_without oiio -%bcond_without python3 %bcond_without usdview # TODO: Figure out how to re-enable the tests. Currently these want to install # into /usr/tests and, and there are issues with the launchers finding the @@ -181,9 +180,7 @@ BuildRequires: stb_image_resize-devel >= 0.97 BuildRequires: stb_image_resize-static Requires: %{name}-libs%{?_isa} = %{version}-%{release} -%if %{with python3} Requires: python3-%{name}%{?_isa} = %{version}-%{release} -%endif # This package is only available for x86_64 and aarch64 # Will fail to build on other architectures @@ -239,7 +236,6 @@ libraries for %{name}. If you would like to develop programs using %{name}, you will need to install %{name}-devel. # For usdview, usdcompress -%if %{with python3} %package -n python3-%{name} Summary: %{summary} @@ -264,7 +260,7 @@ Requires: python3dist(pyopengl) %description -n python3-%{name} Python language bindings for the Universal Scene Description (USD) C++ API -%endif + %if %{with documentation} %package doc @@ -281,10 +277,8 @@ Documentation for the Universal Scene Description (USD) C++ API # Convert NOTICE.txt from CRNL line encoding dos2unix NOTICE.txt -%if %{with python3} # Fix all Python shebangs recursively in . %py3_shebang_fix . -%endif # Further drop shebangs line for some py files sed -r -i '1{/^#!/d}' \ @@ -333,9 +327,6 @@ exec uic-qt5 -g python "$@" EOF chmod +x uic-wrapper -# Fix python3 support -# https://github.com/PixarAnimationStudios/USD/issues/1419 - flags="%{optflags} -Wl,--as-needed -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1" \ # Patch2 was not good enough to get the include path for Imath everywhere it # was needed. Add it globally. @@ -385,13 +376,9 @@ flags="${flags} $(pkgconf --cflags Imath)" -DPXR_ENABLE_OSL_SUPPORT=ON \ %endif -DPYTHON_EXECUTABLE=%{python3} \ -%if %{with python3} -DPXR_USE_PYTHON_3=ON \ -DPYSIDE_AVAILABLE=ON \ -DPYSIDEUICBINARY:PATH=${PWD}/uic-wrapper \ -%else - -DPXR_ENABLE_PYTHON_SUPPORT=OFF \ -%endif -DPXR_BUILD_MONOLITHIC=ON \ -DPXR_ENABLE_MALLOCHOOK_SUPPORT=OFF %cmake_build @@ -454,7 +441,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %{_bindir}/usdtree %{_bindir}/usdzip -%if %{with python3} %files -n python3-%{name} %{python3_sitearch}/pxr/ %if %{with draco} @@ -465,7 +451,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %{_bindir}/testusdview %{_bindir}/usdview %endif -%endif %files libs %license LICENSE.txt From 72c3d34dac4d285c86c0dc69b05c936b89b8f738 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 21 Apr 2023 08:43:54 -0400 Subject: [PATCH 08/20] Be more explicit that we are on OpenEXR/Imath 3 --- usd.spec | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/usd.spec b/usd.spec index d2b97d0..2eefa2a 100644 --- a/usd.spec +++ b/usd.spec @@ -154,12 +154,8 @@ BuildRequires: pkgconfig(OpenColorIO) < 2 %if %{with oiio} BuildRequires: pkgconfig(OpenImageIO) %endif -BuildRequires: cmake(OpenEXR) -%if 0%{?fedora} < 35 -BuildRequires: pkgconfig(IlmBase) >= 2.0 -%else -BuildRequires: cmake(Imath) >= 2.0 -%endif +BuildRequires: cmake(OpenEXR) >= 3.0 +BuildRequires: cmake(Imath) >= 3.0 BuildRequires: pkgconfig(Ptex) %endif %if %{with alembic} From f0cc08bac8d859db90af2f5bb584567ea28a6df8 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 21 Apr 2023 08:44:27 -0400 Subject: [PATCH 09/20] Slightly improve handling of compiler/linker flags --- usd.spec | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/usd.spec b/usd.spec index 2eefa2a..4173997 100644 --- a/usd.spec +++ b/usd.spec @@ -316,6 +316,8 @@ sed -i 's|plugin/usd|%{_libdir}/usd/plugin|g' \ sed -i 's|"${CMAKE_INSTALL_PREFIX}"|%{_libdir}/cmake/pxr|g' pxr/CMakeLists.txt %build +%set_build_flags + # Fix uic-qt5 use cat > uic-wrapper <<'EOF' #!/bin/sh @@ -323,17 +325,20 @@ exec uic-qt5 -g python "$@" EOF chmod +x uic-wrapper -flags="%{optflags} -Wl,--as-needed -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1" \ -# Patch2 was not good enough to get the include path for Imath everywhere it -# was needed. Add it globally. -# https://github.com/PixarAnimationStudios/USD/issues/1591 -flags="${flags} $(pkgconf --cflags Imath)" +# Although upstream supports OpenEXR3 / Imath now, the necessary include path +# is not set everywhere it’s needed. It’s not immediately clear exactly why +# this is happening here or what should be changed upstream. +extra_flags="${extra_flags-} $(pkgconf --cflags Imath)" +# Suppress deprecation warnings from TBB; upstream should act on them +# eventually, but they just add noise here. +extra_flags="${extra_flags-} -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1" %cmake \ - -DCMAKE_CXX_FLAGS_RELEASE="${flags}" \ - -DCMAKE_C_FLAGS_RELEASE="${flags}" \ + -DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS-} ${extra_flags}" \ + -DCMAKE_C_FLAGS_RELEASE="${CFLAGS-} ${extra_flags}" \ -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_EXE_LINKER_FLAGS="-pie" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \ + -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=ON \ From 0e192c5c63bcdc932898a58c19ed6b14ddc2e7b2 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 21 Apr 2023 09:51:47 -0400 Subject: [PATCH 10/20] Write the uic-wrapper script in prep, not build --- usd.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usd.spec b/usd.spec index 4173997..d7b9a90 100644 --- a/usd.spec +++ b/usd.spec @@ -315,9 +315,6 @@ sed -i 's|plugin/usd|%{_libdir}/usd/plugin|g' \ # Fix cmake directory destination sed -i 's|"${CMAKE_INSTALL_PREFIX}"|%{_libdir}/cmake/pxr|g' pxr/CMakeLists.txt -%build -%set_build_flags - # Fix uic-qt5 use cat > uic-wrapper <<'EOF' #!/bin/sh @@ -325,6 +322,10 @@ exec uic-qt5 -g python "$@" EOF chmod +x uic-wrapper + +%build +%set_build_flags + # Although upstream supports OpenEXR3 / Imath now, the necessary include path # is not set everywhere it’s needed. It’s not immediately clear exactly why # this is happening here or what should be changed upstream. From 55f4734f33d1b790fd6292176d63f57ea5ab8f88 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 17 Apr 2023 10:54:20 -0400 Subject: [PATCH 11/20] Put all the tools and apps in the base package They were not correctly sorted between Python and non-Python anyway. --- usd.spec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usd.spec b/usd.spec index d7b9a90..11541c0 100644 --- a/usd.spec +++ b/usd.spec @@ -432,6 +432,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %{_bindir}/usdGenSchema %{_bindir}/usdcat %{_bindir}/usdchecker +%if %{with draco} +%{_bindir}/usdcompress +%endif %{_bindir}/usddiff %{_bindir}/usddumpcrate %{_bindir}/usdedit @@ -442,18 +445,15 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %{_bindir}/usdstitchclips %{_bindir}/usdtree %{_bindir}/usdzip - -%files -n python3-%{name} -%{python3_sitearch}/pxr/ -%if %{with draco} -%{_bindir}/usdcompress -%endif %if %{with usdview} %{_datadir}/applications/org.open%{name}.%{name}view.desktop %{_bindir}/testusdview %{_bindir}/usdview %endif +%files -n python3-%{name} +%{python3_sitearch}/pxr/ + %files libs %license LICENSE.txt %doc NOTICE.txt README.md From c54ae0b451321603f30764187d388af574f29a19 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 22 Apr 2023 15:03:52 -0400 Subject: [PATCH 12/20] Add generated man pages These are slightly sloppy in places. For example, there is a warning from _DiscoverPlugins mixed into some of them. However, they are of mostly-good quality, are perfectly usable, and are much better than nothing. --- usd.spec | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/usd.spec b/usd.spec index 11541c0..49f14b2 100644 --- a/usd.spec +++ b/usd.spec @@ -112,11 +112,16 @@ Patch: %{forgeurl}/pull/1830.patch Patch: %{forgeurl}/pull/1928.patch # Base +BuildRequires: gcc-c++ + +BuildRequires: cmake + +BuildRequires: dos2unix +BuildRequires: help2man + +BuildRequires: pkgconfig(blosc) BuildRequires: boost-devel BuildRequires: boost-program-options -BuildRequires: cmake -BuildRequires: dos2unix -BuildRequires: gcc-c++ BuildRequires: pkgconfig(blosc) BuildRequires: pkgconfig(tbb) @@ -419,6 +424,21 @@ mv %{buildroot}%{_prefix}/lib/python/pxr/Usdviewq/* \ # https://github.com/PixarAnimationStudios/USD/issues/1088 rm -vrf '%{buildroot}%{_libdir}/cmake' +# Generate and install man pages. While generating the man pages might more +# properly go in %%build, it is generally much easier to do this here in a +# single step, using the entry points installed into the buildroot. This is +# especially true for the entry points that are Python scripts. +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 %if %{with usdview} desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{name}view.desktop @@ -427,6 +447,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %files %doc NOTICE.txt README.md + %{_bindir}/sdfdump %{_bindir}/sdffilter %{_bindir}/usdGenSchema @@ -451,6 +472,29 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %{_bindir}/usdview %endif +%{_mandir}/man1/sdfdump.1* +%{_mandir}/man1/sdffilter.1* +%{_mandir}/man1/usdGenSchema.1* +%{_mandir}/man1/usdcat.1* +%{_mandir}/man1/usdchecker.1* +%if %{with draco} +%{_mandir}/man1/usdcompress.1* +%endif +%{_mandir}/man1/usddiff.1* +%{_mandir}/man1/usddumpcrate.1* +%{_mandir}/man1/usdedit.1* +%{_mandir}/man1/usdgenschemafromsdr.1* +%{_mandir}/man1/usdrecord.1* +%{_mandir}/man1/usdresolve.1* +%{_mandir}/man1/usdstitch.1* +%{_mandir}/man1/usdstitchclips.1* +%{_mandir}/man1/usdtree.1* +%{_mandir}/man1/usdzip.1* +%if %{with usdview} +%{_mandir}/man1/testusdview.1* +%{_mandir}/man1/usdview.1* +%endif + %files -n python3-%{name} %{python3_sitearch}/pxr/ From 73336472bf4f01eeb01761fb0c4d66d0c7a9e41b Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 24 Apr 2023 17:19:25 -0400 Subject: [PATCH 13/20] Move codegenTemplates from -devel to -libs While headers normally go in -devel packages, these headers and C++ source files are used as data templates for generated code, and it makes sense to package them with the rest of the library resources. --- usd.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usd.spec b/usd.spec index 49f14b2..44c40ed 100644 --- a/usd.spec +++ b/usd.spec @@ -502,14 +502,18 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %license LICENSE.txt %doc NOTICE.txt README.md %{_libdir}/lib%{name}_%{name}_ms.so.%{downstream_so_version} -%{_libdir}/%{name} -%exclude %{_libdir}/%{name}/%{name}/resources/codegenTemplates +# While headers normally go in -devel packages, those in +# %%{_libdir}/usd/usd/resources/codegenTemplates/ are used as data (templates +# for generated code), and it makes sense to package them with the rest of the +# library resources. (Technically, these are currently used only by the +# usdGenSchema command-line tool, so they could be moved to the base package, +# but this is probably too fussy.) +%{_libdir}/%{name}/ %files devel %doc BUILDING.md CHANGELOG.md VERSIONS.md %{_includedir}/pxr/ %{_libdir}/lib%{name}_%{name}_ms.so -%{_libdir}/%{name}/%{name}/resources/codegenTemplates/ %if %{with documentation} %files doc From f8e3dafaace3a66ab2aa642f7f501e8a5a91564a Mon Sep 17 00:00:00 2001 From: Luya Tshimbalanga Date: Sat, 6 May 2023 20:09:05 -0700 Subject: [PATCH 14/20] Symlink libusd_ms.so library This update includes symlink needed for Blender 3.5.1 --- usd.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usd.spec b/usd.spec index 44c40ed..6d5dac9 100644 --- a/usd.spec +++ b/usd.spec @@ -393,6 +393,10 @@ extra_flags="${extra_flags-} -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1" %install %cmake_install +# Blender 3.5.1 requires libusd_ms.so +ln -s %{_libdir}/lib%{name}_%{name}_ms.so \ + %{buildroot}%{_libdir}/lib%{name}_ms.so + # Fix python3 files installation mkdir -p %{buildroot}%{python3_sitearch} mv %{buildroot}%{python3_sitelib}/* %{buildroot}%{python3_sitearch} @@ -514,6 +518,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.open%{name}.%{nam %doc BUILDING.md CHANGELOG.md VERSIONS.md %{_includedir}/pxr/ %{_libdir}/lib%{name}_%{name}_ms.so +%{_libdir}/lib%{name}_ms.so %if %{with documentation} %files doc From 244bffe4e6487dbfc5e58af8ca173fd016acc081 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sun, 7 May 2023 08:26:41 -0400 Subject: [PATCH 15/20] Rebuild for draco 1.5.6 (close RHBZ#2203306) From 5ff2acbf1be41045549e7bfe2fec5d41e38f97c7 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 29 Nov 2022 16:51:06 -0500 Subject: [PATCH 16/20] Update License to SPDX --- usd.spec | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/usd.spec b/usd.spec index 6d5dac9..6ced584 100644 --- a/usd.spec +++ b/usd.spec @@ -25,12 +25,13 @@ Version: 22.05b Release: %autorelease -b 9 Summary: 3D VFX pipeline interchange file format -# The entire source is ASL 2.0 except: +# The entire source is Apache-2.0 except: # -# BSD: +# BSD-3-Clause: # - pxr/base/gf/ilmbase_* # - pxr/base/js/rapidjson/msinttypes/ # - pxr/base/tf/pxrDoubleConversion/ +# BSD-2-Clause: # - pxr/base/tf/pxrLZ4/ # MIT: # - pxr/imaging/garch/khrplatform.h @@ -38,20 +39,16 @@ Summary: 3D VFX pipeline interchange file format # - third_party/renderman-24/plugin/rmanArgsParser/pugixml/ # - pxr/base/tf/pxrTslRobinMap/ # - pxr/imaging/hgiVulkan/vk_mem_alloc.h -# MIT or Unlicense: +# MIT OR Unlicense: # - pxr/imaging/hio/stb/ -# -# (Certain build system files are also under licenses other than ASL 2.0, but -# do not contribute their license terms to the built RPMs.) -# -# The following files mention GPLv3+, but are distributed under ASL 2.0 due to -# the special exception for Bison parser skeletons. See the comments in their -# headers for details. -# +# Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2: # - pxr/usd/sdf/path.tab.{cpp,h} # - pxr/usd/sdf/textFileFormat.tab.{cpp,h} # - third_party/renderman-24/plugin/hdPrman/virtualStructConditionalGrammar.tab.{cpp,h} -License: ASL 2.0 and BSD and MIT and (MIT or Unlicense) +# +# (Certain build system files are also under licenses other than Apache-2.0, but +# do not contribute their license terms to the built RPMs.) +License: Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND (MIT OR Unlicense) AND (Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2) URL: http://www.openusd.org/ %global forgeurl https://github.com/PixarAnimationStudios/%{name} Source0: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz From 145487ddf11d8467d5c9ebc1f7388f6bfa5ddfb9 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 26 Oct 2023 06:57:42 -0400 Subject: [PATCH 17/20] Add versioned Requires on usd-libs from python3-usd --- usd.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usd.spec b/usd.spec index 6ced584..6325f49 100644 --- a/usd.spec +++ b/usd.spec @@ -254,6 +254,9 @@ Requires: python3dist(jinja2) Requires: python3dist(pyside2) %endif Requires: python3dist(pyopengl) + +Requires: usd-libs%{?_isa} = %{version}-%{release} + %py_provides python3-pxr %description -n python3-%{name} From 084872b62c94497e132dee1b3f877ac0e7b459c2 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 25 Oct 2023 12:24:09 -0400 Subject: [PATCH 18/20] Ensure stb_image contains the latest CVE patches --- usd.spec | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/usd.spec b/usd.spec index 6325f49..aecf934 100644 --- a/usd.spec +++ b/usd.spec @@ -167,10 +167,19 @@ BuildRequires: hdf5-devel # Header-only library: -static is for tracking per guidelines # -# Enforce the the minimum EVR to contain fixes for all of CVE-2021-28021, -# CVE-2021-42715, CVE-2021-42716, and CVE-2022-28041, plus the null-pointer -# dereference bug https://github.com/nothings/stb/issues/1452. -BuildRequires: stb_image-devel >= 2.28^20230129git5736b15-0.2 +# Enforce the the minimum EVR to contain fixes for all of: +# CVE-2021-28021 +# CVE-2021-42715 +# CVE-2021-42716 +# CVE-2022-28041 +# CVE-2023-43898 +# CVE-2023-45661 +# CVE-2023-45662 +# CVE-2023-45663 +# CVE-2023-45664 +# CVE-2023-45666 +# CVE-2023-45667 +BuildRequires: stb_image-devel >= 2.28^20231011gitbeebb24-12 BuildRequires: stb_image-static BuildRequires: stb_image_write-devel >= 1.16 BuildRequires: stb_image_write-static From 90bb66f821cc99549b6500661356311b082f9ddc Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 30 Oct 2023 07:24:43 -0400 Subject: [PATCH 19/20] Break a long line in the spec file [skip changelog] --- usd.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usd.spec b/usd.spec index aecf934..161bcc0 100644 --- a/usd.spec +++ b/usd.spec @@ -48,7 +48,14 @@ Summary: 3D VFX pipeline interchange file format # # (Certain build system files are also under licenses other than Apache-2.0, but # do not contribute their license terms to the built RPMs.) -License: Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND (MIT OR Unlicense) AND (Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2) +License: %{shrink: + Apache-2.0 AND + BSD-3-Clause AND + BSD-2-Clause AND + MIT AND + (MIT OR Unlicense) AND + (Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2) + } URL: http://www.openusd.org/ %global forgeurl https://github.com/PixarAnimationStudios/%{name} Source0: %{forgeurl}/archive/v%{version}/%{name}-%{version}.tar.gz From c7ee7db80be464e4a70c6848e13ddabaf6c98448 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 10 Nov 2023 07:51:48 -0500 Subject: [PATCH 20/20] =?UTF-8?q?Correct=20license=20to=20Pixar=20AND=20?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “Modified Apache 2.0” license is not really Apache 2.0. https://gitlab.com/fedora/legal/fedora-license-data/-/issues/304 https://github.com/spdx/license-list-XML/issues/2225 https://github.com/spdx/license-list-XML/pull/2247 --- usd.spec | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/usd.spec b/usd.spec index 161bcc0..8b59f46 100644 --- a/usd.spec +++ b/usd.spec @@ -25,8 +25,10 @@ Version: 22.05b Release: %autorelease -b 9 Summary: 3D VFX pipeline interchange file format -# The entire source is Apache-2.0 except: +# The entire source is Pixar except: # +# Apache-2.0: +# - pxr/imaging/hgiVulkan/spirv_reflect.{cpp,h} # BSD-3-Clause: # - pxr/base/gf/ilmbase_* # - pxr/base/js/rapidjson/msinttypes/ @@ -41,20 +43,31 @@ Summary: 3D VFX pipeline interchange file format # - pxr/imaging/hgiVulkan/vk_mem_alloc.h # MIT OR Unlicense: # - pxr/imaging/hio/stb/ -# Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2: +# Pixar AND GPL-3.0-or-later WITH Bison-exception-2.2: # - pxr/usd/sdf/path.tab.{cpp,h} # - pxr/usd/sdf/textFileFormat.tab.{cpp,h} # - third_party/renderman-24/plugin/hdPrman/virtualStructConditionalGrammar.tab.{cpp,h} # +# Additionally, the following would be listed above but are removed in %%prep: +# +# Apache-2.0: +# - pxr/usdImaging/usdviewq/fonts/Roboto_Mono/ +# - pxr/usdImaging/usdviewq/fonts/Roboto/ +# MIT: +# - docs/doxygen/doxygen-awesome-css/ (except doxygen-awesome-darkmode-toggle.js) +# MIT AND Apache-2.0: +# - docs/doxygen/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js +# # (Certain build system files are also under licenses other than Apache-2.0, but # do not contribute their license terms to the built RPMs.) License: %{shrink: + Pixar AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND (MIT OR Unlicense) AND - (Apache-2.0 AND GPL-3.0-or-later WITH Bison-exception-2.2) + (Pixar AND GPL-3.0-or-later WITH Bison-exception-2.2) } URL: http://www.openusd.org/ %global forgeurl https://github.com/PixarAnimationStudios/%{name}