commit:     b4754d9dc0a17508c6dc37202595ca48aa34ccb1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 19 07:16:23 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 19 07:34:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4754d9d

games-strategy/colobot: Fix missing -lsndfile with USE=-openal

Closes: https://bugs.gentoo.org/808495
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 games-strategy/colobot/colobot-0.1.12.ebuild       |  2 ++
 .../files/colobot-0.1.12-sndfile-link.patch        | 40 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/games-strategy/colobot/colobot-0.1.12.ebuild 
b/games-strategy/colobot/colobot-0.1.12.ebuild
index 56e82f5815b..152ba200e16 100644
--- a/games-strategy/colobot/colobot-0.1.12.ebuild
+++ b/games-strategy/colobot/colobot-0.1.12.ebuild
@@ -40,6 +40,8 @@ RDEPEND="${DEPEND}
 PATCHES=(
        # https://github.com/colobot/colobot/pull/1300
        "${FILESDIR}"/${P}-includes.patch
+       # https://github.com/colobot/colobot/pull/1453
+       "${FILESDIR}"/${P}-sndfile-link.patch
 )
 
 src_prepare() {

diff --git a/games-strategy/colobot/files/colobot-0.1.12-sndfile-link.patch 
b/games-strategy/colobot/files/colobot-0.1.12-sndfile-link.patch
new file mode 100644
index 00000000000..349bb91c487
--- /dev/null
+++ b/games-strategy/colobot/files/colobot-0.1.12-sndfile-link.patch
@@ -0,0 +1,40 @@
+From f13ca0c15efc80da7034ae1d06224e31591cfc46 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Thu, 19 Aug 2021 09:11:16 +0200
+Subject: [PATCH] Fix missing linking to sndfile with OPENAL_SOUND=OFF
+
+Fix the CMake files to use sndfile even if OPENAL_SOUND is disabled.
+The package code (via sndfile_wrapper.cpp) uses sndfile unconditionally,
+and it currently fails to build with -DOPENAL_SOUND=OFF:
+
+    [293/293] Linking CXX executable colobot
+    FAILED: colobot
+    : && /usr/bin/c++ -std=gnu++11 -Wall -Werror -Wold-style-cast 
-pedantic-errors -Wmissing-declarations -Wno-error=deprecated-declarations 
-Wsuggest-override  -g -O0 -rdynamic src/CMakeFiles/colobot.dir/app/main.cpp.o 
-o colobot -L/tmp/colobot/src/CBot 
-Wl,-rpath,/tmp/colobot/src/CBot:/tmp/colobot/build/src/CBot:  
src/libcolobotbase.a  src/CBot/libCBot.so  lib/localename/liblocalename.a  
-Wl,-Bstatic  -lSDL2main  -Wl,-Bdynamic  -lSDL2  -lpthread  -lSDL2_image  
-lSDL2_ttf  -lGL  -lGLU  -lpng  -lz  -lGLEW  
/usr/lib64/libboost_system.so.1.76.0  /usr/lib64/libboost_filesystem.so.1.76.0  
/usr/lib64/libboost_regex.so.1.76.0  -lphysfs && :
+    
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: 
src/libcolobotbase.a(sndfile_wrapper.cpp.o): undefined reference to symbol 
'sf_close@@libsndfile.so.1.0'
+    
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: 
/usr/lib64/libsndfile.so.1: error adding symbols: DSO missing from command line
+    collect2: error: ld returned 1 exit status
+    ninja: build stopped: subcommand failed.
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 90843488..95927733 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -303,10 +303,11 @@ find_package(Boost COMPONENTS system filesystem regex 
REQUIRED)
+ 
+ find_package(GLEW REQUIRED)
+ 
++find_package(LibSndFile REQUIRED)
++
+ if (OPENAL_SOUND)
+     find_package(OpenAL REQUIRED)
+     include_directories(${OPENAL_INCLUDE_DIR})
+-    find_package(LibSndFile REQUIRED)
+ endif()
+ 
+ 
+-- 
+2.33.0
+

Reply via email to