+ .../files/patch-pxr_imaging_plugin_hioOiio_pch.h | 11 + misc/usd/files/patch-pxr_imaging_pxOsd_pch.h | 11 + .../files/patch-pxr_usdImaging_usdAppUtils_pch.h | 16 + .../files/patch-pxr_usdImaging_usdImagingGL_pch.h | 11 + .../files/patch-pxr_usdImaging_usdImaging_pch.h | 16 + .../patch-pxr_usdImaging_usdRiPxrImaging_pch.h | 11 + .../patch-pxr_usdImaging_usdSkelImaging_pch.h | 11 + .../files/patch-pxr_usdImaging_usdVolImaging_pch.h | 11 + misc/usd/files/patch-pxr_usdImaging_usdviewq_pch.h | 11 + misc/usd/files/patch-pxr_usd_ar_pch.h | 16 + misc/usd/files/patch-pxr_usd_pcp_pch.h | 11 + misc/usd/files/patch-pxr_usd_plugin_sdrOsl_pch.h | 11 + misc/usd/files/patch-pxr_usd_plugin_usdAbc_pch.h | 16 + misc/usd/files/patch-pxr_usd_plugin_usdDraco_pch.h | 11 + misc/usd/files/patch-pxr_usd_sdf_pch.h | 16 + misc/usd/files/patch-pxr_usd_sdr_pch.h | 16 + misc/usd/files/patch-pxr_usd_usdGeom_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdHydra_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdLux_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdMedia_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdPhysics_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdRender_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdRi_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdShade_pch.h | 16 + misc/usd/files/patch-pxr_usd_usdSkel_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdUI_pch.h | 11 + misc/usd/files/patch-pxr_usd_usdUtils_pch.h | 16 + misc/usd/files/patch-pxr_usd_usdVol_pch.h | 11 + misc/usd/files/patch-pxr_usd_usd_clip.cpp | 8 +- misc/usd/files/patch-pxr_usd_usd_pch.h | 16 + ..._party_renderman-26_plugin_rmanArgsParser_pch.h | 16 + misc/usd/pkg-plist | 1415 +++++++++++++++++++- 74 files changed, 2594 insertions(+), 91 deletions(-) diff --git a/misc/usd/Makefile b/misc/usd/Makefile index 366db3100207..b6fb8fda1cdb 100644 --- a/misc/usd/Makefile +++ b/misc/usd/Makefile @@ -1,13 +1,8 @@ PORTNAME= usd DISTVERSIONPREFIX= v -DISTVERSION= 21.11 -PORTREVISION= 12 +DISTVERSION= 25.11 CATEGORIES= misc -PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/ -PATCHFILES= 4942189cf7b1a45b23d62f4ae92a940721ec4009.patch:-p1 \ - 445e3f8a473db9b1e0d1301e6ce4bf74c270f376.patch:-p1 - MAINTAINER= yuri@FreeBSD.org COMMENT= Universal Scene Description is a scene description management system WWW= http://www.openusd.org/ @@ -15,35 +10,46 @@ WWW= http://www.openusd.org/ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE.txt -NOT_FOR_ARCHS= armv6 armv7 i386 powerpc powerpc64le # CMakeLists.txt fails for non-64-bit architectures: Compiler does not support 64-bit builds; also: pxr/base/arch/defines.h:69:2: error: "Unsupported architecture. x86_64 or ARM64 required." +ONLY_FOR_ARCHS= aarch64 amd64 +ONLY_FOR_ARCHS_REASON= CMakeLists.txt fails for non-64-bit architectures: Compiler does not support 64-bit builds; also: pxr/base/arch/defines.h:69:2: error: "Unsupported architecture. x86_64 or ARM64 required." -LIB_DEPENDS= libtbb.so:devel/tbb +LIB_DEPENDS= libtbb.so:devel/onetbb USES= cmake python:test - USE_GITHUB= yes GH_ACCOUNT= PixarAnimationStudios -GH_PROJECT= ${PORTNAME:tu} +GH_PROJECT= OpenUSD +USE_LDCONFIG= yes -CMAKE_OFF= PXR_BUILD_TESTS PXR_BUILD_EXAMPLES PXR_BUILD_TUTORIALS PXR_ENABLE_PYTHON_SUPPORT +CMAKE_OFF= PXR_BUILD_EXAMPLES PXR_BUILD_TESTS PXR_BUILD_TUTORIALS \ + PXR_ENABLE_PYTHON_SUPPORT -OPTIONS_DEFINE= IMAGING TOOLS -OPTIONS_DEFAULT= TOOLS +OPTIONS_DEFINE= IMAGING MONOLITHIC TOOLS +OPTIONS_DEFAULT= IMAGING MONOLITHIC TOOLS OPTIONS_SUB= yes IMAGING_DESC= Build imaging components +MONOLITHIC_DESC= Build a monolithic library (required for blender) +TOOLS_DESC= Build commandline tools + +IMAGING_LIB_DEPENDS= libosdCPU.so:graphics/opensubdiv \ + libosdGPU.so:graphics/opensubdiv +IMAGING_USES= gl xorg +IMAGING_USE= GL=gl XORG=ice,sm,x11,xext IMAGING_CMAKE_BOOL= PXR_BUILD_IMAGING IMAGING_CMAKE_ON= -DPTEX_INCLUDE_DIR=${LOCALBASE}/include -IMAGING_BROKEN= see https://github.com/PixarAnimationStudios/USD/issues/1706 -TOOLS_DESC= Build commandline tools +MONOLITHIC_CMAKE_BOOL= PXR_BUILD_MONOLITHIC + TOOLS_CMAKE_BOOL= PXR_BUILD_USD_TOOLS -TOOLS_LIB_DEPENDS= libboost_program_options.so:devel/boost-libs do-test: # tests are expected to be installed, see https://github.com/PixarAnimationStudios/USD/issues/1707 @cd ${BUILD_WRKSRC} && \ - ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DPXR_BUILD_TESTS=ON -DPYTHON_EXECUTABLE=${PYTHON_CMD} ${CMAKE_SOURCE_PATH} && \ + ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} \ + -DPXR_BUILD_TESTS=ON -DPYTHON_EXECUTABLE=${PYTHON_CMD} ${CMAKE_SOURCE_PATH} && \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} install && \ - ctest -C ${CMAKE_BUILD_TYPE} ${WRKSRC} + ${FIND} ${BUILD_WRKSRC} -name CTestTestfile.cmake -type f -exec \ + ${REINPLACE_CMD} -e 's|${PREFIX}/tests|${STAGEDIR}${PREFIX}/tests|g' {} + && \ + ctest -C ${CMAKE_BUILD_TYPE} ${WRKSRC} --output-on-failure .include diff --git a/misc/usd/distinfo b/misc/usd/distinfo index 8b3f5718dfe2..341f78e18de4 100644 --- a/misc/usd/distinfo +++ b/misc/usd/distinfo @@ -1,7 +1,3 @@ -TIMESTAMP = 1673539699 -SHA256 (PixarAnimationStudios-USD-v21.11_GH0.tar.gz) = 7adfde17b8ee294ee7002edb240555c61b5135fa215a7252b2a8e291bb9c4b44 -SIZE (PixarAnimationStudios-USD-v21.11_GH0.tar.gz) = 29844452 -SHA256 (4942189cf7b1a45b23d62f4ae92a940721ec4009.patch) = b53487285f28a163f7f39549fbe3b9cb743fd401570565df2466cbf357538990 -SIZE (4942189cf7b1a45b23d62f4ae92a940721ec4009.patch) = 46383 -SHA256 (445e3f8a473db9b1e0d1301e6ce4bf74c270f376.patch) = 3d0a237e3ac8b3d7fb7367e3801d68939b3d9bf4bd7b24f8cca152f43a7347e0 -SIZE (445e3f8a473db9b1e0d1301e6ce4bf74c270f376.patch) = 5930 +TIMESTAMP = 1761399445 +SHA256 (PixarAnimationStudios-OpenUSD-v25.11_GH0.tar.gz) = c37c633b5037a4552f61574670ecca8836229b78326bd62622f3422671188667 +SIZE (PixarAnimationStudios-OpenUSD-v25.11_GH0.tar.gz) = 148797586 diff --git a/misc/usd/files/patch-cmake_defaults_Packages.cmake b/misc/usd/files/patch-cmake_defaults_Packages.cmake new file mode 100644 index 000000000000..a1c868c52e52 --- /dev/null +++ b/misc/usd/files/patch-cmake_defaults_Packages.cmake @@ -0,0 +1,29 @@ +--- cmake/defaults/Packages.cmake.orig 2025-10-24 16:21:56 UTC ++++ cmake/defaults/Packages.cmake +@@ -218,6 +218,7 @@ if (PXR_BUILD_IMAGING) + endif() + # --Opensubdiv + set(OPENSUBDIV_USE_GPU ${PXR_BUILD_GPU_SUPPORT}) ++ find_package(OpenMP) + find_package(OpenSubdiv 3 CONFIG) + if(OpenSubdiv_DIR) + # Found in CONFIG mode. +@@ -230,6 +231,9 @@ if (PXR_BUILD_IMAGING) + if(OPENSUBDIV_USE_GPU) + list(APPEND OPENSUBDIV_LIBRARIES OpenSubdiv::osdGPU${postfix}) + endif() ++ if(OPENSUBDIV_USE_OPENMP) ++ list(APPEND OPENSUBDIV_LIBRARIES OpenMP::OpenMP_CXX) ++ endif() + break() + endforeach() + endif() +@@ -253,7 +257,7 @@ if (PXR_BUILD_IMAGING) + add_definitions(-DPXR_OPENVDB_SUPPORT_ENABLED) + endif() + # --X11 +- if (CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "Windows")) + find_package(X11) + add_definitions(-DPXR_X11_SUPPORT_ENABLED) + endif() diff --git a/misc/usd/files/patch-extras_usd_examples_usdObj_pch.h b/misc/usd/files/patch-extras_usd_examples_usdObj_pch.h new file mode 100644 index 000000000000..4d732d16110d --- /dev/null +++ b/misc/usd/files/patch-extras_usd_examples_usdObj_pch.h @@ -0,0 +1,11 @@ +--- extras/usd/examples/usdObj/pch.h.orig 2025-10-24 16:21:56 UTC ++++ extras/usd/examples/usdObj/pch.h +@@ -13,7 +13,7 @@ + #if defined(ARCH_OS_DARWIN) + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #endif diff --git a/misc/usd/files/patch-extras_usd_examples_usdSchemaExamples_pch.h b/misc/usd/files/patch-extras_usd_examples_usdSchemaExamples_pch.h new file mode 100644 index 000000000000..2903379fe034 --- /dev/null +++ b/misc/usd/files/patch-extras_usd_examples_usdSchemaExamples_pch.h @@ -0,0 +1,11 @@ +--- extras/usd/examples/usdSchemaExamples/pch.h.orig 2025-10-24 16:21:56 UTC ++++ extras/usd/examples/usdSchemaExamples/pch.h +@@ -13,7 +13,7 @@ + #if defined(ARCH_OS_DARWIN) + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #endif diff --git a/misc/usd/files/patch-pxr_base_arch_assumptions.cpp b/misc/usd/files/patch-pxr_base_arch_assumptions.cpp new file mode 100644 index 000000000000..80f2bb354d95 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_assumptions.cpp @@ -0,0 +1,20 @@ +--- pxr/base/arch/assumptions.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/assumptions.cpp +@@ -20,6 +20,8 @@ + + #if defined(ARCH_OS_LINUX) + #include ++#elif defined(ARCH_OS_FREEBSD) ++#include + #elif defined(ARCH_OS_DARWIN) + #include + #include +@@ -35,6 +37,8 @@ Arch_ObtainCacheLineSize() + { + #if defined(ARCH_OS_LINUX) + return sysconf(_SC_LEVEL1_DCACHE_LINESIZE); ++#elif defined(ARCH_OS_FREEBSD) ++ return CACHE_LINE_SIZE; + #elif defined(ARCH_OS_WASM_VM) + return 64; + #elif defined(ARCH_OS_DARWIN) diff --git a/misc/usd/files/patch-pxr_base_arch_daemon.cpp b/misc/usd/files/patch-pxr_base_arch_daemon.cpp new file mode 100644 index 000000000000..4dbbc2bfe0f4 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_daemon.cpp @@ -0,0 +1,11 @@ +--- pxr/base/arch/daemon.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/daemon.cpp +@@ -28,7 +28,7 @@ ArchCloseAllFiles(int nExcept, const int* exceptFds) + int + ArchCloseAllFiles(int nExcept, const int* exceptFds) + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + + int status, retStatus, retErrno; + int i, j, maxfd, maxExcept = -1; diff --git a/misc/usd/files/patch-pxr_base_arch_debugger.cpp b/misc/usd/files/patch-pxr_base_arch_debugger.cpp new file mode 100644 index 000000000000..b4ad13346a9c --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_debugger.cpp @@ -0,0 +1,83 @@ +--- pxr/base/arch/debugger.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/debugger.cpp +@@ -14,7 +14,7 @@ + #include "pxr/base/arch/export.h" + #include "pxr/base/arch/stackTrace.h" + #include "pxr/base/arch/systemInfo.h" +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + #include "pxr/base/arch/inttypes.h" + #include + #if !defined(ARCH_OS_IPHONE) +@@ -59,7 +59,7 @@ static char** _archDebuggerAttachArgs = 0; + + static char** _archDebuggerAttachArgs = 0; + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + static + void + Arch_DebuggerTrapHandler(int) +@@ -74,7 +74,7 @@ Arch_DebuggerTrapHandler(int) + } + #endif + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + static + void + Arch_DebuggerInitPosix() +@@ -108,7 +108,7 @@ Arch_DebuggerInit() + void + Arch_DebuggerInit() + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + #if defined(ARCH_CPU_INTEL) && defined(ARCH_BITS_64) + // Save some registers that normally don't have to be preserved. We + // do this so the caller of ArchDebuggerTrap() can see its arguments +@@ -153,7 +153,7 @@ Arch_DebuggerInit() + } + + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + // Use a 'non-locking' fork so that we won't get hung up if we've + // had malloc corruption. We can't prevent fork() from using the + // heap, unfortunately, since fork handlers can do whatever they +@@ -332,7 +332,7 @@ Arch_DebuggerAttachExecPosix(void* data) + + #endif // defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) + +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + + // Reads /proc/self/status, finds the line starting with "field:", and + // returns the portion following the ":". +@@ -443,7 +443,7 @@ Arch_DebuggerAttach() + return false; + } + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + + // To attach to gdb under Unix/Linux and Gnome: + // ARCH_DEBUGGER="gnome-terminal -e 'gdb -p %p'" +@@ -500,7 +500,7 @@ Arch_InitDebuggerAttach() + void + Arch_InitDebuggerAttach() + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_DARWIN) + // Maximum length of a pid written as a decimal. It's okay for this + // to be greater than that. + static const size_t _decimalPidLength = 20; +@@ -632,7 +632,7 @@ ArchDebuggerIsAttached() + return IsDebuggerPresent() == TRUE; + #elif defined(ARCH_OS_DARWIN) + return AmIBeingDebugged(); +-#elif defined(ARCH_OS_LINUX) ++#elif defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + return Arch_DebuggerIsAttachedPosix(); + #endif + return false; diff --git a/misc/usd/files/patch-pxr_base_arch_defines.h b/misc/usd/files/patch-pxr_base_arch_defines.h new file mode 100644 index 000000000000..375ca55421ee --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_defines.h @@ -0,0 +1,26 @@ +--- pxr/base/arch/defines.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/defines.h +@@ -14,6 +14,8 @@ + #define ARCH_OS_WASM_VM + #elif defined(__linux__) + #define ARCH_OS_LINUX ++#elif defined(__FreeBSD__) ++#define ARCH_OS_FREEBSD + #elif defined(__APPLE__) + #include "TargetConditionals.h" + #define ARCH_OS_DARWIN +@@ -80,12 +82,12 @@ + // + + // Only use the GNU STL extensions on Linux when using gcc. +-#if defined(ARCH_OS_LINUX) && defined(ARCH_COMPILER_GCC) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) && defined(ARCH_COMPILER_GCC) + #define ARCH_HAS_GNU_STL_EXTENSIONS + #endif + + // The MAP_POPULATE flag for mmap calls only exists on Linux platforms. +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #define ARCH_HAS_MMAP_MAP_POPULATE + #endif + diff --git a/misc/usd/files/patch-pxr_base_arch_fileSystem.cpp b/misc/usd/files/patch-pxr_base_arch_fileSystem.cpp new file mode 100644 index 000000000000..4083b8c629c5 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_fileSystem.cpp @@ -0,0 +1,142 @@ +--- pxr/base/arch/fileSystem.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/fileSystem.cpp +@@ -35,12 +35,24 @@ + #include + #include + #else ++#if !defined(ARCH_OS_FREEBSD) + #include ++#else ++#include ++#endif + #include + #include + #include + #endif + ++#if defined(ARCH_OS_FREEBSD) ++#include ++#include ++#include ++#include ++#include ++#endif ++ + PXR_NAMESPACE_OPEN_SCOPE + + using std::pair; +@@ -143,7 +155,7 @@ ArchStatIsWritable(const ArchStatType *st) + bool + ArchStatIsWritable(const ArchStatType *st) + { +-#if defined(ARCH_OS_LINUX) || defined (ARCH_OS_DARWIN) || \ ++#if defined(ARCH_OS_LINUX) || defined (ARCH_OS_DARWIN) || defined(ARCH_OS_FREEBSD) || \ + defined(ARCH_OS_WASM_VM) + if (st) { + return (st->st_mode & S_IWOTH) || +@@ -181,7 +193,7 @@ ArchGetModificationTime(const ArchStatType& st) + double + ArchGetModificationTime(const ArchStatType& st) + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + return st.st_mtim.tv_sec + 1e-9*st.st_mtim.tv_nsec; + #elif defined(ARCH_OS_DARWIN) + return st.st_mtimespec.tv_sec + 1e-9*st.st_mtimespec.tv_nsec; +@@ -433,7 +445,7 @@ ArchGetAccessTime(const struct stat& st) + double + ArchGetAccessTime(const struct stat& st) + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + return st.st_atim.tv_sec + 1e-9*st.st_atim.tv_nsec; + #elif defined(ARCH_OS_DARWIN) + return st.st_atimespec.tv_sec + 1e-9*st.st_atimespec.tv_nsec; +@@ -448,7 +460,7 @@ ArchGetStatusChangeTime(const struct stat& st) + double + ArchGetStatusChangeTime(const struct stat& st) + { +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + return st.st_ctim.tv_sec + 1e-9*st.st_ctim.tv_nsec; + #elif defined(ARCH_OS_DARWIN) + return st.st_ctimespec.tv_sec + 1e-9*st.st_ctimespec.tv_nsec; +@@ -479,7 +491,7 @@ ArchGetFileLength(FILE *file) + if (!file) + return -1; + #if defined (ARCH_OS_LINUX) || defined (ARCH_OS_DARWIN) || \ +- defined(ARCH_OS_WASM_VM) ++ defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + struct stat buf; + return fstat(fileno(file), &buf) < 0 ? -1 : + static_cast(buf.st_size); +@@ -494,7 +506,7 @@ ArchGetFileLength(const char* fileName) + ArchGetFileLength(const char* fileName) + { + #if defined (ARCH_OS_LINUX) || defined (ARCH_OS_DARWIN) || \ +- defined(ARCH_OS_WASM_VM) ++ defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + struct stat buf; + return stat(fileName, &buf) < 0 ? -1 : static_cast(buf.st_size); + #elif defined (ARCH_OS_WINDOWS) +@@ -557,7 +569,49 @@ ArchGetFileName(FILE *file) + std::filesystem::path(filePath.begin(), filePath.begin() + dwSize)); + result = ArchWindowsUtf16ToUtf8(canonicalPath.wstring()); + } +- return result; ++ return result; ++#elif defined (ARCH_OS_FREEBSD) ++ int mib[4]; ++ size_t i, len; ++ char *buffer = NULL; ++ struct kinfo_file *kf; ++ string path; ++ ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_PROC; ++ mib[2] = KERN_PROC_FILEDESC; ++ mib[3] = getpid(); ++ len = 0; ++ if (sysctl( mib, sizeof(mib)/sizeof(mib[0]), NULL, &len, NULL, 0 )) ++ goto end; ++ len *= 2; ++ buffer = (char*)malloc( len ); ++ if (!buffer) ++ goto end; ++ if (sysctl( mib, sizeof(mib)/sizeof(mib[0]), buffer, &len, NULL, 0 )) ++ goto end; ++ ++ for (i = 0; i < len; ) ++ { ++ kf = (struct kinfo_file*) &buffer[i]; ++ if (kf->kf_structsize == 0) ++ break; ++ i += kf->kf_structsize; ++ ++ if (kf->kf_fd == fileno(file)) ++ { ++ if (kf->kf_path[0]) ++ { ++ path.resize(strlen(kf->kf_path) + 1); ++ sprintf(&path[0], "%s", kf->kf_path); ++ } ++ break; ++ } ++ } ++ ++end: ++ free( buffer ); ++ return path; + #else + #error Unknown system architecture + #endif +@@ -920,6 +974,9 @@ ArchQueryMappedMemoryResidency( + int ret = mincore( + reinterpret_cast(const_cast(addr)), len, + reinterpret_cast(pageMap)); ++ return ret == 0; ++#elif defined(ARCH_OS_FREEBSD) ++ int ret = mincore(const_cast(addr), len, (char *)(pageMap)); + return ret == 0; + #endif + // XXX: Not implemented for other platforms yet. diff --git a/misc/usd/files/patch-pxr_base_arch_fileSystem.h b/misc/usd/files/patch-pxr_base_arch_fileSystem.h new file mode 100644 index 000000000000..c74a1f4bc931 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_fileSystem.h @@ -0,0 +1,12 @@ +--- pxr/base/arch/fileSystem.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/fileSystem.h +@@ -28,6 +28,9 @@ + #include + #include + #include ++#elif defined(ARCH_OS_FREEBSD) ++#include ++#include + #elif defined(ARCH_OS_DARWIN) + #include + #include diff --git a/misc/usd/files/patch-pxr_base_arch_math.h b/misc/usd/files/patch-pxr_base_arch_math.h new file mode 100644 index 000000000000..39863c3e9280 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_math.h @@ -0,0 +1,11 @@ +--- pxr/base/arch/math.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/math.h +@@ -89,7 +89,7 @@ inline double ArchBitPatternToDouble(uint64_t v) { + #error Unknown system architecture. + #endif + +-#if defined(ARCH_OS_LINUX) || defined(doxygen) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(doxygen) + + /// Computes the sine and cosine of the specified value as a float. + inline void ArchSinCosf(float v, float *s, float *c) { sincosf(v, s, c); } diff --git a/misc/usd/files/patch-pxr_base_arch_pch.h b/misc/usd/files/patch-pxr_base_arch_pch.h new file mode 100644 index 000000000000..863c3e57055c --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_pch.h @@ -0,0 +1,11 @@ +--- pxr/base/arch/pch.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/pch.h +@@ -30,7 +30,7 @@ + #include + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #include diff --git a/misc/usd/files/patch-pxr_base_arch_stackTrace.cpp b/misc/usd/files/patch-pxr_base_arch_stackTrace.cpp new file mode 100644 index 000000000000..580851784f08 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_stackTrace.cpp @@ -0,0 +1,43 @@ +--- pxr/base/arch/stackTrace.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/stackTrace.cpp +@@ -58,11 +58,11 @@ + /* Darwin/ppc did not do stack traces. Darwin/i386 still + needs some work, this has been stubbed out for now. */ + +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #endif + +-#if defined(ARCH_OS_LINUX) && defined(ARCH_BITS_64) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) && defined(ARCH_BITS_64) + #include + #endif + +@@ -93,7 +93,7 @@ ForkFunc Arch_nonLockingFork = + // total hack -- no idea if this will work if we die in malloc... + typedef int (*ForkFunc)(void); + ForkFunc Arch_nonLockingFork = +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + (ForkFunc)dlsym(RTLD_DEFAULT, "_Fork"); + #elif defined(ARCH_OS_DARWIN) || defined(ARCH_OS_WASM_VM) + NULL; +@@ -626,7 +626,7 @@ nonLockingFork() + } + #endif + +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + static int + nonLockingLinux__execve (const char *file, + char *const argv[], +@@ -1392,7 +1392,7 @@ ArchGetStackFrames(size_t maxDepth, size_t skip, vecto + frames->resize(ArchGetStackFrames(maxDepth, skip, frames->data())); + } + +-#if defined(ARCH_OS_LINUX) && defined(ARCH_BITS_64) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) && defined(ARCH_BITS_64) + struct Arch_UnwindContext { + public: + Arch_UnwindContext(size_t maxdepth, size_t skip, uintptr_t* frames) : diff --git a/misc/usd/files/patch-pxr_base_arch_symbols.cpp b/misc/usd/files/patch-pxr_base_arch_symbols.cpp new file mode 100644 index 000000000000..5cb15df826e6 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_symbols.cpp @@ -0,0 +1,11 @@ +--- pxr/base/arch/symbols.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/symbols.cpp +@@ -10,7 +10,7 @@ + #include "pxr/base/arch/symbols.h" + #include "pxr/base/arch/defines.h" + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + #include + #elif defined(ARCH_OS_DARWIN) + #include diff --git a/misc/usd/files/patch-pxr_base_arch_systemInfo.cpp b/misc/usd/files/patch-pxr_base_arch_systemInfo.cpp new file mode 100644 index 000000000000..aec6ff8461cf --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_systemInfo.cpp @@ -0,0 +1,64 @@ +--- pxr/base/arch/systemInfo.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/systemInfo.cpp +@@ -15,7 +15,7 @@ + #include + #include + +-#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + + #include + #include +@@ -96,16 +96,23 @@ ArchGetExecutablePath() + std::string + ArchGetExecutablePath() + { +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + ++#if defined(ARCH_OS_LINUX) + // On Linux the executable path is retrieved from the /proc/self/exe + // symlink. ++#define SELF_PATHNAME "/proc/self/exe"; ++#else ++ // On FreeBSD the executable path is retrieved from the /proc/curproc/file ++ // symlink. ++#define SELF_PATHNAME "/proc/curproc/file" ++#endif + return + _DynamicSizedRead(ARCH_PATH_MAX, + [](char* buffer, size_t* size) { +- const ssize_t n = readlink("/proc/self/exe", buffer, *size); ++ const ssize_t n = readlink(SELF_PATHNAME, buffer, *size); + if (n == -1) { +- ARCH_WARNING("Unable to read /proc/self/exe to obtain " ++ ARCH_WARNING("Unable to read " SELF_PATHNAME " to obtain " + "executable path"); + *size = std::numeric_limits::max(); + return false; +@@ -113,7 +120,7 @@ ArchGetExecutablePath() + else if (static_cast(n) >= *size) { + // Find out how much space we need. + struct stat sb; +- if (lstat("/proc/self/exe", &sb) == 0) { ++ if (lstat(SELF_PATHNAME, &sb) == 0) { + *size = sb.st_size + 1; + } + else { +@@ -127,6 +134,7 @@ ArchGetExecutablePath() + return true; + } + }); ++#undef SELF_PATHNAME + + #elif defined(ARCH_OS_DARWIN) + +@@ -177,7 +185,7 @@ ArchGetPageSize() + ArchGetPageSize() + { + #if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN) || \ +- defined(ARCH_OS_WASM_VM) ++ defined(ARCH_OS_WASM_VM) || defined(ARCH_OS_FREEBSD) + return sysconf(_SC_PAGE_SIZE); + #elif defined(ARCH_OS_WINDOWS) + SYSTEM_INFO info; diff --git a/misc/usd/files/patch-pxr_base_arch_timing.cpp b/misc/usd/files/patch-pxr_base_arch_timing.cpp new file mode 100644 index 000000000000..426339839f97 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_timing.cpp @@ -0,0 +1,40 @@ +--- pxr/base/arch/timing.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/timing.cpp +@@ -24,6 +24,10 @@ + #include + #include + #include ++#elif defined(ARCH_OS_FREEBSD) ++#include ++#include ++#include + #elif defined(ARCH_OS_WINDOWS) + #include + #include +@@ -133,6 +137,26 @@ Arch_ComputeNanosecondsPerTick() + // as the overhead to call now() one time. + return clockNanoSecs / + double(ticks - ArchGetIntervalTimerTickOverhead() - nowDuration); ++} ++#elif defined(ARCH_OS_FREEBSD) ++ ++static ++double ++Arch_ComputeNanosecondsPerTick() ++{ ++#if defined(ARCH_CPU_ARM) ++ uint64_t counter_hz; ++ __asm __volatile("mrs %0, CNTFRQ_EL0" : "=&r" (counter_hz)); ++ Arch_NanosecondsPerTick = double(1e9) / double(counter_hz); ++#else ++ size_t counter_mhz = 0; ++ const char mib[] = "dev.cpu.0.freq"; ++ if (sysctlbyname(mib, NULL, &counter_mhz, NULL, 0) == -1) { ++ perror("sysctlbyname"); ++ abort(); ++ } ++ Arch_NanosecondsPerTick = double(1e9) / double(counter_mhz*1000000); ++#endif + } + #elif defined(ARCH_OS_WINDOWS) + diff --git a/misc/usd/files/patch-pxr_base_arch_timing.h b/misc/usd/files/patch-pxr_base_arch_timing.h new file mode 100644 index 000000000000..bc14f5aaca01 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_arch_timing.h @@ -0,0 +1,11 @@ +--- pxr/base/arch/timing.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/arch/timing.h +@@ -19,7 +19,7 @@ + /// \addtogroup group_arch_SystemFunctions + ///@{ + +-#if defined(ARCH_OS_LINUX) && defined(ARCH_CPU_INTEL) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_FREEBSD) && defined(ARCH_CPU_INTEL) + #include + #elif defined(ARCH_OS_WASM_VM) + #include diff --git a/misc/usd/files/patch-pxr_base_plug_pch.h b/misc/usd/files/patch-pxr_base_plug_pch.h new file mode 100644 index 000000000000..4d65c007300a --- /dev/null +++ b/misc/usd/files/patch-pxr_base_plug_pch.h @@ -0,0 +1,16 @@ +--- pxr/base/plug/pch.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/plug/pch.h +@@ -26,6 +26,13 @@ + #include + #include + #endif ++#if defined(ARCH_OS_FREEBSD) ++#include ++#include ++#include ++#include ++#include ++#endif + #if defined(ARCH_OS_WINDOWS) + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN diff --git a/misc/usd/files/patch-pxr_base_tf_diagnostic.cpp b/misc/usd/files/patch-pxr_base_tf_diagnostic.cpp new file mode 100644 index 000000000000..0c6baa237618 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_tf_diagnostic.cpp @@ -0,0 +1,10 @@ +--- pxr/base/tf/diagnostic.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/tf/diagnostic.cpp +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + using std::string; + diff --git a/misc/usd/files/patch-pxr_base_tf_fileUtils.cpp b/misc/usd/files/patch-pxr_base_tf_fileUtils.cpp new file mode 100644 index 000000000000..420d4f9997a3 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_tf_fileUtils.cpp @@ -0,0 +1,11 @@ +--- pxr/base/tf/fileUtils.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/tf/fileUtils.cpp +@@ -230,7 +230,7 @@ TfIsWritable(string const& path) + bool + TfIsWritable(string const& path) + { +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + // faccessat accounts for mount read-only status. For maintaining legacy + // behavior, use faccessat instead of access so we can use the effective + // UID instead of the real UID. diff --git a/misc/usd/files/patch-pxr_base_tf_testenv_mallocTag.cpp b/misc/usd/files/patch-pxr_base_tf_testenv_mallocTag.cpp new file mode 100644 index 000000000000..af12f76feda1 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_tf_testenv_mallocTag.cpp @@ -0,0 +1,11 @@ +--- pxr/base/tf/testenv/mallocTag.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/tf/testenv/mallocTag.cpp +@@ -19,7 +19,7 @@ PXR_NAMESPACE_USING_DIRECTIVE + + // The TfMallocTag code depends upon the Linux memory allocator, ptmalloc3. + // Turning this test off for any other platforms for now. +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_FREEBSD) + + using std::vector; + using std::string; diff --git a/misc/usd/files/patch-pxr_base_trace_pch.h b/misc/usd/files/patch-pxr_base_trace_pch.h new file mode 100644 index 000000000000..edeac4f7e748 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_trace_pch.h @@ -0,0 +1,11 @@ +--- pxr/base/trace/pch.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/trace/pch.h +@@ -13,7 +13,7 @@ + #if defined(ARCH_OS_DARWIN) + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #endif diff --git a/misc/usd/files/patch-pxr_base_vt_pch.h b/misc/usd/files/patch-pxr_base_vt_pch.h new file mode 100644 index 000000000000..23f71116bae1 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_vt_pch.h @@ -0,0 +1,11 @@ +--- pxr/base/vt/pch.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/vt/pch.h +@@ -13,7 +13,7 @@ + #if defined(ARCH_OS_DARWIN) + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #endif diff --git a/misc/usd/files/patch-pxr_base_work_pch.h b/misc/usd/files/patch-pxr_base_work_pch.h new file mode 100644 index 000000000000..cb75fe44ef64 --- /dev/null +++ b/misc/usd/files/patch-pxr_base_work_pch.h @@ -0,0 +1,11 @@ +--- pxr/base/work/pch.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/base/work/pch.h +@@ -13,7 +13,7 @@ + #if defined(ARCH_OS_DARWIN) + #include + #endif +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) + #include + #include + #endif diff --git a/misc/usd/files/patch-pxr_imaging_garch_glDebugWindow.cpp b/misc/usd/files/patch-pxr_imaging_garch_glDebugWindow.cpp new file mode 100644 index 000000000000..de4cb5e8ed62 --- /dev/null +++ b/misc/usd/files/patch-pxr_imaging_garch_glDebugWindow.cpp @@ -0,0 +1,11 @@ +--- pxr/imaging/garch/glDebugWindow.cpp.orig 2025-10-24 16:21:56 UTC ++++ pxr/imaging/garch/glDebugWindow.cpp +@@ -9,7 +9,7 @@ + #include "pxr/imaging/garch/glPlatformDebugContext.h" + #include "pxr/base/arch/defines.h" + +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_FREEBSD) + #include "pxr/imaging/garch/glPlatformDebugWindowGLX.h" + #elif defined(ARCH_OS_DARWIN) + #include "pxr/imaging/garch/glPlatformDebugWindowDarwin.h" diff --git a/misc/usd/files/patch-pxr_imaging_garch_glPlatformContext.h b/misc/usd/files/patch-pxr_imaging_garch_glPlatformContext.h new file mode 100644 index 000000000000..67f31c01159f --- /dev/null +++ b/misc/usd/files/patch-pxr_imaging_garch_glPlatformContext.h @@ -0,0 +1,11 @@ +--- pxr/imaging/garch/glPlatformContext.h.orig 2025-10-24 16:21:56 UTC ++++ pxr/imaging/garch/glPlatformContext.h +@@ -15,7 +15,7 @@ + #include + #include + +-#if defined(ARCH_OS_LINUX) ++#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_FREEBSD) || defined(ARCH_OS_FREEBSD) + + #include "pxr/imaging/garch/glPlatformContextGLX.h" + diff --git a/misc/usd/files/patch-pxr_imaging_garch_glPlatformDebugContext.cpp b/misc/usd/files/patch-pxr_imaging_garch_glPlatformDebugContext.cpp new file mode 100644 *** 2665 LINES SKIPPED ***