Changeset View
Changeset View
Standalone View
Standalone View
cmake/KF5I18nMacros.cmake.in
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | |||||
84 | # fr/ | 84 | # fr/ | ||
85 | # scripts/ | 85 | # scripts/ | ||
86 | # kfoo/ | 86 | # kfoo/ | ||
87 | # kfoo.js | 87 | # kfoo.js | ||
88 | # kfoo.po | 88 | # kfoo.po | ||
89 | # | 89 | # | ||
90 | # KI18N_INSTALL(po) does the following: | 90 | # KI18N_INSTALL(po) does the following: | ||
91 | # - Compiles kfoo.po into kfoo.mo and installs it in | 91 | # - Compiles kfoo.po into kfoo.mo and installs it in | ||
92 | # ${LOCALE_INSTALL_DIR}/fr/LC_MESSAGES or share/locale/fr/LC_MESSAGES if | 92 | # ${KDE_INSTALL_LOCALEDIR}/fr/LC_MESSAGES or share/locale/fr/LC_MESSAGES if | ||
93 | # ${LOCALE_INSTALL_DIR} is not set. | 93 | # ${KDE_INSTALL_LOCALEDIR} is not set. | ||
94 | # - Installs kfoo.js in ${LOCALE_INSTALL_DIR}/fr/LC_SCRIPTS/kfoo | 94 | # - Installs kfoo.js in ${KDE_INSTALL_LOCALEDIR}/fr/LC_SCRIPTS/kfoo | ||
95 | # | 95 | # | ||
96 | # KI18N_INSTALL_TS_FILES() is deprecated, use KI18N_INSTALL() | 96 | # KI18N_INSTALL_TS_FILES() is deprecated, use KI18N_INSTALL() | ||
97 | # | 97 | # | ||
98 | function(KI18N_INSTALL podir) | 98 | function(KI18N_INSTALL podir) | ||
99 | if (NOT LOCALE_INSTALL_DIR) | 99 | if (NOT KDE_INSTALL_LOCALEDIR) | ||
100 | set(LOCALE_INSTALL_DIR share/locale) | 100 | if (LOCALE_INSTALL_DIR) # TODO KF6: deprecated, remove | ||
101 | set(KDE_INSTALL_LOCALEDIR ${LOCALE_INSTALL_DIR}) | ||||
102 | else() | ||||
103 | set(KDE_INSTALL_LOCALEDIR share/locale) | ||||
104 | endif() | ||||
101 | endif() | 105 | endif() | ||
102 | 106 | | |||
103 | # First try to find the po directory in the source directory, where the release scripts copy them before making the tarballs | 107 | # First try to find the po directory in the source directory, where the release scripts copy them before making the tarballs | ||
104 | get_filename_component(absolute_podir ${podir} ABSOLUTE) | 108 | get_filename_component(absolute_podir ${podir} ABSOLUTE) | ||
105 | 109 | | |||
106 | # we try to find the po directory in the binary directory, in case it was downloaded | 110 | # we try to find the po directory in the binary directory, in case it was downloaded | ||
107 | # using ECM | 111 | # using ECM | ||
108 | if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}")) | 112 | if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}")) | ||
109 | get_filename_component(absolute_podir ${CMAKE_CURRENT_BINARY_DIR}/${podir} ABSOLUTE) | 113 | get_filename_component(absolute_podir ${CMAKE_CURRENT_BINARY_DIR}/${podir} ABSOLUTE) | ||
110 | endif() | 114 | endif() | ||
111 | 115 | | |||
112 | if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}")) | 116 | if (NOT (EXISTS "${absolute_podir}" AND IS_DIRECTORY "${absolute_podir}")) | ||
113 | # Nothing to do if there's no podir and it would create an empty | 117 | # Nothing to do if there's no podir and it would create an empty | ||
114 | # LOCALE_INSTALL_DIR in that case. | 118 | # KDE_INSTALL_LOCALEDIR in that case. | ||
115 | return() | 119 | return() | ||
116 | endif() | 120 | endif() | ||
117 | 121 | | |||
118 | get_filename_component(dirname ${LOCALE_INSTALL_DIR} NAME) | 122 | get_filename_component(dirname ${KDE_INSTALL_LOCALEDIR} NAME) | ||
119 | get_filename_component(destname ${LOCALE_INSTALL_DIR} DIRECTORY) | 123 | get_filename_component(destname ${KDE_INSTALL_LOCALEDIR} DIRECTORY) | ||
120 | string(MD5 pathmd5 ${absolute_podir}) | 124 | string(MD5 pathmd5 ${absolute_podir}) | ||
121 | 125 | | |||
122 | add_custom_target(pofiles-${pathmd5} ALL | 126 | add_custom_target(pofiles-${pathmd5} ALL | ||
123 | COMMENT "Generating mo..." | 127 | COMMENT "Generating mo..." | ||
124 | COMMAND ${CMAKE_COMMAND} | 128 | COMMAND ${CMAKE_COMMAND} | ||
125 | -DGETTEXT_MSGFMT_EXECUTABLE=${GETTEXT_MSGFMT_EXECUTABLE} | 129 | -DGETTEXT_MSGFMT_EXECUTABLE=${GETTEXT_MSGFMT_EXECUTABLE} | ||
126 | -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} | 130 | -DCOPY_TO=${CMAKE_CURRENT_BINARY_DIR}/${dirname} | ||
127 | -DPO_DIR=${absolute_podir} | 131 | -DPO_DIR=${absolute_podir} | ||
Show All 30 Lines | 159 | function(KI18N_INSTALL_TS_FILES lang scripts_dir) | |||
158 | foreach(ts_file ${ts_files}) | 162 | foreach(ts_file ${ts_files}) | ||
159 | string(REGEX MATCH "\\.svn/" in_svn ${ts_file}) | 163 | string(REGEX MATCH "\\.svn/" in_svn ${ts_file}) | ||
160 | if(NOT in_svn) | 164 | if(NOT in_svn) | ||
161 | # If ts_file is "path/to/foo/bar.js" | 165 | # If ts_file is "path/to/foo/bar.js" | ||
162 | # We want subpath to contain "foo" | 166 | # We want subpath to contain "foo" | ||
163 | get_filename_component(subpath ${ts_file} DIRECTORY) | 167 | get_filename_component(subpath ${ts_file} DIRECTORY) | ||
164 | get_filename_component(subpath ${subpath} NAME) | 168 | get_filename_component(subpath ${subpath} NAME) | ||
165 | install(FILES ${ts_file} | 169 | install(FILES ${ts_file} | ||
166 | DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath}) | 170 | DESTINATION ${KDE_INSTALL_LOCALEDIR}/${lang}/LC_SCRIPTS/${subpath}) | ||
167 | # If current file is a pmap, also install the compiled version. | 171 | # If current file is a pmap, also install the compiled version. | ||
168 | get_filename_component(ts_ext ${ts_file} EXT) | 172 | get_filename_component(ts_ext ${ts_file} EXT) | ||
169 | if(ts_ext STREQUAL ".pmap") | 173 | if(ts_ext STREQUAL ".pmap") | ||
170 | set(pmap_file ${ts_file}) | 174 | set(pmap_file ${ts_file}) | ||
171 | get_filename_component(pmap_basename ${ts_file} NAME) | 175 | get_filename_component(pmap_basename ${ts_file} NAME) | ||
172 | set(pmapc_basename "${pmap_basename}c") | 176 | set(pmapc_basename "${pmap_basename}c") | ||
173 | set(pmapc_file "${lang}-${subpath}-${pmapc_basename}") | 177 | set(pmapc_file "${lang}-${subpath}-${pmapc_basename}") | ||
174 | add_custom_command(OUTPUT ${pmapc_file} | 178 | add_custom_command(OUTPUT ${pmapc_file} | ||
175 | COMMAND ${KI18N_PYTHON_EXECUTABLE} | 179 | COMMAND ${KI18N_PYTHON_EXECUTABLE} | ||
176 | ARGS | 180 | ARGS | ||
177 | -B | 181 | -B | ||
178 | ${_ki18n_pmap_compile_script} | 182 | ${_ki18n_pmap_compile_script} | ||
179 | ${CMAKE_CURRENT_SOURCE_DIR}/${pmap_file} | 183 | ${CMAKE_CURRENT_SOURCE_DIR}/${pmap_file} | ||
180 | ${pmapc_file} | 184 | ${pmapc_file} | ||
181 | DEPENDS ${pmap_file}) | 185 | DEPENDS ${pmap_file}) | ||
182 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pmapc_file} | 186 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pmapc_file} | ||
183 | DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_SCRIPTS/${subpath} | 187 | DESTINATION ${KDE_INSTALL_LOCALEDIR}/${lang}/LC_SCRIPTS/${subpath} | ||
184 | RENAME ${pmapc_basename}) | 188 | RENAME ${pmapc_basename}) | ||
185 | list(APPEND pmapc_files ${pmapc_file}) | 189 | list(APPEND pmapc_files ${pmapc_file}) | ||
186 | endif() | 190 | endif() | ||
187 | endif() | 191 | endif() | ||
188 | endforeach() | 192 | endforeach() | ||
189 | if(pmapc_files) | 193 | if(pmapc_files) | ||
190 | if(NOT TARGET pmapfiles) | 194 | if(NOT TARGET pmapfiles) | ||
191 | add_custom_target(pmapfiles) | 195 | add_custom_target(pmapfiles) | ||
192 | endif() | 196 | endif() | ||
193 | set(pmapc_target "pmapfiles-${lang}") | 197 | set(pmapc_target "pmapfiles-${lang}") | ||
194 | string(REPLACE "@" "_" pmapc_target ${pmapc_target}) | 198 | string(REPLACE "@" "_" pmapc_target ${pmapc_target}) | ||
195 | add_custom_target(${pmapc_target} ALL DEPENDS ${pmapc_files}) | 199 | add_custom_target(${pmapc_target} ALL DEPENDS ${pmapc_files}) | ||
196 | add_dependencies(pmapfiles ${pmapc_target}) | 200 | add_dependencies(pmapfiles ${pmapc_target}) | ||
197 | endif() | 201 | endif() | ||
198 | endfunction() | 202 | endfunction() |