aboutsummaryrefslogblamecommitdiffstats
path: root/community/minetest/0001-CMake-link-with-Intl-when-necessary.patch
blob: d24f8c9509fedfcb75a1b866ac5a1fd547780830 (plain) (tree)






























                                                                                              
                               

















                                                                                              
From 45ed3aa6be6d70cf76a4f10c81684ab86cb5017f Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Mon, 12 Jun 2017 21:57:05 +0200
Subject: [PATCH] CMake: link with Intl when necessary

On non Glibc system linking with Intl library may be needed when
Gettext support is enabled.

Fixes:
clientlauncher.cpp:(.text+0xcac): undefined reference to `libintl_gettext'
clientlauncher.cpp:(.text+0xdf0): undefined reference to `libintl_gettext'

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 src/CMakeLists.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,6 +70,14 @@ if(ENABLE_GETTEXT)
 		endif()
 		set(USE_GETTEXT TRUE)
 		message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
+		# On some platforms, such as Linux with GNU libc, the gettext
+		# functions are present in the C standard library and libintl
+		# is not required. For other libc (uClibc-ng or musl) libintl
+		# may be required.
+		find_package(Intl)
+		if(NOT Intl_LIBRARIES STREQUAL "")
+			message(STATUS "GetText Intl : ${Intl_LIBRARIES}")
+		endif()
 	endif(GETTEXTLIB_FOUND)
 else()
 	mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
@@ -554,6 +554,7 @@
 		${BZIP2_LIBRARIES}
 		${PNG_LIBRARIES}
 		${X11_LIBRARIES}
+		${Intl_LIBRARIES}
 		${SOUND_LIBRARIES}
 		${SQLITE3_LIBRARY}
 		${LUA_LIBRARY}
@@ -623,6 +624,7 @@
 		${ZLIB_LIBRARIES}
 		${SQLITE3_LIBRARY}
 		${JSON_LIBRARY}
+		${Intl_LIBRARIES}
 		${LUA_LIBRARY}
 		${GMP_LIBRARY}
 		${PLATFORM_LIBS}