File openexr-glibc-2.43.patch of Package openexr

From c6e25f46d9b448cb2a3a74c76624a761212f30b3 Mon Sep 17 00:00:00 2001
From: Cary Phillips <cary@ilm.com>
Date: Sun, 22 Feb 2026 12:39:00 -0800
Subject: [PATCH 1/5] Fix build failure with glibc 2.43 due to C11 threads.h
 conflicts

Fix conflicting once_flag, ONCE_FLAG_INIT, and call_once definitions
when building with glibc 2.43, which now includes C11 <threads.h>
support

Detect <threads.h> availability and use standard C11 thread primitives
when present, falling back to pthread or Windows implementations
otherwise CI

This also adds a new Linux build (#12) using a Fedora Rawhide container to
test against glibc 2.43

Signed-off-by: Cary Phillips <cary@ilm.com>
---
 .github/workflows/ci_steps.yml        | 15 +++++++++
 .github/workflows/ci_workflow.yml     | 12 +++++++-
 src/lib/OpenEXRCore/internal_thread.h | 44 ++++++++++++++++++++++-----
 3 files changed, 62 insertions(+), 9 deletions(-)

Index: openexr-3.4.6/.github/workflows/ci_steps.yml
===================================================================
--- openexr-3.4.6.orig/.github/workflows/ci_steps.yml
+++ openexr-3.4.6/.github/workflows/ci_steps.yml
@@ -120,6 +120,21 @@ jobs:
 
         shell: bash
 
+      - name: Report C Runtime Version
+        run: |
+          if [[ "$RUNNER_OS" == "Linux" ]]; then
+            ldd --version 2>&1 | head -1 || true
+          elif [[ "$RUNNER_OS" == "macOS" ]]; then
+            echo "macOS SDK: $(xcrun --show-sdk-version 2>/dev/null || echo 'unknown')"
+          fi
+        shell: bash
+
+      - name: Install Build Dependencies (Fedora)
+        if: startsWith(inputs.container, 'fedora:')
+        run: |
+          dnf install -y gcc gcc-c++ cmake make git wget libdeflate-devel
+        shell: bash
+
       - name: Determine MSYS2 Packages
         if: inputs.msystem != ''
         run: |
Index: openexr-3.4.6/.github/workflows/ci_workflow.yml
===================================================================
--- openexr-3.4.6.orig/.github/workflows/ci_workflow.yml
+++ openexr-3.4.6/.github/workflows/ci_workflow.yml
@@ -65,7 +65,7 @@ jobs:
       build: ${{ matrix.build }}
       # DockerHub: https://hub.docker.com/u/aswf
       # Source: https://github.com/AcademySoftwareFoundation/aswf-docker
-      container: aswf/ci-openexr:${{ matrix.vfx-cy || '2024' }}
+      container: ${{ matrix.container || format('aswf/ci-openexr:{0}', matrix.vfx-cy || '2024') }}
       cmake: ${{ matrix.cmake || '3.14.7' }}
       cxx-standard: ${{ matrix.cxx-standard || '17' }}
       cxx-compiler: ${{ matrix.cxx-compiler || 'g++' }}
@@ -147,6 +147,16 @@ jobs:
             RUN_TESTING: OFF
             validate_install: OFF
 
+          - build: 12
+            label: Fedora Rawhide
+            container: fedora:rawhide
+            cmake: '3.31.6'
+            OPENEXR_FORCE_INTERNAL_IMATH: 'ON'
+            OPENEXR_FORCE_INTERNAL_DEFLATE: 'OFF'
+            OPENEXR_FORCE_INTERNAL_OPENJPH: 'ON'
+            OPENEXR_INSTALL_DOCS: 'OFF'
+            validate_install: 'OFF'
+
   macOS:
     name: 'macOS.${{ matrix.build}}: ${{ matrix.label }}'
     uses: ./.github/workflows/ci_steps.yml
Index: openexr-3.4.6/src/lib/OpenEXRCore/internal_thread.h
===================================================================
--- openexr-3.4.6.orig/src/lib/OpenEXRCore/internal_thread.h
+++ openexr-3.4.6/src/lib/OpenEXRCore/internal_thread.h
@@ -8,10 +8,12 @@
 
 #include "openexr_config.h"
 
-// Thread-safe single initiatization, using InitOnceExecuteOnce on Windows,
-// pthread_once elsewhere, or a simple variable if threading is completely disabled.
 #if ILMTHREAD_THREADING_ENABLED
 #    ifdef _WIN32
+/*
+ * On Windows, use native InitOnceExecuteOnce, which avoids MSVC's
+ * problematic <threads.h>
+ */
 #        include <windows.h>
 #        define ONCE_FLAG_INIT INIT_ONCE_STATIC_INIT
 typedef INIT_ONCE once_flag;
@@ -27,7 +29,16 @@ call_once (once_flag* flag, void (*func)
 {
     InitOnceExecuteOnce (flag, once_init_fn, (PVOID) func, NULL);
 }
+#    elif __has_include(<threads.h>)
+/*
+ * On Linux (glibc 2.28+), use standard <threads.h>
+ */
+#        include <threads.h>
+
 #    else
+/*
+ * No <threads.h> on macOS and older Linux distros: fall back to pthreads
+ */
 #        include <pthread.h>
 #        define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
 typedef pthread_once_t once_flag;
@@ -36,9 +47,17 @@ call_once (once_flag* flag, void (*func)
 {
     (void) pthread_once (flag, func);
 }
+
 #    endif
-#else
-#    define ONCE_FLAG_INIT 0
+
+#endif /* ILMTHREAD_THREADING_ENABLED */
+
+/*
+ * If threading is disabled, or call_once/ONCE_FLAG_INIT wasn't declared
+ * above, declare a default implementation.
+ */
+#ifndef ONCE_FLAG_INIT
+#  define ONCE_FLAG_INIT 0
 typedef int once_flag;
 static inline void
 call_once (once_flag* flag, void (*func) (void))
@@ -50,4 +69,5 @@ call_once (once_flag* flag, void (*func)
 }
 #endif
 
+
 #endif /* OPENEXR_PRIVATE_THREAD_H */
openSUSE Build Service is sponsored by