summaryrefslogtreecommitdiffstats
path: root/po/CMakeLists.txt
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-07-01 19:54:16 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-07-02 16:35:11 +0000
commit3180946c8af1e28105aae017c9dd23379337696e (patch)
tree737334f195c9dfc997b1db62eedc7e7be5a7e0bc /po/CMakeLists.txt
parentCrashfix when importing/selecting large png (diff)
downloadinkscape-3180946c8af1e28105aae017c9dd23379337696e.tar.gz
inkscape-3180946c8af1e28105aae017c9dd23379337696e.zip
CMake: Allow Windows devs to re-create inkscape.pot
Diffstat (limited to 'po/CMakeLists.txt')
-rw-r--r--po/CMakeLists.txt79
1 files changed, 44 insertions, 35 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index fa1fb4584..4e8439389 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,5 +1,6 @@
-# process and install .po files
# SPDX-License-Identifier: GPL-2.0-or-later
+
+# process and install .po files
file(GLOB LANGUAGES *.po)
foreach(language ${LANGUAGES})
string(REGEX REPLACE "(.+(\\\\|/))+" "" language ${language})
@@ -11,6 +12,48 @@ foreach(language ${LANGUAGES})
endforeach(language)
+# update inkscape.pot
+set(_potFile ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pot)
+set(xgettext_options -j --keyword=_ --keyword=N_ --keyword=Q_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --msgid-bugs-address=inkscape-devel@lists.sourceforge.net --strict -s --from-code=UTF-8 -ktranslatable -o ${_potFile})
+
+# Due to a bug in old xgettext versions, we cannot use '--its='.
+# Instead, we use GETTEXTDATADIR=. to refer to the po/its/*.its files.
+# This requires a .loc file for each .its file. See po/its/units.loc for an example.
+# See https://gitlab.com/inkscape/inkscape/issues/271 for details.
+# This workaround is necessary for Debian 9, so roughly until ca 2021.
+set(its_workaround ${CMAKE_COMMAND} -E env GETTEXTDATADIR=.)
+
+add_custom_target(inkscape_pot BYPRODUCTS ${_potFile}
+ # make sure inkscape.pot is re-created from scratch
+ COMMAND rm -f ${_potFile} && touch ${_potFile}
+
+ # extract strings from source files into inkscape.pot
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -C -f POTFILES.src.in
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Glade -f POTFILES.ui.in
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Python -f POTFILES.py.in
+ # the following uses po/its/inx.{loc, its}
+ COMMAND ${its_workaround} ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -f POTFILES.inx.in --from-code=UTF-8
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L AppData ../org.inkscape.Inkscape.appdata.xml.in
+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Desktop ../org.inkscape.Inkscape.desktop.template
+ # the following uses po/its/menus.{loc, its}
+ COMMAND ${its_workaround} ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/menus.xml
+ # the following uses po/its/units.{loc, its}
+ COMMAND ${its_workaround} ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/units.xml
+
+ COMMENT "Extract translatable messages to ${_potFile}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_dependencies(inkscape_pot filters_svg_h)
+add_dependencies(inkscape_pot palettes_h)
+add_dependencies(inkscape_pot patterns_svg_h)
+add_dependencies(inkscape_pot symbols_h)
+add_dependencies(inkscape_pot templates_h)
+
+
+# create
+# - org.inkscape.Inkscape.desktop
+# - org.inkscape.Inkscape.appdata.xml
if(UNIX)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/org.inkscape.Inkscape.desktop
DEPENDS ${LANGUAGES}
@@ -24,38 +67,4 @@ if(UNIX)
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --xml --template ${CMAKE_SOURCE_DIR}/org.inkscape.Inkscape.appdata.xml.in -d ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_BINARY_DIR}/org.inkscape.Inkscape.appdata.xml
)
add_custom_target(inkscape_appdata ALL DEPENDS ${CMAKE_BINARY_DIR}/org.inkscape.Inkscape.appdata.xml)
-
-
-
- # update inkscape.pot
- SET(_potFile ${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.pot)
- set(xgettext_options -j --keyword=_ --keyword=N_ --keyword=Q_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --msgid-bugs-address=inkscape-devel@lists.sourceforge.net --strict -s --from-code=UTF-8 -ktranslatable -o ${_potFile})
- add_custom_target(inkscape_pot BYPRODUCTS ${_potFile}
- #COMMAND sh -c "${INTLTOOL-UPDATE} --pot --gettext-package=inkscape"
- COMMAND rm -f ${_potFile} && touch ${_potFile}
- # Due to a bug in old xgettext versions, we cannot use '--its='.
- # Instead, we use GETTEXTDATADIR=. to refer to the po/its/*.its files.
- # This requires a .loc file for each .its file. See po/its/units.loc for an example.
- # See https://gitlab.com/inkscape/inkscape/issues/271 for details.
- # This workaround is necessary for Debian 9, so roughly until ca 2021.
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -C -f POTFILES.src.in
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Glade -f POTFILES.ui.in
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Python -f POTFILES.py.in
- # the following uses po/its/inx.{loc, its}
- COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -f POTFILES.inx.in --from-code=UTF-8
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L AppData ../org.inkscape.Inkscape.appdata.xml.in
- COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} -L Desktop ../org.inkscape.Inkscape.desktop.template
- # the following uses po/its/menus.{loc, its}
- COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/menus.xml
- # the following uses po/its/units.{loc, its}
- COMMAND GETTEXTDATADIR=. ${GETTEXT_XGETTEXT_EXECUTABLE} ${xgettext_options} ../share/ui/units.xml
- COMMENT "Extract translatable messages to ${_potFile}"
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- add_dependencies(inkscape_pot filters_svg_h)
- add_dependencies(inkscape_pot palettes_h)
- add_dependencies(inkscape_pot patterns_svg_h)
- add_dependencies(inkscape_pot symbols_h)
- add_dependencies(inkscape_pot templates_h)
endif()