From 1340da7b54721cffff6c546df2f4e2c931cf6377 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 12:33:29 +0200 Subject: Refactor and clean up gettext management --- cmake/Modules/FindGettextLib.cmake | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cmake/Modules/FindGettextLib.cmake (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake new file mode 100644 index 000000000..1ef8997f4 --- /dev/null +++ b/cmake/Modules/FindGettextLib.cmake @@ -0,0 +1,48 @@ +# Package finder for gettext libs and include files + +SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext" + CACHE FILEPATH "path to custom gettext") + +# by default +SET(GETTEXT_FOUND FALSE) + +FIND_PATH(GETTEXT_INCLUDE_DIR + NAMES libintl.h + PATHS "${CUSTOM_GETTEXT_PATH}/include" + DOC "gettext include directory") + +FIND_PROGRAM(GETTEXT_MSGFMT + NAMES msgfmt + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgfmt") + +# modern Linux, as well as Mac, seem to not need require special linking +# TODO check the requirements on other BSDs and older Linux +IF (WIN32) + FIND_LIBRARY(GETTEXT_LIBRARY + NAMES libintl.lib intl.lib libintl3.lib intl3.lib + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *intl*.lib") + FIND_LIBRARY(GETTEXT_DLL + NAMES libintl.dll intl.dll libintl3.dll intl3.dll + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *intl*.dll") + FIND_LIBRARY(GETTEXT_ICONV_DLL + NAMES libiconv2.dll + PATHS "${CUSTOM_GETTEXT_PATH}/lib" + DOC "gettext *iconv*.lib") +ENDIF(WIN32) + + +IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT) + IF (WIN32) + # in the Win32 case check also for the extra linking requirements + IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL) + SET(GETTEXT_FOUND TRUE) + ENDIF() + ELSE(WIN32) + SET(GETTEXT_FOUND TRUE) + ENDIF(WIN32) +ENDIF() + + -- cgit v1.2.3 From 2a6c0fc17f0ed113a6f46f852338b96bce4d966d Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Thu, 21 Jul 2011 13:24:37 +0200 Subject: updated some path because the dlls are mostly under bin not lib added explanation why libintl must not belinked under some oses --- cmake/Modules/FindGettextLib.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 1ef8997f4..3fb391e65 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -17,6 +17,7 @@ FIND_PROGRAM(GETTEXT_MSGFMT DOC "path to msgfmt") # modern Linux, as well as Mac, seem to not need require special linking +# they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux IF (WIN32) FIND_LIBRARY(GETTEXT_LIBRARY @@ -25,11 +26,11 @@ IF (WIN32) DOC "gettext *intl*.lib") FIND_LIBRARY(GETTEXT_DLL NAMES libintl.dll intl.dll libintl3.dll intl3.dll - PATHS "${CUSTOM_GETTEXT_PATH}/lib" + PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.dll") FIND_LIBRARY(GETTEXT_ICONV_DLL NAMES libiconv2.dll - PATHS "${CUSTOM_GETTEXT_PATH}/lib" + PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *iconv*.lib") ENDIF(WIN32) -- cgit v1.2.3 From 9fa4b72a4752795962b0d17c485de92fdbd029fc Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 21 Jul 2011 14:50:15 +0200 Subject: Find correct library for MSVC vs MingW in Winows --- cmake/Modules/FindGettextLib.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 3fb391e65..1bc92708a 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -20,8 +20,15 @@ FIND_PROGRAM(GETTEXT_MSGFMT # they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux IF (WIN32) + IF(MSVC) + SET(GETTEXT_LIB_NAMES + libintl.lib intl.lib libintl3.lib intl3.lib) + ELSE() + SET(GETTEXT_LIB_NAMES + libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a) + ENDIF() FIND_LIBRARY(GETTEXT_LIBRARY - NAMES libintl.lib intl.lib libintl3.lib intl3.lib + NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.lib") FIND_LIBRARY(GETTEXT_DLL -- cgit v1.2.3 From fc95d00b2f9929d3fdb93fff9a971d26115c12f4 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Thu, 21 Jul 2011 16:21:01 +0200 Subject: fixed not finding dll for gettext in MSVC --- cmake/Modules/FindGettextLib.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 1bc92708a..f7ac8de5d 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -31,11 +31,11 @@ IF (WIN32) NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.lib") - FIND_LIBRARY(GETTEXT_DLL + FIND_FILE(GETTEXT_DLL NAMES libintl.dll intl.dll libintl3.dll intl3.dll PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *intl*.dll") - FIND_LIBRARY(GETTEXT_ICONV_DLL + FIND_FILE(GETTEXT_ICONV_DLL NAMES libiconv2.dll PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *iconv*.lib") -- cgit v1.2.3 From d386f02893e132317bd2641878d0b86b52347d15 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 09:36:17 +0200 Subject: Refactor mo creation/installation --- cmake/Modules/FindGettextLib.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index f7ac8de5d..31b261539 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -53,4 +53,13 @@ IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT) ENDIF(WIN32) ENDIF() - +IF(GETTEXT_FOUND) + SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po) + SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale//LC_MESSAGES) + SET(GETTEXT_MO_DEST_PATH locale//LC_MESSAGES) + FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*") + MACRO(SET_MO_PATHS _buildvar _destvar _locale) + STRING(REPLACE "" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH}) + STRING(REPLACE "" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH}) + ENDMACRO(SET_MO_PATHS) +ENDIF() -- cgit v1.2.3 From d78e5e7329bc56255288c32193504ca97dbf15db Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 22 Jul 2011 10:55:05 +0200 Subject: updatepo cmake rule Get rid of the system-specific updatelocales.sh and introduce an updatepo cmake rule. po files are also updated before creating the mo files, and we now keep the .pot file (in the po/en directory). To stabilize the po file creation, file contents are sorted by source filename. Update po files in the process. --- cmake/Modules/FindGettextLib.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 31b261539..b99fd33b8 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -16,6 +16,21 @@ FIND_PROGRAM(GETTEXT_MSGFMT PATHS "${CUSTOM_GETTEXT_PATH}/bin" DOC "path to msgfmt") +FIND_PROGRAM(GETTEXT_MSGMERGE + NAMES msgmerge + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgmerge") + +FIND_PROGRAM(GETTEXT_MSGEN + NAMES msgen + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to msgen") + +FIND_PROGRAM(GETTEXT_EXTRACT + NAMES xgettext + PATHS "${CUSTOM_GETTEXT_PATH}/bin" + DOC "path to xgettext") + # modern Linux, as well as Mac, seem to not need require special linking # they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux -- cgit v1.2.3 From f6d9bcc9bb020f79f73bc2cf0187f73a6d1d9275 Mon Sep 17 00:00:00 2001 From: Constantin Wenger Date: Sat, 23 Jul 2011 22:36:11 +0200 Subject: updated cmakerules to autodetect if gettext can be used fixed error if gettext is disabled --- cmake/Modules/FindGettextLib.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index b99fd33b8..1c36f8c6e 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -77,4 +77,7 @@ IF(GETTEXT_FOUND) STRING(REPLACE "" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH}) STRING(REPLACE "" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH}) ENDMACRO(SET_MO_PATHS) +ELSE() + SET(GETTEXT_INCLUDE_DIR "") + SET(GETTEXT_LIBRARY "") ENDIF() -- cgit v1.2.3 From 47381bde3b4d7a9ee9780786c9a993f2b63a488a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 24 Jul 2011 10:19:31 +0200 Subject: Bring po update out of cmake again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This solves two issues at once: * CMake would delete po files during ‘make clean’ because it thought they were autogenerated and not just managed * the only gettext tools readily available in Windows are so old they don't support options like --package-name The change also moves minetest.pot down one level, so we don't need to special case ‘en’ anymore. The downside is of course that you need some sane POSIX shell to update the po files. --- cmake/Modules/FindGettextLib.cmake | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 1c36f8c6e..a215f3f8d 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -16,21 +16,6 @@ FIND_PROGRAM(GETTEXT_MSGFMT PATHS "${CUSTOM_GETTEXT_PATH}/bin" DOC "path to msgfmt") -FIND_PROGRAM(GETTEXT_MSGMERGE - NAMES msgmerge - PATHS "${CUSTOM_GETTEXT_PATH}/bin" - DOC "path to msgmerge") - -FIND_PROGRAM(GETTEXT_MSGEN - NAMES msgen - PATHS "${CUSTOM_GETTEXT_PATH}/bin" - DOC "path to msgen") - -FIND_PROGRAM(GETTEXT_EXTRACT - NAMES xgettext - PATHS "${CUSTOM_GETTEXT_PATH}/bin" - DOC "path to xgettext") - # modern Linux, as well as Mac, seem to not need require special linking # they do not because gettext is part of glibc # TODO check the requirements on other BSDs and older Linux @@ -73,6 +58,7 @@ IF(GETTEXT_FOUND) SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale//LC_MESSAGES) SET(GETTEXT_MO_DEST_PATH locale//LC_MESSAGES) FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*") + LIST(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot) MACRO(SET_MO_PATHS _buildvar _destvar _locale) STRING(REPLACE "" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH}) STRING(REPLACE "" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH}) -- cgit v1.2.3 From cce210f6768ab9960248f07d2b203dfae660daac Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 24 Jul 2011 19:20:40 +0200 Subject: Locale dir should be parallel to global data dir --- cmake/Modules/FindGettextLib.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake/Modules/FindGettextLib.cmake') diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index a215f3f8d..18935eaad 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -56,7 +56,7 @@ ENDIF() IF(GETTEXT_FOUND) SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po) SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale//LC_MESSAGES) - SET(GETTEXT_MO_DEST_PATH locale//LC_MESSAGES) + SET(GETTEXT_MO_DEST_PATH ${DATADIR}/../locale//LC_MESSAGES) FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*") LIST(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot) MACRO(SET_MO_PATHS _buildvar _destvar _locale) -- cgit v1.2.3