gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, cmake, updated. 2f8d4e37f5dffe7f5b8d28a2


From: Juergen Kahrs
Subject: [gawk-diffs] [SCM] gawk branch, cmake, updated. 2f8d4e37f5dffe7f5b8d28a21d785b37d6e09e0f
Date: Mon, 11 Feb 2013 18:21:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, cmake has been updated
       via  2f8d4e37f5dffe7f5b8d28a21d785b37d6e09e0f (commit)
      from  1eade34854d9bfa858ffd2aa44cd1f5baf5951f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2f8d4e37f5dffe7f5b8d28a21d785b37d6e09e0f

commit 2f8d4e37f5dffe7f5b8d28a21d785b37d6e09e0f
Author: Juergen Kahrs <address@hidden>
Date:   Mon Feb 11 19:20:50 2013 +0100

    Add ENABLE_NLS if all necessary packages can be found.Build translations. 
Copied po/CMakeLists.txt from Stellarium project at 
http://sourceforge.net/projects/stellarium/. This works somehow with some 
changes.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d76f834..7dbe993 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,9 +126,19 @@ DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H)
 DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H)
 DefineFunctionIfAvailable(gettext HAVE_GETTEXT)
 DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT)
+  FIND_PACKAGE(Gettext REQUIRED)
+#  FIND_PACKAGE(XGettext REQUIRED)
+#  FIND_PACKAGE(Iconv REQUIRED)
+  FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include)
+  FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib)
 DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET)
 DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES)
 DefineTypeIfAvailable("_Bool" HAVE__BOOL)
+if (${HAVE_GETTEXT} AND  ${HAVE_DCGETTEXT} AND ${HAVE_LANGINFO_CODESET} AND 
${HAVE_LC_MESSAGES})
+  add_definitions(-D LOCALEDIR=\\"/usr/share/locale\\")
+  add_definitions(-D ENABLE_NLS)
+  ADD_SUBDIRECTORY( po )
+endif()
 DefineHFileIfAvailable(stdbool.h HAVE_STDBOOL_H)
 DefineHFileIfAvailable(sys/wait.h HAVE_SYS_WAIT_H)
 DefineHFileIfAvailable(arpa/inet.h HAVE_ARPA_INET_H)
