diff --git a/findtqt-name-fix.patch b/findtqt-name-fix.patch index 938a27b..b368527 100644 --- a/findtqt-name-fix.patch +++ b/findtqt-name-fix.patch @@ -1,12 +1,6799 @@ +diff -Naur orig/.tdescminfo tde-cmake-trinity-14.1.3/.tdescminfo +--- orig/.tdescminfo 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/.tdescminfo 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,5 @@ ++# TDE SCM module information ++Name: dependencies/tde-cmake ++Version: R14.1.3 ++Revision: r14.1.x-b7e338003b6d2adca0340b3c8d04ebce9dec61f6 ++DateTime: 10/14/2024 16:00 +diff -Naur orig/CMakeLists.txt tde-cmake-trinity-14.1.3/CMakeLists.txt +--- orig/CMakeLists.txt 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/CMakeLists.txt 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,39 @@ ++################################################# ++# ++# (C) 2021 Slávek Banko ++# slavek.banko (at) axis.cz ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++## Process only if it is built as a standalone package ++if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}" ) ++ ++##### general package setup ##################### ++ ++ # building tde-cmake requires reading the minimum required version ++ # from the source files, because there may be a different version ++ # of tde-cmake already installed in the system. Trying to build ++ # tde-cmake with a lower minimum version would not be allowed then. ++ ++ include( ${CMAKE_SOURCE_DIR}/modules/TDEVersion.cmake ) ++ cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} ) ++ project( tde-cmake-rules ) ++ ++ ++##### install TDE CMake files ################### ++ ++ file( GLOB_RECURSE _modules ++ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_SOURCE_DIR}/modules/* ) ++ install( FILES ${_modules} DESTINATION ${CMAKE_ROOT}/Modules ) ++ ++ file( GLOB_RECURSE _templates ++ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_SOURCE_DIR}/templates/* ) ++ install( FILES ${_templates} DESTINATION ${CMAKE_ROOT}/Templates ) ++ ++endif() +diff -Naur orig/generate_apidox tde-cmake-trinity-14.1.3/generate_apidox +--- orig/generate_apidox 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/generate_apidox 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,17 @@ ++#!/bin/bash ++ ++top_srcdir=${1} ++top_builddir=${2} ++kde_libs_htmldir=${3} ++export TQTDOCDIR=${4} ++ ++if [[ ! -d "${top_srcdir}/doc/common/" ]]; then ++ export DOXDATA=${kde_libs_htmldir}/en/common ++fi ++ ++abs_top_srcdir=$(cd ${top_srcdir} && pwd) ++ ++rm -rf ${top_builddir}/${kde_libs_htmldir}/en ++mkdir -p ${top_builddir}/${kde_libs_htmldir}/en ++cd ${top_builddir}/${kde_libs_htmldir}/en ++${abs_top_srcdir}/admin/doxygen.sh --modulename --installdir=${top_builddir}/${kde_libs_htmldir}/en ${abs_top_srcdir} +diff -Naur orig/install_apidox tde-cmake-trinity-14.1.3/install_apidox +--- orig/install_apidox 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/install_apidox 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,12 @@ ++#!/bin/bash ++ ++top_srcdir=${1} ++top_builddir=${2} ++kde_libs_htmldir=${3} ++installdir=${DESTDIR} ++ ++abs_top_srcdir=$(cd ${top_srcdir} && pwd) ++ ++cd ${top_builddir} ++mkdir -p ${installdir}/${kde_libs_htmldir}/en ++cp -Rp ${top_builddir}/${kde_libs_htmldir}/en ${installdir}/${kde_libs_htmldir}/ +diff -Naur orig/modules/FindTDE.cmake tde-cmake-trinity-14.1.3/modules/FindTDE.cmake +--- orig/modules/FindTDE.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/FindTDE.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,107 @@ ++################################################# ++# ++# (C) 2010-2011 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++if( NOT TDE_FOUND ) ++ ++ message( STATUS "checking for 'TDE'") ++ ++ pkg_search_module( TDE tqt ) ++ ++ if( NOT TDE_FOUND ) ++ tde_message_fatal( "Unable to find tdelibs!\n Try adding the directory in which the tdelibs.pc file is located\nto the PKG_CONFIG_PATH variable." ) ++ endif( ) ++ ++ # if the path is not already defined by user, ++ # find tde-config executable ++ if( NOT DEFINED KDECONFIG_EXECUTABLE ) ++ find_program( KDECONFIG_EXECUTABLE ++ NAMES tde-config ++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} ) ++ if( NOT KDECONFIG_EXECUTABLE ) ++ tde_message_fatal( "tde-config are NOT found." ) ++ endif( NOT KDECONFIG_EXECUTABLE ) ++ set( KDECONFIG_EXECUTABLE ${KDECONFIG_EXECUTABLE} ++ CACHE INTERNAL "tde-config executable" ) ++ endif( NOT DEFINED KDECONFIG_EXECUTABLE ) ++ ++ set( ENV{LD_LIBRARY_PATH} "${TDE_LIBDIR}:$ENV{LD_LIBRARY_PATH}" ) ++ # check for installed trinity version ++ tde_execute_process( ++ COMMAND ${KDECONFIG_EXECUTABLE} --version ++ OUTPUT_VARIABLE _version ++ RESULT_VARIABLE _result ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ MESSAGE "Unable to run tde-config!\n TDELIBS are correctly installed?\n Path to tde-config are corect?" ) ++ ++ # parse tde-config output, to extract TDE version ++ string( REGEX MATCH "TDE: R([0-9\\.]+).*" __dummy "${_version}" ) ++ set( TDE_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "" ) ++ ++ # ask tde-config for few paths ++ macro( __internal_get_path __type __var ) ++ tde_execute_process( ++ COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type} ++ OUTPUT_VARIABLE ${__var} ++ CACHE INTERNAL "TDE ${__type} path" FORCE ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ endmacro( __internal_get_path ) ++ ++ __internal_get_path( include TDE_INCLUDE_DIR ) ++ __internal_get_path( lib TDE_LIB_DIR ) ++ __internal_get_path( exe TDE_BIN_DIR ) ++ __internal_get_path( data TDE_DATA_DIR ) ++ __internal_get_path( config TDE_CONFIG_DIR ) ++ __internal_get_path( html TDE_HTML_DIR ) ++ __internal_get_path( cmake TDE_CMAKE_DIR ) ++ __internal_get_path( tqtplugins TDE_TQTPLUGINS_DIR ) ++ ++ # find kde tools ++ macro( __internal_find_program __prog __var ) ++ find_program( ${__var} ++ NAMES ${__prog} ++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ if( NOT ${__var} ) ++ tde_message_fatal( "${__prog} is NOT found.\n TDELIBS are correctly installed?" ) ++ endif( NOT ${__var} ) ++ set( ${__var} ${${__var}} CACHE INTERNAL "${__prog} executable" FORCE ) ++ endmacro( __internal_find_program ) ++ ++ __internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE ) ++ __internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE ) ++ __internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE ) ++ __internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE ) ++ __internal_find_program( tdeconfig_compiler KDE3_KCFGC_EXECUTABLE ) ++ __internal_find_program( maketdewidgets KDE3_MAKETDEWIDGETS_EXECUTABLE ) ++ # Don't use __internal_find_program due to it's not mandatory ++ if( NOT DEFINED TDELFEDITOR_EXECUTABLE ) ++ find_program( TDELFEDITOR_EXECUTABLE NAMES tdelfeditor ++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ set( TDELFEDITOR_EXECUTABLE ${TDELFEDITOR_EXECUTABLE} ++ CACHE INTERNAL "tdelfeditor executable" ) ++ endif( ) ++ ++ # dcopidlng is a bash script which using tde-config; ++ # if PATH to tde-config is not set, dcopidlng will fail; ++ # for this reason we set KDECONFIG environment variable before running dcopidlng ++ set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE} ++ CACHE INTERNAL "dcopidlng executable" FORCE ) ++ ++ # read source metadata ++ tde_read_src_metadata() ++ ++ message( STATUS " found 'TDE', version ${TDE_VERSION}" ) ++ ++endif( NOT TDE_FOUND ) ++ ++if( NOT TARGET tdecore-shared ) ++ include( "${TDE_CMAKE_DIR}/tdelibs.cmake" ) ++endif() diff -Naur orig/modules/FindTQt.cmake tde-cmake-trinity-14.1.3/modules/FindTQt.cmake ---- orig/modules/FindTQt.cmake 2024-10-15 00:00:02.000000000 +0800 -+++ tde-cmake-trinity-14.1.3/modules/FindTQt.cmake 2025-04-08 14:23:21.174115911 +0800 -@@ -88,7 +88,7 @@ - list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} ) - - check_cxx_source_compiles(" -- #include -+ #include - int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } " - HAVE_USABLE_TQT ) - +--- orig/modules/FindTQt.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/FindTQt.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,122 @@ ++################################################# ++# ++# (C) 2010-2011 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++macro( tqt_message ) ++ message( STATUS "${ARGN}" ) ++endmacro( ) ++ ++if( NOT TQT_FOUND ) ++ pkg_search_module( TQT tqt ) ++ ++ if( NOT TQT_FOUND ) ++ tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." ) ++ endif( ) ++ ++ mark_as_advanced( ++ TMOC_EXECUTABLE ++ MOC_EXECUTABLE ++ UIC_EXECUTABLE ++ ) ++ ++ # tmoc_executable ++ tde_execute_process( ++ COMMAND pkg-config tqt --variable=tmoc_executable ++ OUTPUT_VARIABLE TMOC_EXECUTABLE ++ CACHE FILEPATH "TQt tmoc executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ ++ if( NOT EXISTS ${TMOC_EXECUTABLE} ) ++ tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" ) ++ endif( ) ++ ++ tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" ) ++ ++ ++ # moc_executable ++ tde_execute_process( ++ COMMAND pkg-config tqt --variable=moc_executable ++ OUTPUT_VARIABLE MOC_EXECUTABLE ++ CACHE FILEPATH "TQt moc executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ ++ if( NOT EXISTS ${MOC_EXECUTABLE} ) ++ tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" ) ++ endif( ) ++ ++ tqt_message( " moc path: ${MOC_EXECUTABLE}" ) ++ ++ ++ # uic_executable ++ tde_execute_process( ++ COMMAND pkg-config tqt --variable=uic_executable ++ OUTPUT_VARIABLE UIC_EXECUTABLE ++ CACHE FILEPATH "TQt uic executable path" ++ OUTPUT_STRIP_TRAILING_WHITESPACE ) ++ ++ if( NOT EXISTS ${UIC_EXECUTABLE} ) ++ tde_message_fatal( "uic not found!\n tqt is correctly installed?" ) ++ endif( ) ++ ++ tqt_message( " uic path: ${UIC_EXECUTABLE}" ) ++ ++ ++ # tqt-replace script ++ set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" ++ CACHE FILEPATH "TQt replace script path" ) ++ ++ if( NOT EXISTS ${TQT_REPLACE_SCRIPT} ) ++ tde_message_fatal( "tqt-replace not found!\n Check tqt installation." ) ++ endif( ) ++ ++ tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" ) ++ ++ ++ # check if tqt is usable ++ tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) ++ set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} ) ++ foreach( _dirs ${TQT_LIBRARY_DIRS} ) ++ list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" ) ++ endforeach() ++ list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} ) ++ ++ check_cxx_source_compiles(" ++ #include ++ int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } " ++ HAVE_USABLE_TQT ) ++ ++ if( NOT HAVE_USABLE_TQT ) ++ tde_message_fatal( "Unable to build a simple tqt test." ) ++ endif( ) ++ ++ tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) ++ ++ ++ # TQT_CMAKE_DIR ++ if( NOT DEFINED TQT_CMAKE_DIR ) ++ set( TQT_CMAKE_DIR "${TQT_LIBDIR}/cmake" ++ CACHE FILEPATH "Path for shared TQt CMake targets" ) ++ endif() ++ ++ ++ # TQT_CXX_FLAGS ++ foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} ) ++ set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" ) ++ endforeach() ++ set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS}" CACHE INTERNAL "" ) ++ ++endif( NOT TQT_FOUND ) ++ ++# Set compiler flags according to build type ++set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" ) ++set( CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG" ) ++ ++# Set the required minimum C++ standard ++set( TDE_CXX_FEATURES cxx_nullptr ) +diff -Naur orig/modules/FindTQtQUI.cmake tde-cmake-trinity-14.1.3/modules/FindTQtQUI.cmake +--- orig/modules/FindTQtQUI.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/FindTQtQUI.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,45 @@ ++################################################# ++# ++# (C) 2010-2011 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++macro( tqtqui_message ) ++ message( STATUS "${ARGN}" ) ++endmacro( ) ++ ++pkg_search_module( TQTQUI tqtqui ) ++ ++if( NOT TQTQUI_FOUND ) ++ tde_message_fatal( "Unable to find tqtqui!\n Try adding the directory in which the tqtqui.pc file is located\nto the PKG_CONFIG_PATH variable." ) ++endif( ) ++ ++# check if tqtqui is usable ++tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) ++set( CMAKE_REQUIRED_INCLUDES ${TQTQUI_INCLUDE_DIRS} ) ++foreach( _dirs ${TQTQUI_LIBRARY_DIRS} ) ++ list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" ) ++endforeach() ++list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQTQUI_LIBRARIES} ) ++ ++check_cxx_source_compiles(" ++ #include ++ int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } " ++ HAVE_USABLE_TQTQUI ) ++ ++if( NOT HAVE_USABLE_TQTQUI ) ++ tde_message_fatal( "Unable to build a simple tqtqui test." ) ++endif( ) ++ ++tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) ++ ++ ++# TQTQUI_CXX_FLAGS ++foreach( _flag ${TQTQUI_CFLAGS_OTHER} ) ++ set( TQTQUI_CXX_FLAGS "${TQTQUI_CXX_FLAGS} ${_flag}" ) ++endforeach() +diff -Naur orig/modules/TDEL10n.cmake tde-cmake-trinity-14.1.3/modules/TDEL10n.cmake +--- orig/modules/TDEL10n.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/TDEL10n.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,1281 @@ ++################################################# ++# ++# (C) 2018-2020 Slávek Banko ++# slavek (DOT) banko (AT) axis.cz ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++ ++##### include essential TDE macros ############## ++ ++set( MASTER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ) ++include( TDEMacros ) ++ ++ ++##### verify required programs ################## ++ ++if( NOT DEFINED TDE_PREFIX AND IS_DIRECTORY /opt/trinity ) ++ set( TDE_PREFIX "/opt/trinity" ) ++else( ) ++ set( TDE_PREFIX "/usr" ) ++endif( ) ++ ++if( NOT DEFINED KDE_XGETTEXT_EXECUTABLE ) ++ find_program( KDE_XGETTEXT_EXECUTABLE ++ NAMES kde-xgettext ++ HINTS "${TDE_PREFIX}/bin" ++ ) ++ if( "${KDE_XGETTEXT_EXECUTABLE}" STREQUAL "KDE_XGETTEXT_EXECUTABLE-NOTFOUND" ) ++ tde_message_fatal( "kde-xgettext is required but not found" ) ++ endif( ) ++endif( ) ++ ++if( NOT DEFINED XGETTEXT_EXECUTABLE ) ++ find_program( XGETTEXT_EXECUTABLE ++ NAMES xgettext ++ HINTS "${TDE_PREFIX}/bin" ++ ) ++ if( "${XGETTEXT_EXECUTABLE}" STREQUAL "XGETTEXT_EXECUTABLE-NOTFOUND" ) ++ tde_message_fatal( "xgettext is required but not found" ) ++ endif( ) ++endif( ) ++ ++if( NOT DEFINED MSGUNIQ_EXECUTABLE ) ++ find_program( MSGUNIQ_EXECUTABLE ++ NAMES msguniq ++ HINTS "${TDE_PREFIX}/bin" ++ ) ++ if( "${MSGUNIQ_EXECUTABLE}" STREQUAL "MSGUNIQ_EXECUTABLE-NOTFOUND" ) ++ tde_message_fatal( "msguniq is required but not found" ) ++ endif( ) ++endif( ) ++ ++if( NOT DEFINED PO4A_GETTEXTIZE_EXECUTABLE ) ++ find_program( PO4A_GETTEXTIZE_EXECUTABLE ++ NAMES po4a-gettextize ++ HINTS "${TDE_PREFIX}/bin" ++ ) ++ if( "${PO4A_GETTEXTIZE_EXECUTABLE}" STREQUAL "PO4A_GETTEXTIZE_EXECUTABLE-NOTFOUND" ) ++ tde_message_fatal( "po4a-gettextize is required but not found" ) ++ endif( ) ++ execute_process( ++ COMMAND ${PO4A_GETTEXTIZE_EXECUTABLE} --version ++ OUTPUT_VARIABLE _po4a_version ++ ERROR_VARIABLE _po4a_version ++ ) ++ string( REGEX REPLACE "^po4a-gettextize[^\n]* ([^ ]*)\n.*" "\\1" _po4a_version ${_po4a_version} ) ++ if( "${_po4a_version}" VERSION_LESS "0.45" ) ++ tde_message_fatal( "po4a version >= 0.45 is required but found only ${_po4_version}" ) ++ endif( ) ++endif( ) ++ ++if( NOT DEFINED TDE_COMMON_TEXTS_POT ) ++ get_filename_component( TDE_SOURCE_BASE "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE ) ++ while( (NOT EXISTS "${TDE_SOURCE_BASE}/core/tdelibs" ++ OR NOT IS_DIRECTORY "${TDE_SOURCE_BASE}/core/tdelibs" ) ++ AND NOT "${TDE_SOURCE_BASE}" STREQUAL "/" ) ++ get_filename_component( TDE_SOURCE_BASE "${TDE_SOURCE_BASE}" PATH ) ++ endwhile( ) ++ find_file( TDE_COMMON_TEXTS_POT ++ NAMES tde.pot ++ HINTS "${TDE_SOURCE_BASE}/core/tdelibs" "${TDE_PREFIX}/include" "${TDE_PREFIX}/include/tde" ++ ) ++ if( "${TDE_COMMON_TEXTS_POT}" STREQUAL "TDE_COMMON_TEXTS_POT-NOTFOUND" ) ++ tde_message_fatal( "translation template with common texts not found" ) ++ endif( ) ++endif( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_add_subdirectory ++##### ++##### The function simulates the add_subdirectory() behavior, but ++##### the CMakeL10n.txt file is used instead of CMakeLists.txt. ++##### ++ ++function( tde_l10n_add_subdirectory _dir ) ++ set( CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}" ) ++ set( CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_dir}" ) ++ include( ${CMAKE_CURRENT_SOURCE_DIR}/CMakeL10n.txt ) ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_auto_add_subdirectories ++##### ++##### The function is equivalent to tde_auto_add_subdirectories, but ++##### the CMakeL10n.txt file is used instead of CMakeLists.txt. ++##### ++ ++function( tde_l10n_auto_add_subdirectories ) ++ file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/*" ) ++ foreach( _dir ${_dirs} ) ++ if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ++ AND NOT ${_dir} STREQUAL ".svn" ++ AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeL10n.txt ) ++ tde_l10n_add_subdirectory( ${_dir} ) ++ endif( ) ++ endforeach( ) ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_create_template ++##### ++##### Macro is used to generate a translation template - POT file. ++##### ++##### Syntax: ++##### tde_l10n_create_template( ++##### [CATALOG] file_name ++##### [SOURCES source_spec [source_spec]] ++##### [COMMENT tag] ++##### [EXCLUDES regex [regex]] ++##### [KEYWORDS keyword [keyword]] ++##### [ATTRIBUTES attrib_spec [attrib_spec]] ++##### [X-POT common_texts.pot] ++##### [DESTINATION directory] ++##### ) ++##### ++##### Where: ++##### CATALOG determines the target file name (without pot suffix). ++##### If the name ends with '/', a catalog of the same name ++##### will be created in the specified directory. ++##### SOURCES can be specified by several options: ++##### a) Do not specify anything ++##### - all usual source files will be automatically searched. ++##### b) Enter the directory name - for example, '.' or 'src' ++##### - all the usual source files in the specified directory ++##### and subdirectories will be searched. ++##### c) Enter the mask - for example '*.cpp' ++##### - all files with the specified mask will be searched. ++##### d) Specify the name of the individual file. ++##### The methods from b) to d) can be combined. ++##### EXCLUDES determines which files are to be excluded from processing ++##### COMMENT determines additional comment to extract by xgettext. ++##### KEYWORDS determines additional keywords for xgettext. ++##### Use "-" if is needed to disable default keywords. ++##### ATTRIBUTES determines files and specification for extractattr: ++##### source_spec:element,attribute[,context][[:element,attribute[,context]]...] ++##### X-POT entries from common_texts.pot are not extracted ++##### By default, "tde.pot" is searched for and used. ++##### Use "-" to skip this. ++##### DESTINATION determines directory to save translation template. ++##### The destination directory is determined as follows: ++##### a) Directory is specified as an argument. ++##### b) The variable POT_SOURCE_DIR is set. ++##### c) There is a 'translations' directory. ++##### d) There is a 'po' directory. ++##### ++##### Note: ++##### Editing the _files list inside foreach( ${_files} ) below in the ++##### code is safe, because in CMake foreach parameters are evaluated ++##### before the loop starts. Therefore, the changes in the list inside ++##### the loop do not have an unwanted impact on the loop processing. ++##### ++ ++macro( tde_l10n_create_template ) ++ ++ unset( _catalog ) ++ unset( _sources ) ++ unset( _excludes ) ++ unset( _files ) ++ unset( _desktops ) ++ unset( _pots ) ++ unset( _dest ) ++ unset( _keywords_add ) ++ unset( _comment ) ++ unset( _attributes ) ++ unset( _exclude_pots ) ++ unset( _pot ) ++ unset( _directive ) ++ set( _var _catalog ) ++ set( _keywords_c_default "i18n" "i18n:1,2" "tr2i18n" "tr2i18n:1,2" "I18N_NOOP" "I18N_NOOP2" ) ++ set( _keywords_desktop_default ++ "-" "Name" "GenericName" "Comment" "Keywords" ++ "Description" "ExtraNames" "X-TDE-Submenu" ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "CATALOG" ++ if( "+${_arg}" STREQUAL "+CATALOG" ) ++ unset( _catalog ) ++ set( _var _catalog ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "SOURCES" ++ if( "+${_arg}" STREQUAL "+SOURCES" ) ++ unset( _sources ) ++ set( _var _sources ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "SOURCES_DESKTOP" ++ if( "+${_arg}" STREQUAL "+SOURCES_DESKTOP" ) ++ unset( _desktops ) ++ set( _var _desktops ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "EXCLUDES" ++ if( "+${_arg}" STREQUAL "+EXCLUDES" ) ++ unset( _excludes ) ++ set( _var _excludes ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ unset( _dest ) ++ set( _var _dest ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "COMMENT" ++ if( "+${_arg}" STREQUAL "+COMMENT" ) ++ unset( _comment ) ++ set( _var _comment ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "KEYWORDS" ++ if( "+${_arg}" STREQUAL "+KEYWORDS" ) ++ unset( _keywords_add ) ++ set( _var _keywords_add ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "ATTRIBUTES" ++ if( "+${_arg}" STREQUAL "+ATTRIBUTES" ) ++ unset( _attributes ) ++ set( _var _attributes ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "X-POT" ++ if( "+${_arg}" STREQUAL "+X-POT" ) ++ unset( _exclude_pots ) ++ set( _var _exclude_pots ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ # verify catalog ++ if( NOT _catalog ) ++ tde_message_fatal( "the name of the translation catalog is not defined" ) ++ endif( ) ++ ++ # determine the destination directory ++ if( NOT _dest ) ++ if( POT_SOURCE_DIR ) ++ set( _dest ${POT_SOURCE_DIR} ) ++ elseif( EXISTS "${MASTER_SOURCE_DIR}/translations" ) ++ set( _dest "${MASTER_SOURCE_DIR}/translations/" ) ++ elseif( EXISTS "${MASTER_SOURCE_DIR}/po" ) ++ set( _dest "${MASTER_SOURCE_DIR}/po/" ) ++ else( ) ++ tde_message_fatal( "cannot determine destination directory" ) ++ endif( ) ++ endif( ) ++ if( ${_dest} MATCHES "[^/]$" ) ++ set( _dest "${_dest}/" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE ${_dest} ) ++ set( _dest "${CMAKE_CURRENT_SOURCE_DIR}/${_dest}" ) ++ endif( ) ++ ++ if( ${_catalog} MATCHES "/$" ) ++ string( REGEX REPLACE "/$" "" _catalog "${_catalog}" ) ++ get_filename_component( _catalog_base "${_catalog}" NAME ) ++ set( _catalog "${_catalog}/${_catalog_base}" ) ++ endif( ) ++ get_filename_component( _potFilename "${_dest}${_catalog}.pot" ABSOLUTE ) ++ file( RELATIVE_PATH _potFilename ${CMAKE_SOURCE_DIR} ${_potFilename} ) ++ message( STATUS "Create translation template ${_potFilename}" ) ++ ++ # verify sources ++ if( NOT _sources AND NOT _attributes AND NOT _desktops ) ++ # add current directory ++ list( APPEND _sources "." ) ++ endif( ) ++ foreach( _src ${_sources} ) ++ ++ # add all source files from directory ++ if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_src} ) ++ if( ${_src} STREQUAL "." ) ++ set( _dir "${CMAKE_CURRENT_SOURCE_DIR}" ) ++ else( ) ++ set( _dir "${CMAKE_CURRENT_SOURCE_DIR}/${_src}" ) ++ endif( ) ++ file( GLOB_RECURSE _add_files ++ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${_dir}/*.c ++ ${_dir}/*.cc ++ ${_dir}/*.cpp ++ ${_dir}/*.cxx ++ ${_dir}/*.h ++ ${_dir}/*.hh ++ ${_dir}/*.hpp ++ ${_dir}/*.hxx ++ ${_dir}/*.kcfg ++ ${_dir}/*.rc ++ ${_dir}/*.ui ++ ) ++ list( SORT _add_files ) ++ list( APPEND _files ${_add_files} ) ++ ++ # add files by the specified mask ++ elseif( ${_src} MATCHES "(\\*|\\?)" ) ++ file( GLOB_RECURSE _add_files ++ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_SOURCE_DIR}/${_src} ++ ) ++ list( SORT _add_files ) ++ list( APPEND _files ${_add_files} ) ++ ++ # add a individual file ++ elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_src} ) ++ list( APPEND _files ${_src} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ # filter files by excludes ++ if( _excludes ) ++ foreach( _src ${_files} ) ++ foreach( _exclude ${_excludes} ) ++ if( ${_src} MATCHES ${_exclude} ) ++ list( REMOVE_ITEM _files ${_src} ) ++ endif( ) ++ endforeach( ) ++ endforeach( ) ++ endif( ) ++ if( NOT _files AND NOT _attributes AND NOT _desktops ) ++ tde_message_fatal( "no source files found" ) ++ endif( ) ++ ++ # prepare x-pot ++ foreach( _exclude_pot_file ${TDE_COMMON_TEXTS_POT} ${_exclude_pots} ) ++ if( "${_exclude_pot_file}" STREQUAL "-" ) ++ unset( _exclude_pot ) ++ else() ++ if( NOT IS_ABSOLUTE "${_exclude_pot_file}" ) ++ set( _exclude_pot_file "${CMAKE_CURRENT_SOURCE_DIR}/${_exclude_pot_file}" ) ++ endif() ++ list( APPEND _exclude_pot "-x${_exclude_pot_file}" ) ++ endif( ) ++ endforeach( ) ++ ++ # prepare comment ++ if( NOT "${_comment}" STREQUAL "" ) ++ if( "${_comment}" STREQUAL "-" OR "${_comment}" STREQUAL "all" ) ++ set( _comment "-c" ) ++ else( ) ++ set( _comment "-c${_comment}" ) ++ endif( ) ++ endif( ) ++ ++ # prepare keywords ++ unset( _keywords_c ) ++ unset( _keywords_desktop ) ++ foreach( _keyword ${_keywords_c_default} ${_keywords_add} ) ++ if( "${_keyword}" STREQUAL "-" ) ++ unset( _keywords_c ) ++ unset( _keyword ) ++ endif( ) ++ list( APPEND _keywords_c "-k${_keyword}" ) ++ endforeach( ) ++ foreach( _keyword ${_keywords_desktop_default} ${_keywords_add} ) ++ if( "${_keyword}" STREQUAL "-" ) ++ unset( _keywords_desktop ) ++ unset( _keyword ) ++ endif( ) ++ if( _keyword ) ++ list( APPEND _keywords_desktop "${_keyword}" ) ++ endif( ) ++ endforeach( ) ++ ++ # prepare resource files *.kcfg, *.rc and *.ui ++ foreach( _src ${_files} ) ++ if( ${_src} MATCHES "\\.(kcfg|rc|ui)(\\.cmake)?$" ) ++ set( _src_index 0 ) ++ set( _src_l10n "${_src}.tde_l10n" ) ++ list( FIND _files "${_src_l10n}" _src_file_index ) ++ while( "${_src_file_index}" GREATER -1 ) ++ set( _src_l10n "${_src}.tde_l10n${_src_index}" ) ++ list( FIND _files "${_src_l10n}" _src_file_index ) ++ math( EXPR _src_index "${_src_index}+1" ) ++ endwhile( ) ++ tde_l10n_prepare_xml( SOURCE ${_src} TARGET ${_src_l10n} ) ++ list( REMOVE_ITEM _files ${_src} ) ++ list( APPEND _files "${_src_l10n}" ) ++ endif( ) ++ endforeach( ) ++ ++ # prepare attributes ++ if( _attributes ) ++ foreach( _attrib ${_attributes} ) ++ if( ${_attrib} MATCHES "^([^:]+):(.+)$" ) ++ string( REGEX REPLACE "^([^:]+):(.+)$" "\\1" _attrib_glob ${_attrib} ) ++ string( REGEX REPLACE "^([^:]+):(.+)$" "\\2" _attrib_spec ${_attrib} ) ++ file( GLOB_RECURSE _attrib_files ++ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_SOURCE_DIR}/${_attrib_glob} ++ ) ++ if( _excludes ) ++ foreach( _src ${_attrib_files} ) ++ foreach( _exclude ${_excludes} ) ++ if( ${_src} MATCHES ${_exclude} ) ++ list( REMOVE_ITEM _attrib_files ${_src} ) ++ endif( ) ++ endforeach( ) ++ endforeach( ) ++ endif( ) ++ if( _attrib_files ) ++ list( SORT _attrib_files ) ++ string( REGEX MATCHALL "[^:]+" _attrib_spec "${_attrib_spec}" ) ++ foreach( _src ${_attrib_files} ) ++ set( _src_index 0 ) ++ set( _src_l10n "${_src}.tde_l10n" ) ++ list( FIND _files "${_src_l10n}" _src_file_index ) ++ while( "${_src_file_index}" GREATER -1 ) ++ set( _src_l10n "${_src}.tde_l10n${_src_index}" ) ++ list( FIND _files "${_src_l10n}" _src_file_index ) ++ math( EXPR _src_index "${_src_index}+1" ) ++ endwhile( ) ++ tde_l10n_prepare_xmlattr( ++ SOURCE ${_src} ++ TARGET ${_src_l10n} ++ ATTRIBUTES ${_attrib_spec} ++ ) ++ list( APPEND _files "${_src_l10n}" ) ++ endforeach( ) ++ endif( ) ++ endif( ) ++ endforeach( ) ++ endif( ) ++ ++ # prepare tips ++ foreach( _src ${_files} ) ++ if( ${_src} MATCHES "(^|/)tips$" ) ++ tde_l10n_preparetips( ${_src} ) ++ list( REMOVE_ITEM _files ${_src} ) ++ list( APPEND _files "${_src}.tde_l10n" ) ++ endif( ) ++ endforeach( ) ++ ++ # prepare documentation ++ foreach( _src ${_files} ) ++ if( ${_src} MATCHES "\\.(ad|adoc|docbook|[1-8])(\\.cmake)?$" ) ++ if( ${_src} MATCHES "\\.(ad|adoc)(\\.cmake)?$" ) ++ set( _doc_format "asciidoc" ) ++ elseif( ${_src} MATCHES "\\.(docbook)(\\.cmake)?$" ) ++ set( _doc_format "docbook" ) ++ elseif( ${_src} MATCHES "\\.([1-8])(\\.cmake)?$" ) ++ set( _doc_format "man" ) ++ else( ) ++ set( _doc_format "text" ) ++ endif( ) ++ execute_process( ++ COMMAND ${PO4A_GETTEXTIZE_EXECUTABLE} ++ -f ${_doc_format} -m ${_src} ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ OUTPUT_VARIABLE _potDoc ++ ) ++ if( _potDoc ) ++ string( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _potDoc "${_potDoc}" ) ++ string( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _potDoc "${_potDoc}" ) ++ file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${_src}.tde_l10n "${_potDoc}" ) ++ list( APPEND _pots ${_src}.tde_l10n ) ++ endif( ) ++ list( REMOVE_ITEM _files ${_src} ) ++ endif( ) ++ endforeach( ) ++ ++ # pick desktop files - *.desktop, *.directory, *.kcsrc, *.protocol, *.theme, *.themerc and eventsrc ++ foreach( _src ${_files} ) ++ if( ${_src} MATCHES "\\.(desktop|directory|kcsrc|protocol|theme|themerc)(\\.cmake)?$" ++ OR ${_src} MATCHES "(^|/)eventsrc(\\.cmake)?$" ) ++ list( APPEND _desktops ${_src} ) ++ list( REMOVE_ITEM _files ${_src} ) ++ endif( ) ++ endforeach( ) ++ ++ # pick pot files *.pot ++ foreach( _src ${_files} ) ++ if( ${_src} MATCHES "\\.pot(\\.cmake)?(\\.tde_l10n)?$" ) ++ list( APPEND _pots ${_src} ) ++ list( REMOVE_ITEM _files ${_src} ) ++ endif( ) ++ endforeach( ) ++ ++ # add common translator info ++ unset( _tranlatorinfo_pot ) ++ if( _files ) ++ list( FIND _excludes "_translatorinfo" _translatorinfo_index ) ++ if( "${_translatorinfo_index}" LESS 0 ) ++ set( _translatorinfo ++ "i18n(\"NAME OF TRANSLATORS\", \"Your names\")\n" ++ "i18n(\"EMAIL OF TRANSLATORS\", \"Your emails\")\n" ++ ) ++ file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/_translatorinfo.tde_l10n ${_translatorinfo} ) ++ execute_process( ++ COMMAND ${KDE_XGETTEXT_EXECUTABLE} --foreign-user -C ++ ${_keywords_c} -o - _translatorinfo.tde_l10n ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ OUTPUT_VARIABLE _translatorinfo_pot ++ ) ++ file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/_translatorinfo.tde_l10n ) ++ endif( ) ++ endif( ) ++ ++ # create translation template ++ if( _files ) ++ execute_process( ++ COMMAND ${KDE_XGETTEXT_EXECUTABLE} --foreign-user -C ++ ${_comment} ${_keywords_c} ${_exclude_pot} -o - ${_files} ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ OUTPUT_VARIABLE _pot ++ ) ++ if( _translatorinfo_pot ) ++ if( _pot ) ++ set( _pot "${_translatorinfo_pot}\n${_pot}" ) ++ else( ) ++ set( _pot "${_translatorinfo_pot}" ) ++ endif( ) ++ endif( ) ++ endif( ) ++ ++ # process desktop files ++ if( _desktops ) ++ # prepare desktop files ++ foreach( _src ${_desktops} ) ++ tde_l10n_prepare_desktop( ${_src} KEYWORDS ${_keywords_desktop} ) ++ list( REMOVE_ITEM _desktops ${_src} ) ++ list( APPEND _desktops "${_src}.tde_l10n" ) ++ endforeach( ) ++ ++ # create translation template for desktop files ++ execute_process( ++ COMMAND ${XGETTEXT_EXECUTABLE} --foreign-user ++ --from-code=UTF-8 -C -c -ki18n -o - ${_desktops} ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ OUTPUT_VARIABLE _potDesktop ++ ) ++ ++ # merge translation templates ++ if( _potDesktop ) ++ if( _pot ) ++ set( _pot "${_pot}\n${_potDesktop}" ) ++ else( ) ++ set( _pot "${_potDesktop}" ) ++ endif( ) ++ endif( ) ++ endif( ) ++ ++ # join additional pot files ++ if( _pots ) ++ foreach( _extra_pot IN LISTS _pots ) ++ file( READ ${CMAKE_CURRENT_SOURCE_DIR}/${_extra_pot} _extra_pot ) ++ if( _extra_pot ) ++ if( _pot ) ++ set( _pot "${_pot}\n${_extra_pot}" ) ++ else( ) ++ set( _pot "${_extra_pot}" ) ++ endif( ) ++ endif( ) ++ endforeach( ) ++ endif( ) ++ ++ # finalize translation template ++ if( _pot ) ++ ++ # set charset and encoding headers ++ string( REPLACE "Content-Type: text/plain; charset=CHARSET" "Content-Type: text/plain; charset=UTF-8" _pot "${_pot}" ) ++ string( REPLACE "Content-Transfer-Encoding: ENCODING" "Content-Transfer-Encoding: 8bit" _pot "${_pot}" ) ++ ++ # update references for resources to original files and line numbers ++ list( FIND _files "extracted-rc.tde_l10n" _extractedRC_index ) ++ if( "${_extractedRC_index}" GREATER -1 ++ AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n ) ++ file( READ "${CMAKE_CURRENT_SOURCE_DIR}/extracted-rc.tde_l10n" _extractedRC ) ++ string( REGEX REPLACE "[^\n]" "" _extractedRC_len "${_extractedRC}" ) ++ string( LENGTH "+${_extractedRC_len}" _extractedRC_len ) ++ set( _rcPos 0 ) ++ while( _rcPos LESS ${_extractedRC_len} ) ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _rcLine "${_extractedRC}" ) ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _extractedRC "${_extractedRC}" ) ++ math( EXPR _rcPos "${_rcPos}+1" ) ++ if( "${_rcLine}" MATCHES "^//i18n: file .* line [0-9]*$" ) ++ string( REGEX REPLACE "^//i18n: file (.*) line ([0-9]*)$" "\\1:\\2" _rcOrig ${_rcLine} ) ++ endif( ) ++ if( "${_rcLine}" MATCHES "^i18n\\(" AND _rcOrig ) ++ string( REGEX REPLACE "(^|\n)(#:.*) extracted-rc.tde_l10n:${_rcPos}( |\n)" "\\1\\2 ${_rcOrig}\\3" _pot "${_pot}" ) ++ unset( _rcOrig ) ++ endif( ) ++ endwhile( ) ++ endif( ) ++ ++ # update references for modified source files (".tde_l10n" extension) ++ string( REGEX REPLACE "\\.tde_l10n[0-9]*(:[0-9]+)" "\\1" _pot "${_pot}" ) ++ ++ # merge unique strings ++ string( REGEX REPLACE "\n\n(#[^\n]*\n)*msgid \"\"\nmsgstr \"\"\n(\"[^\n]*\n)*\n" "\n\n" _pot "${_pot}" ) ++ file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp "${_pot}" ) ++ execute_process( ++ COMMAND ${MSGUNIQ_EXECUTABLE} ++ INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ++ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ++ OUTPUT_VARIABLE _pot ++ ) ++ file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/extracted-pot.tmp ) ++ string( REGEX REPLACE "(^|\n)#.? #-#-#-#-# [^\n]* #-#-#-#-#\n" "\\1" _pot "${_pot}" ) ++ ++ # replace the references for _translatorinfo with instructions in the comment ++ string( REGEX REPLACE ++ "(^|\n)(#:[^\n]*) _translatorinfo:1($|[^\n]*)" ++ "\\1#. Instead of a literal translation, add your name to the end of the list (separated by a comma).\n\\2\\3\n#, ignore-inconsistent" ++ _pot "${_pot}" ++ ) ++ string( REGEX REPLACE ++ "(^|\n)(#:[^\n]*) _translatorinfo:2($|[^\n]*)" ++ "\\1#. Instead of a literal translation, add your email to the end of the list (separated by a comma).\n\\2\\3\n#, ignore-inconsistent" ++ _pot "${_pot}" ++ ) ++ string( REGEX REPLACE "(^|\n)#:($|\n)" "\\1" _pot "${_pot}" ) ++ ++ # save translation template ++ if( EXISTS "${_dest}${_catalog}.pot" ) ++ file( READ "${_dest}${_catalog}.pot" _potOrig ) ++ else( ) ++ unset( _potOrig ) ++ endif( ) ++ if( _potOrig ) ++ string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potOrig "${_potOrig}" ) ++ string( REGEX REPLACE "\n\"POT-Creation-Date: [^\"]*\"\n" "" _potNew "${_pot}" ) ++ endif( ) ++ if( NOT _potOrig OR NOT "${_potNew}" STREQUAL "${_potOrig}" ) ++ file( WRITE "${_dest}${_catalog}.pot" "${_pot}" ) ++ endif( ) ++ ++ endif( _pot ) ++ ++ # cleanup ++ foreach( _file ${_files} ${_desktops} ${_pots} ) ++ if( "${_file}" MATCHES "\\.tde_l10n[0-9]*$" ) ++ file( REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ) ++ endif( ) ++ endforeach( ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_preparetips ++##### ++##### Macro is used to prepare tips file for xgettext ++##### ++ ++macro( tde_l10n_preparetips _tips ) ++ ++ tde_l10n_prepare_xml( ++ SOURCE ${_tips} ++ TAGS html ++ C_FORMAT ++ PRESERVE entities line-wrap spaces-leading spaces-trailing spaces-multi ++ ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_prepare_xml ++##### ++##### The function is used to prepare XML file for xgettext. ++##### The default settings are identical to extractrc. ++##### ++ ++function( tde_l10n_prepare_xml ) ++ ++ unset( _source ) ++ unset( _target ) ++ unset( _context ) ++ set( _skip_properties "database|associations|populationText" ) ++ set( _tags "[tT][eE][xX][tT]|title|string|whatsthis|tooltip|label" ) ++ set( _preserve "line-wrap" "lines-leading" "lines-multi" "spaces-leading" "spaces-trailing" "spaces-multi" ) ++ set( _no_c_format 1 ) ++ unset( _directive ) ++ set( _var _source ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "SOURCE" ++ if( "+${_arg}" STREQUAL "+SOURCE" ) ++ unset( _source ) ++ set( _var _source ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "TARGET" ++ if( "+${_arg}" STREQUAL "+TARGET" ) ++ unset( _target ) ++ set( _var _target ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "CONTEXT" ++ if( "+${_arg}" STREQUAL "+CONTEXT" ) ++ unset( _context ) ++ set( _var _context ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "SKIP-PROPERTIES" ++ if( "+${_arg}" STREQUAL "+SKIP-PROPERTIES" ) ++ unset( _skip_properties ) ++ set( _var _skip_properties ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "TAGS" ++ if( "+${_arg}" STREQUAL "+TAGS" ) ++ unset( _tags ) ++ set( _var _tags ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "PRESERVE" ++ if( "+${_arg}" STREQUAL "+PRESERVE" ) ++ unset( _preserve ) ++ set( _var _preserve ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "C_FORMAT" ++ if( "+${_arg}" STREQUAL "+C_FORMAT" ) ++ unset( _no_c_format ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "NO_C_FORMAT" ++ if( "+${_arg}" STREQUAL "+NO_C_FORMAT" ) ++ set( _no_c_format 1 ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ # verify source ++ if( NOT _source ) ++ tde_message_fatal( "no source XML file" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_source}" ) ++ set( _source "${CMAKE_CURRENT_SOURCE_DIR}/${_source}" ) ++ endif( ) ++ if( NOT _target ) ++ set( _target "${_source}.tde_l10n" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_target}" ) ++ set( _target "${CMAKE_CURRENT_SOURCE_DIR}/${_target}" ) ++ endif( ) ++ ++ # prepare tags to regexp ++ string( REPLACE ";" "|" _tags "${_tags}" ) ++ if( "${_skip_properties}" STREQUAL "-" ) ++ unset( _skip_properties ) ++ endif( ) ++ if( DEFINED _skip_properties ) ++ string( REPLACE ";" "|" _skip_properties "${_skip_properties}" ) ++ set( _tags "property|${_tags}" ) ++ endif( ) ++ ++ # read file ++ file( READ ${_source} _xml_data ) ++ string( REGEX REPLACE "[^\n]" "" _xml_len ${_xml_data} ) ++ string( LENGTH "+${_xml_len}" _xml_len ) ++ ++ # process lines ++ set( _xml_pos 0 ) ++ unset( _xml_l10n ) ++ unset( _xml_inside ) ++ unset( _xml_tag_empty ) ++ unset( _xml_skipped_prop ) ++ while( _xml_pos LESS ${_xml_len} ) ++ # pick line ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _xml_line "${_xml_data}" ) ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _xml_data "${_xml_data}" ) ++ math( EXPR _xml_pos "${_xml_pos}+1" ) ++ set( _xml_newline 1 ) ++ ++ # process tags on line ++ while( _xml_newline OR NOT "${_xml_line}" STREQUAL "" ) ++ unset( _xml_newline ) ++ unset( _xml_line_prefix ) ++ unset( _xml_line_suffix ) ++ unset( _xml_line_rest ) ++ if( NOT _xml_inside ) ++ if( _xml_skipped_prop AND "${_xml_line}" MATCHES "" ) ++ unset( _xml_skipped_prop ) ++ string( REGEX MATCH "(.*)" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE "^(.*)" "\\1" _xml_line "${_xml_line}" ) ++ endif( ) ++ if( NOT _xml_skipped_prop AND "${_xml_line}" MATCHES "<(${_tags})([ \t][^>]*)*>" ) ++ string( REGEX MATCH "<(${_tags})([ \t][^>]*)*>(.*)" _xml_line "${_xml_line}" ) ++ string( REGEX MATCH "^<(${_tags})([ \t][^>]*)*>" _xml_attr "${_xml_line}" ) ++ string( REGEX REPLACE "^<(${_tags})([ \t][^>]*)*>(.*)" "\\3" _xml_line "${_xml_line}" ) ++ if( "${_xml_attr}" MATCHES "^]*)*>" AND DEFINED _skip_properties ) ++ if( "${_xml_attr}" MATCHES "[ \t]name=\"(${_skip_properties})\"" ) ++ set( _xml_skipped_prop 1 ) ++ endif( ) ++ set( _xml_line_rest "${_xml_line}" ) ++ set( _xml_line "" ) ++ else( ) ++ set( _xml_inside 1 ) ++ set( _xml_context "${_context}" ) ++ if( "${_xml_attr}" MATCHES "[ \t]context=\"([^\"]*)\"" ) ++ string( REGEX REPLACE ".* context=\"([^\"]*)\".*" "\\1" _xml_context "${_xml_attr}" ) ++ endif( ) ++ set( _xml_line_prefix "i18n(" ) ++ if( _no_c_format ) ++ set( _xml_line_prefix "${_xml_line_prefix}/* xgettext: no-c-format */" ) ++ endif( ) ++ if( _xml_context ) ++ set( _xml_line_prefix "${_xml_line_prefix}\"${_xml_context}\", " ) ++ endif( ) ++ set( _xml_tag_empty 1 ) ++ endif( ) ++ else( ) ++ set( _xml_line "" ) ++ endif( ) ++ endif( ) ++ ++ if( _xml_inside ) ++ if( "${_xml_line}" MATCHES "" ) ++ unset( _xml_inside ) ++ string( REGEX REPLACE "(.*)" "\\2" _xml_line_rest "${_xml_line}" ) ++ string( REGEX REPLACE "(.*)" "" _xml_line "${_xml_line}" ) ++ set( _xml_line_suffix ");" ) ++ endif( ) ++ ++ string( REGEX REPLACE "\\\\" "\\\\\\\\" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE "\\\"" "\\\\\"" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE "\t" "\\\\t" _xml_line "${_xml_line}" ) ++ if( NOT ";${_preserve};" MATCHES ";entities;" ) ++ string( REGEX REPLACE "<" "<" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE ">" ">" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE "&" "&" _xml_line "${_xml_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-leading;" ) ++ string( REGEX REPLACE "^ +" "" _xml_line "${_xml_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-trailing;" ) ++ string( REGEX REPLACE " +$" "" _xml_line "${_xml_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-multi;" ) ++ string( REGEX REPLACE " +" " " _xml_line "${_xml_line}" ) ++ endif( ) ++ ++ if( _xml_inside ) ++ if( ";${_preserve};" MATCHES ";line-wrap;" ) ++ if( NOT "${_xml_line}" STREQUAL "" ++ OR ( ";${_preserve};" MATCHES ";lines-leading;" AND _xml_tag_empty ) ++ OR ( ";${_preserve};" MATCHES ";lines-multi;" AND NOT _xml_tag_empty ) ) ++ set( _xml_line "${_xml_line}\\n" ) ++ endif( ) ++ elseif( NOT "${_xml_line}" STREQUAL "" AND NOT _xml_tag_empty ) ++ set( _xml_line " ${_xml_line}" ) ++ endif( ) ++ endif( ) ++ if( NOT "${_xml_line}" STREQUAL "" ) ++ unset( _xml_tag_empty ) ++ endif( ) ++ endif( ) ++ ++ # drop empty tag on single line ++ if( _xml_line_prefix AND _xml_line_suffix AND _xml_tag_empty ) ++ # skip empty string for translation ++ ++ # add current tag to output ++ else( ) ++ set( _xml_l10n "${_xml_l10n}${_xml_line_prefix}" ) ++ if( NOT "${_xml_line}" STREQUAL "" OR ( _xml_line_suffix AND _xml_tag_empty ) ) ++ set( _xml_l10n "${_xml_l10n}\"${_xml_line}\"" ) ++ endif( ) ++ set( _xml_l10n "${_xml_l10n}${_xml_line_suffix}" ) ++ endif( ) ++ ++ # take the rest of the line for processing ++ set( _xml_line "${_xml_line_rest}" ) ++ endwhile( ) ++ set( _xml_l10n "${_xml_l10n}\n" ) ++ endwhile( ) ++ ++ # write file ++ file( WRITE ${_target} "${_xml_l10n}" ) ++ ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_prepare_xmlattr ++##### ++##### The function is used to prepare attributes in XML file ++##### for xgettext, comparable to extractattr. ++##### ++ ++function( tde_l10n_prepare_xmlattr ) ++ ++ unset( _source ) ++ unset( _target ) ++ unset( _context ) ++ unset( _attribs ) ++ unset( _directive ) ++ set( _preserve "line-wrap" "lines-leading" "spaces-leading" "spaces-trailing" "spaces-multi" ) ++ set( _var _source ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "SOURCE" ++ if( "+${_arg}" STREQUAL "+SOURCE" ) ++ unset( _source ) ++ set( _var _source ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "TARGET" ++ if( "+${_arg}" STREQUAL "+TARGET" ) ++ unset( _target ) ++ set( _var _target ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "CONTEXT" ++ if( "+${_arg}" STREQUAL "+CONTEXT" ) ++ unset( _context ) ++ set( _var _context ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "ATTRIBUTES" ++ if( "+${_arg}" STREQUAL "+ATTRIBUTES" ) ++ unset( _attribs ) ++ set( _var _attribs ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "PRESERVE" ++ if( "+${_arg}" STREQUAL "+PRESERVE" ) ++ unset( _preserve ) ++ set( _var _preserve ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ # verify source ++ if( NOT _source ) ++ tde_message_fatal( "no source XML file" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_source}" ) ++ set( _source "${CMAKE_CURRENT_SOURCE_DIR}/${_source}" ) ++ endif( ) ++ if( NOT _target ) ++ set( _target "${_source}.tde_l10n" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_target}" ) ++ set( _target "${CMAKE_CURRENT_SOURCE_DIR}/${_target}" ) ++ endif( ) ++ ++ # prepare tags to regexp ++ if( NOT _attribs ) ++ tde_message_fatal( "no attributes specified" ) ++ endif( ) ++ unset( _tags ) ++ foreach( _attrib ${_attribs} ) ++ string( REGEX REPLACE "^([^,]+),.*" "\\1" _tag "${_attrib}" ) ++ list( APPEND _tags "${_tag}" ) ++ endforeach( ) ++ list( REMOVE_DUPLICATES _tags ) ++ string( REPLACE ";" "|" _tags "${_tags}" ) ++ ++ # read file ++ file( READ ${_source} _xml_data ) ++ string( REGEX REPLACE "[^\n]" "" _xml_len ${_xml_data} ) ++ string( LENGTH "+${_xml_len}" _xml_len ) ++ ++ # process lines ++ set( _xml_pos 0 ) ++ unset( _xml_l10n ) ++ unset( _xml_inside_tag ) ++ unset( _xml_inside_attrib ) ++ unset( _xml_attrib_empty ) ++ while( _xml_pos LESS ${_xml_len} ) ++ # pick line ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _xml_line "${_xml_data}" ) ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _xml_data "${_xml_data}" ) ++ math( EXPR _xml_pos "${_xml_pos}+1" ) ++ set( _xml_newline 1 ) ++ ++ # process tags on line ++ while( _xml_newline OR NOT "${_xml_line}" STREQUAL "" ) ++ unset( _xml_line_rest ) ++ if( NOT _xml_inside_tag ) ++ if( "${_xml_line}" MATCHES "<(${_tags})([ \t\n][^>]*|$)" ) ++ set( _xml_inside_tag 1 ) ++ string( REGEX MATCH "<(${_tags})([ \t\n][^>]*|$)(.*)" _xml_line "${_xml_line}" ) ++ string( REGEX REPLACE "^<(${_tags})[ \t\n]*.*" "\\1" _xml_tag "${_xml_line}" ) ++ string( REGEX REPLACE "^<(${_tags})[ \t\n]*" "" _xml_line "${_xml_line}" ) ++ unset( _tag_attribs ) ++ foreach( _attrib ${_attribs} ) ++ if( "${_attrib}" MATCHES "^${_xml_tag}," ) ++ string( REGEX REPLACE "^([^,]+),([^,]+),?(.*)" "\\2" _attrib "${_attrib}" ) ++ list( APPEND _tag_attribs "${_attrib}" ) ++ endif( ) ++ endforeach( ) ++ string( REPLACE ";" "|" _tag_attribs "${_tag_attribs}" ) ++ unset( _xml_inside_attrib ) ++ else( ) ++ set( _xml_line "" ) ++ endif( ) ++ endif( ) ++ ++ if( _xml_inside_tag ) ++ if( "${_xml_line}" MATCHES "^(([ \t]*[^>=]+=\"[^\"]*\")*)[ \t]*/?>" ) ++ unset( _xml_inside_tag ) ++ string( REGEX REPLACE "^(([ \t]*[^>=]+=\"[^\"]*\")*)[ \t]*/?>(.*)" "\\3" _xml_line_rest "${_xml_line}" ) ++ string( REGEX REPLACE "^(([ \t]*[^>=]+=\"[^\"]*\")*)[ \t]*/?>(.*)" "\\1" _xml_line "${_xml_line}" ) ++ endif( ) ++ ++ # process attribs on line ++ set( _xml_attrib_line "${_xml_line}" ) ++ while( _xml_newline OR NOT "${_xml_attrib_line}" STREQUAL "" ) ++ unset( _xml_newline ) ++ unset( _xml_line_prefix ) ++ unset( _xml_line_suffix ) ++ unset( _xml_attrib_line_rest ) ++ ++ if( NOT _xml_inside_attrib ) ++ if( "${_xml_attrib_line}" MATCHES "(^|[ \t]+)(${_tag_attribs})=\"" ) ++ set( _xml_inside_attrib 1 ) ++ string( REGEX MATCH "(^|[ \t]+)(${_tag_attribs})=\"(.*)" _xml_attrib_line "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "^[ \t]*(${_tag_attribs})=\".*" "\\1" _xml_attrib "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "^[ \t]*(${_tag_attribs})=\"" "" _xml_attrib_line "${_xml_attrib_line}" ) ++ set( _xml_context "${_context}" ) ++ foreach( _attrib ${_attribs} ) ++ if( "${_attrib}" MATCHES "^${_xml_tag},${_xml_attrib}," ) ++ string( REGEX REPLACE "^([^,]+),([^,]+),?(.*)" "\\3" _xml_context "${_attrib}" ) ++ endif( ) ++ endforeach( ) ++ set( _xml_line_prefix "i18n(" ) ++ if( _xml_context ) ++ set( _xml_line_prefix "${_xml_line_prefix}\"${_xml_context}\", " ) ++ endif( ) ++ set( _xml_attrib_empty 1 ) ++ else( ) ++ set( _xml_attrib_line "" ) ++ endif( ) ++ endif( ) ++ ++ if( _xml_inside_attrib ) ++ if( "${_xml_attrib_line}" MATCHES "\"" ) ++ unset( _xml_inside_attrib ) ++ string( REGEX REPLACE "\"(.*)" "\\1" _xml_attrib_line_rest "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "\"(.*)" "" _xml_attrib_line "${_xml_attrib_line}" ) ++ set( _xml_line_suffix ");" ) ++ endif( ) ++ ++ string( REGEX REPLACE "\\\\" "\\\\\\\\" _xml_attrib_line "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "\\\"" "\\\\\"" _xml_attrib_line "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "\t" "\\\\t" _xml_attrib_line "${_xml_attrib_line}" ) ++ if( NOT ";${_preserve};" MATCHES ";entities;" ) ++ string( REGEX REPLACE "<" "<" _xml_attrib_line "${_xml_attrib_line}" ) ++ string( REGEX REPLACE ">" ">" _xml_attrib_line "${_xml_attrib_line}" ) ++ string( REGEX REPLACE "&" "&" _xml_attrib_line "${_xml_attrib_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-leading;" ) ++ string( REGEX REPLACE "^ +" "" _xml_attrib_line "${_xml_attrib_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-trailing;" ) ++ string( REGEX REPLACE " +$" "" _xml_attrib_line "${_xml_attrib_line}" ) ++ endif( ) ++ if( NOT ";${_preserve};" MATCHES ";spaces-multi;" ) ++ string( REGEX REPLACE " +" " " _xml_attrib_line "${_xml_attrib_line}" ) ++ endif( ) ++ ++ if( NOT "${_xml_inside_attrib}" STREQUAL "" ) ++ if( ";${_preserve};" MATCHES ";line-wrap;" ) ++ if( ";${_preserve};" MATCHES ";lines-leading;" ++ OR NOT "${_xml_attrib_line}" STREQUAL "" OR NOT _xml_attrib_empty ) ++ set( _xml_attrib_line "${_xml_attrib_line}\\n" ) ++ endif( ) ++ elseif( NOT "${_xml_attrib_line}" STREQUAL "" AND NOT _xml_attrib_empty ) ++ set( _xml_attrib_line " ${_xml_attrib_line}" ) ++ endif( ) ++ endif( ) ++ if( NOT "${_xml_attrib_line}" STREQUAL "" ) ++ unset( _xml_attrib_empty ) ++ endif( ) ++ endif( ) ++ ++ # drop empty attrib on single line ++ if( _xml_line_prefix AND _xml_line_suffix AND _xml_attrib_empty ) ++ # skip empty translation ++ ++ # add current attrib to output ++ else( ) ++ set( _xml_l10n "${_xml_l10n}${_xml_line_prefix}" ) ++ if( NOT "${_xml_attrib_line}" STREQUAL "" OR ( _xml_line_suffix AND _xml_attrib_empty ) ) ++ set( _xml_l10n "${_xml_l10n}\"${_xml_attrib_line}\"" ) ++ endif( ) ++ set( _xml_l10n "${_xml_l10n}${_xml_line_suffix}" ) ++ endif( ) ++ ++ # take the rest of the line for processing ++ set( _xml_attrib_line "${_xml_attrib_line_rest}" ) ++ endwhile( ) ++ endif( ) ++ ++ # take the rest of the line for processing ++ unset( _xml_newline ) ++ set( _xml_line "${_xml_line_rest}" ) ++ endwhile( ) ++ set( _xml_l10n "${_xml_l10n}\n" ) ++ endwhile( ) ++ ++ # write file ++ file( WRITE ${_target} "${_xml_l10n}" ) ++ ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_l10n_prepare_desktop ++##### ++##### The function is used to prepare desktop style file ++##### for xgettext. ++##### ++##### Note: gettext >= 0.19 includes support for extracting ++##### strings from desktop files, but there are some drawbacks. ++##### ++ ++function( tde_l10n_prepare_desktop ) ++ ++ unset( _source ) ++ unset( _target ) ++ unset( _keywords ) ++ unset( _directive ) ++ set( _var _source ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "SOURCE" ++ if( "+${_arg}" STREQUAL "+SOURCE" ) ++ unset( _source ) ++ set( _var _source ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "TARGET" ++ if( "+${_arg}" STREQUAL "+TARGET" ) ++ unset( _target ) ++ set( _var _target ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "KEYWORDS" ++ if( "+${_arg}" STREQUAL "+KEYWORDS" ) ++ unset( _keywords ) ++ set( _var _keywords ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ # verify source ++ if( NOT _source ) ++ tde_message_fatal( "no source desktop file" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_source}" ) ++ set( _source "${CMAKE_CURRENT_SOURCE_DIR}/${_source}" ) ++ endif( ) ++ if( NOT _target ) ++ set( _target "${_source}.tde_l10n" ) ++ endif( ) ++ if( NOT IS_ABSOLUTE "${_target}" ) ++ set( _target "${CMAKE_CURRENT_SOURCE_DIR}/${_target}" ) ++ endif( ) ++ ++ # prepare keywords ++ if( NOT _keywords ) ++ tde_message_fatal( "the keywords whose strings are to be extracted are not specified" ) ++ endif( ) ++ string( REPLACE ";" "|" _keywords_match "(${_keywords})" ) ++ ++ # read file ++ file( READ ${_source} _desktop_data ) ++ string( REGEX REPLACE "[^\n]" "" _desktop_len ${_desktop_data} ) ++ string( LENGTH "+${_desktop_len}" _desktop_len ) ++ ++ # process lines ++ set( _desktop_pos 0 ) ++ unset( _desktop_l10n ) ++ while( _desktop_pos LESS ${_desktop_len} ) ++ # pick line ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\1" _desktop_line "${_desktop_data}" ) ++ string( REGEX REPLACE "^([^\n]*)\n(.*)" "\\2" _desktop_data "${_desktop_data}" ) ++ math( EXPR _desktop_pos "${_desktop_pos}+1" ) ++ ++ # process line ++ if( "${_desktop_line}" MATCHES "^${_keywords_match}[ ]*=" ) ++ string( REGEX REPLACE "\\\"" "\\\\\"" _desktop_line "${_desktop_line}" ) ++ string( REGEX REPLACE "^${_keywords_match}[ ]*=[ ]*([^\n]*)" "/*\\1*/i18n(\"\\2\");" _desktop_line "${_desktop_line}" ) ++ else( ) ++ set( _desktop_line "" ) ++ endif( ) ++ set( _desktop_l10n "${_desktop_l10n}${_desktop_line}\n" ) ++ endwhile( ) ++ ++ # write file ++ file( WRITE ${_target} "${_desktop_l10n}" ) ++ ++endfunction( ) +diff -Naur orig/modules/TDEMacros.cmake tde-cmake-trinity-14.1.3/modules/TDEMacros.cmake +--- orig/modules/TDEMacros.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/TDEMacros.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,3257 @@ ++################################################# ++# ++# (C) 2010-2012 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# (C) 2011-2012 Timothy Pearson ++# kb9vqf (AT) pearsoncomputing.net ++# ++# (C) 2012-2020 Slávek Banko ++# slavek (DOT) banko (AT) axis.cz ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++ ++################################################# ++##### ++##### Need cmake minimum version ++ ++include( TDEVersion ) ++ ++ ++################################################# ++##### ++##### initialization... ++ ++if( NOT TDE_CMAKE_ROOT ) ++ if( "${CMAKE_VERSION}" VERSION_LESS "${TDE_CMAKE_MINIMUM_VERSION}" ) ++ message( FATAL_ERROR "CMake >= ${TDE_CMAKE_MINIMUM_VERSION} required" ) ++ endif() ++ ++ if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules ) ++ ++ # TDE CMake is installed in the system directory ++ set( TDE_CMAKE_ROOT ${CMAKE_ROOT} ++ CACHE FILEPATH "TDE CMake root" ) ++ set( TDE_CMAKE_MODULES ${TDE_CMAKE_ROOT}/Modules ++ CACHE FILEPATH "TDE CMake modules" ) ++ set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/Templates ++ CACHE FILEPATH "TDE CMake templates" ) ++ ++ else() ++ ++ # TDE CMake is part of the source code ++ get_filename_component( TDE_CMAKE_ROOT ${CMAKE_CURRENT_LIST_DIR} PATH ) ++ set( TDE_CMAKE_ROOT ${TDE_CMAKE_ROOT} ++ CACHE FILEPATH "TDE CMake root" ) ++ set( TDE_CMAKE_MODULES ${TDE_CMAKE_ROOT}/modules ++ CACHE FILEPATH "TDE CMake modules" ) ++ set( TDE_CMAKE_TEMPLATES ${TDE_CMAKE_ROOT}/templates ++ CACHE FILEPATH "TDE CMake templates" ) ++ ++ endif() ++ ++ ++ option( FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE ) ++ if( ${FORCE_COLORED_OUTPUT} ) ++ if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) ++ if( NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9" ) ++ add_compile_options (-fdiagnostics-color=always) ++ endif() ++ elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) ++ add_compile_options (-fcolor-diagnostics) ++ endif() ++ endif() ++ ++endif() ++ ++ ++################################################# ++##### ++##### set necessary CMake policies ++ ++cmake_policy( PUSH ) ++if( POLICY CMP0057 ) ++ # necessary for CheckLinkerFlag ++ cmake_policy( SET CMP0057 NEW ) ++endif() ++ ++ ++################################################# ++##### ++##### necessary includes ++ ++include( CheckCXXCompilerFlag ) ++include( CheckCXXSourceCompiles ) ++include( CheckLinkerFlag OPTIONAL ) ++include( CheckSymbolExists ) ++include( CheckTypeSize ) ++ ++ ++################################################# ++##### ++##### tde_concat_msg ++ ++macro( tde_concat_msg _msg ) ++ unset( ${_msg} ) ++ foreach( _arg ${ARGN} ) ++ string( APPEND ${_msg} " ${_arg}\n" ) ++ endforeach() ++endmacro( tde_concat_msg ) ++ ++ ++################################################# ++##### ++##### tde_message_author_warning ++ ++function( tde_message_author_warning ) ++ tde_concat_msg( _msg ${ARGV} ) ++ message( AUTHOR_WARNING ++ "-------------------------------------------------\n" ++ "${_msg}" ++ "-------------------------------------------------" ) ++endfunction( tde_message_author_warning ) ++ ++ ++################################################# ++##### ++##### tde_message_fatal ++ ++macro( tde_message_fatal ) ++ tde_concat_msg( _msg ${ARGV} ) ++ ++ message( FATAL_ERROR ++ "#################################################\n" ++ "${_msg}" ++ "#################################################" ) ++endmacro( tde_message_fatal ) ++ ++ ++################################################# ++##### ++##### tde_get_arg( ) ++##### ARG_NAME(string): name of an argument to find in ARGS ++##### COUNT(number): argument dimension, a number of items returned in RETURN ++##### RETURN(list ref): items returned for argument as they found in ARGS ++##### REST(list ref): rest of items except argument name and items returned in RETURN ++##### ARGS(list): source list of arguments ++ ++macro( tde_get_arg ARG_NAME COUNT RETURN REST ) ++ unset( ${RETURN} ) ++ unset( ${REST} ) ++ list( APPEND ${REST} ${ARGN} ) ++ list( FIND ${REST} ${ARG_NAME} _arg_idx) ++ if( NOT ${_arg_idx} EQUAL -1 ) ++ list( REMOVE_AT ${REST} ${_arg_idx} ) ++ set( _i 0 ) ++ while( ${_i} LESS ${COUNT} ) ++ list( GET ${REST} ${_arg_idx} _arg ) ++ list( REMOVE_AT ${REST} ${_arg_idx} ) ++ list( APPEND ${RETURN} ${_arg} ) ++ math( EXPR _i "${_i} + 1" ) ++ endwhile() ++ endif() ++endmacro( tde_get_arg ) ++ ++ ++################################################ ++##### ++##### tde_execute_process( [MESSAGE ] ) ++##### MSG: fatal error message (standard message will be written if not supplied) ++##### ARGS: execute_process arguments ++ ++macro( tde_execute_process ) ++ tde_get_arg( MESSAGE 1 _message _rest_args ${ARGV} ) ++ tde_get_arg( RESULT_VARIABLE 1 _result_variable _tmp ${_rest_args} ) ++ tde_get_arg( COMMAND 1 _command _tmp ${_rest_args} ) ++ tde_get_arg( OUTPUT_VARIABLE 1 _output_variable _tmp ${_rest_args} ) ++ tde_get_arg( CACHE 3 _cache _rest_args2 ${_rest_args} ) ++ ++ # handle optional FORCE parameter ++ if( DEFINED _cache ) ++ list( GET _cache 2 _tmp ) ++ if( _tmp STREQUAL FORCE ) ++ set( _rest_args ${_rest_args2} ) ++ else() ++ tde_get_arg( CACHE 2 _cache _rest_args ${_rest_args} ) ++ endif() ++ endif() ++ ++ if( NOT DEFINED _result_variable ) ++ list( APPEND _rest_args RESULT_VARIABLE _exec_result ) ++ set( _result_variable _exec_result ) ++ endif() ++ ++ execute_process( ${_rest_args} ) ++ ++ if( DEFINED _output_variable AND DEFINED _cache ) ++ set( ${_output_variable} ${${_output_variable}} CACHE ${_cache} ) ++ endif() ++ ++ if( ${_result_variable} ) ++ if( DEFINED _message ) ++ tde_message_fatal( ${_message} ) ++ else() ++ if( ${${_result_variable}} MATCHES "^[0-9]+$" ) ++ set( ${_result_variable} "status ${${_result_variable}} returned!" ) ++ endif() ++ tde_message_fatal( "Error executing '${_command}': ${${_result_variable}}" ) ++ endif() ++ endif() ++endmacro( tde_execute_process ) ++ ++ ++################################################ ++##### ++##### tde_read_src_metadata ++ ++macro( tde_read_src_metadata ) ++ # look for SCM data if present ++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescminfo" ) ++ file( READ "${CMAKE_SOURCE_DIR}/.tdescminfo" TDE_SCM_INFO ) ++ string( REGEX MATCH "(^|\n)Name: ([^\n]*)" TDE_SCM_MODULE_NAME "${TDE_SCM_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_NAME "${TDE_SCM_MODULE_NAME}" ) ++ string( REGEX MATCH "(^|\n)Revision: ([^\n]*)" TDE_SCM_MODULE_REVISION "${TDE_SCM_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_REVISION "${TDE_SCM_MODULE_REVISION}" ) ++ string( REGEX MATCH "(^|\n)DateTime: ([^\n]*)" TDE_SCM_MODULE_DATETIME "${TDE_SCM_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_SCM_MODULE_DATETIME "${TDE_SCM_MODULE_DATETIME}" ) ++ else( ) ++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" ) ++ file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmmodule" TDE_SCM_MODULE_NAME ) ++ endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" ) ++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" ) ++ file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmrevision" TDE_SCM_MODULE_REVISION ) ++ endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" ) ++ endif( ) ++ ++ # look for package data if present ++ if( EXISTS "${CMAKE_SOURCE_DIR}/.tdepkginfo" ) ++ file( READ "${CMAKE_SOURCE_DIR}/.tdepkginfo" TDE_PKG_INFO ) ++ endif( ) ++ if( EXISTS "${CMAKE_BINARY_DIR}/.tdepkginfo" ) ++ file( READ "${CMAKE_BINARY_DIR}/.tdepkginfo" TDE_PKG_INFO ) ++ endif( ) ++ if( TDE_PKG_INFO ) ++ string( REGEX MATCH "(^|\n)Name: ([^\n]*)" TDE_PKG_NAME "${TDE_PKG_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_NAME "${TDE_PKG_NAME}" ) ++ string( REGEX MATCH "(^|\n)Version: ([^\n]*)" TDE_PKG_VERSION "${TDE_PKG_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_VERSION "${TDE_PKG_VERSION}" ) ++ string( REGEX MATCH "(^|\n)DateTime: ([^\n]*)" TDE_PKG_DATETIME "${TDE_PKG_INFO}" ) ++ string( REGEX REPLACE "^[^:]*: " "" TDE_PKG_DATETIME "${TDE_PKG_DATETIME}" ) ++ endif( ) ++endmacro( tde_read_src_metadata ) ++ ++ ++################################################ ++##### ++##### finalization as a slave part ++ ++if( DEFINED MASTER_SOURCE_DIR ) ++ cmake_policy( POP ) ++ return( ) ++endif( ) ++ ++########### slave part ends here ############### ++ ++ ++################################################ ++##### ++##### tde_install_icons( THEME DESTINATION ) ++##### default theme: hicolor ++##### default destination: ${SHARE_INSTALL_DIR}/icons ++ ++macro( tde_install_icons ) ++ tde_get_arg( DESTINATION 1 _dest _args ${ARGV} ) ++ tde_get_arg( THEME 1 _req_theme _icons ${_args} ) ++ ++ #defaults ++ if( NOT _icons ) ++ set( _icons "*" ) ++ endif( NOT _icons ) ++ if( NOT _dest ) ++ set( _dest "${ICON_INSTALL_DIR}" ) ++ endif( NOT _dest ) ++ ++ foreach( _icon ${_icons} ) ++ unset( _theme ) # clearing ++ ++ file(GLOB _icon_files *-${_icon}.png *-${_icon}.mng _icon_files *-${_icon}.svg* ) ++ foreach( _icon_file ${_icon_files} ) ++ # FIXME need a review ++ string( REGEX MATCH "^.*/([a-zA-Z][a-zA-Z])([0-9a-zA-Z]+)\\-([a-z]+)\\-([^/]+)$" _dummy "${_icon_file}" ) ++ set( _type "${CMAKE_MATCH_1}" ) ++ set( _size "${CMAKE_MATCH_2}" ) ++ set( _group "${CMAKE_MATCH_3}" ) ++ set( _name "${CMAKE_MATCH_4}" ) ++ ++ # we must ignore invalid icon names ++ if( _type AND _size AND _group AND _name ) ++ ++ # autodetect theme ++ if( NOT _req_theme ) ++ unset( _theme ) ++ if( "${_type}" STREQUAL "cr" ) ++ set( _theme crystalsvg ) ++ elseif( "${_type}" STREQUAL "lo" ) ++ set( _theme locolor ) ++ endif( "${_type}" STREQUAL "cr" ) ++ # defaulting ++ if( NOT _theme ) ++ set( _theme hicolor ) ++ endif( NOT _theme ) ++ else( NOT _req_theme ) ++ set( _theme ${_req_theme} ) ++ endif( NOT _req_theme ) ++ ++ # fix "group" name ++ if( "${_group}" STREQUAL "mime" ) ++ set( _group "mimetypes" ) ++ endif( "${_group}" STREQUAL "mime" ) ++ if( "${_group}" STREQUAL "filesys" ) ++ set( _group "places" ) ++ endif( "${_group}" STREQUAL "filesys" ) ++ if( "${_group}" STREQUAL "category" ) ++ set( _group "categories" ) ++ endif( "${_group}" STREQUAL "category" ) ++ if( "${_group}" STREQUAL "device" ) ++ set( _group "devices" ) ++ endif( "${_group}" STREQUAL "device" ) ++ if( "${_group}" STREQUAL "app" ) ++ set( _group "apps" ) ++ endif( "${_group}" STREQUAL "app" ) ++ if( "${_group}" STREQUAL "action" ) ++ set( _group "actions" ) ++ endif( "${_group}" STREQUAL "action" ) ++ ++ if( "${_size}" STREQUAL "sc" ) ++ install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/scalable/${_group}/ RENAME ${_name} ) ++ else( "${_size}" STREQUAL "sc" ) ++ install( FILES ${_icon_file} DESTINATION ${_dest}/${_theme}/${_size}x${_size}/${_group}/ RENAME ${_name} ) ++ endif( "${_size}" STREQUAL "sc" ) ++ ++ endif( _type AND _size AND _group AND _name ) ++ ++ endforeach( _icon_file ) ++ endforeach( _icon ) ++ ++endmacro( tde_install_icons ) ++ ++ ++################################################# ++##### ++##### tde_add_lut( [depends] ) ++##### default depends: source ++ ++macro( tde_add_lut _src _lut _dep ) ++ set( create_hash_table ${CMAKE_SOURCE_DIR}/kjs/create_hash_table ) ++ if( NOT _dep ) ++ set( _dep ${_src} ) ++ endif( NOT _dep ) ++ add_custom_command( OUTPUT ${_lut} ++ COMMAND perl ARGS ${create_hash_table} ${CMAKE_CURRENT_SOURCE_DIR}/${_src} -i > ${_lut} ++ DEPENDS ${_src} ) ++ set_source_files_properties( ${_dep} PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_lut} ) ++ unset( _dep ) ++endmacro( tde_add_lut ) ++ ++ ++################################################# ++##### ++##### tde_add_luts( ) ++ ++macro( tde_add_luts ) ++ foreach( _src ${ARGV} ) ++ get_filename_component( _lut ${_src} NAME_WE ) ++ set( _lut "${_lut}.lut.h" ) ++ tde_add_lut( ${_src} ${_lut} ${_src} ) ++ endforeach( _src ) ++endmacro( tde_add_luts ) ++ ++ ++################################################# ++##### ++##### tde_file_to_cpp( ) ++ ++macro( tde_file_to_cpp _src _dst _var ) ++ if( IS_ABSOLUTE ${_dst} ) ++ set( dst ${_dst} ) ++ else( ) ++ set( dst "${CMAKE_CURRENT_BINARY_DIR}/${_dst}" ) ++ endif( ) ++ file( READ ${_src} text ) ++ string( REGEX REPLACE "\n" "\\\\n\"\n\"" text "${text}" ) ++ set( text "/* Generated by CMake */\n\nconst char *${_var} = \n\n\"${text}\";\n" ) ++ string( REGEX REPLACE "\n\"\";\n$" ";\n" text "${text}" ) ++ file( WRITE ${dst} "${text}" ) ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_get_library_filename( ) ++ ++function( tde_get_library_filename _filename _target ) ++ get_target_property( _type ${_target} TYPE ) ++ if( "${_type}" MATCHES "_LIBRARY" ) ++ get_target_property( _output_prefix ${_target} PREFIX ) ++ if( "${_output_prefix}" STREQUAL "_output_prefix-NOTFOUND" ) ++ if( "${_type}" MATCHES "STATIC_" ) ++ set( _output_prefix "${CMAKE_STATIC_LIBRARY_PREFIX}" ) ++ elseif( "${_type}" MATCHES "SHARED_" ) ++ set( _output_prefix "${CMAKE_SHARED_LIBRARY_PREFIX}" ) ++ elseif( "${_type}" MATCHES "MODULE_" ) ++ set( _output_prefix "${CMAKE_SHARED_MODULE_PREFIX}" ) ++ else( ) ++ set( _output_prefix "" ) ++ endif( ) ++ endif( ) ++ get_target_property( _output_suffix ${_target} SUFFIX ) ++ if( "${_output_suffix}" STREQUAL "_output_suffix-NOTFOUND" ) ++ if( "${_type}" MATCHES "STATIC_" ) ++ set( _output_suffix "${CMAKE_STATIC_LIBRARY_SUFFIX}" ) ++ elseif( "${_type}" MATCHES "SHARED_" ) ++ set( _output_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}" ) ++ elseif( "${_type}" MATCHES "MODULE_" ) ++ set( _output_suffix "${CMAKE_SHARED_MODULE_SUFFIX}" ) ++ else( ) ++ set( _output_suffix "" ) ++ endif( ) ++ endif( ) ++ get_target_property( _output ${_target} OUTPUT_NAME ) ++ set( ${_filename} "${_output_prefix}${_output}${_output_suffix}" PARENT_SCOPE ) ++ else( ) ++ set( ${_filename} "" PARENT_SCOPE ) ++ endif( ) ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_install_la_file( ) ++ ++macro( tde_install_la_file _target _destination ) ++ ++ tde_get_library_filename( _soname ${_target} ) ++ get_target_property( _target_release ${_target} RELEASE ) ++ if( _target_release ) ++ string( REPLACE "-${_target_release}" "" _soname_base "${_soname}" ) ++ else( ) ++ set( _soname_base ${_soname} ) ++ endif( ) ++ string( REGEX REPLACE "\\.so(\\.[0-9]+)*$" "" _laname "${_soname_base}" ) ++ set( _laname ${CMAKE_CURRENT_BINARY_DIR}/${_laname}.la ) ++ ++ file( WRITE ${_laname} ++"# ${_laname} - a libtool library file, generated by cmake ++# The name that we can dlopen(3). ++dlname='${_soname}' ++# Names of this library ++library_names='${_soname} ${_soname} ${_soname_base}' ++# The name of the static archive ++old_library='' ++# Libraries that this one depends upon. ++dependency_libs='' ++# Version information.\ncurrent=0\nage=0\nrevision=0 ++# Is this an already installed library?\ninstalled=yes ++# Should we warn about portability when linking against -modules?\nshouldnotlink=yes ++# Files to dlopen/dlpreopen\ndlopen=''\ndlpreopen='' ++# Directory that this library needs to be installed in: ++libdir='${_destination}' ++" ) ++ ++ install( FILES ${_laname} DESTINATION ${_destination} ) ++ ++endmacro( tde_install_la_file ) ++ ++ ++################################################# ++##### ++##### tde_add_ui_files ++ ++macro( tde_add_ui_files _sources ) ++ if( TDE_FOUND OR "${CMAKE_PROJECT_NAME}" STREQUAL "tdelibs" ) ++ set( HAVE_TDE 1 ) ++ endif() ++ ++ foreach( _ui_file ${ARGN} ) ++ ++ get_filename_component( _ui_basename ${_ui_file} NAME_WE ) ++ get_filename_component( _ui_absolute_path ${_ui_file} ABSOLUTE ) ++ ++ list( APPEND ${_sources} ${_ui_basename}.cpp ) ++ ++ add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp ++ COMMAND ${CMAKE_COMMAND} ++ -DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE} ++ -DTQT_REPLACE_SCRIPT:FILEPATH=${TQT_REPLACE_SCRIPT} ++ -DTDE_TQTPLUGINS_DIR:FILEPATH=${TDE_TQTPLUGINS_DIR} ++ -DMOC_EXECUTABLE:FILEPATH=${MOC_EXECUTABLE} ++ -DUI_FILE:FILEPATH=${_ui_absolute_path} ++ -DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR} ++ -DMASTER_BINARY_DIR:FILEPATH=${CMAKE_BINARY_DIR} ++ -DTDE_FOUND=${HAVE_TDE} ++ -DTQT_ONLY=${TQT_ONLY} ++ -P ${TDE_CMAKE_MODULES}/tde_uic.cmake ++ DEPENDS ${_ui_absolute_path} ) ++ ++ endforeach( _ui_file ) ++endmacro( tde_add_ui_files ) ++ ++ ++################################################# ++##### ++##### tde_moc ++ ++macro( tde_moc _sources ) ++ foreach( _input_file ${ARGN} ) ++ ++ get_filename_component( _input_file "${_input_file}" ABSOLUTE ) ++ get_filename_component( _basename ${_input_file} NAME_WE ) ++ set( _output_file "${_basename}.moc.cpp" ) ++ add_custom_command( OUTPUT ${_output_file} ++ COMMAND ++ ${TMOC_EXECUTABLE} ${_input_file} -o ${_output_file} ++ DEPENDS ++ ${_input_file} ) ++ list( APPEND ${_sources} ${_output_file} ) ++ ++ endforeach( ) ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_automoc ++ ++macro( tde_automoc ) ++ foreach( _src_file ${ARGN} ) ++ ++ get_filename_component( _src_file "${_src_file}" ABSOLUTE ) ++ ++ if( EXISTS "${_src_file}" ) ++ ++ # read source file and check if have moc include ++ file( READ "${_src_file}" _src_content ) ++ string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" ) ++ ++ # found included moc(s)? ++ if( _moc_includes ) ++ foreach( _moc_file ${_moc_includes} ) ++ ++ # extracting moc filename ++ string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" ) ++ set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" ) ++ ++ # create header filename ++ get_filename_component( _src_path "${_src_file}" ABSOLUTE ) ++ get_filename_component( _src_path "${_src_path}" PATH ) ++ get_filename_component( _src_header "${_moc_file}" NAME_WE ) ++ set( _header_file "${_src_path}/${_src_header}.h" ) ++ ++ # if header doesn't exists, check in META_INCLUDES ++ if( NOT EXISTS "${_header_file}" ) ++ unset( _found ) ++ foreach( _src_path ${_meta_includes} ) ++ set( _header_file "${_src_path}/${_src_header}.h" ) ++ if( EXISTS "${_header_file}" ) ++ set( _found 1 ) ++ break( ) ++ endif( ) ++ endforeach( ) ++ if( NOT _found ) ++ get_filename_component( _moc_file "${_moc_file}" NAME ) ++ tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_header}.h' not found." ) ++ endif( ) ++ endif( ) ++ ++ # moc-ing header ++ file( RELATIVE_PATH _moc_file_relative "${CMAKE_BINARY_DIR}" "${_moc_file}" ) ++ add_custom_command( OUTPUT ${_moc_file} ++ COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file} ++ COMMENT "Generating ${_moc_file_relative}" ++ DEPENDS ${_header_file} ) ++ ++ # create dependency between source file and moc file ++ set_property( SOURCE ${_src_file} APPEND PROPERTY OBJECT_DEPENDS ${_moc_file} ) ++ ++ endforeach( _moc_file ) ++ ++ endif( _moc_includes ) ++ ++ else( EXISTS "${_src_file}" ) ++ ++ # for generated file, the path must match the binary directory ++ string( LENGTH "${CMAKE_BINARY_DIR}" CMAKE_BINARY_DIR_LEN ) ++ string( LENGTH "${_src_file}" _basename_len ) ++ if( ${_basename_len} LESS ${CMAKE_BINARY_DIR_LEN} ) ++ set( _basedir_prefix "${CMAKE_SOURCE_DIR}" ) ++ else( ) ++ string( SUBSTRING "${_src_file}" 0 ${CMAKE_BINARY_DIR_LEN} _basedir_prefix ) ++ endif( ) ++ if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" ) ++ file( RELATIVE_PATH _sourcename "${CMAKE_BINARY_DIR}" "${_src_file}" ) ++ file( RELATIVE_PATH _basename "${CMAKE_CURRENT_BINARY_DIR}" "${_src_file}" ) ++ else( ) ++ file( RELATIVE_PATH _sourcename "${CMAKE_SOURCE_DIR}" "${_src_file}" ) ++ file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_src_file}" ) ++ endif( ) ++ ++ # automocing generated file ++ get_filename_component( _automoc_file "${_src_file}+automoc" NAME ) ++ set( _automoc_file "${CMAKE_CURRENT_BINARY_DIR}/${_automoc_file}" ) ++ ++ add_custom_command( OUTPUT ${_automoc_file} ++ COMMAND ${CMAKE_COMMAND} ++ -DTMOC_EXECUTABLE:FILEPATH=${TMOC_EXECUTABLE} ++ -DSRC_FILE:FILEPATH=${CMAKE_CURRENT_BINARY_DIR}/${_basename} ++ -DMETA_INCLUDES:STRING="${_meta_includes}" ++ -DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR} ++ -DMASTER_BINARY_DIR:FILEPATH=${CMAKE_BINARY_DIR} ++ -P ${TDE_CMAKE_MODULES}/tde_automoc.cmake ++ COMMENT "Automocing ${_sourcename}" ++ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" ++ ) ++ ++ # create dependency between source file and moc file ++ set_property( SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" ++ APPEND PROPERTY OBJECT_DEPENDS ${_automoc_file} ) ++ ++ endif( EXISTS "${_src_file}" ) ++ ++ endforeach( _src_file ) ++endmacro( tde_automoc ) ++ ++ ++################################################# ++##### ++##### tde_create_dcop_kidl ++ ++macro( tde_create_dcop_kidl _kidl _kidl_source ) ++ ++ get_filename_component( _kidl_source ${_kidl_source} ABSOLUTE ) ++ get_filename_component( _kidl_basename ${_kidl_source} NAME_WE ) ++ set( _kidl_output ${CMAKE_CURRENT_BINARY_DIR}/${_kidl_basename}.kidl ) ++ file( RELATIVE_PATH _kidl_target "${CMAKE_BINARY_DIR}" "${_kidl_output}" ) ++ string( REPLACE "/" "+" _kidl_target "${_kidl_target}" ) ++ ++ if( NOT TARGET ${_kidl_target} ) ++ add_custom_command( ++ OUTPUT ${_kidl_output} ++ COMMAND ${KDE3_DCOPIDLNG_EXECUTABLE} ++ ARGS ${_kidl_source} > ${_kidl_output} ++ DEPENDS ${_kidl_source} ++ ) ++ add_custom_target( ${_kidl_target} DEPENDS ${_kidl_output} ) ++ endif( ) ++ ++ set( ${_kidl} ${_kidl_output} ) ++ ++endmacro( tde_create_dcop_kidl ) ++ ++ ++################################################# ++##### ++##### tde_add_dcop_skels ++ ++macro( tde_add_dcop_skels _sources ) ++ foreach( _current_FILE ${ARGN} ) ++ ++ get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) ++ get_filename_component( _basename ${_tmp_FILE} NAME_WE ) ++ ++ set( _skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp ) ++ file( RELATIVE_PATH _skel_target "${CMAKE_BINARY_DIR}" "${_skel}" ) ++ string( REPLACE "/" "+" _skel_target "${_skel_target}" ) ++ ++ tde_create_dcop_kidl( _kidl ${_tmp_FILE} ) ++ ++ if( NOT TARGET ${_skel_target} ) ++ add_custom_command( ++ OUTPUT ${_skel} ++ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} ++ ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} ++ DEPENDS ${_kidl_target} ++ ) ++ add_custom_target( ${_skel_target} DEPENDS ${_skel} ) ++ endif( ) ++ ++ list( APPEND ${_sources} ${_skel} ) ++ ++ endforeach( _current_FILE ) ++endmacro( tde_add_dcop_skels ) ++ ++ ++################################################# ++##### ++##### tde_add_dcop_stubs ++ ++macro( tde_add_dcop_stubs _sources ) ++ foreach( _current_FILE ${ARGN} ) ++ ++ get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) ++ get_filename_component( _basename ${_tmp_FILE} NAME_WE ) ++ ++ set( _stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp ) ++ set( _stub_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.h ) ++ file( RELATIVE_PATH _stub_target "${CMAKE_BINARY_DIR}" "${_stub_CPP}" ) ++ string( REPLACE "/" "+" _stub_target "${_stub_target}" ) ++ ++ tde_create_dcop_kidl( _kidl ${_tmp_FILE} ) ++ ++ if( NOT TARGET ${_stub_target} ) ++ add_custom_command( ++ OUTPUT ${_stub_CPP} ${_stub_HEADER} ++ COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} ++ ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} ++ DEPENDS ${_kidl_target} ++ ) ++ add_custom_target( ${_stub_target} DEPENDS ${_stub_CPP} ${_stub_HEADER} ) ++ endif( ) ++ ++ list( APPEND ${_sources} ${_stub_CPP} ) ++ ++ endforeach( _current_FILE ) ++endmacro( tde_add_dcop_stubs ) ++ ++ ++################################################# ++##### ++##### tde_add_kcfg_files ++ ++macro( tde_add_kcfg_files _sources ) ++ foreach( _current_FILE ${ARGN} ) ++ ++ get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) ++ get_filename_component( _basename ${_tmp_FILE} NAME_WE ) ++ ++ file( READ ${_tmp_FILE} _contents ) ++ string( REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}" ) ++ ++ set( _src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp ) ++ set( _header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h ) ++ file( RELATIVE_PATH _kcfg_target "${CMAKE_BINARY_DIR}" "${_src_FILE}" ) ++ string( REPLACE "/" "+" _kcfg_target "${_kcfg_target}" ) ++ ++ if( NOT TARGET ${_kcfg_target} ) ++ add_custom_command( ++ OUTPUT ${_src_FILE} ${_header_FILE} ++ COMMAND ${KDE3_KCFGC_EXECUTABLE} ++ ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} ++ DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ++ ) ++ add_custom_target( ${_kcfg_target} DEPENDS ${_src_FILE} ${_header_FILE} ) ++ endif( ) ++ ++ list( APPEND ${_sources} ${_src_FILE} ) ++ ++ endforeach( _current_FILE ) ++endmacro( tde_add_kcfg_files ) ++ ++ ++################################################# ++##### ++##### __tde_internal_process_sources ++ ++macro( __tde_internal_process_sources _sources ) ++ ++ unset( ${_sources} ) ++ ++ foreach( _arg ${ARGN} ) ++ get_filename_component( _ext ${_arg} EXT ) ++ get_filename_component( _name ${_arg} NAME_WE ) ++ get_filename_component( _path ${_arg} PATH ) ++ ++ # if not path, set it to "." ++ if( NOT _path ) ++ set( _path "./" ) ++ endif( NOT _path ) ++ ++ # handle .ui files ++ if( ${_ext} STREQUAL ".ui" ) ++ tde_add_ui_files( ${_sources} ${_arg} ) ++ ++ # handle .skel files ++ elseif( ${_ext} STREQUAL ".skel" ) ++ tde_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) ++ ++ # handle .stub files ++ elseif( ${_ext} STREQUAL ".stub" ) ++ tde_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) ++ ++ # handle .kcfgc files ++ elseif( ${_ext} STREQUAL ".kcfgc" ) ++ tde_add_kcfg_files( ${_sources} ${_arg} ) ++ ++ # handle any other files ++ else( ${_ext} STREQUAL ".ui" ) ++ list(APPEND ${_sources} ${_arg} ) ++ endif( ${_ext} STREQUAL ".ui" ) ++ endforeach( _arg ) ++ ++endmacro( __tde_internal_process_sources ) ++ ++ ++################################################# ++##### ++##### tde_install_libtool_file ++ ++macro( tde_install_libtool_file _target _destination ) ++ ++ # get .so name ++ tde_get_library_filename( _soname ${_target} ) ++ get_target_property( _target_release ${_target} RELEASE ) ++ if( _target_release ) ++ string( REPLACE "-${_target_release}" "" _soname_base "${_soname}" ) ++ else( ) ++ set( _soname_base ${_soname} ) ++ endif( ) ++ ++ # get .la name ++ string( REGEX REPLACE "\\.so(\\.[0-9]+)*$" "" _laname "${_soname_base}" ) ++ set( _laname ${_laname}.la ) ++ ++ # get version of target ++ get_target_property( _target_version ${_target} VERSION ) ++ get_target_property( _target_soversion ${_target} SOVERSION ) ++ ++ # we have so version ++ if( _target_version ) ++ set( _library_name_1 "${_soname}.${_target_version}" ) ++ set( _library_name_2 "${_soname}.${_target_soversion}" ) ++ set( _library_name_3 "${_soname_base}" ) ++ ++ string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_target_version}" ) ++ set( _version_current "${CMAKE_MATCH_1}" ) ++ set( _version_age "${CMAKE_MATCH_2}" ) ++ set( _version_revision "${CMAKE_MATCH_3}" ) ++ ++ # we have no so version (module?) ++ else( _target_version ) ++ set( _library_name_1 "${_soname}" ) ++ set( _library_name_2 "${_soname}" ) ++ set( _library_name_3 "${_soname_base}" ) ++ set( _version_current "0" ) ++ set( _version_age "0" ) ++ set( _version_revision "0" ) ++ endif( _target_version ) ++ ++ if( IS_ABSOLUTE ${_destination} ) ++ set( _libdir "${_destination}" ) ++ else( IS_ABSOLUTE ${_destination} ) ++ set( _libdir "${CMAKE_INSTALL_PREFIX}/${_destination}" ) ++ endif( IS_ABSOLUTE ${_destination} ) ++ ++ configure_file( ${TDE_CMAKE_TEMPLATES}/tde_libtool_file.cmake "${_laname}" @ONLY ) ++ ++ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_laname}" DESTINATION ${_destination} ) ++ ++endmacro( tde_install_libtool_file ) ++ ++ ++################################################# ++##### ++##### tde_install_export / tde_import ++ ++function( tde_install_export ) ++ file( GLOB export_files ${CMAKE_CURRENT_BINARY_DIR}/export-*.cmake ) ++ list( SORT export_files ) ++ ++ set( mode "WRITE" ) ++ foreach( filename ${export_files} ) ++ file( READ ${filename} content ) ++ file( ${mode} "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" "${content}" ) ++ set( mode "APPEND" ) ++ endforeach( ) ++ ++ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.cmake" DESTINATION ${CMAKE_INSTALL_DIR} ) ++endfunction( ) ++ ++ ++macro( tde_import _library ) ++ if( NOT DEFINED TDE_IMPORT_${_library} ) ++ message( STATUS "Checking for '${_library}'" ) ++ string( TOUPPER "BUILD_${_library}" _build ) ++ if( ${_build} ) ++ message( STATUS "Checking for '${_library}' - ok, activated for build" ) ++ set( TDE_IMPORT_${_library} "build" CACHE INTERNAL "Library ${_library} activated for build" ) ++ else() ++ if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" ) ++ set( tde_import_include "${TDE_CMAKE_DIR}/${_library}.cmake" ) ++ elseif( EXISTS "${TQT_CMAKE_DIR}/${_library}.cmake" ) ++ set( tde_import_include "${TQT_CMAKE_DIR}/${_library}.cmake" ) ++ else() ++ tde_message_fatal( "'${_library}' is required, but is not installed nor selected for build" ) ++ endif() ++ include( "${tde_import_include}" ) ++ message( STATUS "Checking for '${_library}' - ok, found import file" ) ++ set( TDE_IMPORT_${_library} "import:${tde_import_include}" CACHE INTERNAL "Library ${_library} imported" ) ++ endif() ++ else() ++ if( "${TDE_IMPORT_${_library}}" MATCHES "^import:" ) ++ string( REGEX REPLACE "^import:" "" tde_import_include "${TDE_IMPORT_${_library}}" ) ++ include( "${tde_import_include}" ) ++ endif() ++ endif() ++endmacro() ++ ++ ++################################################# ++##### ++##### tde_add_library ++ ++macro( tde_add_library _arg_target ) ++ ++ unset( _target ) ++ unset( _type ) ++ unset( _static_pic ) ++ unset( _automoc ) ++ unset( _meta_includes ) ++ unset( _no_libtool_file ) ++ unset( _no_export ) ++ unset( _version ) ++ unset( _release ) ++ unset( _sources ) ++ unset( _cxx_features ) ++ unset( _cxx_features_private ) ++ unset( _destination ) ++ unset( _embed ) ++ unset( _link ) ++ unset( _link_private ) ++ unset( _dependencies ) ++ unset( _storage ) ++ unset( _exclude_from_all ) ++ ++ set( _shouldnotlink no ) ++ ++ # metadata ++ unset( _description ) ++ unset( _license ) ++ unset( _copyright ) ++ unset( _authors ) ++ unset( _product ) ++ unset( _organization ) ++ unset( _version ) ++ unset( _datetime ) ++ unset( _notes ) ++ ++ # default metadata ++ set( _product "Trinity Desktop Environment" ) ++ tde_curdatetime( _datetime ) ++ ++ foreach( _arg ${ARGV} ) ++ ++ # this variable help us to skip ++ # storing unapropriate values (i.e. directives) ++ unset( _skip_store ) ++ ++ # found one of directives: "SHARED", "STATIC", "MODULE" ++ if( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" ) ++ set( _skip_store 1 ) ++ set( _type "${_arg}" ) ++ endif( "+${_arg}" STREQUAL "+SHARED" OR "+${_arg}" STREQUAL "+STATIC" OR "+${_arg}" STREQUAL "+MODULE" ) ++ ++ # found directive "STATIC_PIC" ++ if( "+${_arg}" STREQUAL "+STATIC_PIC" ) ++ set( _skip_store 1 ) ++ set( _type "STATIC" ) ++ set( _static_pic 1 ) ++ endif( "+${_arg}" STREQUAL "+STATIC_PIC" ) ++ ++ # found directive "AUTOMOC" ++ if( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ set( _skip_store 1 ) ++ set( _automoc 1 ) ++ endif( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ ++ # found directive "META_INCLUDES" ++ if( "+${_arg}" STREQUAL "+META_INCLUDES" ) ++ set( _skip_store 1 ) ++ set( _storage "_meta_includes" ) ++ endif( ) ++ ++ # found directive "NO_LIBTOOL_FILE" ++ if( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" ) ++ set( _skip_store 1 ) ++ set( _no_libtool_file 1 ) ++ endif( "+${_arg}" STREQUAL "+NO_LIBTOOL_FILE" ) ++ ++ # found directive "NO_EXPORT" ++ if( "+${_arg}" STREQUAL "+NO_EXPORT" ) ++ set( _skip_store 1 ) ++ set( _no_export 1 ) ++ endif( "+${_arg}" STREQUAL "+NO_EXPORT" ) ++ ++ # found directive "VERSION" ++ if( "+${_arg}" STREQUAL "+VERSION" ) ++ set( _skip_store 1 ) ++ set( _storage "_version" ) ++ endif( "+${_arg}" STREQUAL "+VERSION" ) ++ ++ # found directive "RELEASE" ++ if( "+${_arg}" STREQUAL "+RELEASE" ) ++ set( _skip_store 1 ) ++ set( _storage "_release" ) ++ endif( "+${_arg}" STREQUAL "+RELEASE" ) ++ ++ # found directive "SOURCES" ++ if( "+${_arg}" STREQUAL "+SOURCES" ) ++ set( _skip_store 1 ) ++ set( _storage "_sources" ) ++ endif( "+${_arg}" STREQUAL "+SOURCES" ) ++ ++ # found directive "CXX_FEATURES" ++ if( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ set( _skip_store 1 ) ++ set( _storage "_cxx_features" ) ++ endif( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ ++ # found directive "CXX_FEATURES_PRIVATE" ++ if( "+${_arg}" STREQUAL "+CXX_FEATURES_PRIVATE" ) ++ set( _skip_store 1 ) ++ set( _storage "_cxx_features_private" ) ++ endif( "+${_arg}" STREQUAL "+CXX_FEATURES_PRIVATE" ) ++ ++ # found directive "EMBED" ++ if( "+${_arg}" STREQUAL "+EMBED" ) ++ set( _skip_store 1 ) ++ set( _storage "_embed" ) ++ endif( "+${_arg}" STREQUAL "+EMBED" ) ++ ++ # found directive "LINK" ++ if( "+${_arg}" STREQUAL "+LINK" ) ++ set( _skip_store 1 ) ++ set( _storage "_link" ) ++ endif( "+${_arg}" STREQUAL "+LINK" ) ++ ++ # found directive "LINK_PRIVATE" ++ if( "+${_arg}" STREQUAL "+LINK_PRIVATE" ) ++ set( _skip_store 1 ) ++ set( _storage "_link_private" ) ++ endif( "+${_arg}" STREQUAL "+LINK_PRIVATE" ) ++ ++ # found directive "DEPENDENCIES" ++ if( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ set( _skip_store 1 ) ++ set( _storage "_dependencies" ) ++ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_destination" ) ++ unset( ${_storage} ) ++ endif( "+${_arg}" STREQUAL "+DESTINATION" ) ++ ++ # found directive "EXCLUDE_FROM_ALL" ++ if( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" ) ++ set( _skip_store 1 ) ++ set( _exclude_from_all "EXCLUDE_FROM_ALL" ) ++ endif( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" ) ++ ++ # metadata ++ if( "+${_arg}" STREQUAL "+DESCRIPTION" ) ++ set( _skip_store 1 ) ++ set( _storage "_description" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+LICENSE" ) ++ set( _skip_store 1 ) ++ set( _storage "_license" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+COPYRIGHT" ) ++ set( _skip_store 1 ) ++ set( _storage "_copyright" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+AUTHORS" ) ++ set( _skip_store 1 ) ++ set( _storage "_authors" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+PRODUCT" ) ++ set( _skip_store 1 ) ++ set( _storage "_product" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+ORGANIZATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_organization" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+VERSION" ) ++ set( _skip_store 1 ) ++ set( _storage "_version" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+DATETIME" ) ++ set( _skip_store 1 ) ++ set( _storage "_datetime" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+NOTES" ) ++ set( _skip_store 1 ) ++ set( _storage "_notes" ) ++ endif( ) ++ ++ # storing value ++ if( _storage AND NOT _skip_store ) ++ list( APPEND ${_storage} ${_arg} ) ++ list( REMOVE_DUPLICATES ${_storage} ) ++ endif( _storage AND NOT _skip_store ) ++ ++ endforeach( _arg ) ++ ++ # if no type is set, we choose one ++ # based on BUILD_SHARED_LIBS ++ if( NOT _type ) ++ if( BUILD_SHARED_LIBS ) ++ set( _type "SHARED" ) ++ else( BUILD_SHARED_LIBS ) ++ set( _type "STATIC" ) ++ endif( BUILD_SHARED_LIBS ) ++ endif( NOT _type ) ++ ++ # change target name, based on type ++ string( TOLOWER "${_type}" _type_lower ) ++ set( _target "${_arg_target}-${_type_lower}" ) ++ ++ # create variables like "LIB_xxx" for convenience ++ if( ${_type} STREQUAL "SHARED" ) ++ string( TOUPPER "${_arg_target}" _tmp ) ++ set( LIB_${_tmp} ${_target} CACHE INTERNAL LIB_${tmp} FORCE ) ++ endif( ${_type} STREQUAL "SHARED" ) ++ ++ # disallow target without sources ++ if( NOT _sources ) ++ message( FATAL_ERROR "\nTarget [$_target] have no sources." ) ++ endif( NOT _sources ) ++ ++ # processing different types of sources ++ __tde_internal_process_sources( _sources ${_sources} ) ++ ++ # set automoc ++ if( _automoc ) ++ tde_automoc( ${_sources} ) ++ endif( _automoc ) ++ ++ # add target ++ add_library( ${_target} ${_type} ${_exclude_from_all} ${_sources} ) ++ ++ # set cxx features ++ if( _cxx_features ) ++ target_compile_features( ${_target} PUBLIC ${_cxx_features} ) ++ endif( ) ++ if( TDE_CXX_FEATURES OR PROJECT_CXX_FEATURES OR _cxx_features_private ) ++ target_compile_features( ${_target} PRIVATE ++ ${TDE_CXX_FEATURES} ${PROJECT_CXX_FEATURES} ${_cxx_features_private} ) ++ endif( ) ++ ++ # we assume that modules have no prefix and no version ++ # also, should not link ++ if( ${_type} STREQUAL "MODULE" ) ++ set_target_properties( ${_target} PROPERTIES PREFIX "" ) ++ unset( _version ) ++ set( _shouldnotlink yes ) ++ endif( ${_type} STREQUAL "MODULE" ) ++ ++ # set real name of target ++ if( _release ) ++ # add release number to output name ++ set_target_properties( ${_target} PROPERTIES RELEASE ${_release} ) ++ set_target_properties( ${_target} PROPERTIES OUTPUT_NAME "${_arg_target}-${_release}" ) ++ else( _release ) ++ set_target_properties( ${_target} PROPERTIES OUTPUT_NAME ${_arg_target} ) ++ endif( _release ) ++ ++ # set -fPIC flag for static libraries ++ if( _static_pic ) ++ set_target_properties( ${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON ) ++ endif( _static_pic ) ++ ++ # set version ++ if( _version ) ++ if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" ) ++ # OpenBSD: _soversion and _version both contains only major and minor ++ string( REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" _dummy "${_version}" ) ++ set( _version "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) ++ set( _soversion "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) ++ else( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" ) ++ # General (Linux) case: _soversion contains only the major number of version ++ string( REGEX MATCH "^[0-9]+" _soversion ${_version} ) ++ endif( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" ) ++ set_target_properties( ${_target} PROPERTIES VERSION ${_version} SOVERSION ${_soversion} ) ++ endif( _version ) ++ ++ # set interface libraries (only for shared) ++ unset( _shared_libs ) ++ if( NOT ${_type} STREQUAL "STATIC" ) ++ foreach( _lib ${_link} ) ++ #get_target_property( _lib_type ${_lib} TYPE ) ++ #if( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) ++ if( NOT ${_lib} MATCHES ".+-static" ) ++ list( APPEND _shared_libs ${_lib} ) ++ endif( NOT ${_lib} MATCHES ".+-static" ) ++ #endif( NOT "STATIC_LIBRARY" STREQUAL "${_lib_type}" ) ++ endforeach( _lib ) ++ endif( NOT ${_type} STREQUAL "STATIC" ) ++ ++ # set embedded archives ++ if( _embed ) ++ if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) ++ list( INSERT _link_private 0 -Wl,-zallextract ${_embed} -Wl,-zdefaultextract ) ++ else( ) ++ list( INSERT _link_private 0 -Wl,-whole-archive ${_embed} -Wl,-no-whole-archive ) ++ endif( ) ++ endif( _embed ) ++ ++ # set private linked libraries ++ if( _link_private ) ++ if( _link ) ++ list( INSERT _link 0 "PUBLIC" ) ++ endif() ++ list( INSERT _link_private 0 "PRIVATE" ) ++ list( INSERT _link 0 ${_link_private} ) ++ endif( _link_private ) ++ ++ # set link libraries ++ if( _link ) ++ target_link_libraries( ${_target} ${_link} ) ++ endif( ) ++ if( _shared_libs ) ++ string( TOUPPER "${CMAKE_BUILD_TYPE}" _build_type ) ++ set_target_properties( ${_target} PROPERTIES ++ LINK_INTERFACE_LIBRARIES "${_shared_libs}" ++ LINK_INTERFACE_LIBRARIES_${_build_type} "${_shared_libs}" ++ INTERFACE_LINK_LIBRARIES "${_shared_libs}" ++ INTERFACE_LINK_LIBRARIES_${_build_type} "${_shared_libs}" ) ++ endif( _shared_libs ) ++ ++ # set dependencies ++ if( _dependencies ) ++ add_dependencies( ${_target} ${_dependencies} ) ++ endif( _dependencies ) ++ ++ # if destination directory is set ++ if( _destination ) ++ ++ # we export only shared libs (no static, no modules); ++ # also, do not export targets marked as "NO_EXPORT" (usually for tdeinit) ++ if( "SHARED" STREQUAL ${_type} AND NOT _no_export ) ++ ++ # get target properties: output name, version, soversion ++ tde_get_library_filename( _output ${_target} ) ++ get_target_property( _version ${_target} VERSION ) ++ get_target_property( _soversion ${_target} SOVERSION ) ++ ++ if( _version ) ++ set( _location "${_destination}/${_output}.${_version}" ) ++ set( _soname "${_output}.${_soversion}" ) ++ else( ) ++ set( _location "${_destination}/${_output}" ) ++ set( _soname "${_output}" ) ++ unset( _version ) ++ endif( ) ++ ++ configure_file( ${TDE_CMAKE_TEMPLATES}/tde_export_library.cmake "${PROJECT_BINARY_DIR}/export-${_target}.cmake" @ONLY ) ++ endif( ) ++ ++ # install target ++ install( TARGETS ${_target} DESTINATION ${_destination} ) ++ ++ # install base soname ++ if( _release AND NOT "STATIC" STREQUAL ${_type} ) ++ tde_get_library_filename( _soname ${_target} ) ++ string( REPLACE "-${_release}" "" _soname_base "${_soname}" ) ++ if( _version ) ++ get_target_property( _soversion ${_target} SOVERSION ) ++ set( _soname "${_soname}.${_soversion}" ) ++ endif( ) ++ if( NOT _exclude_from_all ) ++ add_custom_command( ++ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" ++ COMMAND ln -s ${_soname} "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" ++ DEPENDS ${_target} ++ ) ++ add_custom_target( ++ ${_target}+base-so ALL ++ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" ++ ) ++ else( ) ++ add_custom_command( ++ TARGET ${_target} POST_BUILD ++ COMMAND ln -s ${_soname} "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" ++ ) ++ endif( ) ++ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${_soname_base}" DESTINATION ${_destination} ) ++ endif( ) ++ ++ # install .la files for dynamic libraries ++ if( NOT "STATIC" STREQUAL ${_type} AND NOT _no_libtool_file ) ++ tde_install_libtool_file( ${_target} ${_destination} ) ++ endif( ) ++ ++ endif( _destination ) ++ ++ # embed name and metadata ++ set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"x-sharedlib\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" ) ++ separate_arguments( ELF_EMBEDDING_METADATA ) ++ if( TDELFEDITOR_EXECUTABLE AND _soname ) ++ if( _version ) ++ get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname}.${_version} ABSOLUTE ) ++ else( ) ++ get_filename_component( _target_lib ${CMAKE_CURRENT_BINARY_DIR}/${_soname} ABSOLUTE ) ++ endif( ) ++ file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_lib}" ) ++ ++ if( TARGET ${TDELFEDITOR_EXECUTABLE} AND NOT _exclude_from_all ) ++ # create target for all metadata writes ++ if( NOT TARGET tdelfeditor-write ) ++ add_custom_target( tdelfeditor-write ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ++ DEPENDS ${TDELFEDITOR_EXECUTABLE} ++ COMMENT "Write metadata to binaries..." ++ ) ++ endif( ) ++ add_custom_target( ++ ${_target}+metadata ALL ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true ++ COMMENT "Storing SCM metadata in ${_target_path}" ++ DEPENDS tdelfeditor-write ++ ) ++ add_dependencies( tdelfeditor-write ${_target} ) ++ else( ) ++ add_custom_command( ++ TARGET ${_target} ++ POST_BUILD ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${_target_lib} ${ELF_EMBEDDING_METADATA} || true ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${_target_lib} || true ++ COMMENT "Storing SCM metadata in ${_target_path}" ++ ) ++ if( TARGET ${TDELFEDITOR_EXECUTABLE} ) ++ add_dependencies( ${_target} ${TDELFEDITOR_EXECUTABLE} ) ++ endif() ++ endif( ) ++ endif( TDELFEDITOR_EXECUTABLE AND _soname ) ++ ++endmacro( tde_add_library ) ++ ++ ++################################################# ++##### ++##### tde_add_kpart ++ ++macro( tde_add_kpart _target ) ++ tde_add_library( ${_target} ${ARGN} MODULE ) ++endmacro( tde_add_kpart ) ++ ++ ++################################################# ++##### ++##### tde_curdatetime ++ ++macro( tde_curdatetime result ) ++ if( TDE_PKG_DATETIME ) ++ set( ${result} ${TDE_PKG_DATETIME} ) ++ elseif( TDE_SCM_MODULE_DATETIME ) ++ set( ${result} ${TDE_SCM_MODULE_DATETIME} ) ++ else( ) ++ tde_execute_process( COMMAND "date" "-u" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} ) ++ string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} ) ++ endif( ) ++endmacro( tde_curdatetime ) ++ ++ ++################################################# ++##### ++##### tde_add_executable ++ ++macro( tde_add_executable _arg_target ) ++ ++ unset( _target ) ++ unset( _automoc ) ++ unset( _meta_includes ) ++ unset( _setuid ) ++ unset( _sources ) ++ unset( _cxx_features ) ++ unset( _destination ) ++ unset( _link ) ++ unset( _dependencies ) ++ unset( _storage ) ++ ++ # metadata ++ unset( _description ) ++ unset( _license ) ++ unset( _copyright ) ++ unset( _authors ) ++ unset( _product ) ++ unset( _organization ) ++ unset( _version ) ++ unset( _datetime ) ++ unset( _notes ) ++ ++ # default metadata ++ set( _product "Trinity Desktop Environment" ) ++ set( _version "${TDE_VERSION}" ) ++ if( TDE_PKG_VERSION ) ++ set( _version "${_version} (${TDE_PKG_VERSION})" ) ++ endif( ) ++ tde_curdatetime( _datetime ) ++ ++ foreach( _arg ${ARGV} ) ++ ++ # this variable help us to skip ++ # storing unapropriate values (i.e. directives) ++ unset( _skip_store ) ++ ++ # found directive "AUTOMOC" ++ if( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ set( _skip_store 1 ) ++ set( _automoc 1 ) ++ endif( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ ++ # found directive "META_INCLUDES" ++ if( "+${_arg}" STREQUAL "+META_INCLUDES" ) ++ set( _skip_store 1 ) ++ set( _storage "_meta_includes" ) ++ endif( ) ++ ++ # found directive "SETUID" ++ if( "+${_arg}" STREQUAL "+SETUID" ) ++ set( _skip_store 1 ) ++ set( _setuid 1 ) ++ endif( "+${_arg}" STREQUAL "+SETUID" ) ++ ++ # found directive "SOURCES" ++ if( "+${_arg}" STREQUAL "+SOURCES" ) ++ set( _skip_store 1 ) ++ set( _storage "_sources" ) ++ endif( "+${_arg}" STREQUAL "+SOURCES" ) ++ ++ # found directive "CXX_FEATURES" ++ if( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ set( _skip_store 1 ) ++ set( _storage "_cxx_features" ) ++ endif( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ ++ # found directive "LINK" ++ if( "+${_arg}" STREQUAL "+LINK" ) ++ set( _skip_store 1 ) ++ set( _storage "_link" ) ++ endif( "+${_arg}" STREQUAL "+LINK" ) ++ ++ # found directive "DEPENDENCIES" ++ if( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ set( _skip_store 1 ) ++ set( _storage "_dependencies" ) ++ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_destination" ) ++ unset( ${_storage} ) ++ endif( "+${_arg}" STREQUAL "+DESTINATION" ) ++ ++ # metadata ++ if( "+${_arg}" STREQUAL "+DESCRIPTION" ) ++ set( _skip_store 1 ) ++ set( _storage "_description" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+LICENSE" ) ++ set( _skip_store 1 ) ++ set( _storage "_license" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+COPYRIGHT" ) ++ set( _skip_store 1 ) ++ set( _storage "_copyright" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+AUTHORS" ) ++ set( _skip_store 1 ) ++ set( _storage "_authors" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+PRODUCT" ) ++ set( _skip_store 1 ) ++ set( _storage "_product" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+ORGANIZATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_organization" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+VERSION" ) ++ set( _skip_store 1 ) ++ set( _storage "_version" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+DATETIME" ) ++ set( _skip_store 1 ) ++ set( _storage "_datetime" ) ++ endif( ) ++ if( "+${_arg}" STREQUAL "+NOTES" ) ++ set( _skip_store 1 ) ++ set( _storage "_notes" ) ++ endif( ) ++ ++ # storing value ++ if( _storage AND NOT _skip_store ) ++ #set( ${_storage} "${${_storage}} ${_arg}" ) ++ list( APPEND ${_storage} ${_arg} ) ++ endif( _storage AND NOT _skip_store ) ++ ++ endforeach( _arg ) ++ ++ set( _target "${_arg_target}" ) ++ ++ # disallow target without sources ++ if( NOT _sources ) ++ message( FATAL_ERROR "\nTarget [$_target] have no sources." ) ++ endif( NOT _sources ) ++ ++ # processing different types of sources ++ __tde_internal_process_sources( _sources ${_sources} ) ++ ++ # set automoc ++ if( _automoc ) ++ tde_automoc( ${_sources} ) ++ endif( _automoc ) ++ ++ # add target ++ add_executable( ${_target} ${_sources} ) ++ ++ # set cxx features ++ if( TDE_CXX_FEATURES OR PROJECT_CXX_FEATURES OR _cxx_features ) ++ target_compile_features( ${_target} PRIVATE ++ ${TDE_CXX_FEATURES} ${PROJECT_CXX_FEATURES} ${_cxx_features} ) ++ endif( ) ++ ++ # set link libraries ++ if( _link ) ++ target_link_libraries( ${_target} ${_link} ) ++ endif( _link ) ++ ++ # set dependencies ++ if( _dependencies ) ++ add_dependencies( ${_target} ${_dependencies} ) ++ endif( _dependencies ) ++ ++ # set PIE flags for setuid binaries ++ if( _setuid ) ++ set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS "${TDE_PIE_CFLAGS}" ) ++ set_target_properties( ${_target} PROPERTIES LINK_FLAGS "${TDE_PIE_LDFLAGS}" ) ++ endif( _setuid ) ++ ++ # set destination directory ++ if( _destination ) ++ if( _setuid ) ++ install( TARGETS ${_target} DESTINATION ${_destination} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE SETUID ) ++ else( _setuid ) ++ install( TARGETS ${_target} DESTINATION ${_destination} ) ++ endif( _setuid ) ++ endif( _destination ) ++ ++ # embed icon, name, and metadata ++ set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_target}\" \"${TDE_SCM_MODULE_NAME}\" \"${TDE_SCM_MODULE_REVISION}\" \"${_notes}\"" ) ++ separate_arguments( ELF_EMBEDDING_METADATA ) ++ if( TDELFEDITOR_EXECUTABLE ) ++ get_filename_component( _target_path ${CMAKE_CURRENT_BINARY_DIR}/${_target} ABSOLUTE ) ++ file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" ) ++ if( TARGET ${TDELFEDITOR_EXECUTABLE} ) ++ # create target for all metadata writes ++ if( NOT TARGET tdelfeditor-write ) ++ add_custom_target( tdelfeditor-write ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ++ DEPENDS ${TDELFEDITOR_EXECUTABLE} ++ COMMENT "Write metadata to binaries..." ++ ) ++ endif( ) ++ add_custom_target( ++ ${_target}+metadata ALL ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true ++ COMMENT "Storing SCM metadata in ${_target_path}" ++ DEPENDS tdelfeditor-write ++ ) ++ add_dependencies( tdelfeditor-write ${_target} ) ++ else() ++ add_custom_command( ++ TARGET ${_target} ++ POST_BUILD ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true ++ COMMAND ${TDELFEDITOR_EXECUTABLE} -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true ++ COMMENT "Storing SCM metadata in ${_target_path}" ++ ) ++ endif() ++ endif( TDELFEDITOR_EXECUTABLE ) ++ ++endmacro( tde_add_executable ) ++ ++ ++################################################# ++##### ++##### tde_add_check_executable ++ ++macro( tde_add_check_executable _arg_target ) ++ ++ unset( _target ) ++ unset( _automoc ) ++ unset( _test ) ++ unset( _test_args ) ++ unset( _meta_includes ) ++ unset( _sources ) ++ unset( _cxx_features ) ++ unset( _destination ) ++ unset( _link ) ++ unset( _dependencies ) ++ unset( _storage ) ++ ++ foreach( _arg ${ARGV} ) ++ ++ # this variable help us to skip ++ # storing unapropriate values (i.e. directives) ++ unset( _skip_store ) ++ ++ # found directive "AUTOMOC" ++ if( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ set( _skip_store 1 ) ++ set( _automoc 1 ) ++ endif( "+${_arg}" STREQUAL "+AUTOMOC" ) ++ ++ # found directive "TEST" ++ if( "+${_arg}" STREQUAL "+TEST" ) ++ set( _skip_store 1 ) ++ set( _test 1 ) ++ set( _storage "_test_args" ) ++ endif( "+${_arg}" STREQUAL "+TEST" ) ++ ++ # found directive "META_INCLUDES" ++ if( "+${_arg}" STREQUAL "+META_INCLUDES" ) ++ set( _skip_store 1 ) ++ set( _storage "_meta_includes" ) ++ endif( ) ++ ++ # found directive "SOURCES" ++ if( "+${_arg}" STREQUAL "+SOURCES" ) ++ set( _skip_store 1 ) ++ set( _storage "_sources" ) ++ endif( "+${_arg}" STREQUAL "+SOURCES" ) ++ ++ # found directive "CXX_FEATURES" ++ if( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ set( _skip_store 1 ) ++ set( _storage "_cxx_features" ) ++ endif( "+${_arg}" STREQUAL "+CXX_FEATURES" ) ++ ++ # found directive "LINK" ++ if( "+${_arg}" STREQUAL "+LINK" ) ++ set( _skip_store 1 ) ++ set( _storage "_link" ) ++ endif( "+${_arg}" STREQUAL "+LINK" ) ++ ++ # found directive "DEPENDENCIES" ++ if( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ set( _skip_store 1 ) ++ set( _storage "_dependencies" ) ++ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" ) ++ ++ # storing value ++ if( _storage AND NOT _skip_store ) ++ #set( ${_storage} "${${_storage}} ${_arg}" ) ++ list( APPEND ${_storage} ${_arg} ) ++ endif( _storage AND NOT _skip_store ) ++ ++ endforeach( _arg ) ++ ++ set( _target "${_arg_target}" ) ++ ++ # try to autodetect sources ++ if( NOT _sources ) ++ file( GLOB _sources "${_target}.cpp" "${_target}.cxx" "${_target}.c" ) ++ if( NOT _sources ) ++ message( FATAL_ERROR "\nNo sources found for test executable \"${_target}\"." ) ++ endif( ) ++ endif( NOT _sources ) ++ ++ # processing different types of sources ++ __tde_internal_process_sources( _sources ${_sources} ) ++ ++ # set automoc ++ if( _automoc ) ++ tde_automoc( ${_sources} ) ++ endif( _automoc ) ++ ++ # add target ++ add_executable( ${_target} EXCLUDE_FROM_ALL ${_sources} ) ++ ++ # set cxx features ++ if( TDE_CXX_FEATURES OR PROJECT_CXX_FEATURES OR _cxx_features ) ++ target_compile_features( ${_target} PRIVATE ++ ${TDE_CXX_FEATURES} ${PROJECT_CXX_FEATURES} ${_cxx_features} ) ++ endif( ) ++ ++ # set link libraries ++ if( _link ) ++ target_link_libraries( ${_target} ${_link} ) ++ endif( _link ) ++ ++ # set dependencies ++ if( _dependencies ) ++ add_dependencies( ${_target} ${_dependencies} ) ++ endif( _dependencies ) ++ ++ # create make check target ++ if(NOT TARGET check) ++ add_custom_target( check ++ COMMAND ${CMAKE_CTEST_COMMAND} ++ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ++ COMMENT "Running tests..." ) ++ endif(NOT TARGET check) ++ ++ add_dependencies( check ${_target} ) ++ ++ # add test target ++ if( _test ) ++ # get relative path to current directory and strip end tests dir ++ file( RELATIVE_PATH _test_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) ++ string( REGEX REPLACE "(^\\.+/?|(^|/)tests?$|/$)" "" _test_prefix "${_test_prefix}" ) ++ if( _test_prefix ) ++ set( _test_prefix "${_test_prefix}/" ) ++ endif( _test_prefix ) ++ add_test( NAME "${_test_prefix}${_target}" COMMAND "${_target}" ${_test_args} ) ++ endif( _test ) ++ ++endmacro( tde_add_check_executable ) ++ ++ ++################################################# ++##### ++##### tde_add_tdeinit_executable ++ ++macro( tde_add_tdeinit_executable _target ) ++ ++ configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_executable.cmake ${_target}_tdeinit_executable.cpp COPYONLY ) ++ configure_file( ${TDE_CMAKE_TEMPLATES}/tde_tdeinit_module.cmake ${_target}_tdeinit_module.cpp COPYONLY ) ++ ++ unset( _sources ) ++ unset( _runtime_destination ) ++ unset( _library_destination ) ++ unset( _plugin_destination ) ++ ++ # default storage is _sources ++ set( _storage _sources ) ++ ++ # set default export to NO_EXPORT ++ set( _export "NO_EXPORT" ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # this variable help us to skip ++ # storing unapropriate values (i.e. directives) ++ unset( _skip_store ) ++ ++ # found directive "EXPORT" ++ if( "+${_arg}" STREQUAL "+EXPORT" ) ++ set( _skip_store 1 ) ++ unset( _export ) ++ endif( "+${_arg}" STREQUAL "+EXPORT" ) ++ ++ # found directive "RUNTIME_DESTINATION" ++ if( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_runtime_destination" ) ++ unset( ${_storage} ) ++ endif( "+${_arg}" STREQUAL "+RUNTIME_DESTINATION" ) ++ ++ # found directive "LIBRARY_DESTINATION" ++ if( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_library_destination" ) ++ unset( ${_storage} ) ++ endif( "+${_arg}" STREQUAL "+LIBRARY_DESTINATION" ) ++ ++ # found directive "PLUGIN_DESTINATION" ++ if( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" ) ++ set( _skip_store 1 ) ++ set( _storage "_plugin_destination" ) ++ unset( ${_storage} ) ++ endif( "+${_arg}" STREQUAL "+PLUGIN_DESTINATION" ) ++ ++ # storing value ++ if( _storage AND NOT _skip_store ) ++ list( APPEND ${_storage} ${_arg} ) ++ set( _storage "_sources" ) ++ endif( _storage AND NOT _skip_store ) ++ ++ endforeach( _arg ) ++ ++ # if destinations are not set, we using some defaults ++ # we assume that tdeinit executable MUST be installed ++ # (otherwise why we build it?) ++ if( NOT _runtime_destination ) ++ set( _runtime_destination ${BIN_INSTALL_DIR} ) ++ endif( NOT _runtime_destination ) ++ if( NOT _library_destination ) ++ set( _library_destination ${LIB_INSTALL_DIR} ) ++ endif( NOT _library_destination ) ++ if( NOT _plugin_destination ) ++ set( _plugin_destination ${PLUGIN_INSTALL_DIR} ) ++ endif( NOT _plugin_destination ) ++ ++ # create the library ++ tde_add_library( tdeinit_${_target} ${_sources} SHARED ${_export} ++ DESTINATION ${_library_destination} ++ ) ++ ++ # create the executable ++ tde_add_executable( ${_target} ++ SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_executable.cpp ++ LINK tdeinit_${_target}-shared ++ DESTINATION ${_runtime_destination} ++ ) ++ ++ # create the plugin ++ tde_add_kpart( ${_target} ++ SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${_target}_tdeinit_module.cpp ++ LINK tdeinit_${_target}-shared ++ DESTINATION ${_plugin_destination} ++ ) ++ ++endmacro( tde_add_tdeinit_executable ) ++ ++ ++################################################# ++##### ++##### tde_conditional_add_project_translations ++##### tde_add_project_translations ++##### ++##### Macro for standard processing and installation of translations. ++##### This is designed for ordinary modules - as an applications, not for core modules. ++ ++function( tde_conditional_add_project_translations _cond ) ++ ++ if( ${_cond} ) ++ tde_add_project_translations() ++ endif() ++ ++endfunction() ++ ++function( tde_add_project_translations ) ++ ++ if( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} ) ++ set( TRANSLATIONS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/translations/messages ) ++ else() ++ set( TRANSLATIONS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) ++ endif() ++ ++ file( GLOB_RECURSE po_files RELATIVE ${TRANSLATIONS_SOURCE_DIR} ${TRANSLATIONS_SOURCE_DIR}/*.po ) ++ string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) ++ ++ foreach( _po ${po_files} ) ++ get_filename_component( _lang ${_po} NAME_WE ) ++ if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" ) ++ if( "${_po}" MATCHES "^([^/]*)/.*" ) ++ string( REGEX REPLACE "^([^/]*)/.*" "\\1" _component "${_po}" ) ++ else( ) ++ set( _component "${PROJECT_NAME}" ) ++ endif( ) ++ tde_create_translation( FILES ${TRANSLATIONS_SOURCE_DIR}/${_po} LANG ${_lang} OUTPUT_NAME ${_component} ) ++ endif( ) ++ endforeach( ) ++ ++endfunction() ++ ++ ++################################################# ++##### ++##### tde_create_translation ++ ++macro( tde_create_translation ) ++ ++ unset( _srcs ) ++ unset( _lang ) ++ unset( _dest ) ++ unset( _out_name ) ++ unset( _directive ) ++ unset( _var ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "FILES" ++ if( "+${_arg}" STREQUAL "+FILES" ) ++ unset( _srcs ) ++ set( _var _srcs ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "LANG" ++ if( "+${_arg}" STREQUAL "+LANG" ) ++ unset( _lang ) ++ set( _var _lang ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ unset( _dest ) ++ set( _var _dest ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "OUTPUT_NAME" ++ if( "+${_arg}" STREQUAL "+OUTPUT_NAME" ) ++ unset( _out_name ) ++ set( _var _out_name ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif() ++ ++ endforeach( ) ++ ++ if( NOT MSGFMT_EXECUTABLE ) ++ tde_setup_msgfmt( ) ++ endif( ) ++ if( NOT _lang ) ++ tde_message_fatal( "missing LANG directive" ) ++ endif( ) ++ ++ # if no file specified, include all *.po files ++ if( NOT _srcs ) ++ file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) ++ endif( ) ++ if( NOT _srcs ) ++ tde_message_fatal( "no source files" ) ++ endif( ) ++ ++ if( NOT _lang STREQUAL "auto") ++ set( _real_lang ${_lang} ) ++ ++ if( NOT _dest ) ++ set( _dest "${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES" ) ++ endif( ) ++ ++ # OUTPUT_NAME can only be used if we have only one file ++ list( LENGTH _srcs _srcs_num) ++ if( _out_name AND _srcs_num GREATER 1 ) ++ tde_message_fatal( "OUTPUT_NAME can be supplied only with single file or LANG=auto" ) ++ endif( ) ++ ++ elseif( NOT _out_name ) ++ tde_message_fatal( "LANG=auto reqires OUTPUT_NAME directive to be set" ) ++ elseif( _dest ) ++ tde_message_fatal( "DESTINATION cannot be used with LANG=auto" ) ++ endif( ) ++ ++ # generate *.mo files ++ foreach( _src ${_srcs} ) ++ ++ get_filename_component( _src ${_src} ABSOLUTE ) ++ ++ if( _out_name ) ++ set( _out ${_out_name} ) ++ if( _lang STREQUAL "auto" ) ++ get_filename_component( _real_lang ${_src} NAME_WE ) ++ set( _dest "${LOCALE_INSTALL_DIR}/${_real_lang}/LC_MESSAGES" ) ++ endif( ) ++ else( ) ++ get_filename_component( _out ${_src} NAME_WE ) ++ endif( ) ++ ++ string( REPLACE "@" "_" _target ${_real_lang} ) ++ set( _out_filename "${_out}-${_real_lang}.mo" ) ++ set( _install_filename "${_out}.mo" ) ++ ++ add_custom_command( ++ OUTPUT ${_out_filename} ++ COMMAND ${MSGFMT_EXECUTABLE} ${_src} -o ${_out_filename} ++ DEPENDS ${_src} ) ++ add_custom_target( "${_out}-${_target}-translation" ALL DEPENDS ${_out_filename} ) ++ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_filename} RENAME ${_install_filename} DESTINATION ${_dest} ) ++ ++ endforeach( ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_create_translated_desktop ++##### ++##### Macro is used to merge translations into desktop file ++##### ++##### Syntax: ++##### tde_create_translated_desktop( ++##### [SOURCE] file_name ++##### [KEYWORDS keyword [keyword]] ++##### [FORMAT (desktop|xml)] ++##### [PO_DIR po_directory] ++##### [DESTINATION directory] ++##### [OUTPUT_NAME file_name] ++##### ) ++ ++macro( tde_create_translated_desktop ) ++ ++ unset( _srcs ) ++ unset( _arg_out_name ) ++ unset( _arg_po_dir ) ++ unset( _keywords_add ) ++ unset( _dest ) ++ unset( _directive ) ++ set( _var _srcs ) ++ set( _keywords_desktop_default ++ "Name" "GenericName" "Comment" "Keywords" ++ "Description" "ExtraNames" "X-TDE-Submenu" ) ++ set( _format "desktop" ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "SOURCE" ++ if( "+${_arg}" STREQUAL "+SOURCE" ) ++ unset( _srcs ) ++ set( _var _srcs ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "KEYWORDS" ++ if( "+${_arg}" STREQUAL "+KEYWORDS" ) ++ unset( _keywords_add ) ++ set( _var _keywords_add ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "FORMAT" ++ if( "+${_arg}" STREQUAL "+FORMAT" ) ++ unset( _format ) ++ set( _var _format ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "PO_DIR" ++ if( "+${_arg}" STREQUAL "+PO_DIR" ) ++ unset( _arg_po_dir ) ++ set( _var _arg_po_dir ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ unset( _dest ) ++ set( _var _dest ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "OUTPUT_NAME" ++ if( "+${_arg}" STREQUAL "+OUTPUT_NAME" ) ++ unset( _arg_out_name ) ++ set( _var _arg_out_name ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif() ++ ++ endforeach( ) ++ ++ # no source file specified! ++ if( NOT _srcs ) ++ tde_message_fatal( "no source desktop file specified" ) ++ endif( ) ++ ++ # OUTPUT_NAME can only be used if we have only one file ++ list( LENGTH _srcs _srcs_num ) ++ if( _arg_out_name AND _srcs_num GREATER 1 ) ++ tde_message_fatal( "OUTPUT_NAME can be supplied only with single file" ) ++ endif( ) ++ ++ # if no destination directory specified, install as application link ++ if( NOT _dest ) ++ set( _dest ${XDG_APPS_INSTALL_DIR} ) ++ endif( ) ++ ++ # select a tool for merging desktop file translations ++ # ++ # Because some of our desktop files contain underscores in variable ++ # names (for example eventsrc), which is not an allowed character ++ # for names of entries in desktop style files, we can't use msgfmt, ++ # so we need intltool-merge. ++ # ++ #if( NOT MSGFMT_EXECUTABLE OR NOT MSGFMT_VERSION ) ++ # tde_setup_msgfmt( ) ++ #endif( ) ++ #if( "${MSGFMT_VERSION}" VERSION_LESS "0.19" ) ++ if( 1 ) ++ if( NOT PERL_EXECUTABLE ) ++ include( FindPerl ) ++ endif( ) ++ if( NOT INTLTOOL_MERGE_EXECUTABLE ) ++ find_file( INTLTOOL_MERGE_EXECUTABLE ++ NAMES tde_l10n_merge.pl ++ HINTS ${TDE_CMAKE_MODULES} ++ ) ++ if( "${INTLTOOL_MERGE_EXECUTABLE}" STREQUAL "INTLTOOL_MERGE_EXECUTABLE-NOTFOUND" ) ++ #tde_message_fatal( "xgettext >= 0.19 or tde_l10n_merge.pl is required but not found" ) ++ tde_message_fatal( "tde_l10n_merge.pl is required but not found" ) ++ endif( ) ++ message( STATUS "Found intltool: ${INTLTOOL_MERGE_EXECUTABLE}" ) ++ endif( ) ++ set( DESKTOP_MERGE_INTLTOOL 1 ) ++ else( ) ++ set( DESKTOP_MERGE_MSGFMT 1 ) ++ endif( ) ++ ++ # pick keywords ++ unset( _keywords_desktop ) ++ foreach( _keyword ${_keywords_desktop_default} ${_keywords_add} ) ++ if( "${_keyword}" STREQUAL "-" ) ++ unset( _keywords_desktop ) ++ unset( _keyword ) ++ endif( ) ++ if( _keyword ) ++ list( APPEND _keywords_desktop "${_keyword}" ) ++ endif( ) ++ endforeach( ) ++ ++ # prepare the length of the binary path prefix ++ string( LENGTH "${CMAKE_BINARY_DIR}" CMAKE_BINARY_DIR_LEN ) ++ ++ # process source files ++ foreach( _src IN LISTS _srcs ) ++ ++ # get a base name and a directory ++ get_filename_component( _basename ${_src} ABSOLUTE ) ++ get_filename_component( _basedir ${_basename} PATH ) ++ file( RELATIVE_PATH _sourcename "${CMAKE_SOURCE_DIR}" "${_basename}" ) ++ string( LENGTH "${_basename}" _basename_len ) ++ if( ${_basename_len} LESS ${CMAKE_BINARY_DIR_LEN} ) ++ set( _basedir_prefix "${CMAKE_SOURCE_DIR}" ) ++ else( ) ++ string( SUBSTRING "${_basename}" 0 ${CMAKE_BINARY_DIR_LEN} _basedir_prefix ) ++ endif( ) ++ if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" ) ++ file( RELATIVE_PATH _basename "${CMAKE_CURRENT_BINARY_DIR}" "${_basename}" ) ++ set( _binsuffix ".out" ) ++ else( ) ++ file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" ) ++ set( _binsuffix "" ) ++ endif( ) ++ ++ # prepare the binary directory according to source directory ++ if( ${_basedir_prefix} STREQUAL "${CMAKE_BINARY_DIR}" ) ++ file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}" "${_basedir}" ) ++ else( ) ++ file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_basedir}" ) ++ endif( ) ++ set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" ) ++ file( MAKE_DIRECTORY "${_binary_basedir}" ) ++ ++ # process source file as a configuration file if necessary ++ if( "+${_src}" MATCHES "\\.cmake$" ) ++ configure_file( ${_src} ${_basename} @ONLY ) ++ set( _src "${CMAKE_CURRENT_BINARY_DIR}/${_basename}" ) ++ string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" ) ++ endif() ++ ++ # determine output name ++ if( _arg_out_name ) ++ set( _out_name ${_arg_out_name} ) ++ else() ++ get_filename_component( _out_name ${_basename} NAME ) ++ endif( ) ++ ++ # determine po directory ++ if( _arg_po_dir ) ++ set( _po_base ${_arg_po_dir} ) ++ else() ++ get_filename_component( _po_base ${_basename} NAME ) ++ endif() ++ if( IS_ABSOLUTE ${_po_base} ) ++ set( _po_dir ${_po_base} ) ++ else() ++ if( EXISTS ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} AND ++ IS_DIRECTORY ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} ) ++ set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files/${_po_base} ) ++ ++ elseif( EXISTS ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} AND ++ IS_DIRECTORY ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} ) ++ set( _po_dir ${CMAKE_SOURCE_DIR}/po/desktop_files/${_po_base} ) ++ ++ else() ++ set( _po_dir ${CMAKE_SOURCE_DIR}/translations/desktop_files ) ++ endif( ) ++ endif( ) ++ ++ # if the translated desktop file is not installed, generate to the specified output name ++ if( "${_dest}" STREQUAL "-" ) ++ set( _basename "${_out_name}" ) ++ set( _binsuffix "" ) ++ get_filename_component( _out_dir "${CMAKE_CURRENT_BINARY_DIR}/${_out_name}" PATH ) ++ file( MAKE_DIRECTORY "${_out_dir}" ) ++ endif( ) ++ ++ # are there any translations available? ++ unset( _translations ) ++ if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" ) ++ file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" ) ++ endif( ) ++ ++ # prepare a full name for the target ++ get_filename_component( _target ${_basename} ABSOLUTE ) ++ file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}-translated" ) ++ string( REPLACE "/" "+" _target "${_target}" ) ++ string( REPLACE "@" "_" _target "${_target}" ) ++ string( REPLACE " " "_" _target "${_target}" ) ++ ++ if( NOT TARGET ${_target} ) ++ ++ # use absolute path for src ++ get_filename_component( _src ${_src} ABSOLUTE ) ++ ++ if( _translations ) ++ ++ if( DESKTOP_MERGE_MSGFMT ) ++ ++ # Decide which translations to build; the ones selected in the ++ # LINGUAS environment variable, or all that are available. ++ if( DEFINED ENV{LINGUAS} ) ++ set( _linguas "$ENV{LINGUAS}" ) ++ else( ) ++ string( REPLACE ".po;" " " _linguas "${_translations};" ) ++ endif( ) ++ ++ # prepare keywords for msgfmt ++ set( _keywords_arg "--keyword=" ) ++ foreach( _keyword ${_keywords_desktop} ) ++ list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" ) ++ endforeach( ) ++ ++ # merge translations command ++ add_custom_command( ++ OUTPUT ${_basename}${_binsuffix} ++ COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename}${_binsuffix} ${_keywords_arg} ++ DEPENDS ${_src} ++ COMMENT "Merging translations into ${_sourcename}" ++ ) ++ ++ else( ) ++ ++ # prepare keywords for intltool ++ string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" ) ++ ++ # merge translations command ++ if( _format STREQUAL "desktop" ) ++ add_custom_command( ++ OUTPUT ${_basename}${_binsuffix} ++ COMMAND ${PERL_EXECUTABLE} -p -e "'s/^${_keywords_match}[ ]*=[ ]*/_\\1=/'" < ${_src} > ${_basename}.in ++ COMMAND ${PERL_EXECUTABLE} ${INTLTOOL_MERGE_EXECUTABLE} -q -d ${_po_dir} ${_basename}.in ${_basename}${_binsuffix} ++ DEPENDS ${_src} ++ COMMENT "Merging translations into ${_sourcename}" ++ ) ++ elseif( _format STREQUAL "xml" ) ++ add_custom_command( ++ OUTPUT ${_basename}${_binsuffix} ++ COMMAND ${PERL_EXECUTABLE} -p -e "'s/(<\\/?)${_keywords_match}([ >])/\\1_\\2\\3/g'" < ${_src} > ${_basename}.in ++ COMMAND ${PERL_EXECUTABLE} ${INTLTOOL_MERGE_EXECUTABLE} -q -x ${_po_dir} ${_basename}.in ${_basename}${_binsuffix} ++ DEPENDS ${_src} ++ COMMENT "Merging translations into ${_sourcename}" ++ ) ++ else() ++ tde_message_fatal( "Unknown file format for merging translations." ) ++ endif() ++ ++ endif( ) ++ ++ ++ else( ) ++ ++ # just copy the original file without translations ++ add_custom_command( ++ OUTPUT ${_basename}${_binsuffix} ++ COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_basename}${_binsuffix} ++ DEPENDS ${_src} ++ COMMENT "Skiping translation and copying source file to ${_sourcename}" ++ ) ++ ++ endif( ) ++ ++ # merge translations target ++ add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_binsuffix} ) ++ ++ endif( ) ++ ++ # install traslated desktop file ++ if( NOT "${_dest}" STREQUAL "-" ) ++ install( ++ FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_binsuffix} ++ RENAME ${_out_name} ++ DESTINATION ${_dest} ++ ) ++ endif() ++ ++ endforeach() ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_conditional_add_project_docs ++##### tde_add_project_docs ++##### ++##### Macro for standard processing and installation of documentation and man pages. ++##### This is designed for ordinary modules - as an applications, not for core modules. ++ ++function( tde_conditional_add_project_docs _cond ) ++ ++ if( ${_cond} ) ++ tde_add_project_docs() ++ endif() ++ ++endfunction() ++ ++function( tde_add_project_docs ) ++ ++ if( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} ) ++ set( DOCS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/doc ) ++ else() ++ set( DOCS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) ++ endif() ++ ++ file( GLOB_RECURSE _doc_files RELATIVE ${DOCS_SOURCE_DIR} ${DOCS_SOURCE_DIR}/* ) ++ foreach( _doc_file IN LISTS _doc_files ) ++ get_filename_component( _dir ${_doc_file} PATH ) ++ list( APPEND _dirs ${_dir} ) ++ endforeach() ++ if( _dirs ) ++ list( SORT _dirs ) ++ list( REMOVE_DUPLICATES _dirs ) ++ endif() ++ ++ string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) ++ ++ unset( _skip_subdir ) ++ foreach( _dir IN LISTS _dirs ) ++ string( REGEX REPLACE "/.*" "" _lang ${_dir} ) ++ if( NOT ${_lang} MATCHES "^(html|man|misc|other)$" ++ AND ( NOT DEFINED _skip_subdir OR ++ NOT ${_dir} MATCHES "^${_skip_subdir}/" ) ++ AND ( ${_lang} STREQUAL "en" OR ++ "${_linguas}" MATCHES "^;*$" OR ++ ";${_linguas};" MATCHES ";${_lang};" )) ++ if( EXISTS ${DOCS_SOURCE_DIR}/${_dir}/CMakeLists.txt ) ++ set( _skip_subdir ${_dir} ) ++ add_subdirectory( ${DOCS_SOURCE_DIR}/${_dir} ) ++ else() ++ unset( _skip_subdir ) ++ if( ${_dir} MATCHES "/[^/]*/" ) ++ string( REGEX REPLACE "^[^/]*/(.*)" "\\1" _doc_dest "${_dir}" ) ++ else() ++ string( REGEX REPLACE "^[^/]*/(.*)" "\\1" _doc_dest "${_dir}/${PROJECT_NAME}" ) ++ endif() ++ file( GLOB _doc_files RELATIVE ${DOCS_SOURCE_DIR}/${_dir} ${DOCS_SOURCE_DIR}/${_dir}/*.docbook ) ++ if( _doc_files ) ++ list( FIND _doc_files "index.docbook" _find_index ) ++ if( -1 EQUAL _find_index ) ++ set( _noindex "NOINDEX" ) ++ else() ++ unset( _noindex ) ++ endif() ++ tde_create_handbook( ++ SOURCE_BASEDIR ${DOCS_SOURCE_DIR}/${_dir} ++ ${_noindex} ++ LANG ${_lang} ++ DESTINATION ${_doc_dest} ++ ) ++ else() ++ file( GLOB _html_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOCS_SOURCE_DIR}/${_dir}/*.html ) ++ if( _html_files ) ++ file( GLOB _htmldoc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ++ ${DOCS_SOURCE_DIR}/${_dir}/*.css ++ ${DOCS_SOURCE_DIR}/${_dir}/*.gif ++ ${DOCS_SOURCE_DIR}/${_dir}/*.jpg ++ ${DOCS_SOURCE_DIR}/${_dir}/*.png ++ ) ++ install( ++ FILES ${_html_files} ${_htmldoc_files} ++ DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest} ++ ) ++ endif() ++ endif() ++ endif() ++ endif() ++ endforeach() ++ ++ if( EXISTS ${DOCS_SOURCE_DIR}/man AND ++ NOT EXISTS ${DOCS_SOURCE_DIR}/man/CMakeLists.txt ) ++ file( GLOB_RECURSE _man_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${DOCS_SOURCE_DIR}/man/* ) ++ foreach( _man_file IN LISTS _man_files ) ++ if( ${_man_file} MATCHES "\\.[0-9]$" ) ++ string( REGEX REPLACE ".*\\.([0-9])$" "\\1" _man_section "${_man_file}" ) ++ list( APPEND _man_files_${_man_section} "${_man_file}" ) ++ list( APPEND _man_sections "${_man_section}" ) ++ endif() ++ endforeach() ++ foreach( _man_section IN LISTS _man_sections ) ++ INSTALL( ++ FILES ${_man_files_${_man_section}} ++ DESTINATION ${MAN_INSTALL_DIR}/man${_man_section} ++ COMPONENT doc ++ ) ++ endforeach() ++ endif() ++ ++ if( EXISTS ${DOCS_SOURCE_DIR}/misc AND ++ NOT EXISTS ${DOCS_SOURCE_DIR}/misc/CMakeLists.txt ) ++ install( ++ DIRECTORY ${DOCS_SOURCE_DIR}/misc/ ++ DESTINATION ${SHARE_INSTALL_PREFIX}/doc/${PROJECT_NAME} ++ COMPONENT doc ++ PATTERN Makefile.am EXCLUDE ++ ) ++ endif() ++ ++ foreach( _dir html man misc other ) ++ if( EXISTS ${DOCS_SOURCE_DIR}/${_dir}/CMakeLists.txt ) ++ add_subdirectory( ${DOCS_SOURCE_DIR}/${_dir} ) ++ endif() ++ endforeach() ++ ++endfunction( ) ++ ++ ++################################################# ++##### ++##### tde_create_handbook ++ ++macro( tde_create_handbook ) ++ ++ unset( _target ) ++ unset( _dest ) ++ unset( _noindex ) ++ unset( _srcs ) ++ unset( _extra ) ++ unset( _srcdir ) ++ ++ get_filename_component( _source_basedir "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE ) ++ set( _lang en ) ++ set( _first_arg 1 ) ++ set( _var _target ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "SOURCE_BASEDIR" ++ if( "+${_arg}" STREQUAL "+SOURCE_BASEDIR" ) ++ unset( _source_basedir ) ++ set( _var _source_basedir ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive "NOINDEX" ++ if( "+${_arg}" STREQUAL "+NOINDEX" ) ++ set( _noindex 1 ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive "FILES" ++ if( "+${_arg}" STREQUAL "+FILES" ) ++ unset( _srcs ) ++ set( _var _srcs ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive "EXTRA" ++ if( "+${_arg}" STREQUAL "+EXTRA" ) ++ unset( _extra ) ++ set( _var _extra ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive "SRCDIR" ++ if( "+${_arg}" STREQUAL "+SRCDIR" ) ++ unset( _srcdir ) ++ set( _var _srcdir ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive DESTINATION ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ unset( _dest ) ++ set( _var _dest ) ++ set( _directive 1 ) ++ endif() ++ ++ # found directive "LANG" ++ if( "+${_arg}" STREQUAL "+LANG" ) ++ unset( _lang ) ++ set( _var _lang ) ++ set( _directive 1 ) ++ endif() ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ if( _first_arg ) ++ set( _target "${_arg}" ) ++ else() ++ list( APPEND ${_var} ${_arg} ) ++ endif() ++ endif() ++ ++ unset( _first_arg ) ++ ++ endforeach() ++ ++ # if source_basedir is relative, complete the path to absolute ++ if( NOT IS_ABSOLUTE ${_source_basedir} ) ++ get_filename_component( _source_basedir "${_source_basedir}" ABSOLUTE ) ++ endif() ++ ++ # prepare the binary directory according to source_basedir ++ file( RELATIVE_PATH _binary_basedir "${CMAKE_CURRENT_SOURCE_DIR}" "${_source_basedir}" ) ++ set( _binary_basedir "${CMAKE_CURRENT_BINARY_DIR}/${_binary_basedir}" ) ++ file( MAKE_DIRECTORY "${_binary_basedir}" ) ++ ++ # if no target specified, try to guess it from DESTINATION ++ if( NOT _target ) ++ if( NOT _dest ) ++ tde_message_fatal( "target name cannot be determined because DESTINATION is not set" ) ++ endif() ++ string( REPLACE "/" "-" _target "${_dest}" ) ++ endif() ++ ++ set( _target "${_target}-${_lang}-handbook" ) ++ ++ # if sources are listed, complete the path to absolute ++ if( _srcs ) ++ foreach( _src ${_srcs} ) ++ if( NOT IS_ABSOLUTE ${_src} ) ++ list( REMOVE_ITEM _srcs ${_src} ) ++ get_filename_component( _src "${_source_basedir}/${_src}" ABSOLUTE ) ++ list( APPEND _srcs ${_src} ) ++ endif() ++ endforeach() ++ endif() ++ ++ # if no file specified, include all docbooks, stylesheets and images ++ if( NOT _srcs ) ++ file( GLOB _srcs ++ ${_source_basedir}/*.docbook ++ ${_source_basedir}/*.css ++ ${_source_basedir}/*.gif ++ ${_source_basedir}/*.jpg ++ ${_source_basedir}/*.png ++ ) ++ endif() ++ ++ # if no destination specified, defaulting to HTML_INSTALL_DIR ++ if( NOT _dest ) ++ set( _dest "${HTML_INSTALL_DIR}/${_lang}" ) ++ # if destination is NOT absolute path, ++ # we assume that is relative to HTML_INSTALL_DIR ++ elseif( NOT IS_ABSOLUTE ${_dest} ) ++ set( _dest "${HTML_INSTALL_DIR}/${_lang}/${_dest}" ) ++ endif() ++ ++ if( NOT _srcs ) ++ tde_message_fatal( "no source files" ) ++ endif() ++ ++ if( NOT _noindex ) ++ ++ # check for index.docbook ++ list( FIND _srcs "${_source_basedir}/index.docbook" _find_index ) ++ if( -1 EQUAL _find_index ) ++ tde_message_fatal( "missing index.docbook file" ) ++ endif() ++ ++ # check for srcdir ++ if( _srcdir ) ++ set( _srcdir "--srcdir=${_srcdir}" ) ++ endif() ++ ++ add_custom_command( ++ OUTPUT ${_binary_basedir}/index.cache.bz2 ++ COMMAND ${KDE3_MEINPROC_EXECUTABLE} ${_srcdir} --check --cache index.cache.bz2 ${_source_basedir}/index.docbook ++ COMMENT "Generating ${_target}" ++ DEPENDS ${_srcs} ++ WORKING_DIRECTORY "${_binary_basedir}" ++ ) ++ ++ string( REPLACE "@" "_" _target "${_target}" ) ++ add_custom_target( ${_target} ALL DEPENDS ${_binary_basedir}/index.cache.bz2 ) ++ ++ list( APPEND _srcs ${_binary_basedir}/index.cache.bz2 ) ++ ++ if( NOT TDE_HTML_DIR ) ++ set( TDE_HTML_DIR ${HTML_INSTALL_DIR} ) ++ endif( ) ++ ++ tde_install_empty_directory( ${_dest} ) ++ file( RELATIVE_PATH _common_link_target "${_dest}" "${TDE_HTML_DIR}/${_lang}/common" ) ++ tde_install_symlink( ${_common_link_target} ${_dest} ) ++ ++ endif() ++ ++ install( FILES ${_srcs} ${_extra} DESTINATION ${_dest} ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_create_tarball ++##### ++##### Macro is used to create tarball. ++##### ++ ++macro( tde_create_tarball ) ++ ++ unset( _target ) ++ unset( _files ) ++ unset( _destination ) ++ set( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}" ) ++ set( _compression "gzip" ) ++ set( _var _target ) ++ ++ foreach( _arg ${ARGN} ) ++ ++ # found directive "TARGET" ++ if( "+${_arg}" STREQUAL "+TARGET" ) ++ unset( _target ) ++ set( _var _target ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "SOURCEDIR" ++ if( "+${_arg}" STREQUAL "+SOURCEDIR" ) ++ unset( _sourcedir ) ++ set( _var _sourcedir ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "FILES" ++ if( "+${_arg}" STREQUAL "+FILES" ) ++ unset( _files ) ++ set( _var _files ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "DESTINATION" ++ if( "+${_arg}" STREQUAL "+DESTINATION" ) ++ unset( _destination ) ++ set( _var _destination ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # found directive "COMPRESSION" ++ if( "+${_arg}" STREQUAL "+COMPRESSION" ) ++ unset( _compression ) ++ set( _var _compression ) ++ set( _directive 1 ) ++ endif( ) ++ ++ # collect data ++ if( _directive ) ++ unset( _directive ) ++ elseif( _var ) ++ list( APPEND ${_var} ${_arg} ) ++ endif( ) ++ ++ endforeach( ) ++ ++ if( NOT _target ) ++ tde_message_fatal( "Target tarball name not specified." ) ++ endif( ) ++ ++ if( NOT IS_ABSOLUTE ${_sourcedir} ) ++ set( _sourcedir "${CMAKE_CURRENT_SOURCE_DIR}/${_sourcedir}" ) ++ endif( ) ++ ++ if( NOT _files ) ++ file( GLOB_RECURSE _files RELATIVE ${_sourcedir} "${_sourcedir}/*" ) ++ list( SORT _files ) ++ endif( ) ++ ++ unset( _files_deps ) ++ foreach( _file ${_files} ) ++ list( APPEND _files_deps "${_sourcedir}/${_file}" ) ++ endforeach( ) ++ ++ if( NOT DEFINED TAR_EXECUTABLE ) ++ find_program( TAR_EXECUTABLE NAMES tar ) ++ if( "${TAR_EXECUTABLE}" STREQUAL "TAR_EXECUTABLE-NOTFOUND" ) ++ tde_message_fatal( "tar executable is required but not found on your system" ) ++ endif( ) ++ endif( ) ++ ++ if( NOT DEFINED TAR_SETOWNER ) ++ execute_process( ++ COMMAND ${TAR_EXECUTABLE} --version ++ OUTPUT_VARIABLE TAR_VERSION ++ ) ++ string( REGEX REPLACE "^([^\n]*)\n.*" "\\1" TAR_VERSION "${TAR_VERSION}" ) ++ if( "${TAR_VERSION}" MATCHES "GNU *tar" ) ++ set( TAR_SETOWNER "--owner=root;--group=root" ) ++ set( TAR_REPRODUCIBLE "--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" ) ++ list( APPEND TAR_REPRODUCIBLE "--mode=u+rw,go=rX,a-s" ) ++ tde_read_src_metadata() ++ if( TDE_PKG_DATETIME ) ++ list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_PKG_DATETIME} UTC" ) ++ elseif( TDE_SCM_MODULE_DATETIME ) ++ list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_SCM_MODULE_DATETIME} UTC" ) ++ endif( ) ++ elseif( "${TAR_VERSION}" MATCHES "bsd *tar" ) ++ set( TAR_SETOWNER "--uname=root;--gname=root" ) ++ else( ) ++ set( TAR_SETOWNER "" ) ++ endif( ) ++ endif( ) ++ ++ if( "${_compression}" STREQUAL "-" ) ++ unset( _compression ) ++ endif( ) ++ if( _compression ) ++ if( "${_compression}" STREQUAL "gzip" ) ++ set( TAR_COMPRESSION "|" ${_compression} "-n" ) ++ else( ) ++ set( TAR_COMPRESSION "|" ${_compression} ) ++ endif( ) ++ endif( ) ++ ++ get_filename_component( _target_path "${CMAKE_CURRENT_BINARY_DIR}/${_target}" ABSOLUTE ) ++ file( RELATIVE_PATH _target_path "${CMAKE_BINARY_DIR}" "${_target_path}" ) ++ string( REPLACE "/" "+" _target_name "${_target_path}" ) ++ add_custom_target( "${_target_name}-tarball" ALL ++ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_target}" ) ++ ++ add_custom_command( ++ COMMAND ${TAR_EXECUTABLE} cf - ++ ${TAR_SETOWNER} ${TAR_REPRODUCIBLE} -- ${_files} ++ ${TAR_COMPRESSION} > ${CMAKE_CURRENT_BINARY_DIR}/${_target} ++ WORKING_DIRECTORY "${_sourcedir}" ++ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_target}" ++ DEPENDS ${_files_deps} ++ COMMENT "Create tarball ${_target_path}" ++ ) ++ ++ if( _destination ) ++ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_target} DESTINATION ${_destination} ) ++ endif( ) ++ ++endmacro() ++ ++ ++################################################# ++##### ++##### tde_include_tqt ++ ++macro( tde_include_tqt ) ++ foreach( _cpp ${ARGN} ) ++ set_source_files_properties( ${_cpp} PROPERTIES COMPILE_FLAGS "-include tqt.h" ) ++ endforeach() ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_install_symlink ++ ++macro( tde_install_symlink _target _link ) ++ ++ # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX ++ if( IS_ABSOLUTE "${_link}" ) ++ set( _destination "${_link}" ) ++ else( IS_ABSOLUTE "${_link}" ) ++ set( _destination "${CMAKE_INSTALL_PREFIX}/${_link}" ) ++ endif( IS_ABSOLUTE "${_link}" ) ++ ++ get_filename_component( _path "${_destination}" PATH ) ++ if( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) ++ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_path}\" )" ) ++ endif( NOT IS_DIRECTORY "\$ENV{DESTDIR}${_path}" ) ++ ++ install( CODE "execute_process( COMMAND ln -s ${_target} \$ENV{DESTDIR}${_destination} )" ) ++ ++endmacro( tde_install_symlink ) ++ ++ ++################################################# ++##### ++##### tde_install_empty_directory ++ ++macro( tde_install_empty_directory _path ) ++ ++ # if path is relative, we must to prefix it with CMAKE_INSTALL_PREFIX ++ if( IS_ABSOLUTE "${_path}" ) ++ set( _destination "${_path}" ) ++ else( IS_ABSOLUTE "${_path}" ) ++ set( _destination "${CMAKE_INSTALL_PREFIX}/${_path}" ) ++ endif( IS_ABSOLUTE "${_path}" ) ++ ++ install( CODE "file( MAKE_DIRECTORY \"\$ENV{DESTDIR}${_destination}\" )" ) ++ ++endmacro( tde_install_empty_directory ) ++ ++ ++################################################# ++##### ++##### tde_conditional_add_subdirectory ++ ++macro( tde_conditional_add_subdirectory _cond _path ) ++ ++ if( ${_cond} ) ++ add_subdirectory( "${_path}" ) ++ endif( ${_cond} ) ++ ++endmacro( tde_conditional_add_subdirectory ) ++ ++ ++################################################# ++##### ++##### tde_auto_add_subdirectories ++ ++macro( tde_auto_add_subdirectories ) ++ file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * ) ++ foreach( _dir ${_dirs} ) ++ if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ) ++ if( NOT ${_dir} STREQUAL ".svn" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt ) ++ add_subdirectory( ${_dir} ) ++ endif() ++ endif() ++ endforeach() ++endmacro() ++ ++ ++################################################# ++##### ++##### tde_save / tde_restore ++ ++macro( tde_save ) ++ foreach( _var ${ARGN} ) ++ set( __bak_${_var} ${${_var}} ) ++ endforeach() ++endmacro() ++ ++macro( tde_save_and_set _var ) ++ set( __bak_${_var} ${${_var}} ) ++ set( ${_var} ${ARGN} ) ++endmacro( ) ++ ++macro( tde_restore ) ++ foreach( _var ${ARGN} ) ++ set( ${_var} ${__bak_${_var}} ) ++ unset( __bak_${_var} ) ++ endforeach() ++endmacro() ++ ++ ++################################################# ++##### ++##### tde_setup_install_path ++ ++macro( tde_setup_install_path _path _default ) ++ if( DEFINED ${_path} ) ++ set( ${_path} "${${_path}}" CACHE INTERNAL "" FORCE ) ++ else( ) ++ set( ${_path} "${_default}" ) ++ endif( ) ++endmacro( ) ++ ++ ++################################################## ++ ++if( ${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR} ) ++ tde_message_fatal( "Please use out-of-source building, like this: ++ \n rm ${CMAKE_SOURCE_DIR}/CMakeCache.txt ++ mkdir /tmp/${PROJECT_NAME}.build ++ cd /tmp/${PROJECT_NAME}.build ++ cmake ${CMAKE_SOURCE_DIR} [arguments...]" ) ++endif( ) ++ ++################################################# ++##### ++##### tde_setup_architecture_flags ++ ++macro( tde_setup_architecture_flags ) ++ if( NOT DEFINED LINKER_IMMEDIATE_BINDING_FLAGS ) ++ message( STATUS "Detected ${CMAKE_SYSTEM_PROCESSOR} CPU architecture" ) ++ ## Immediate symbol binding is available only for gcc but not on ARM architectures ++ if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm* AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" ) ++ set( LINKER_IMMEDIATE_BINDING_FLAGS "-z\ now" CACHE INTERNAL "" FORCE ) ++ else( ) ++ set( LINKER_IMMEDIATE_BINDING_FLAGS "" CACHE INTERNAL "" FORCE ) ++ endif( ) ++ ++ check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT ) ++ if( HAVE_PIE_SUPPORT ) ++ set( TDE_PIE_CFLAGS -fPIE ) ++ ++ if( ${CMAKE_VERSION} VERSION_LESS "3.18" ) ++ execute_process(COMMAND "${CMAKE_LINKER}" --help ++ OUTPUT_VARIABLE __linker_help ++ ERROR_VARIABLE __linker_help) ++ if( "${__linker_help}" MATCHES "-pie" ) ++ set( LINKER_PIE_SUPPORT 1 ) ++ elseif( "${__linker_help}" MATCHES "type=type.*pie" ) ++ set( LINKER_ZTYPE_PIE_SUPPORT 1 ) ++ endif( ) ++ unset(__linker_help) ++ else( ) ++ check_linker_flag(CXX -pie LINKER_PIE_SUPPORT) ++ if( NOT LINKER_PIE_SUPPORT ) ++ check_linker_flag(CXX -ztype=pie LINKER_ZTYPE_PIE_SUPPORT) ++ endif() ++ endif() ++ if( LINKER_PIE_SUPPORT ) ++ set( TDE_PIE_LDFLAGS -pie ) ++ endif( LINKER_PIE_SUPPORT ) ++ if( LINKER_ZTYPE_PIE_SUPPORT ) ++ set( TDE_PIE_LDFLAGS -ztype=pie ) ++ endif( LINKER_ZTYPE_PIE_SUPPORT ) ++ endif( HAVE_PIE_SUPPORT ) ++ ++ set( _reproducible_cxxflags ++ "-fdebug-prefix-map=${CMAKE_SOURCE_DIR}=." ++ "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=." ++ ) ++ foreach( _flag ${_reproducible_cxxflags} ) ++ string( REGEX REPLACE "=.*" "" _flag_name "${_flag}" ) ++ string( REGEX REPLACE "[^a-zA-Z0-9]+" "_" _flag_var "CXXFLAG_${_flag_name}" ) ++ if( NOT "${CMAKE_CXX_FLAGS}" MATCHES "(^| )${_flag_name}" ) ++ check_cxx_compiler_flag( "${_flag}" ${_flag_var} ) ++ if( ${_flag_var} ) ++ set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}" ) ++ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}" ) ++ endif() ++ endif() ++ endforeach() ++ endif( ) ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_setup_gcc_visibility ++ ++macro( tde_setup_gcc_visibility ) ++ if( NOT DEFINED __TDE_HAVE_GCC_VISIBILITY ) ++ if( NOT UNIX ) ++ tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" ) ++ endif( NOT UNIX ) ++ ++ if( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY ) ++ find_library( TQT_LIBFILE tqt-mt HINTS "${TQT_LIBRARY_DIRS}" ) ++ if( NOT "${TQT_LIBFILE}" STREQUAL "TQT_LIBFILE-NOTFOUND" ) ++ message( STATUS "Performing Test HAVE_TQT_VISIBILITY" ) ++ execute_process( ++ COMMAND readelf --syms "${TQT_LIBFILE}" ++ OUTPUT_VARIABLE HAVE_TQT_VISIBILITY ++ ) ++ if( "${HAVE_TQT_VISIBILITY}" STREQUAL "" OR ++ "${HAVE_TQT_VISIBILITY}" MATCHES "GLOBAL[\t ]+DEFAULT[^\n]+QSettingsPrivate" ) ++ message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Failed" ) ++ tde_message_fatal( "gcc visibility support was requested, but not supported in tqt library" ) ++ endif( ) ++ set( HAVE_TQT_VISIBILITY 1 CACHE INTERNAL "" ) ++ message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Success" ) ++ endif( ) ++ endif( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY ) ++ ++ if( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY ) ++ find_file( TDEMACROS_H tdemacros.h HINTS "${TDE_INCLUDE_DIR}" ) ++ if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" ) ++ tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" ) ++ check_cxx_source_compiles( " ++ #include <${TDEMACROS_H}> ++ #ifndef __TDE_HAVE_GCC_VISIBILITY ++ #error gcc visibility is not enabled in tdelibs ++ #endif ++ int main() { return 0; } " ++ HAVE_TDE_VISIBILITY ++ ) ++ tde_restore( CMAKE_REQUIRED_INCLUDES ) ++ if( NOT HAVE_TDE_VISIBILITY ) ++ tde_message_fatal( "gcc visibility support was requested, but not supported in tdelibs" ) ++ endif( NOT HAVE_TDE_VISIBILITY ) ++ endif( ) ++ endif( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY ) ++ ++ set( __TDE_HAVE_GCC_VISIBILITY 1 CACHE INTERNAL "" ) ++ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") ++ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") ++ endif( ) ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_setup_msgfmt ++ ++macro( tde_setup_msgfmt ) ++ if( NOT DEFINED MSGFMT_EXECUTABLE ) ++ include( FindGettext ) ++ if( GETTEXT_FOUND ) ++ set( MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT_EXECUTABLE} ++ CACHE FILEPATH "path to msgfmt executable" ) ++ if( GETTEXT_VERSION_STRING ) ++ set( MSGFMT_VERSION ${GETTEXT_VERSION_STRING} ++ CACHE STRING "version of msgfmt executable" ) ++ endif( ) ++ endif( GETTEXT_FOUND ) ++ ++ if( NOT MSGFMT_EXECUTABLE ) ++ tde_message_fatal( "msgfmt is required but was not found on your system." ) ++ endif( NOT MSGFMT_EXECUTABLE ) ++ endif( ) ++ ++ if( NOT MSGFMT_VERSION ) ++ execute_process( ++ COMMAND ${MSGFMT_EXECUTABLE} --version ++ OUTPUT_VARIABLE _msgfmt_version ++ ERROR_VARIABLE _msgfmt_version ++ ) ++ string( REGEX REPLACE "^msgfmt[^\n]* ([^ ]*)\n.*" "\\1" _msgfmt_version ${_msgfmt_version} ) ++ set( MSGFMT_VERSION ${_msgfmt_version} ++ CACHE STRING "version of msgfmt executable" ) ++ endif( ) ++endmacro( ) ++ ++ ++################################################ ++##### ++##### tde_setup_largefiles ++ ++macro( tde_setup_largefiles ) ++ if( NOT DEFINED HAVE_LARGEFILES ) ++ message( STATUS "Check support for large files" ) ++ unset( LARGEFILES_DEFINITIONS ) ++ ++ # check without special definitions ++ unset( HAVE_SIZEOF_T CACHE ) ++ check_type_size( off_t SIZEOF_OFF_T ) ++ if( SIZEOF_OFF_T GREATER 7 ) ++ set( HAVE_LARGEFILES 1 ) ++ endif( ) ++ ++ # check with definition _FILE_OFFSET_BITS=64 ++ if( NOT HAVE_LARGEFILES ) ++ unset( HAVE_SIZEOF_OFF_T CACHE ) ++ tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64" ) ++ check_type_size( off_t SIZEOF_OFF_T ) ++ tde_restore( CMAKE_REQUIRED_DEFINITIONS ) ++ if( SIZEOF_OFF_T GREATER 7 ) ++ set( LARGEFILES_DEFINITIONS "-D_FILE_OFFSET_BITS=64" ) ++ set( HAVE_LARGEFILES 1 ) ++ endif( ) ++ endif( ) ++ ++ # check with definition _LARGE_FILES ++ if( NOT HAVE_LARGEFILES ) ++ unset( HAVE_SIZEOF_OFF_T CACHE ) ++ tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGE_FILES" ) ++ check_type_size( off_t SIZEOF_OFF_T ) ++ tde_restore( CMAKE_REQUIRED_DEFINITIONS ) ++ if( SIZEOF_OFF_T GREATER 7 ) ++ set( LARGEFILES_DEFINITIONS "-D_LARGE_FILES" ) ++ set( HAVE_LARGEFILES 1 ) ++ endif( ) ++ endif( ) ++ ++ # check with definition _LARGEFILE_SOURCE ++ if( NOT HAVE_LARGEFILES ) ++ unset( HAVE_SIZEOF_OFF_T CACHE ) ++ tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE_SOURCE" ) ++ check_type_size( off_t SIZEOF_OFF_T ) ++ tde_restore( CMAKE_REQUIRED_DEFINITIONS ) ++ if( SIZEOF_OFF_T GREATER 7 ) ++ set( LARGEFILES_DEFINITIONS "-D_LARGEFILE_SOURCE" ) ++ set( HAVE_LARGEFILES 1 ) ++ endif( ) ++ endif( ) ++ ++ # check for fseeko/ftello ++ if( HAVE_LARGEFILES ) ++ tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${LARGEFILES_DEFINITIONS}" ) ++ check_symbol_exists( "fseeko" "stdio.h" HAVE_FSEEKO ) ++ tde_restore( CMAKE_REQUIRED_DEFINITIONS ) ++ if( NOT HAVE_FSEEKO ) ++ tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${LARGEFILES_DEFINITIONS} -D_LARGEFILE_SOURCE" ) ++ check_symbol_exists( "fseeko" "stdio.h" HAVE_FSEEKO ) ++ tde_restore( CMAKE_REQUIRED_DEFINITIONS ) ++ if( HAVE_FSEEKO ) ++ set( LARGEFILES_DEFINITIONS "${LARGEFILES_DEFINITIONS} -D_LARGEFILE_SOURCE" ) ++ else( ) ++ unset( HAVE_LARGEFILES ) ++ endif( ) ++ endif( ) ++ endif( ) ++ ++ # check results ++ if( HAVE_LARGEFILES ) ++ if( "${LARGEFILES_DEFINITIONS}" STREQUAL "" ) ++ message( STATUS "Check support for large files - Success" ) ++ else( ) ++ add_definitions( ${LARGEFILES_DEFINITIONS} ) ++ message( STATUS "Check support for large files - Success with ${LARGEFILES_DEFINITIONS}" ) ++ endif( ) ++ set( HAVE_LARGEFILES 1 CACHE INTERNAL "Support for large files enabled" ) ++ else( ) ++ message( STATUS "Check support for large files - Failed" ) ++ tde_message_fatal( "Cannot find a way to enable support for large files." ) ++ endif( ) ++ endif( ) ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_setup_dbus ++ ++macro( tde_setup_dbus ) ++ if( NOT DBUS_FOUND ) ++ pkg_search_module( DBUS dbus-1 ) ++ if( NOT DBUS_FOUND ) ++ tde_message_fatal( "dbus-1 is required, but not found on your system" ) ++ endif( ) ++ endif( ) ++ ++ if( NOT DEFINED DBUS_SYSTEM_CONF_DIRECTORY ) ++ execute_process( ++ COMMAND ${PKG_CONFIG_EXECUTABLE} ++ dbus-1 --variable=sysconfdir ++ OUTPUT_VARIABLE DBUS_SYSTEM_CONF_BASE ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ if( DBUS_SYSTEM_CONF_BASE ) ++ set( DBUS_SYSTEM_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/system.d" ++ CACHE PATH "Path for DBUS system configuration files" ) ++ message( STATUS "Using " ${DBUS_SYSTEM_CONF_DIRECTORY} " for DBUS system configuration files" ) ++ else( ) ++ tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" ) ++ endif( ) ++ endif( ) ++ ++ if( NOT DEFINED DBUS_SESSION_CONF_DIRECTORY ) ++ execute_process( ++ COMMAND ${PKG_CONFIG_EXECUTABLE} ++ dbus-1 --variable=sysconfdir ++ OUTPUT_VARIABLE DBUS_SYSTEM_CONF_BASE ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ if( DBUS_SYSTEM_CONF_BASE ) ++ set( DBUS_SESSION_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/session.d" ++ CACHE PATH "Path for DBUS session configuration files" ) ++ message( STATUS "Using " ${DBUS_SESSION_CONF_DIRECTORY} " for DBUS session configuration files" ) ++ else( ) ++ tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" ) ++ endif( ) ++ endif( ) ++ ++ if( NOT DEFINED DBUS_SESSION_DIRECTORY ) ++ execute_process( ++ COMMAND ${PKG_CONFIG_EXECUTABLE} ++ dbus-1 --variable=session_bus_services_dir ++ OUTPUT_VARIABLE DBUS_SESSION_DIRECTORY ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ set( DBUS_SESSION_DIRECTORY "${DBUS_SESSION_DIRECTORY}" ++ CACHE PATH "Path for DBUS session service files" ) ++ message( STATUS "Using " ${DBUS_SESSION_DIRECTORY} " for DBUS session service files" ) ++ endif( ) ++ ++ if( NOT DEFINED DBUS_SERVICE_DIRECTORY ) ++ execute_process( ++ COMMAND ${PKG_CONFIG_EXECUTABLE} ++ dbus-1 --variable=system_bus_services_dir ++ OUTPUT_VARIABLE DBUS_SERVICE_DIRECTORY ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ if( "${DBUS_SERVICE_DIRECTORY}" STREQUAL "" ) ++ if( "${DBUS_SESSION_DIRECTORY}" MATCHES "/services$" ) ++ string( REGEX REPLACE "/services$" "/system-services" ++ DBUS_SERVICE_DIRECTORY "${DBUS_SESSION_DIRECTORY}" ) ++ else( ) ++ tde_message_fatal( "Directory for DBUS system service files can not be determined." ) ++ endif( ) ++ endif( ) ++ set( DBUS_SERVICE_DIRECTORY "${DBUS_SERVICE_DIRECTORY}" ++ CACHE PATH "Path for DBUS system service files" ) ++ message( STATUS "Using " ${DBUS_SERVICE_DIRECTORY} " for DBUS system service files" ) ++ endif( ) ++ ++ if( NOT "${ARGV}" STREQUAL "" AND NOT DBUS_TQT_FOUND ) ++ pkg_search_module( DBUS_TQT ${ARGV} ) ++ if( NOT DBUS_TQT_FOUND ) ++ tde_message_fatal( "${ARGV} is required, but not found on your system" ) ++ endif( ) ++ endif( ) ++ if( "${ARGV}" STREQUAL "dbus-1-tqt" AND NOT DEFINED DBUSXML2QT3_EXECUTABLE ) ++ find_program( DBUSXML2QT3_EXECUTABLE ++ NAMES dbusxml2qt3 ++ HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} ++ ) ++ endif( ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### tde_setup_polkit ++ ++macro( tde_setup_polkit ) ++ if( NOT POLKIT_GOBJECT_FOUND ) ++ pkg_search_module( POLKIT_GOBJECT polkit-gobject-1 ) ++ if( NOT POLKIT_GOBJECT_FOUND ) ++ tde_message_fatal( "polkit-gobject-1 is required, but not found on your system" ) ++ endif( ) ++ endif( ) ++ ++ foreach( _arg ${ARGV} ) ++ if( NOT "${_arg}" MATCHES "^polkit-" ) ++ set( _arg "polkit-${_arg}" ) ++ endif( ) ++ string( TOUPPER "${_arg}" _polkit_module ) ++ if( "${_polkit_module}" MATCHES "-[0-9]+$" ) ++ string( REGEX REPLACE "-[0-9]+$" "" _polkit_module "${_polkit_module}" ) ++ endif( ) ++ string( REPLACE "-" "_" _polkit_module "${_polkit_module}" ) ++ if( NOT "${_arg}" MATCHES "-[0-9]+$" ) ++ set( _arg "${_arg}-1" ) ++ endif( ) ++ if( NOT ${_polkit_module}_FOUND ) ++ pkg_search_module( ${_polkit_module} ${_arg} ) ++ if( NOT ${_polkit_module}_FOUND ) ++ tde_message_fatal( "${_arg} is required, but not found on your system" ) ++ endif( ) ++ endif( ) ++ endforeach( ) ++ ++ if( NOT DEFINED POLKIT_ACTIONS_DIRECTORY ) ++ execute_process( ++ COMMAND ${PKG_CONFIG_EXECUTABLE} ++ polkit-gobject-1 --variable=actiondir ++ OUTPUT_VARIABLE POLKIT_ACTIONS_DIRECTORY ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ set( POLKIT_ACTIONS_DIRECTORY "${POLKIT_ACTIONS_DIRECTORY}" ++ CACHE PATH "Path for PolicyKit action files" ) ++ message( STATUS "Using " ${POLKIT_ACTIONS_DIRECTORY} " for PolicyKit action files" ) ++ endif( ) ++ ++endmacro( ) ++ ++ ++################################################# ++##### ++##### restore CMake policies ++ ++cmake_policy( POP ) ++ ++ ++################################################# +diff -Naur orig/modules/TDESetupPaths.cmake tde-cmake-trinity-14.1.3/modules/TDESetupPaths.cmake +--- orig/modules/TDESetupPaths.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/TDESetupPaths.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,72 @@ ++################################################# ++# ++# (C) 2010-2011 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++################################################# ++##### ++##### tde_internal_setup_path ++ ++macro( _tde_internal_setup_path _path _default _comment ) ++ if( DEFINED ${_path} ) ++ if( IS_ABSOLUTE ${${_path}} ) ++ set( ${_path} "${${_path}}" CACHE PATH "${_comment}" FORCE ) ++ else( ) ++ set( ${_path} "${CMAKE_INSTALL_PREFIX}/${${_path}}" CACHE PATH "${_comment}" FORCE ) ++ endif( ) ++ else( ) ++ set( ${_path} "${_default}" ) ++ endif( ) ++endmacro( _tde_internal_setup_path ) ++ ++ ++################################################# ++##### ++##### tde_setup_paths ++ ++macro( tde_setup_paths ) ++ ++ # install paths ++ _tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" ) ++ _tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" ) ++ _tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" ) ++ _tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" ) ++ _tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" ) ++ _tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/trinity/libexec)" ) ++ _tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" "The install dir for pkg-config metadata files" ) ++ _tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" ) ++ ++ _tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" ) ++ _tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/trinity)" ) ++ _tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" ) ++ _tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" ) ++ _tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/tde/HTML" "The HTML install dir for documentation" ) ++ _tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" ) ++ _tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for tdeconfig files" ) ++ _tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" ) ++ _tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" ) ++ _tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" ) ++ _tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" ) ++ _tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" ) ++ _tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" ) ++ _tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" ) ++ _tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" ) ++ _tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/tdeconf_update" "The tdeconf_update install dir" ) ++ _tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" ) ++ ++ _tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" ) ++ _tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" ) ++ _tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" ) ++ ++ _tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" ) ++ _tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/tde" "The XDG apps dir" ) ++ _tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" ) ++ _tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" ) ++ ++endmacro( tde_setup_paths ) +diff -Naur orig/modules/TDEVersion.cmake tde-cmake-trinity-14.1.3/modules/TDEVersion.cmake +--- orig/modules/TDEVersion.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/TDEVersion.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,37 @@ ++################################################# ++# ++# (C) 2022 Michele Calgaro ++# michele (DOT) calgaro (AT) yahoo (DOT) it ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++# Centralized place where to set the minimum cmake version required in TDE ++ ++set( TDE_CMAKE_MINIMUM_VERSION 3.5 ) ++ ++ ++################################################# ++##### ++##### tde_set_project_version ++ ++macro( tde_set_project_version ) ++ ++ set( DEFAULT_VERSION "R14.1.3" ) ++ ++ unset( VERSION ) ++ ++ if( EXISTS ${CMAKE_SOURCE_DIR}/.tdescminfo ) ++ file( STRINGS ${CMAKE_SOURCE_DIR}/.tdescminfo VERSION_STRING REGEX "^Version:.+$" ) ++ string( REGEX REPLACE "^Version: (R[0-9]+\\.[0-9]+\\.[0-9]+.*)$" "\\1" VERSION "${VERSION_STRING}" ) ++ endif() ++ ++ if( NOT VERSION ) ++ set( VERSION "${DEFAULT_VERSION}" ) ++ endif() ++ ++endmacro( ) ++ +diff -Naur orig/modules/tde_automoc.cmake tde-cmake-trinity-14.1.3/modules/tde_automoc.cmake +--- orig/modules/tde_automoc.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/tde_automoc.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,76 @@ ++################################################# ++# ++# (C) 2022 Slávek Banko ++# slavek (DOT) banko (AT) axis.cz ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++if( NOT ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules ) ++ set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" ) ++endif() ++include( TDEMacros ) ++ ++ ++get_filename_component( _src_file "${SRC_FILE}" ABSOLUTE ) ++set( _meta_includes ${META_INCLUES} ) ++unset( _moc_headers ) ++ ++if( EXISTS "${_src_file}" ) ++ ++ # read source file and check if have moc include ++ file( READ "${_src_file}" _src_content ) ++ string( REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _moc_includes "${_src_content}" ) ++ ++ # found included moc(s)? ++ if( _moc_includes ) ++ foreach( _moc_file ${_moc_includes} ) ++ ++ # extracting moc filename ++ string( REGEX MATCH "[^ <\"]+\\.moc" _moc_file "${_moc_file}" ) ++ set( _moc_file "${CMAKE_CURRENT_BINARY_DIR}/${_moc_file}" ) ++ ++ # create header filename ++ get_filename_component( _src_path "${_src_file}" ABSOLUTE ) ++ get_filename_component( _src_path "${_src_path}" PATH ) ++ get_filename_component( _src_header "${_moc_file}" NAME_WE ) ++ set( _header_file "${_src_path}/${_src_header}.h" ) ++ ++ # if header doesn't exists, check in META_INCLUDES ++ if( NOT EXISTS "${_header_file}" ) ++ unset( _found ) ++ foreach( _src_path ${_meta_includes} ) ++ set( _header_file "${_src_path}/${_src_header}.h" ) ++ if( EXISTS "${_header_file}" ) ++ set( _found 1 ) ++ break( ) ++ endif( ) ++ endforeach( ) ++ if( NOT _found ) ++ get_filename_component( _moc_file "${_moc_file}" NAME ) ++ tde_message_fatal( "AUTOMOC error: '${_moc_file}' cannot be generated.\n Reason: '${_src_header}.h' not found." ) ++ endif( ) ++ endif( ) ++ ++ # moc-ing header ++ execute_process( COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file} ) ++ list( APPEND _moc_headers "${_src_header}.h" ) ++ ++ endforeach( _moc_file ) ++ ++ endif( _moc_includes ) ++ ++else() ++ tde_message_fatal( "AUTOMOC error: '${_src_file}' not found!" ) ++endif( EXISTS "${_src_file}" ) ++ ++get_filename_component( _automoc_file "${_src_file}+automoc" NAME ) ++if( DEFINED _moc_headers ) ++ string( REPLACE ";" "\n * " _moc_headers "${_moc_headers}" ) ++ file( WRITE "${_automoc_file}" "/*\n * processed:\n * ${_moc_headers}\n */" ) ++else() ++ file( WRITE "${_automoc_file}" "/* processed - no moc files */" ) ++endif() +diff -Naur orig/modules/tde_l10n_merge.pl tde-cmake-trinity-14.1.3/modules/tde_l10n_merge.pl +--- orig/modules/tde_l10n_merge.pl 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/tde_l10n_merge.pl 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,1521 @@ ++#!/usr/bin/perl -w ++# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- ++ ++# ++# The Intltool Message Merger ++# ++# Copyright (C) 2000, 2003 Free Software Foundation. ++# Copyright (C) 2000, 2001 Eazel, Inc ++# ++# Intltool is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License ++# version 2 published by the Free Software Foundation. ++# ++# Intltool is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++# ++# As a special exception to the GNU General Public License, if you ++# distribute this file as part of a program that contains a ++# configuration script generated by Autoconf, you may include it under ++# the same distribution terms that you use for the rest of that program. ++# ++# Authors: Maciej Stachowiak ++# Kenneth Christiansen ++# Darin Adler ++# ++# Proper XML UTF-8'ification written by Cyrille Chepelov ++# ++ ++## Release information ++my $PROGRAM = "intltool-merge"; ++my $PACKAGE = "intltool"; ++my $VERSION = "0.51.0"; ++ ++## Loaded modules ++use strict; ++use Getopt::Long; ++use Text::Wrap; ++use File::Basename; ++use Encode; ++use Fcntl qw(:flock); ++ ++my $must_end_tag = -1; ++my $last_depth = -1; ++my $translation_depth = -1; ++my @tag_stack = (); ++my @entered_tag = (); ++my @translation_strings = (); ++my $leading_space = ""; ++ ++## Scalars used by the option stuff ++my $HELP_ARG = 0; ++my $VERSION_ARG = 0; ++my $BA_STYLE_ARG = 0; ++my $XML_STYLE_ARG = 0; ++my $KEYS_STYLE_ARG = 0; ++my $DESKTOP_STYLE_ARG = 0; ++my $SCHEMAS_STYLE_ARG = 0; ++my $RFC822DEB_STYLE_ARG = 0; ++my $QUOTED_STYLE_ARG = 0; ++my $QUOTEDXML_STYLE_ARG = 0; ++my $QUIET_ARG = 0; ++my $PASS_THROUGH_ARG = 0; ++my $UTF8_ARG = 0; ++my $MULTIPLE_OUTPUT = 0; ++my $NO_TRANSLATIONS_ARG = 0; ++my $cache_file; ++ ++## Handle options ++GetOptions ++( ++ "help" => \$HELP_ARG, ++ "version" => \$VERSION_ARG, ++ "quiet|q" => \$QUIET_ARG, ++ "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility ++ "ba-style|b" => \$BA_STYLE_ARG, ++ "xml-style|x" => \$XML_STYLE_ARG, ++ "keys-style|k" => \$KEYS_STYLE_ARG, ++ "desktop-style|d" => \$DESKTOP_STYLE_ARG, ++ "schemas-style|s" => \$SCHEMAS_STYLE_ARG, ++ "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, ++ "quoted-style" => \$QUOTED_STYLE_ARG, ++ "quotedxml-style" => \$QUOTEDXML_STYLE_ARG, ++ "pass-through|p" => \$PASS_THROUGH_ARG, ++ "utf8|u" => \$UTF8_ARG, ++ "multiple-output|m" => \$MULTIPLE_OUTPUT, ++ "no-translations" => \$NO_TRANSLATIONS_ARG, ++ "cache|c=s" => \$cache_file ++ ) or &error; ++ ++my $PO_DIR; ++my $FILE; ++my $OUTFILE; ++ ++my %po_files_by_lang = (); ++my %translations = (); ++ ++# Use this instead of \w for XML files to handle more possible characters. ++my $w = "[-A-Za-z0-9._:]"; ++ ++# XML quoted string contents ++my $q = "[^\\\"]*"; ++ ++## Check for options. ++ ++if ($VERSION_ARG) ++{ ++ &print_version; ++} ++elsif ($HELP_ARG) ++{ ++ &print_help; ++} ++elsif ($BA_STYLE_ARG && @ARGV > 2) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ &ba_merge_translations; ++ &finalize; ++} ++elsif ($XML_STYLE_ARG && (@ARGV > 2 || ($NO_TRANSLATIONS_ARG && @ARGV > 1))) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ &xml_merge_output; ++ &finalize; ++} ++elsif ($KEYS_STYLE_ARG && @ARGV > 2) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ &keys_merge_translations; ++ &finalize; ++} ++elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ &desktop_merge_translations; ++ &finalize; ++} ++elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ &schemas_merge_translations; ++ &finalize; ++} ++elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) ++{ ++ &preparation; ++ &print_message; ++ &rfc822deb_merge_translations; ++ &finalize; ++} ++elsif (($QUOTED_STYLE_ARG || $QUOTEDXML_STYLE_ARG) && @ARGV > 2) ++{ ++ &utf8_sanity_check; ++ &preparation; ++ &print_message; ++ "ed_merge_translations($QUOTEDXML_STYLE_ARG); ++ &finalize; ++} ++else ++{ ++ &print_help; ++} ++ ++exit; ++ ++## Sub for printing release information ++sub print_version ++{ ++ print <<_EOF_; ++${PROGRAM} (${PACKAGE}) ${VERSION} ++Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. ++ ++Copyright (C) 2000-2003 Free Software Foundation, Inc. ++Copyright (C) 2000-2001 Eazel, Inc. ++This is free software; see the source for copying conditions. There is NO ++warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++_EOF_ ++ exit; ++} ++ ++## Sub for printing usage information ++sub print_help ++{ ++ print <<_EOF_; ++Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE ++Generates an output file that includes some localized attributes from an ++untranslated source file. ++ ++Mandatory options: (exactly one must be specified) ++ -b, --ba-style includes translations in the bonobo-activation style ++ -d, --desktop-style includes translations in the desktop style ++ -k, --keys-style includes translations in the keys style ++ -s, --schemas-style includes translations in the schemas style ++ -r, --rfc822deb-style includes translations in the RFC822 style ++ --quoted-style includes translations in the quoted string style ++ --quotedxml-style includes translations in the quoted xml string style ++ -x, --xml-style includes translations in the standard xml style ++ ++Other options: ++ -u, --utf8 convert all strings to UTF-8 before merging ++ (default for everything except RFC822 style) ++ -p, --pass-through deprecated, does nothing and issues a warning ++ -m, --multiple-output output one localized file per locale, instead of ++ a single file containing all localized elements ++ --no-translations do not merge any translations: only generates the ++ unlocalised (English) version -- applies only ++ to XML merging ++ -c, --cache=FILE specify cache file name ++ (usually \$top_builddir/po/.intltool-merge-cache) ++ -q, --quiet suppress most messages ++ --help display this help and exit ++ --version output version information and exit ++ ++Report bugs to http://bugs.launchpad.net/intltool ++_EOF_ ++ exit; ++} ++ ++ ++## Sub for printing error messages ++sub print_error ++{ ++ print STDERR "Try `${PROGRAM} --help' for more information.\n"; ++ exit; ++} ++ ++ ++sub print_message ++{ ++ print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; ++} ++ ++ ++sub preparation ++{ ++ if (!$XML_STYLE_ARG || !$NO_TRANSLATIONS_ARG) { ++ $PO_DIR = $ARGV[0]; ++ $FILE = $ARGV[1]; ++ $OUTFILE = $ARGV[2]; ++ ++ &gather_po_files; ++ &get_translation_database; ++ } else { ++ $FILE = $ARGV[0]; ++ $OUTFILE = $ARGV[1]; ++ } ++} ++ ++# General-purpose code for looking up translations in .po files ++ ++sub po_file2lang ++{ ++ my ($tmp) = @_; ++ $tmp =~ s/^.*\/(.*)\.po$/$1/; ++ return $tmp; ++} ++ ++sub gather_po_files ++{ ++ if (my $linguas = $ENV{"LINGUAS"}) ++ { ++ for my $lang (split / /, $linguas) { ++ my $po_file = $PO_DIR . "/" . $lang . ".po"; ++ if (-e $po_file) { ++ $po_files_by_lang{$lang} = $po_file; ++ } ++ } ++ } ++ else ++ { ++ if (open LINGUAS_FILE, "$PO_DIR/LINGUAS") ++ { ++ while () ++ { ++ next if /^#/; ++ ++ for my $lang (split) ++ { ++ chomp ($lang); ++ my $po_file = $PO_DIR . "/" . $lang . ".po"; ++ if (-e $po_file) { ++ $po_files_by_lang{$lang} = $po_file; ++ } ++ } ++ } ++ ++ close LINGUAS_FILE; ++ } ++ else ++ { ++ for my $po_file (glob "$PO_DIR/*.po") { ++ $po_files_by_lang{po_file2lang($po_file)} = $po_file; ++ } ++ } ++ } ++} ++ ++sub get_po_encoding ++{ ++ my ($in_po_file) = @_; ++ my $encoding = ""; ++ ++ open IN_PO_FILE, $in_po_file or die; ++ while () ++ { ++ ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" ++ if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) ++ { ++ $encoding = $1; ++ last; ++ } ++ } ++ close IN_PO_FILE; ++ ++ if (!$encoding) ++ { ++ print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; ++ $encoding = "ISO-8859-1"; ++ } ++ ++ return $encoding ++} ++ ++sub utf8_sanity_check ++{ ++ print STDERR "Warning: option --pass-through has been removed.\n" if $PASS_THROUGH_ARG; ++ $UTF8_ARG = 1; ++} ++ ++sub get_translation_database ++{ ++ if ($cache_file) { ++ &get_cached_translation_database; ++ } else { ++ &create_translation_database; ++ } ++} ++ ++sub get_newest_po_age ++{ ++ my $newest_age; ++ ++ foreach my $file (values %po_files_by_lang) ++ { ++ my $file_age = -M $file; ++ $newest_age = $file_age if !$newest_age || $file_age < $newest_age; ++ } ++ ++ $newest_age = 0 if !$newest_age; ++ ++ return $newest_age; ++} ++ ++sub create_cache ++{ ++ print "Generating and caching the translation database\n" unless $QUIET_ARG; ++ ++ &create_translation_database; ++ ++ open CACHE, ">$cache_file" || die; ++ print CACHE join "\x01", %translations; ++ close CACHE; ++} ++ ++sub load_cache ++{ ++ print "Found cached translation database\n" unless $QUIET_ARG; ++ ++ my $contents; ++ open CACHE, "<$cache_file" || die; ++ { ++ local $/; ++ $contents = ; ++ } ++ close CACHE; ++ %translations = split "\x01", $contents; ++} ++ ++sub get_cached_translation_database ++{ ++ open(my $lockfh, ">", "$cache_file.lock") or die $!; ++ flock($lockfh, LOCK_EX) or die "Could not lock '$cache_file.lock' - $!"; ++ my $cache_file_age = -M $cache_file; ++ if (defined $cache_file_age) ++ { ++ if ($cache_file_age <= &get_newest_po_age) ++ { ++ close($lockfh); ++ &load_cache; ++ return; ++ } ++ print "Found too-old cached translation database\n" unless $QUIET_ARG; ++ } ++ ++ &create_cache; ++ close($lockfh); ++} ++ ++sub add_translation ++{ ++ my ($lang, $encoding, $msgctxt, $msgid, $msgstr) = @_; ++ ++ return if !($msgid && $msgstr); ++ ++ if ($msgctxt) { ++ $msgid = "$msgctxt\004$msgid"; ++ } ++ if (uc $encoding ne "UTF-8") { ++ Encode::from_to ($msgid, $encoding, "UTF-8"); ++ Encode::from_to ($msgstr, $encoding, "UTF-8"); ++ } ++ $translations{$lang, $msgid} = $msgstr; ++} ++ ++sub create_translation_database ++{ ++ for my $lang (keys %po_files_by_lang) ++ { ++ my $po_file = $po_files_by_lang{$lang}; ++ my $encoding = "UTF-8"; ++ ++ if ($UTF8_ARG) ++ { ++ $encoding = get_po_encoding ($po_file); ++ if (uc $encoding ne "UTF-8") { ++ print "NOTICE: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; ++ } ++ } ++ open PO_FILE, "<$po_file"; ++ ++ my $nextfuzzy = 0; ++ my $inmsgctxt = 0; ++ my $inmsgid = 0; ++ my $inmsgstr = 0; ++ my $msgctxt = ""; ++ my $msgid = ""; ++ my $msgstr = ""; ++ ++ while () ++ { ++ $nextfuzzy = 1 if /^#, fuzzy/; ++ ++ if (/^msgctxt "((\\.|[^\\]+)*)"/ ) ++ { ++ if ($inmsgstr) { ++ add_translation ($lang, $encoding, ++ $msgctxt, $msgid, $msgstr); ++ $msgctxt = ""; ++ $msgid = ""; ++ $msgstr = ""; ++ } ++ ++ $msgctxt = unescape_po_string($1); ++ $inmsgctxt = 1; ++ $inmsgid = 0; ++ $inmsgstr = 0; ++ } ++ ++ if (/^msgid "((\\.|[^\\]+)*)"/ ) ++ { ++ if ($inmsgstr) { ++ add_translation ($lang, $encoding, ++ $msgctxt, $msgid, $msgstr); ++ $msgctxt = ""; ++ $msgid = ""; ++ $msgstr = ""; ++ } ++ ++ if ($nextfuzzy) { ++ $inmsgid = 0; ++ $nextfuzzy = 0; ++ } else { ++ $msgid = unescape_po_string($1); ++ $inmsgid = 1; ++ } ++ $inmsgctxt = 0; ++ $inmsgstr = 0; ++ } ++ ++ if (/^msgstr "((\\.|[^\\]+)*)"/) ++ { ++ $msgstr = unescape_po_string($1); ++ $inmsgstr = 1; ++ $inmsgctxt = 0; ++ $inmsgid = 0; ++ } ++ ++ if (/^"((\\.|[^\\]+)*)"/) ++ { ++ $msgctxt .= unescape_po_string($1) if $inmsgctxt; ++ $msgid .= unescape_po_string($1) if $inmsgid; ++ $msgstr .= unescape_po_string($1) if $inmsgstr; ++ } ++ } ++ add_translation ($lang, $encoding, $msgctxt, $msgid, $msgstr) ++ if ($inmsgstr); ++ } ++} ++ ++sub finalize ++{ ++} ++ ++sub unescape_one_sequence ++{ ++ my ($sequence) = @_; ++ ++ return "\\" if $sequence eq "\\\\"; ++ return "\"" if $sequence eq "\\\""; ++ return "\n" if $sequence eq "\\n"; ++ return "\r" if $sequence eq "\\r"; ++ return "\t" if $sequence eq "\\t"; ++ return "\b" if $sequence eq "\\b"; ++ return "\f" if $sequence eq "\\f"; ++ return "\a" if $sequence eq "\\a"; ++ return chr(11) if $sequence eq "\\v"; # vertical tab, see ascii(7) ++ ++ return chr(hex($1)) if ($sequence =~ /\\x([0-9a-fA-F]{2})/); ++ return chr(oct($1)) if ($sequence =~ /\\([0-7]{3})/); ++ ++ # FIXME: Is \0 supported as well? Kenneth and Rodney don't want it, see bug #48489 ++ ++ return $sequence; ++} ++ ++sub unescape_po_string ++{ ++ my ($string) = @_; ++ ++ $string =~ s/(\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\.)/unescape_one_sequence($1)/eg; ++ ++ return $string; ++} ++ ++sub entity_decode ++{ ++ local ($_) = @_; ++ ++ s/'/'/g; # ' ++ s/"/"/g; # " ++ s/<//g; ++ s/&/&/g; ++ ++ return $_; ++} ++ ++# entity_encode: (string) ++# ++# Encode the given string to XML format (encode '<' etc). ++ ++sub entity_encode ++{ ++ my ($pre_encoded) = @_; ++ ++ my @list_of_chars = unpack ('C*', $pre_encoded); ++ ++ # with UTF-8 we only encode minimalistic ++ return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); ++} ++ ++sub entity_encode_int_minimalist ++{ ++ return """ if $_ == 34; ++ return "&" if $_ == 38; ++ return "'" if $_ == 39; ++ return "<" if $_ == 60; ++ return ">" if $_ == 62; ++ return chr $_; ++} ++ ++sub entity_encoded_translation ++{ ++ my ($lang, $string) = @_; ++ ++ my $translation = $translations{$lang, $string}; ++ return $string if !$translation; ++ return entity_encode ($translation); ++} ++ ++## XML (bonobo-activation specific) merge code ++ ++sub ba_merge_translations ++{ ++ my $source; ++ ++ { ++ local $/; # slurp mode ++ open INPUT, "<$FILE" or die "can't open $FILE: $!"; ++ $source = ; ++ close INPUT; ++ } ++ ++ open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; ++ # Binmode so that selftest works ok if using a native Win32 Perl... ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ ++ while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) ++ { ++ print OUTPUT $1; ++ ++ my $node = $2 . "\n"; ++ ++ my @strings = (); ++ $_ = $node; ++ while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { ++ push @strings, entity_decode($3); ++ } ++ print OUTPUT; ++ ++ my %langs; ++ for my $string (@strings) ++ { ++ for my $lang (keys %po_files_by_lang) ++ { ++ $langs{$lang} = 1 if $translations{$lang, $string}; ++ } ++ } ++ ++ for my $lang (sort keys %langs) ++ { ++ $_ = $node; ++ s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; ++ s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; ++ print OUTPUT; ++ } ++ } ++ ++ print OUTPUT $source; ++ ++ close OUTPUT; ++} ++ ++ ++## XML (non-bonobo-activation) merge code ++ ++ ++# Process tag attributes ++# Only parameter is a HASH containing attributes -> values mapping ++sub getAttributeString ++{ ++ my $sub = shift; ++ my $do_translate = shift || 0; ++ my $language = shift || ""; ++ my $result = ""; ++ my $translate = shift; ++ foreach my $e (reverse(sort(keys %{ $sub }))) { ++ my $key = $e; ++ my $string = $sub->{$e}; ++ my $quote = '"'; ++ ++ $string =~ s/^[\s]+//; ++ $string =~ s/[\s]+$//; ++ ++ if ($string =~ /^'.*'$/) ++ { ++ $quote = "'"; ++ } ++ $string =~ s/^['"]//g; ++ $string =~ s/['"]$//g; ++ ++ if ($do_translate && $key =~ /^_/) { ++ $key =~ s|^_||g; ++ if ($language) { ++ # Handle translation ++ my $decode_string = entity_decode($string); ++ my $translation = $translations{$language, $decode_string}; ++ if ($translation) { ++ $translation = entity_encode($translation); ++ $string = $translation; ++ } ++ $$translate = 2; ++ } else { ++ $$translate = 2 if ($translate && (!$$translate)); # watch not to "overwrite" $translate ++ } ++ } ++ ++ $result .= " $key=$quote$string$quote"; ++ } ++ return $result; ++} ++ ++# Returns a translatable string from XML node, it works on contents of every node in XML::Parser tree ++sub getXMLstring ++{ ++ my $ref = shift; ++ my $spacepreserve = shift || 0; ++ my @list = @{ $ref }; ++ my $result = ""; ++ ++ my $count = scalar(@list); ++ my $attrs = $list[0]; ++ my $index = 1; ++ ++ $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); ++ $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); ++ ++ while ($index < $count) { ++ my $type = $list[$index]; ++ my $content = $list[$index+1]; ++ if (! $type ) { ++ # We've got CDATA ++ if ($content) { ++ # lets strip the whitespace here, and *ONLY* here ++ $content =~ s/\s+/ /gs if (!$spacepreserve); ++ $result .= $content; ++ } ++ } elsif ( "$type" ne "1" ) { ++ # We've got another element ++ $result .= "<$type"; ++ $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements ++ if ($content) { ++ my $subresult = getXMLstring($content, $spacepreserve); ++ if ($subresult) { ++ $result .= ">".$subresult . ""; ++ } else { ++ $result .= "/>"; ++ } ++ } else { ++ $result .= "/>"; ++ } ++ } ++ $index += 2; ++ } ++ return $result; ++} ++ ++# Translate list of nodes if necessary ++sub translate_subnodes ++{ ++ my $fh = shift; ++ my $content = shift; ++ my $language = shift || ""; ++ my $singlelang = shift || 0; ++ my $spacepreserve = shift || 0; ++ ++ my @nodes = @{ $content }; ++ ++ my $count = scalar(@nodes); ++ my $index = 0; ++ while ($index < $count) { ++ my $type = $nodes[$index]; ++ my $rest = $nodes[$index+1]; ++ if ($singlelang) { ++ my $oldMO = $MULTIPLE_OUTPUT; ++ $MULTIPLE_OUTPUT = 1; ++ traverse($fh, $type, $rest, $language, $spacepreserve); ++ $MULTIPLE_OUTPUT = $oldMO; ++ } else { ++ traverse($fh, $type, $rest, $language, $spacepreserve); ++ } ++ $index += 2; ++ } ++} ++ ++sub isWellFormedXmlFragment ++{ ++ my $ret = eval 'require XML::Parser'; ++ if(!$ret) { ++ die "You must have XML::Parser installed to run $0\n\n"; ++ } ++ ++ my $fragment = shift; ++ return 0 if (!$fragment); ++ ++ $fragment = "$fragment"; ++ my $xp = new XML::Parser(Style => 'Tree'); ++ my $tree = 0; ++ eval { $tree = $xp->parse($fragment); }; ++ return $tree; ++} ++ ++sub traverse ++{ ++ my $fh = shift; ++ my $nodename = shift; ++ my $content = shift; ++ my $language = shift || ""; ++ my $spacepreserve = shift || 0; ++ ++ if (!$nodename) { ++ if ($content =~ /^[\s]*$/) { ++ $leading_space .= $content; ++ } ++ print $fh $content; ++ } else { ++ # element ++ my @all = @{ $content }; ++ my $attrs = shift @all; ++ my $translate = 0; ++ my $outattr = getAttributeString($attrs, 1, $language, \$translate); ++ ++ if ($nodename =~ /^_/) { ++ $translate = 1; ++ $nodename =~ s/^_//; ++ } ++ my $lookup = ''; ++ ++ $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); ++ $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); ++ ++ print $fh "<$nodename", $outattr; ++ if ($translate) { ++ $content = getXMLstring($content, $spacepreserve); ++ if (!$spacepreserve) { ++ $content =~ s/^\s+//s; ++ $content =~ s/\s+$//s; ++ } ++ if (exists $attrs->{"msgctxt"}) { ++ my $context = entity_decode ($attrs->{"msgctxt"}); ++ $context =~ s/^["'](.*)["']/$1/; ++ $lookup = "$context\004$content"; ++ } else { ++ $lookup = $content; ++ } ++ ++ if ($lookup || $translate == 2) { ++ my $translation = $translations{$language, $lookup} if isWellFormedXmlFragment($translations{$language, $lookup}); ++ if ($MULTIPLE_OUTPUT && ($translation || $translate == 2)) { ++ $translation = $content if (!$translation); ++ print $fh " xml:lang=\"", $language, "\"" if $language; ++ print $fh ">"; ++ if ($translate == 2) { ++ translate_subnodes($fh, \@all, $language, 1, $spacepreserve); ++ } else { ++ print $fh $translation; ++ } ++ print $fh ""; ++ ++ return; # this means there will be no same translation with xml:lang="$language"... ++ # if we want them both, just remove this "return" ++ } else { ++ print $fh ">"; ++ if ($translate == 2) { ++ translate_subnodes($fh, \@all, $language, 1, $spacepreserve); ++ } else { ++ print $fh $content; ++ } ++ print $fh ""; ++ } ++ } else { ++ print $fh "/>"; ++ } ++ ++ for my $lang (sort keys %po_files_by_lang) { ++ if ($MULTIPLE_OUTPUT && $lang ne "$language") { ++ next; ++ } ++ if ($lang) { ++ # Handle translation ++ # ++ my $translate = 0; ++ my $localattrs = getAttributeString($attrs, 1, $lang, \$translate); ++ my $translation = $translations{$lang, $lookup} if isWellFormedXmlFragment($translations{$lang, $lookup}); ++ if ($translate && !$translation) { ++ $translation = $content; ++ } ++ ++ if ($translation || $translate) { ++ print $fh "\n"; ++ $leading_space =~ s/.*\n//g; ++ print $fh $leading_space; ++ print $fh "<", $nodename, " xml:lang=\"", $lang, "\"", $localattrs, ">"; ++ if ($translate == 2) { ++ translate_subnodes($fh, \@all, $lang, 1, $spacepreserve); ++ } else { ++ print $fh $translation; ++ } ++ print $fh ""; ++ } ++ } ++ } ++ ++ } else { ++ my $count = scalar(@all); ++ if ($count > 0) { ++ print $fh ">"; ++ my $index = 0; ++ while ($index < $count) { ++ my $type = $all[$index]; ++ my $rest = $all[$index+1]; ++ traverse($fh, $type, $rest, $language, $spacepreserve); ++ $index += 2; ++ } ++ print $fh ""; ++ } else { ++ print $fh "/>"; ++ } ++ } ++ } ++} ++ ++sub intltool_tree_comment ++{ ++ my $expat = shift; ++ my $data = shift; ++ my $clist = $expat->{Curlist}; ++ my $pos = $#$clist; ++ ++ push @$clist, 1 => $data; ++} ++ ++sub intltool_tree_cdatastart ++{ ++ my $expat = shift; ++ my $clist = $expat->{Curlist}; ++ my $pos = $#$clist; ++ ++ push @$clist, 0 => $expat->original_string(); ++} ++ ++sub intltool_tree_cdataend ++{ ++ my $expat = shift; ++ my $clist = $expat->{Curlist}; ++ my $pos = $#$clist; ++ ++ $clist->[$pos] .= $expat->original_string(); ++} ++ ++sub intltool_tree_char ++{ ++ my $expat = shift; ++ my $text = shift; ++ my $clist = $expat->{Curlist}; ++ my $pos = $#$clist; ++ ++ # Use original_string so that we retain escaped entities ++ # in CDATA sections. ++ # ++ if ($pos > 0 and $clist->[$pos - 1] eq '0') { ++ $clist->[$pos] .= $expat->original_string(); ++ } else { ++ push @$clist, 0 => $expat->original_string(); ++ } ++} ++ ++sub intltool_tree_start ++{ ++ my $expat = shift; ++ my $tag = shift; ++ my @origlist = (); ++ ++ # Use original_string so that we retain escaped entities ++ # in attribute values. We must convert the string to an ++ # @origlist array to conform to the structure of the Tree ++ # Style. ++ # ++ my @original_array = split /\x/, $expat->original_string(); ++ my $source = $expat->original_string(); ++ ++ # Remove leading tag. ++ # ++ $source =~ s|^\s*<\s*(\S+)||s; ++ ++ # Grab attribute key/value pairs and push onto @origlist array. ++ # ++ while ($source) ++ { ++ if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) ++ { ++ $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; ++ push @origlist, $1; ++ push @origlist, '"' . $2 . '"'; ++ } ++ elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) ++ { ++ $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; ++ push @origlist, $1; ++ push @origlist, "'" . $2 . "'"; ++ } ++ else ++ { ++ last; ++ } ++ } ++ ++ my $ol = [ { @origlist } ]; ++ ++ push @{ $expat->{Lists} }, $expat->{Curlist}; ++ push @{ $expat->{Curlist} }, $tag => $ol; ++ $expat->{Curlist} = $ol; ++} ++ ++sub readXml ++{ ++ my $filename = shift || return; ++ if(!-f $filename) { ++ die "ERROR Cannot find filename: $filename\n"; ++ } ++ ++ my $ret = eval 'require XML::Parser'; ++ if(!$ret) { ++ die "You must have XML::Parser installed to run $0\n\n"; ++ } ++ my $xp = new XML::Parser(Style => 'Tree'); ++ $xp->setHandlers(Char => \&intltool_tree_char); ++ $xp->setHandlers(Start => \&intltool_tree_start); ++ $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); ++ $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); ++ my $tree = $xp->parsefile($filename); ++ ++# Hello thereHowdydo ++# would be: ++# [foo, [{}, head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, [{}, ++# 0, "Howdy", ref, [{}]], 0, "do" ] ] ++ ++ return $tree; ++} ++ ++sub print_header ++{ ++ my $infile = shift; ++ my $fh = shift; ++ my $source; ++ ++ if(!-f $infile) { ++ die "ERROR Cannot find filename: $infile\n"; ++ } ++ ++ print $fh qq{\n}; ++ { ++ local $/; ++ open DOCINPUT, "<${FILE}" or die; ++ $source = ; ++ close DOCINPUT; ++ } ++ if ($source =~ /()/s) ++ { ++ print $fh "$1\n"; ++ } ++ elsif ($source =~ /(]*>)/s) ++ { ++ print $fh "$1\n"; ++ } ++} ++ ++sub parseTree ++{ ++ my $fh = shift; ++ my $ref = shift; ++ my $language = shift || ""; ++ ++ my $name = shift @{ $ref }; ++ my $cont = shift @{ $ref }; ++ ++ while (!$name || "$name" eq "1") { ++ $name = shift @{ $ref }; ++ $cont = shift @{ $ref }; ++ } ++ ++ my $spacepreserve = 0; ++ my $attrs = @{$cont}[0]; ++ $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); ++ ++ traverse($fh, $name, $cont, $language, $spacepreserve); ++} ++ ++sub xml_merge_output ++{ ++ my $source; ++ ++ if ($MULTIPLE_OUTPUT) { ++ for my $lang (sort keys %po_files_by_lang) { ++ if ( ! -d $lang ) { ++ mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; ++ } ++ open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ my $tree = readXml($FILE); ++ print_header($FILE, \*OUTPUT); ++ parseTree(\*OUTPUT, $tree, $lang); ++ close OUTPUT; ++ print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; ++ } ++ if ( ! -d "C" ) { ++ mkdir "C" or -d "C" or die "Cannot create subdirectory C: $!\n"; ++ } ++ open OUTPUT, ">C/$OUTFILE" or die "Cannot open C/$OUTFILE: $!\n"; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ my $tree = readXml($FILE); ++ print_header($FILE, \*OUTPUT); ++ parseTree(\*OUTPUT, $tree); ++ close OUTPUT; ++ print "CREATED C/$OUTFILE\n" unless $QUIET_ARG; ++ } else { ++ open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n"; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ my $tree = readXml($FILE); ++ print_header($FILE, \*OUTPUT); ++ parseTree(\*OUTPUT, $tree); ++ close OUTPUT; ++ print "CREATED $OUTFILE\n" unless $QUIET_ARG; ++ } ++} ++ ++sub keys_merge_translation ++{ ++ my ($lang) = @_; ++ ++ if ( ! -d $lang && $MULTIPLE_OUTPUT) ++ { ++ mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; ++ } ++ ++ open INPUT, "<${FILE}" or die "Cannot open ${FILE}: $!\n"; ++ open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ ++ while () ++ { ++ if (s/^(\s*)_(\w+=(.*))/$1$2/) ++ { ++ my $string = $3; ++ ++ if (!$MULTIPLE_OUTPUT) ++ { ++ print OUTPUT; ++ ++ my $non_translated_line = $_; ++ ++ for my $lang (sort keys %po_files_by_lang) ++ { ++ my $translation = $translations{$lang, $string}; ++ next if !$translation; ++ ++ $_ = $non_translated_line; ++ s/(\w+)=.*/[$lang]$1=$translation/; ++ print OUTPUT; ++ } ++ } ++ else ++ { ++ my $non_translated_line = $_; ++ my $translation = $translations{$lang, $string}; ++ $translation = $string if !$translation; ++ ++ $_ = $non_translated_line; ++ s/(\w+)=.*/$1=$translation/; ++ print OUTPUT; ++ } ++ } ++ else ++ { ++ print OUTPUT; ++ } ++ } ++ ++ close OUTPUT; ++ close INPUT; ++ ++ print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; ++} ++ ++sub keys_merge_translations ++{ ++ if ($MULTIPLE_OUTPUT) ++ { ++ for my $lang (sort keys %po_files_by_lang) ++ { ++ keys_merge_translation ($lang); ++ } ++ keys_merge_translation ("C"); ++ } ++ else ++ { ++ keys_merge_translation ("."); ++ } ++} ++ ++sub desktop_merge_translations ++{ ++ open INPUT, "<${FILE}" or die; ++ open OUTPUT, ">${OUTFILE}" or die; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ ++ while () ++ { ++ if (s/^(\s*)_([A-Za-z0-9\-]+\s*=\s*(.*))/$1$2/) ++ { ++ my $string = $3; ++ ++ print OUTPUT; ++ ++ my $non_translated_line = $_; ++ ++ for my $lang (sort keys %po_files_by_lang) ++ { ++ my $translation = $translations{$lang, unescape_po_string($string)}; ++ next if !$translation; ++ ++ # escape new lines ++ $translation =~ s/\n/\\n/g; ++ ++ # skip unchanged strings ++ next if $translation eq $string; ++ ++ $_ = $non_translated_line; ++ s/(\w+)\s*=\s*.*/${1}[$lang]=$translation/; ++ print OUTPUT; ++ } ++ } ++ else ++ { ++ print OUTPUT; ++ } ++ } ++ ++ close OUTPUT; ++ close INPUT; ++} ++ ++sub schemas_merge_translations ++{ ++ my $source; ++ ++ { ++ local $/; # slurp mode ++ open INPUT, "<$FILE" or die "can't open $FILE: $!"; ++ $source = ; ++ close INPUT; ++ } ++ ++ open OUTPUT, ">$OUTFILE" or die; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ ++ # FIXME: support attribute translations ++ ++ # Empty nodes never need translation, so unmark all of them. ++ # For example, <_foo/> is just replaced by . ++ $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; ++ ++ while ($source =~ s/ ++ (.*?) ++ (\s+)((\s*) ++ (\s*(?:\s*)?(.*?)\s*<\/default>)?(\s*) ++ (\s*(?:\s*)?(.*?)\s*<\/short>)?(\s*) ++ (\s*(?:\s*)?(.*?)\s*<\/long>)?(\s*) ++ <\/locale>) ++ //sx) ++ { ++ print OUTPUT $1; ++ ++ my $locale_start_spaces = $2 ? $2 : ''; ++ my $default_spaces = $4 ? $4 : ''; ++ my $short_spaces = $7 ? $7 : ''; ++ my $long_spaces = $10 ? $10 : ''; ++ my $locale_end_spaces = $13 ? $13 : ''; ++ my $c_default_block = $3 ? $3 : ''; ++ my $default_string = $6 ? $6 : ''; ++ my $short_string = $9 ? $9 : ''; ++ my $long_string = $12 ? $12 : ''; ++ ++ print OUTPUT "$locale_start_spaces$c_default_block"; ++ ++ $default_string =~ s/\s+/ /g; ++ $default_string = entity_decode($default_string); ++ $short_string =~ s/\s+/ /g; ++ $short_string = entity_decode($short_string); ++ $long_string =~ s/\s+/ /g; ++ $long_string = entity_decode($long_string); ++ ++ for my $lang (sort keys %po_files_by_lang) ++ { ++ my $default_translation = $translations{$lang, $default_string}; ++ my $short_translation = $translations{$lang, $short_string}; ++ my $long_translation = $translations{$lang, $long_string}; ++ ++ next if (!$default_translation && !$short_translation && ++ !$long_translation); ++ ++ print OUTPUT "\n$locale_start_spaces"; ++ ++ print OUTPUT "$default_spaces"; ++ ++ if ($default_translation) ++ { ++ $default_translation = entity_encode($default_translation); ++ print OUTPUT "$default_translation"; ++ } ++ ++ print OUTPUT "$short_spaces"; ++ ++ if ($short_translation) ++ { ++ $short_translation = entity_encode($short_translation); ++ print OUTPUT "$short_translation"; ++ } ++ ++ print OUTPUT "$long_spaces"; ++ ++ if ($long_translation) ++ { ++ $long_translation = entity_encode($long_translation); ++ print OUTPUT "$long_translation"; ++ } ++ ++ print OUTPUT "$locale_end_spaces"; ++ } ++ } ++ ++ print OUTPUT $source; ++ ++ close OUTPUT; ++} ++ ++sub rfc822deb_merge_translations ++{ ++ my %encodings = (); ++ for my $lang (keys %po_files_by_lang) { ++ $encodings{$lang} = ($UTF8_ARG ? 'UTF-8' : get_po_encoding($po_files_by_lang{$lang})); ++ } ++ ++ my $source; ++ ++ $Text::Wrap::huge = 'overflow'; ++ $Text::Wrap::break = qr/\n|\s(?=\S)/; ++ ++ { ++ local $/; # slurp mode ++ open INPUT, "<$FILE" or die "can't open $FILE: $!"; ++ $source = ; ++ close INPUT; ++ } ++ ++ open OUTPUT, ">${OUTFILE}" or die; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ ++ while ($source =~ /(^|\n+)(_*)([^:\s]+)(:[ \t]*)(.*?)(?=\n[\S\n]|$)/sg) ++ { ++ my $sep = $1; ++ my $non_translated_line = $3.$4; ++ my $string = $5; ++ my $underscore = length($2); ++ next if $underscore eq 0 && $non_translated_line =~ /^#/; ++ # Remove [] dummy strings ++ my $stripped = $string; ++ $stripped =~ s/\[\s[^\[\]]*\],/,/g if $underscore eq 2; ++ $stripped =~ s/\[\s[^\[\]]*\]$//; ++ $non_translated_line .= $stripped; ++ ++ print OUTPUT $sep.$non_translated_line; ++ ++ if ($underscore) ++ { ++ my @str_list = rfc822deb_split($underscore, $string); ++ ++ for my $lang (sort keys %po_files_by_lang) ++ { ++ my $is_translated = 1; ++ my $str_translated = ''; ++ my $first = 1; ++ ++ for my $str (@str_list) ++ { ++ my $translation = $translations{$lang, $str}; ++ ++ if (!$translation) ++ { ++ $is_translated = 0; ++ last; ++ } ++ ++ # $translation may also contain [] dummy ++ # strings, mostly to indicate an empty string ++ $translation =~ s/\[\s[^\[\]]*\]$//; ++ ++ if ($first) ++ { ++ if ($underscore eq 2) ++ { ++ $str_translated .= $translation; ++ } ++ else ++ { ++ $str_translated .= ++ Text::Tabs::expand($translation) . ++ "\n"; ++ } ++ } ++ else ++ { ++ if ($underscore eq 2) ++ { ++ $str_translated .= ', ' . $translation; ++ } ++ else ++ { ++ $str_translated .= Text::Tabs::expand( ++ Text::Wrap::wrap(' ', ' ', $translation)) . ++ "\n .\n"; ++ } ++ } ++ $first = 0; ++ ++ # To fix some problems with Text::Wrap::wrap ++ $str_translated =~ s/(\n )+\n/\n .\n/g; ++ } ++ next unless $is_translated; ++ ++ $str_translated =~ s/\n \.\n$//; ++ $str_translated =~ s/\s+$//; ++ ++ $_ = $non_translated_line; ++ s/^(\w+):\s*.*/$sep${1}-$lang.$encodings{$lang}: $str_translated/s; ++ print OUTPUT; ++ } ++ } ++ } ++ print OUTPUT "\n"; ++ ++ close OUTPUT; ++ close INPUT; ++} ++ ++sub rfc822deb_split ++{ ++ # Debian defines a special way to deal with rfc822-style files: ++ # when a value contain newlines, it consists of ++ # 1. a short form (first line) ++ # 2. a long description, all lines begin with a space, ++ # and paragraphs are separated by a single dot on a line ++ # This routine returns an array of all paragraphs, and reformat ++ # them. ++ # When first argument is 2, the string is a comma separated list of ++ # values. ++ my $type = shift; ++ my $text = shift; ++ $text =~ s/^[ \t]//mg; ++ return (split(/, */, $text, 0)) if $type ne 1; ++ return ($text) if $text !~ /\n/; ++ ++ $text =~ s/([^\n]*)\n//; ++ my @list = ($1); ++ my $str = ''; ++ ++ for my $line (split (/\n/, $text)) ++ { ++ chomp $line; ++ if ($line =~ /^\.\s*$/) ++ { ++ # New paragraph ++ $str =~ s/\s*$//; ++ push(@list, $str); ++ $str = ''; ++ } ++ elsif ($line =~ /^\s/) ++ { ++ # Line which must not be reformatted ++ $str .= "\n" if length ($str) && $str !~ /\n$/; ++ $line =~ s/\s+$//; ++ $str .= $line."\n"; ++ } ++ else ++ { ++ # Continuation line, remove newline ++ $str .= " " if length ($str) && $str !~ /\n$/; ++ $str .= $line; ++ } ++ } ++ ++ $str =~ s/\s*$//; ++ push(@list, $str) if length ($str); ++ ++ return @list; ++} ++ ++sub quoted_translation ++{ ++ my ($xml_mode, $lang, $string) = @_; ++ ++ $string = entity_decode($string) if $xml_mode; ++ $string =~ s/\\\"/\"/g; ++ ++ my $translation = $translations{$lang, $string}; ++ $translation = $string if !$translation; ++ $translation = entity_encode($translation) if $xml_mode; ++ $translation =~ s/\"/\\\"/g; ++ return $translation ++} ++ ++sub quoted_merge_translations ++{ ++ my ($xml_mode) = @_; ++ ++ if (!$MULTIPLE_OUTPUT) { ++ print "Quoted only supports Multiple Output.\n"; ++ exit(1); ++ } ++ ++ for my $lang (sort keys %po_files_by_lang) { ++ if ( ! -d $lang ) { ++ mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; ++ } ++ open INPUT, "<${FILE}" or die; ++ open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; ++ binmode (OUTPUT) if $^O eq 'MSWin32'; ++ while () ++ { ++ s/\"(([^\"]|\\\")*[^\\\"])\"/"\"" . "ed_translation($xml_mode, $lang, $1) . "\""/ge; ++ print OUTPUT; ++ } ++ close OUTPUT; ++ close INPUT; ++ } ++} +diff -Naur orig/modules/tde_uic.cmake tde-cmake-trinity-14.1.3/modules/tde_uic.cmake +--- orig/modules/tde_uic.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/modules/tde_uic.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,79 @@ ++################################################# ++# ++# (C) 2010-2011 Serghei Amelian ++# serghei (DOT) amelian (AT) gmail.com ++# ++# Improvements and feedback are welcome ++# ++# This file is released under GPL >= 2 ++# ++################################################# ++ ++if( NOT ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules ) ++ set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" ) ++endif() ++include( TDEMacros ) ++ ++get_filename_component( _ui_basename ${UI_FILE} NAME_WE ) ++ ++# FIXME this will working only on out-of-source mode ++set( local_ui_file ${_ui_basename}.ui ) ++configure_file( ${UI_FILE} ${local_ui_file} COPYONLY ) ++tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file} ) ++ ++# ui.h extension file, if exists ++if( EXISTS "${UI_FILE}.h" ) ++ configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY ) ++ tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file}.h ) ++endif( ) ++ ++if( TDE_TQTPLUGINS_DIR ) ++ set( L -L ${TDE_TQTPLUGINS_DIR} ) ++endif( ) ++ ++# Choose translation function, different for TQt and TDE ++if ( TDE_FOUND AND NOT TQT_ONLY ) ++ set( TR_FUNC "tr2i18n" ) ++else( TDE_FOUND AND NOT TQT_ONLY ) ++ set( TR_FUNC "tr" ) ++endif( TDE_FOUND AND NOT TQT_ONLY ) ++ ++# Generate ui .h file ++tde_execute_process( COMMAND ${UIC_EXECUTABLE} ++ -nounload -tr ${TR_FUNC} ++ ${L} ++ ${local_ui_file} ++ OUTPUT_VARIABLE _ui_h_content ) ++ ++if( _ui_h_content ) ++ string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" ) ++ string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" ) ++ if ( TDE_FOUND AND NOT TQT_ONLY ) ++ string( REGEX REPLACE "public T?QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" ) ++ string( REGEX REPLACE "#include <(n?t)?qwizard.h>" "#include " _ui_h_content "${_ui_h_content}" ) ++ endif( TDE_FOUND AND NOT TQT_ONLY ) ++ file( WRITE ${_ui_basename}.h "${_ui_h_content}" ) ++endif( ) ++ ++# Generate ui .cpp file ++tde_execute_process( COMMAND ${UIC_EXECUTABLE} ++ -nounload -tr ${TR_FUNC} ++ ${L} ++ -impl ${_ui_basename}.h ++ ${local_ui_file} ++ OUTPUT_VARIABLE _ui_cpp_content ) ++ ++if( _ui_cpp_content ) ++ string( REGEX REPLACE "${TR_FUNC}\\(\"\"\\)" "TQString::null" _ui_cpp_content "${_ui_cpp_content}" ) ++ string( REGEX REPLACE "${TR_FUNC}\\(\"\", \"\"\\)" "TQString::null" _ui_cpp_content "${_ui_cpp_content}" ) ++ if ( TDE_FOUND AND NOT TQT_ONLY ) ++ string( REGEX REPLACE ": T?QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" ) ++ set( _ui_cpp_content "#include \n#include \n\n${_ui_cpp_content}" ) ++ endif( TDE_FOUND AND NOT TQT_ONLY ) ++ file( WRITE ${_ui_basename}.cpp "${_ui_cpp_content}" ) ++ ++ tde_execute_process( COMMAND ${MOC_EXECUTABLE} ++ ${_ui_basename}.h ++ OUTPUT_VARIABLE _ui_h_moc_content ) ++ file( APPEND ${_ui_basename}.cpp "${_ui_h_moc_content}" ) ++endif( _ui_cpp_content ) +diff -Naur orig/templates/tde_dummy_cpp.cmake tde-cmake-trinity-14.1.3/templates/tde_dummy_cpp.cmake +--- orig/templates/tde_dummy_cpp.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/templates/tde_dummy_cpp.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,5 @@ ++#ifdef _AIX ++ namespace { ++ void *not_empty_file; ++ } ++#endif +diff -Naur orig/templates/tde_export_library.cmake tde-cmake-trinity-14.1.3/templates/tde_export_library.cmake +--- orig/templates/tde_export_library.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/templates/tde_export_library.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,8 @@ ++add_library( @_target@ @_type@ IMPORTED ) ++ ++set_target_properties( @_target@ PROPERTIES ++ INTERFACE_COMPILE_FEATURES "@_cxx_features@" ++ IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@" ++ IMPORTED_LOCATION "@_location@" ++ IMPORTED_SONAME "@_soname@" ) ++ +diff -Naur orig/templates/tde_libtool_file.cmake tde-cmake-trinity-14.1.3/templates/tde_libtool_file.cmake +--- orig/templates/tde_libtool_file.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/templates/tde_libtool_file.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,35 @@ ++# @_laname@ - a libtool library file ++# Generated by CMake - GNU libtool ++# ++# Please DO NOT delete this file! ++# It is necessary for linking the library. ++ ++# The name that we can dlopen(3). ++dlname='@_library_name_2@' ++ ++# Names of this library. ++library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@' ++ ++# The name of the static archive. ++old_library='' ++ ++# Libraries that this one depends upon. ++dependency_libs='' ++ ++# Version information for @_name@. ++current=@_version_current@ ++age=@_version_age@ ++revision=@_version_revision@ ++ ++# Is this an already installed library? ++installed=yes ++ ++# Should we warn about portability when linking against -modules? ++shouldnotlink=@_shouldnotlink@ ++ ++# Files to dlopen/dlpreopen ++dlopen='' ++dlpreopen='' ++ ++# Directory that this library needs to be installed in: ++libdir='@_libdir@' +diff -Naur orig/templates/tde_tdeinit_executable.cmake tde-cmake-trinity-14.1.3/templates/tde_tdeinit_executable.cmake +--- orig/templates/tde_tdeinit_executable.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/templates/tde_tdeinit_executable.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,2 @@ ++extern "C" int kdemain(int argc, char* argv[]); ++int main(int argc, char* argv[]) { return kdemain(argc,argv); } +diff -Naur orig/templates/tde_tdeinit_module.cmake tde-cmake-trinity-14.1.3/templates/tde_tdeinit_module.cmake +--- orig/templates/tde_tdeinit_module.cmake 1970-01-01 08:00:00.000000000 +0800 ++++ tde-cmake-trinity-14.1.3/templates/tde_tdeinit_module.cmake 2024-10-15 00:00:02.000000000 +0800 +@@ -0,0 +1,3 @@ ++#include ++extern "C" int kdemain(int argc, char* argv[]); ++extern "C" TDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }