[Bf-blender-cvs] [9f11129d28d] master: Build: fix building sndfile with OPUS on Linux

Campbell Barton noreply at git.blender.org
Tue Dec 13 02:36:24 CET 2022


Commit: 9f11129d28da4e361becc8b7dd8bfada0cc0b52d
Author: Campbell Barton
Date:   Tue Dec 13 11:41:05 2022 +1100
Branches: master
https://developer.blender.org/rB9f11129d28da4e361becc8b7dd8bfada0cc0b52d

Build: fix building sndfile with OPUS on Linux

The PKGCONFIG file exposes the OPUS include: requiring <opus/opus.h>
to be replaced with <opus.h>. Manipulate the PKGCONFIG file instead of
patching the source since the small change is only needed in one place.

===================================================================

M	build_files/build_environment/cmake/sndfile.cmake

===================================================================

diff --git a/build_files/build_environment/cmake/sndfile.cmake b/build_files/build_environment/cmake/sndfile.cmake
index 1e4249e7e53..60a33c6a236 100644
--- a/build_files/build_environment/cmake/sndfile.cmake
+++ b/build_files/build_environment/cmake/sndfile.cmake
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 set(SNDFILE_EXTRA_ARGS)
-set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR})
+set(SNDFILE_ENV)
 
 if(WIN32)
+  set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR})
   set(SNDFILE_ENV set ${SNDFILE_ENV} &&)
   # Shared for windows because static libs will drag in a libgcc dependency.
   set(SNDFILE_OPTIONS --disable-static --enable-shared )
@@ -11,6 +12,16 @@ else()
   set(SNDFILE_OPTIONS --enable-static --disable-shared )
 endif()
 
+if(UNIX AND NOT APPLE)
+  # NOTE(@campbellbarton): For some reason OPUS is alone in referencing the sub-directory,
+  # manipulate the package-config file to prevent this from happening.
+  # There is no problem with applying this change multiple times.
+  #
+  # Replace: Cflags: -I${includedir}/opus
+  # With:    Cflags: -I${includedir}
+  set(SNDFILE_ENV sed -i s/{includedir}\\/opus/{includedir}/g ${LIBDIR}/opus/lib/pkgconfig/opus.pc && ${SNDFILE_ENV})
+endif()
+
 ExternalProject_Add(external_sndfile
   URL file://${PACKAGE_DIR}/${SNDFILE_FILE}
   DOWNLOAD_DIR ${DOWNLOAD_DIR}



More information about the Bf-blender-cvs mailing list