@@ -261,7 +271,6 @@ endif()
 
 set (GAWK_SOURCES ${GAWK_SOURCES}
   array.c
-  awkgram.c
   builtin.c 
   cint_array.c 
   command.c
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..cd93007
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,133 @@
+# Most of this copied from the repository of Stellarium
+# http://sourceforge.net/projects/stellarium/
+
+# Special targets for translations:
+#
+# translations
+#   Converts all PO files to GMO files. Note that it does *not* update
+#   the PO files or the PO templates -- in fact, these files are never
+#   updated automatically.
+#
+# generate-pot
+#   Re-creates all POT files unconditionally.
+#
+# update-po
+#   Updates all PO files unconditionally. Note that it takes care of
+#   updating the POT files.
+#
+# translations-<DOMAIN>
+# generate-pot-<DOMAIN>
+# update-po-<DOMAIN>
+#   Same as above, but only affect the files in the corresponding
+#   po/<DOMAIN> directory. (DOMAIN is actually the base name of the POT
+#   file in the subdirectory, but that should match the directory name
+#   anyway.)
+
+ADD_CUSTOM_TARGET(translations)
+ADD_CUSTOM_TARGET(generate-pot)
+ADD_CUSTOM_TARGET(update-po)
+
+# GETTEXT_CREATE_TRANSLATIONS(domain [DEFAULT_TARGET] lang1 ... langN)
+#
+# Creates custom build rules to create and install (G)MO files for the
+# specified languages. If the DEFAULT_TARGET option is used, the
+# translations will also be created when building the default target.
+#
+# "domain" is the translation domain, eg. "gawk". A POT file
+# with the name ${domain}.pot must exist in the directory of the
+# CMakeLists.txt file invoking the macro.
+#
+# This macro also creates the "translations-${domain}" and
+# "update-po-${domain}" targets (see above for an explanation).
+#
+MACRO(GETTEXT_CREATE_TRANSLATIONS _domain _firstLang)
+
+    SET(_gmoFiles)
+    GET_FILENAME_COMPONENT(_absPotFile ${_domain}.pot ABSOLUTE)
+
+    # Update these PO files when building the "update-po-<DOMAIN>" and
+    # "update-po" targets.
+    ADD_CUSTOM_TARGET(update-po-${_domain})
+    ADD_DEPENDENCIES(update-po update-po-${_domain})
+
+    # Make sure the POT file is updated before updating the PO files.
+    ADD_DEPENDENCIES(update-po-${_domain} generate-pot-${_domain})
+
+    SET(_addToAll)
+    IF(${_firstLang} STREQUAL "DEFAULT_TARGET")
+        SET(_addToAll "ALL")
+        SET(_firstLang)
+    ENDIF(${_firstLang} STREQUAL "DEFAULT_TARGET")
+
+    FOREACH (_lang ${ARGN})
+        GET_FILENAME_COMPONENT(_absFile ${_lang}.po ABSOLUTE)
+        FILE(RELATIVE_PATH _relFile ${PROJECT_SOURCE_DIR} ${_absFile})
+        SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+        # Convert a PO file into a GMO file.
+        ADD_CUSTOM_COMMAND(
+            OUTPUT ${_gmoFile} 
+            COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+            DEPENDS ${_absFile}
+        )
+
+        # Update the PO file unconditionally when building the
+        # "update-po-<DOMAIN>" target. Note that to see the file being
+        # processed, we have to run "cmake -E echo", because the
+        # COMMENT is not displayed by cmake...
+        ADD_CUSTOM_COMMAND(
+            TARGET update-po-${_domain}
+            POST_BUILD
+            COMMAND ${CMAKE_COMMAND} -E echo "** Updating ${_relFile}"
+            COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
+                --quiet --update -m --backup=none -s
+                ${_absFile} ${_absPotFile}
+            VERBATIM
+        )
+
+        INSTALL(FILES ${_gmoFile} DESTINATION 
share/locale/${_lang}/LC_MESSAGES RENAME ${_domain}.mo)
+        SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+   ENDFOREACH (_lang)
+
+   # Create the GMO files when building the "translations-<DOMAIN>" and
+   # "translations" targets.
+   ADD_CUSTOM_TARGET(translations-${_domain} ${_addToAll} DEPENDS ${_gmoFiles})
+   ADD_DEPENDENCIES(translations translations-${_domain})
+
+ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
+
+SET(gawk_DOMAIN gawk)
+SET(gawk_POT ${gawk_DOMAIN}.pot)
+
+file(READ LINGUAS linguas)
+string(REGEX REPLACE "\n" ";"  linguas ${linguas})
+GETTEXT_CREATE_TRANSLATIONS(${gawk_DOMAIN} DEFAULT_TARGET ${linguas})
+
+ADD_CUSTOM_TARGET(
+  generate-pot-${gawk_DOMAIN}
+  ${GETTEXT_XGETTEXT_EXECUTABLE}
+  -o ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT}
+  -C
+  --keyword=_
+  --keyword=N_
+  --keyword=q_
+  --keyword=translate:2
+  --add-comments=TRANSLATORS:
+  --directory=${CMAKE_BINARY_DIR}
+  --directory=${CMAKE_SOURCE_DIR}
+  --output-dir=${CMAKE_BINARY_DIR}
+  --files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in
+  --copyright-holder=FSF
+  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+  COMMENT "Generating ${gawk_POT}"
+  VERBATIM
+)
+# TODO: It would be nice to just depend on the exact files in POTFILES.in
+#file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT} UiHeaders)
+#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} UiHeaders)
+#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} gawk_UIS_H)
+# Make sure the UI headers are created first.
+ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} StelGuiLib)  # ??? FIXME
+# Generate this POT file when building the "generate-pot" target.
+ADD_DEPENDENCIES(generate-pot generate-pot-${gawk_DOMAIN}) 

-----------------------------------------------------------------------

Summary of changes:
 CMakeLists.txt    |   11 ++++-
 po/CMakeLists.txt |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 1 deletions(-)
 create mode 100644 po/CMakeLists.txt


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]