Remove option to link libintl instead of Boost.Locale
This commit is contained in:
parent
379df76dcb
commit
dc24fa16f7
11 changed files with 11 additions and 527 deletions
|
@ -53,7 +53,6 @@ option(ENABLE_TESTS "Build unit tests")
|
|||
option(ENABLE_NLS "Enable building of translations" ON)
|
||||
option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF)
|
||||
option(ENABLE_LIBPNG "Enable support for writing png files (screenshots, images)" ON)
|
||||
option(ENABLE_LIBINTL "Enable using libintl for translations instead of Boost.Locale library (not recommended)" OFF)
|
||||
option(ENABLE_HISTORY "Enable using GNU history for history in lua console" ON)
|
||||
|
||||
if(DEFINED ENV{TRAVIS})
|
||||
|
@ -609,15 +608,7 @@ endif(ENABLE_GAME)
|
|||
if(ENABLE_GAME OR ENABLE_SERVER OR ENABLE_TOOLS OR ENABLE_TESTS)
|
||||
find_package( Boost 1.44 REQUIRED COMPONENTS filesystem )
|
||||
|
||||
if(NOT ENABLE_LIBINTL)
|
||||
find_package( Boost 1.48 REQUIRED COMPONENTS locale )
|
||||
else()
|
||||
find_package( Libintl REQUIRED )
|
||||
if(WIN32)
|
||||
# CMake 2.6 doesn't do message(WARNING ...)
|
||||
message("Warning: Using libintl on Windows instead of Boost.Locale may result in issues with translations and Unicode file paths!")
|
||||
endif()
|
||||
endif()
|
||||
find_package( Boost 1.48 REQUIRED COMPONENTS locale )
|
||||
endif(ENABLE_GAME OR ENABLE_SERVER OR ENABLE_TOOLS OR ENABLE_TESTS)
|
||||
|
||||
if(ENABLE_POT_UPDATE_TARGET)
|
||||
|
|
14
SConstruct
14
SConstruct
|
@ -72,7 +72,6 @@ opts.AddVariables(
|
|||
PathVariable('python_site_packages_dir', 'sets the directory where python modules are installed', "lib/python/site-packages/wesnoth", PathVariable.PathAccept),
|
||||
BoolVariable('notifications', 'Enable support for desktop notifications', True),
|
||||
BoolVariable('nls','enable compile/install of gettext message catalogs',True),
|
||||
BoolVariable('libintl', 'Use lib intl for translations, instead of boost locale', False),
|
||||
BoolVariable('png', 'Clear to disable writing png files for screenshots, images', True),
|
||||
PathVariable('prefix', 'autotools-style installation prefix', "/usr/local", PathVariable.PathAccept),
|
||||
PathVariable('prefsdir', 'user preferences directory', "", PathVariable.PathAccept),
|
||||
|
@ -349,13 +348,6 @@ if env["prereqs"]:
|
|||
conf.CheckSDL("SDL2_mixer", header_file = "SDL_mixer") & \
|
||||
conf.CheckSDL("SDL2_image", header_file = "SDL_image")
|
||||
|
||||
if env["libintl"]:
|
||||
def have_i18n_prereqs():
|
||||
return conf.CheckGettextLibintl()
|
||||
else:
|
||||
def have_i18n_prereqs():
|
||||
return conf.CheckBoost("locale")
|
||||
|
||||
have_server_prereqs = (\
|
||||
conf.CheckCPlusPlus(gcc_version = "4.8") & \
|
||||
conf.CheckBoost("iostreams", require_version = boost_version) & \
|
||||
|
@ -366,7 +358,7 @@ if env["prereqs"]:
|
|||
conf.CheckBoost("smart_ptr", header_only = True) & \
|
||||
conf.CheckBoost("system") & \
|
||||
conf.CheckBoost("filesystem", require_version = boost_version) & \
|
||||
have_i18n_prereqs() \
|
||||
conf.CheckBoost("locale") \
|
||||
and Info("Base prerequisites are met")) \
|
||||
or Warning("Base prerequisites are not met")
|
||||
|
||||
|
@ -390,10 +382,6 @@ if env["prereqs"]:
|
|||
if have_client_prereqs:
|
||||
if env["PLATFORM"] != "win32":
|
||||
have_X = conf.CheckLib('X11')
|
||||
else:
|
||||
if env["libintl"]:
|
||||
Warning("You cannot use the libintl option when building for windows")
|
||||
have_client_prereqs = False
|
||||
|
||||
env["notifications"] = env["notifications"] and conf.CheckPKG("dbus-1")
|
||||
if env["notifications"]:
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
# Try to find Libintl functionality
|
||||
# Once done this will define
|
||||
#
|
||||
# LIBINTL_FOUND - system has Libintl
|
||||
# LIBINTL_INCLUDE_DIR - Libintl include directory
|
||||
# LIBINTL_LIBRARIES - Libraries needed to use Libintl
|
||||
#
|
||||
# TODO: This will enable translations only if Gettext functionality is
|
||||
# present in libc. Must have more robust system for release, where Gettext
|
||||
# functionality can also reside in standalone Gettext library, or the one
|
||||
# embedded within kdelibs (cf. gettext.m4 from Gettext source).
|
||||
|
||||
# Copyright (c) 2006, Chusslove Illich, <caslav.ilic@gmx.net>
|
||||
# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
|
||||
set(Libintl_FIND_QUIETLY TRUE)
|
||||
endif(LIBINTL_INCLUDE_DIR AND LIBINTL_LIB_FOUND)
|
||||
|
||||
find_path(LIBINTL_INCLUDE_DIR libintl.h)
|
||||
|
||||
set(LIBINTL_LIB_FOUND FALSE)
|
||||
|
||||
if(LIBINTL_INCLUDE_DIR)
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(dgettext LIBINTL_LIBC_HAS_DGETTEXT)
|
||||
|
||||
if (LIBINTL_LIBC_HAS_DGETTEXT)
|
||||
set(LIBINTL_LIBRARIES)
|
||||
set(LIBINTL_LIB_FOUND TRUE)
|
||||
else (LIBINTL_LIBC_HAS_DGETTEXT)
|
||||
find_library(LIBINTL_LIBRARIES NAMES intl libintl )
|
||||
if(LIBINTL_LIBRARIES)
|
||||
set(LIBINTL_LIB_FOUND TRUE)
|
||||
endif(LIBINTL_LIBRARIES)
|
||||
endif (LIBINTL_LIBC_HAS_DGETTEXT)
|
||||
|
||||
endif(LIBINTL_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libintl DEFAULT_MSG LIBINTL_INCLUDE_DIR LIBINTL_LIB_FOUND)
|
||||
|
||||
mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARIES LIBINTL_LIBC_HAS_DGETTEXT LIBINTL_LIB_FOUND)
|
|
@ -1,178 +0,0 @@
|
|||
# - Find Gettext run-time library and tools.
|
||||
# This module finds the GNU gettext run-time library (LGPL), include paths and
|
||||
# associated tools (GPL). This code sets the following variables:
|
||||
# GETTEXT_INCLUDE_DIR = path(s) to gettext's include files
|
||||
# GETTEXT_LIBRARIES = the libraries to link against to use gettext
|
||||
# GETTEXT_INTL_LIBRARY = path to gettext's intl library
|
||||
# GETTEXT_RUNTIME_FOUND = true if runtime libs were found (intl)
|
||||
# GETTEXT_INFO_MSG = information string about gettext
|
||||
# GETTEXT_XGETTEXT_EXECUTABLE = xgettext tool
|
||||
# GETTEXT_MSGINIT_EXECUTABLE = msginit tool
|
||||
# GETTEXT_MSGCAT_EXECUTABLE = msgcat tool
|
||||
# GETTEXT_MSGCONV_EXECUTABLE = msgconv tool
|
||||
# GETTEXT_TOOLS_FOUND = true if all the tools were found
|
||||
# GETTEXT_FOUND = true if both runtime and tools were found
|
||||
# As a convenience, the following variables can be set before including
|
||||
# this module to make its life easier:
|
||||
# GETTEXT_SEARCH_PATH = list of path to search gettext components for
|
||||
# --------------------------------------------------------------------------
|
||||
# As a convenience, try to find everything as soon as we set any one of
|
||||
# the cache variables.
|
||||
|
||||
macro(GETTEXT_FIND_POTENTIAL_DIRS)
|
||||
|
||||
set(potential_bin_dirs)
|
||||
set(potential_lib_dirs)
|
||||
set(potential_include_dirs)
|
||||
foreach(filepath
|
||||
"${GETTEXT_INTL_LIBRARY}"
|
||||
"${GETTEXT_XGETTEXT_EXECUTABLE}"
|
||||
"${GETTEXT_MSGINIT_EXECUTABLE}"
|
||||
"${GETTEXT_MSGCAT_EXECUTABLE}"
|
||||
"${GETTEXT_MSGCONV_EXECUTABLE}"
|
||||
)
|
||||
get_filename_component(path "${filepath}" PATH)
|
||||
set(potential_bin_dirs ${potential_bin_dirs} "${path}/../bin")
|
||||
set(potential_lib_dirs ${potential_lib_dirs} "${path}/../lib")
|
||||
set(potential_include_dirs ${potential_include_dirs} "${path}/../include")
|
||||
endforeach(filepath)
|
||||
|
||||
foreach(path
|
||||
"${GETTEXT_INCLUDE_DIR}"
|
||||
"${GETTEXT_SEARCH_PATH}"
|
||||
)
|
||||
set(potential_bin_dirs ${potential_bin_dirs} "${path}/../bin")
|
||||
set(potential_lib_dirs ${potential_lib_dirs} "${path}/../lib")
|
||||
set(potential_include_dirs ${potential_include_dirs} "${path}/../include")
|
||||
endforeach(path)
|
||||
|
||||
endmacro(GETTEXT_FIND_POTENTIAL_DIRS)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Find the runtime lib
|
||||
|
||||
macro(GETTEXT_FIND_RUNTIME_LIBRARY)
|
||||
|
||||
set(GETTEXT_RUNTIME_FOUND 1)
|
||||
|
||||
# The gettext intl include dir (libintl.h)
|
||||
|
||||
find_path(GETTEXT_INCLUDE_DIR
|
||||
libintl.h
|
||||
${potential_include_dirs}
|
||||
DOC "Path to gettext include directory (where libintl.h can be found)")
|
||||
mark_as_advanced(GETTEXT_INCLUDE_DIR)
|
||||
if(NOT GETTEXT_INCLUDE_DIR)
|
||||
set(GETTEXT_RUNTIME_FOUND 0)
|
||||
endif(NOT GETTEXT_INCLUDE_DIR)
|
||||
|
||||
set(GETTEXT_LIBRARIES)
|
||||
|
||||
# The gettext intl library
|
||||
# Some Unix system (like Linux) have gettext right into libc
|
||||
|
||||
if(WIN32)
|
||||
set(HAVE_GETTEXT 0)
|
||||
else(WIN32)
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(gettext HAVE_GETTEXT)
|
||||
endif(WIN32)
|
||||
|
||||
if(HAVE_GETTEXT)
|
||||
# Even if we have a system one, let the user provide another one
|
||||
# eventually (i.e., more recent, or GNU).
|
||||
set(GETTEXT_INTL_LIBRARY "" CACHE FILEPATH
|
||||
"Path to gettext intl library (leave it empty to use the system one)")
|
||||
else(HAVE_GETTEXT)
|
||||
find_library(GETTEXT_INTL_LIBRARY
|
||||
NAMES intl
|
||||
PATHS ${potential_lib_dirs}
|
||||
DOC "Path to gettext intl library")
|
||||
if(NOT GETTEXT_INTL_LIBRARY)
|
||||
set(GETTEXT_RUNTIME_FOUND 0)
|
||||
endif(NOT GETTEXT_INTL_LIBRARY)
|
||||
endif(HAVE_GETTEXT)
|
||||
|
||||
mark_as_advanced(GETTEXT_INTL_LIBRARY)
|
||||
if(GETTEXT_INTL_LIBRARY)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARIES} ${GETTEXT_INTL_LIBRARY})
|
||||
endif(GETTEXT_INTL_LIBRARY)
|
||||
|
||||
# The gettext asprintf library
|
||||
# Actually not useful as it does not seem to exist on Unix
|
||||
|
||||
# IF(WIN32)
|
||||
# FIND_LIBRARY(GETTEXT_ASPRINTF_LIBRARY
|
||||
# NAMES asprintf
|
||||
# PATHS ${potential_lib_dirs}
|
||||
# DOC "Gettext asprintf library")
|
||||
# MARK_AS_ADVANCED(GETTEXT_ASPRINTF_LIBRARY)
|
||||
# IF(NOT GETTEXT_ASPRINTF_LIBRARY)
|
||||
# SET(GETTEXT_RUNTIME_FOUND 0)
|
||||
# ELSE(NOT GETTEXT_ASPRINTF_LIBRARY)
|
||||
# SET(GETTEXT_LIBRARIES ${GETTEXT_LIBRARIES} ${GETTEXT_ASPRINTF_LIBRARY})
|
||||
# ENDIF(NOT GETTEXT_ASPRINTF_LIBRARY)
|
||||
# ENDIF(WIN32)
|
||||
|
||||
endmacro(GETTEXT_FIND_RUNTIME_LIBRARY)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Find the tools
|
||||
|
||||
macro(GETTEXT_FIND_TOOLS)
|
||||
set(GETTEXT_TOOLS_FOUND 1)
|
||||
foreach(tool
|
||||
xgettext
|
||||
msginit
|
||||
msgmerge
|
||||
msgcat
|
||||
msgconv
|
||||
msgfmt
|
||||
)
|
||||
string(TOUPPER ${tool} tool_upper)
|
||||
find_program(GETTEXT_${tool_upper}_EXECUTABLE
|
||||
NAMES ${tool}
|
||||
PATHS ${potential_bin_dirs}
|
||||
DOC "Path to gettext ${tool} tool")
|
||||
mark_as_advanced(GETTEXT_${tool_upper}_EXECUTABLE)
|
||||
if(NOT GETTEXT_${tool_upper}_EXECUTABLE)
|
||||
set(GETTEXT_TOOLS_FOUND 0)
|
||||
endif(NOT GETTEXT_${tool_upper}_EXECUTABLE)
|
||||
endforeach(tool)
|
||||
endmacro(GETTEXT_FIND_TOOLS)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Some convenient info about gettext, where to get it, etc.
|
||||
|
||||
set(GETTEXT_INFO_MSG "More information about gettext can be found at http://directory.fsf.org/gettext.html.")
|
||||
if(WIN32)
|
||||
set(GETTEXT_INFO_MSG "${GETTEXT_INFO_MSG} Windows users can download gettext-runtime-0.13.1.bin.woe32.zip (LGPL), gettext-tools-0.13.1.bin.woe32.zip (GPL) as well as libiconv-1.9.1.bin.woe32.zip (LGPL) from any GNU mirror (say, http://mirrors.kernel.org/gnu/gettext/ and http://mirrors.kernel.org/gnu/libiconv/), unpack the archives in the same directory, then set GETTEXT_INTL_LIBRARY to 'lib/intl.lib' in and GETTEXT_INCLUDE_DIR to 'include' in that directory.\n\nWarning: if you are using ActiveTcl, the ActiveState binary distribution for Tcl, make sure you overwrite the iconv.dll file found in both the Tcl bin/ and lib/ directories with the iconv.dll file found in your gettext bin/ directory.")
|
||||
endif(WIN32)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Found ?
|
||||
|
||||
gettext_find_potential_dirs()
|
||||
gettext_find_runtime_library()
|
||||
gettext_find_tools()
|
||||
|
||||
# Try again with new potential dirs now that we may have found the runtime
|
||||
# or the tools
|
||||
|
||||
gettext_find_potential_dirs()
|
||||
if(NOT GETTEXT_RUNTIME_FOUND)
|
||||
gettext_find_runtime_library()
|
||||
endif(NOT GETTEXT_RUNTIME_FOUND)
|
||||
if(NOT GETTEXT_TOOLS_FOUND)
|
||||
gettext_find_tools()
|
||||
endif(NOT GETTEXT_TOOLS_FOUND)
|
||||
|
||||
if(GETTEXT_RUNTIME_FOUND AND GETTEXT_TOOLS_FOUND)
|
||||
set(GETTEXT_FOUND 1)
|
||||
else(GETTEXT_RUNTIME_FOUND AND GETTEXT_TOOLS_FOUND)
|
||||
set(GETTEXT_FOUND 0)
|
||||
endif(GETTEXT_RUNTIME_FOUND AND GETTEXT_TOOLS_FOUND)
|
||||
|
||||
if(NOT GETTEXT_FOUND AND NOT Gettext_FIND_QUIETLY AND Gettext_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find gettext runtime library and tools for internationalization purposes.\n\n${GETTEXT_INFO_MSG}")
|
||||
endif(NOT GETTEXT_FOUND AND NOT Gettext_FIND_QUIETLY AND Gettext_FIND_REQUIRED)
|
|
@ -1,9 +1,5 @@
|
|||
Files in this folder will be used to help cmake. The origin of the scripts, if they are not written by us will be noted here, too, so that it is easy to update them.
|
||||
|
||||
file: FindLibintl.cmake
|
||||
url: http://websvn.kde.org/*checkout*/trunk/KDE/kdelibs/cmake/modules/FindLibintl.cmake
|
||||
revision: 797757
|
||||
|
||||
file: FindGettext.cmake
|
||||
url: http://kwwidgets.org/cgi-bin/viewcvs.cgi/CMake/FindGettext.cmake?root=KWWidgets&view=markup
|
||||
revision: 1.2
|
||||
|
|
|
@ -466,7 +466,6 @@
|
|||
91B622131B76C0A600B00E0F /* libgthread-2.0.0.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242A18EF07B4001FA499 /* libgthread-2.0.0.dylib */; };
|
||||
91B622141B76C0A600B00E0F /* libharfbuzz.0.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242B18EF07B4001FA499 /* libharfbuzz.0.dylib */; };
|
||||
91B622151B76C0A600B00E0F /* libiconv.2.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242C18EF07B4001FA499 /* libiconv.2.dylib */; };
|
||||
91B622161B76C0A600B00E0F /* libintl.8.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242D18EF07B4001FA499 /* libintl.8.dylib */; };
|
||||
91B622171B76C0A600B00E0F /* libpango-1.0.0.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242E18EF07B4001FA499 /* libpango-1.0.0.dylib */; };
|
||||
91B622181B76C0A600B00E0F /* libpangocairo-1.0.0.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242F18EF07B4001FA499 /* libpangocairo-1.0.0.dylib */; };
|
||||
91B622191B76C0A600B00E0F /* libpangoft2-1.0.0.dylib in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C243018EF07B4001FA499 /* libpangoft2-1.0.0.dylib */; };
|
||||
|
@ -1084,7 +1083,6 @@
|
|||
EC2194491960634100420969 /* game_launcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC2194471960634100420969 /* game_launcher.cpp */; };
|
||||
EC21944F1960649000420969 /* display_chat_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC21944D1960649000420969 /* display_chat_manager.cpp */; };
|
||||
EC219454196064C500420969 /* wesnoth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC219453196064C500420969 /* wesnoth.cpp */; };
|
||||
EC225C9718EF0ABC00025EC4 /* libintl.8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242D18EF07B4001FA499 /* libintl.8.dylib */; };
|
||||
EC2864301967989000168DFF /* filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC28642E1967988F00168DFF /* filter.cpp */; };
|
||||
EC2864331967990500168DFF /* variable_info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC2864311967990500168DFF /* variable_info.cpp */; };
|
||||
EC28C58F19423426003B0F5E /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EC28C58D19423426003B0F5E /* utils.cpp */; };
|
||||
|
@ -1142,7 +1140,6 @@
|
|||
EC5C244318EF07B4001FA499 /* libgthread-2.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242A18EF07B4001FA499 /* libgthread-2.0.0.dylib */; };
|
||||
EC5C244418EF07B4001FA499 /* libharfbuzz.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242B18EF07B4001FA499 /* libharfbuzz.0.dylib */; };
|
||||
EC5C244518EF07B4001FA499 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242C18EF07B4001FA499 /* libiconv.2.dylib */; };
|
||||
EC5C244618EF07B4001FA499 /* libintl.8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242D18EF07B4001FA499 /* libintl.8.dylib */; };
|
||||
EC5C244718EF07B4001FA499 /* libpango-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242E18EF07B4001FA499 /* libpango-1.0.0.dylib */; };
|
||||
EC5C244818EF07B4001FA499 /* libpangocairo-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C242F18EF07B4001FA499 /* libpangocairo-1.0.0.dylib */; };
|
||||
EC5C244918EF07B4001FA499 /* libpangoft2-1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EC5C243018EF07B4001FA499 /* libpangoft2-1.0.0.dylib */; };
|
||||
|
@ -1374,7 +1371,6 @@
|
|||
91B622131B76C0A600B00E0F /* libgthread-2.0.0.dylib in Copy Frameworks */,
|
||||
91B622141B76C0A600B00E0F /* libharfbuzz.0.dylib in Copy Frameworks */,
|
||||
91B622151B76C0A600B00E0F /* libiconv.2.dylib in Copy Frameworks */,
|
||||
91B622161B76C0A600B00E0F /* libintl.8.dylib in Copy Frameworks */,
|
||||
91B622171B76C0A600B00E0F /* libpango-1.0.0.dylib in Copy Frameworks */,
|
||||
91B622181B76C0A600B00E0F /* libpangocairo-1.0.0.dylib in Copy Frameworks */,
|
||||
91B622191B76C0A600B00E0F /* libpangoft2-1.0.0.dylib in Copy Frameworks */,
|
||||
|
@ -2474,7 +2470,6 @@
|
|||
EC5C242A18EF07B4001FA499 /* libgthread-2.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libgthread-2.0.0.dylib"; path = "lib/libgthread-2.0.0.dylib"; sourceTree = "<group>"; };
|
||||
EC5C242B18EF07B4001FA499 /* libharfbuzz.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libharfbuzz.0.dylib; path = lib/libharfbuzz.0.dylib; sourceTree = "<group>"; };
|
||||
EC5C242C18EF07B4001FA499 /* libiconv.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.2.dylib; path = lib/libiconv.2.dylib; sourceTree = "<group>"; };
|
||||
EC5C242D18EF07B4001FA499 /* libintl.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libintl.8.dylib; path = lib/libintl.8.dylib; sourceTree = "<group>"; };
|
||||
EC5C242E18EF07B4001FA499 /* libpango-1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libpango-1.0.0.dylib"; path = "lib/libpango-1.0.0.dylib"; sourceTree = "<group>"; };
|
||||
EC5C242F18EF07B4001FA499 /* libpangocairo-1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libpangocairo-1.0.0.dylib"; path = "lib/libpangocairo-1.0.0.dylib"; sourceTree = "<group>"; };
|
||||
EC5C243018EF07B4001FA499 /* libpangoft2-1.0.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libpangoft2-1.0.0.dylib"; path = "lib/libpangoft2-1.0.0.dylib"; sourceTree = "<group>"; };
|
||||
|
@ -2735,7 +2730,6 @@
|
|||
EC5C244318EF07B4001FA499 /* libgthread-2.0.0.dylib in Frameworks */,
|
||||
EC5C244418EF07B4001FA499 /* libharfbuzz.0.dylib in Frameworks */,
|
||||
EC5C244518EF07B4001FA499 /* libiconv.2.dylib in Frameworks */,
|
||||
EC5C244618EF07B4001FA499 /* libintl.8.dylib in Frameworks */,
|
||||
EC5C244718EF07B4001FA499 /* libpango-1.0.0.dylib in Frameworks */,
|
||||
EC5C244818EF07B4001FA499 /* libpangocairo-1.0.0.dylib in Frameworks */,
|
||||
90606A2B1D5599BA00719B40 /* libpcre.1.dylib in Frameworks */,
|
||||
|
@ -2809,7 +2803,6 @@
|
|||
EC4DF45B19FEA84A000EC086 /* libboost_locale-mt.dylib in Frameworks */,
|
||||
EC64D7681A085F4A0092EF75 /* libboost_random-mt.dylib in Frameworks */,
|
||||
ECF9D44219F4050E00E6C9D9 /* libboost_system-mt.dylib in Frameworks */,
|
||||
EC225C9718EF0ABC00025EC4 /* libintl.8.dylib in Frameworks */,
|
||||
91C554681D77A545002DB0C8 /* libpcre.1.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -3207,7 +3200,6 @@
|
|||
EC5C242A18EF07B4001FA499 /* libgthread-2.0.0.dylib */,
|
||||
EC5C242B18EF07B4001FA499 /* libharfbuzz.0.dylib */,
|
||||
EC5C242C18EF07B4001FA499 /* libiconv.2.dylib */,
|
||||
EC5C242D18EF07B4001FA499 /* libintl.8.dylib */,
|
||||
EC5C242E18EF07B4001FA499 /* libpango-1.0.0.dylib */,
|
||||
EC5C242F18EF07B4001FA499 /* libpangocairo-1.0.0.dylib */,
|
||||
EC5C243018EF07B4001FA499 /* libpangoft2-1.0.0.dylib */,
|
||||
|
|
|
@ -57,41 +57,4 @@ def generate(env):
|
|||
)
|
||||
env["BUILDERS"]["Po4aTranslate"] = po4a_translate
|
||||
|
||||
def CheckGettextLibintl(context):
|
||||
env = context.env
|
||||
backup = env.Clone().Dictionary()
|
||||
context.Message("Checking for Gettext's libintl... ")
|
||||
|
||||
test_program = """
|
||||
#include <libintl.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
textdomain("test");
|
||||
char* text = gettext("foo");
|
||||
}
|
||||
\n"""
|
||||
|
||||
if not env.get("gettextdir") and context.TryLink(test_program, ".c"):
|
||||
context.Result("libc built-in")
|
||||
return True
|
||||
|
||||
prefixes = [env["prefix"]]
|
||||
if env.get("gettextdir"):
|
||||
prefixes = [env["gettextdir"]] + prefixes
|
||||
includes = find_include(prefixes, "libintl.h", default_prefixes=not env["host"])
|
||||
if includes:
|
||||
env.AppendUnique(
|
||||
CPPPATH = [join(includes[0][0], "include")],
|
||||
LIBPATH = [join(includes[0][0], "lib")]
|
||||
)
|
||||
env.AppendUnique(LIBS = ["intl"])
|
||||
if context.TryLink("/* external libintl*/\n" + test_program, ".c"):
|
||||
context.Result("external")
|
||||
return True
|
||||
|
||||
context.Result("no")
|
||||
env.Replace(**backup)
|
||||
return False
|
||||
|
||||
config_checks = { "CheckGettextLibintl" : CheckGettextLibintl }
|
||||
config_checks = {}
|
||||
|
|
|
@ -18,7 +18,6 @@ endif(MSVC)
|
|||
include_directories(SYSTEM ${PANGOCAIRO_INCLUDE_DIRS} )
|
||||
include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR} )
|
||||
include_directories(SYSTEM ${LIBDBUS_INCLUDE_DIRS} )
|
||||
include_directories(SYSTEM ${LIBINTL_INCLUDE_DIR} )
|
||||
include_directories(SYSTEM ${VORBISFILE_INCLUDE_DIR} )
|
||||
|
||||
|
||||
|
@ -78,17 +77,10 @@ set(common-external-libs
|
|||
${Boost_FILESYSTEM_LIBRARY}
|
||||
)
|
||||
|
||||
if(NOT ENABLE_LIBINTL)
|
||||
set(common-external-libs
|
||||
${common-external-libs}
|
||||
${Boost_LOCALE_LIBRARY}
|
||||
)
|
||||
else()
|
||||
set(common-external-libs
|
||||
${common-external-libs}
|
||||
${LIBINTL_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
set(common-external-libs
|
||||
${common-external-libs}
|
||||
${Boost_LOCALE_LIBRARY}
|
||||
)
|
||||
|
||||
set(game-external-libs
|
||||
${common-external-libs}
|
||||
|
@ -222,6 +214,7 @@ set(libwesnoth-core_STAT_SRC
|
|||
filesystem_common.cpp
|
||||
font/constants.cpp
|
||||
game_config.cpp
|
||||
gettext_boost.cpp
|
||||
hash.cpp
|
||||
log.cpp
|
||||
md5.cpp
|
||||
|
@ -239,18 +232,6 @@ set(libwesnoth-core_STAT_SRC
|
|||
serialization/validator.cpp
|
||||
)
|
||||
|
||||
if(NOT ENABLE_LIBINTL)
|
||||
set(libwesnoth-core_STAT_SRC
|
||||
${libwesnoth-core_STAT_SRC}
|
||||
gettext_boost.cpp
|
||||
)
|
||||
else()
|
||||
set(libwesnoth-core_STAT_SRC
|
||||
${libwesnoth-core_STAT_SRC}
|
||||
gettext.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(libwesnoth-core_STAT_SRC
|
||||
${libwesnoth-core_STAT_SRC}
|
||||
|
@ -1185,7 +1166,6 @@ add_executable(campaignd ${campaignd_SRC})
|
|||
target_link_libraries(campaignd
|
||||
wesnoth-core
|
||||
${server-external-libs}
|
||||
${LIBINTL_LIBRARIES}
|
||||
${Boost_RANDOM_LIBRARY}
|
||||
${LIBRT}
|
||||
)
|
||||
|
|
|
@ -75,14 +75,9 @@ if env["PLATFORM"] == "win32":
|
|||
filesystem_env.Object("log_windows.cpp")
|
||||
])
|
||||
|
||||
if env["libintl"]:
|
||||
libwesnoth_core_sources.extend([
|
||||
filesystem_env.Object("gettext.cpp")
|
||||
])
|
||||
else:
|
||||
libwesnoth_core_sources.extend([
|
||||
filesystem_env.Object("gettext_boost.cpp")
|
||||
])
|
||||
libwesnoth_core_sources.extend([
|
||||
filesystem_env.Object("gettext_boost.cpp")
|
||||
])
|
||||
|
||||
libwesnoth_core = [env.Library("wesnoth_core", libwesnoth_core_sources)]
|
||||
|
||||
|
|
196
src/gettext.cpp
196
src/gettext.cpp
|
@ -1,196 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003 - 2016 by David White <dave@whitevine.net>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "global.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libintl.h>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef setlocale
|
||||
// Someone in libintl world decided it was a good idea to define a "setlocale" macro.
|
||||
// Note: This is necessary to compile on OS X, it fixes bug #16649
|
||||
#undef setlocale
|
||||
#endif
|
||||
|
||||
#define DBG_G LOG_STREAM(debug, lg::general)
|
||||
#define LOG_G LOG_STREAM(info, lg::general)
|
||||
#define WRN_G LOG_STREAM(warn, lg::general)
|
||||
#define ERR_G LOG_STREAM(err, lg::general)
|
||||
namespace translation
|
||||
{
|
||||
std::string dgettext(const char* domain, const char* msgid)
|
||||
{
|
||||
return ::dgettext(domain, msgid);
|
||||
}
|
||||
std::string egettext(char const *msgid)
|
||||
{
|
||||
return msgid[0] == '\0' ? msgid : (::gettext)(msgid);
|
||||
}
|
||||
|
||||
std::string dsgettext (const char * domainname, const char *msgid)
|
||||
{
|
||||
bind_textdomain_codeset(domainname, "UTF-8");
|
||||
const char *msgval = ::dgettext (domainname, msgid);
|
||||
if (msgval == msgid) {
|
||||
msgval = std::strrchr (msgid, '^');
|
||||
if (msgval == nullptr)
|
||||
msgval = msgid;
|
||||
else
|
||||
msgval++;
|
||||
}
|
||||
return msgval;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
const char* sgettext (const char *msgid)
|
||||
{
|
||||
const char *msgval = gettext (msgid);
|
||||
if (msgval == msgid) {
|
||||
msgval = std::strrchr (msgid, '^');
|
||||
if (msgval == nullptr)
|
||||
msgval = msgid;
|
||||
else
|
||||
msgval++;
|
||||
}
|
||||
return msgval;
|
||||
}
|
||||
|
||||
const char* sngettext (const char *singular, const char *plural, int n)
|
||||
{
|
||||
const char *msgval = ngettext (singular, plural, n);
|
||||
if (msgval == singular) {
|
||||
msgval = std::strrchr (singular, '^');
|
||||
if (msgval == nullptr)
|
||||
msgval = singular;
|
||||
else
|
||||
msgval++;
|
||||
}
|
||||
return msgval;
|
||||
}
|
||||
|
||||
#endif
|
||||
std::string dsngettext (const char * domainname, const char *singular, const char *plural, int n)
|
||||
{
|
||||
bind_textdomain_codeset(domainname, "UTF-8");
|
||||
const char *msgval = ::dngettext (domainname, singular, plural, n);
|
||||
if (msgval == singular) {
|
||||
msgval = std::strrchr (singular, '^');
|
||||
if (msgval == nullptr)
|
||||
msgval = singular;
|
||||
else
|
||||
msgval++;
|
||||
}
|
||||
return msgval;
|
||||
}
|
||||
|
||||
void bind_textdomain(const char* domain, const char* directory, const char* encoding)
|
||||
{
|
||||
if(domain != nullptr && strchr(domain, '/') != nullptr) {
|
||||
// For compatibility with Boost.Locale implementation, which interprets
|
||||
// slashes in domain names in a special fashion.
|
||||
ERR_G << "illegal textdomain name '" << domain
|
||||
<< "', skipping textdomain\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if(directory != nullptr)
|
||||
bindtextdomain(domain, directory);
|
||||
if(encoding != nullptr)
|
||||
bind_textdomain_codeset(domain, encoding);
|
||||
}
|
||||
|
||||
void set_default_textdomain(const char* domain)
|
||||
{
|
||||
textdomain(domain);
|
||||
}
|
||||
|
||||
void set_language(const std::string& slocale, const std::vector<std::string>* alternates)
|
||||
{
|
||||
|
||||
//Code copied from language.cpp::wesnoth_setlocale()
|
||||
std::string locale = slocale;
|
||||
// FIXME: ideally we should check LANGUAGE and on first invocation
|
||||
// use that value, so someone with es would get the game in Spanish
|
||||
// instead of en_US the first time round
|
||||
// LANGUAGE overrides other settings, so for now just get rid of it
|
||||
|
||||
#ifdef _WIN32
|
||||
(void)alternates;
|
||||
std::string win_locale(locale, 0, 2);
|
||||
#include "language_win32.ii"
|
||||
SetEnvironmentVariableA("LANG", win_locale.c_str());
|
||||
std::string env = "LANGUAGE=" + locale;
|
||||
_putenv(env.c_str());
|
||||
return;
|
||||
#else
|
||||
// FIXME: add configure check for unsetenv
|
||||
unsetenv ("LANGUAGE"); // void so no return value to check
|
||||
#ifdef __APPLE__
|
||||
if (setenv("LANG", locale.c_str(), 1) == -1) {
|
||||
ERR_G << "setenv LANG failed: " << strerror(errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *res = nullptr;
|
||||
std::vector<std::string>::const_iterator i;
|
||||
if (alternates) i = alternates->begin();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::string lang = locale, extra;
|
||||
std::string::size_type pos = locale.find('@');
|
||||
if (pos != std::string::npos) {
|
||||
lang.erase(pos);
|
||||
extra = locale.substr(pos);
|
||||
}
|
||||
|
||||
/*
|
||||
* The "" is the last item to work-around a problem in glibc picking
|
||||
* the non utf8 locale instead an utf8 version if available.
|
||||
*/
|
||||
char const *encoding[] = { ".utf-8", ".UTF-8", "" };
|
||||
for (int j = 0; j != 3; ++j)
|
||||
{
|
||||
locale = lang + encoding[j] + extra;
|
||||
res = std::setlocale(LC_MESSAGES, locale.c_str());
|
||||
if (res) {
|
||||
LOG_G << "Set locale to '" << locale << "' result: '" << res << "'.\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!alternates || i == alternates->end()) break;
|
||||
locale = *i;
|
||||
++i;
|
||||
}
|
||||
WRN_G << "setlocale() failed for '" << slocale << "'." << std::endl;
|
||||
#endif //win32
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
std::setlocale(LC_MESSAGES, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,6 @@
|
|||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-test"
|
||||
//#include <libintl.h>
|
||||
|
||||
#include "tests/utils/game_config_manager.hpp"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue