Files
codex/patches/opusic_sys_install_headers.patch
T
Benjamin Carlsson 8842c09a7f Fix Opus header installation with relative symlink inputs (#59972)
## Why

Opus build inputs can be relative symlinks. CMake can preserve those links during header installation, leaving dangling links in the install prefix.

## What changed

Add and export the `opusic-sys` patch referenced by the Bazel configuration. The patch copies public headers into the CMake build directory and uses those copies for `PUBLIC_HEADER` installation.

GitOrigin-RevId: 03f0e1ab536fdf894dc23a40acc331bf16bcae13
2026-11-06 20:26:49 +00:00

27 lines
1.1 KiB
Diff

--- a/opus/CMakeLists.txt
+++ b/opus/CMakeLists.txt
@@ -301,13 +301,22 @@
get_library_version(OPUS_LIBRARY_VERSION OPUS_LIBRARY_VERSION_MAJOR)
message(DEBUG "Opus library version: ${OPUS_LIBRARY_VERSION}")
+# Build-script inputs can be relative symlinks. Materialize public headers so
+# CMake does not preserve links that become dangling in the install prefix.
+foreach(header IN LISTS Opus_PUBLIC_HEADER)
+ get_filename_component(header_name "${header}" NAME)
+ set(install_header "${CMAKE_CURRENT_BINARY_DIR}/public_headers/${header_name}")
+ configure_file("${header}" "${install_header}" COPYONLY)
+ list(APPEND Opus_INSTALL_HEADERS "${install_header}")
+endforeach()
+
set_target_properties(opus
PROPERTIES SOVERSION
${OPUS_LIBRARY_VERSION_MAJOR}
VERSION
${OPUS_LIBRARY_VERSION}
PUBLIC_HEADER
- "${Opus_PUBLIC_HEADER}")
+ "${Opus_INSTALL_HEADERS}")
target_include_directories(
opus