tde_create_translated_desktop: Add the ability to process multiple source

files to be installed in the same destination folder.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 7592371d26)
v3.5.13-sru
Slávek Banko 5 years ago
parent 0368210118
commit 25375aaa87
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1584,13 +1584,13 @@ endmacro( )
macro( tde_create_translated_desktop ) macro( tde_create_translated_desktop )
unset( _src ) unset( _srcs )
unset( _arg_out_name )
unset( _arg_po_dir )
unset( _keywords_add ) unset( _keywords_add )
unset( _po_dir )
unset( _dest ) unset( _dest )
unset( _out_name )
unset( _directive ) unset( _directive )
set( _var _src ) set( _var _srcs )
set( _keywords_desktop_default set( _keywords_desktop_default
"Name" "GenericName" "Comment" "Keywords" "Name" "GenericName" "Comment" "Keywords"
"Description" "ExtraNames" "X-TDE-Submenu" ) "Description" "ExtraNames" "X-TDE-Submenu" )
@ -1599,8 +1599,8 @@ macro( tde_create_translated_desktop )
# found directive "SOURCE" # found directive "SOURCE"
if( "+${_arg}" STREQUAL "+SOURCE" ) if( "+${_arg}" STREQUAL "+SOURCE" )
unset( _src ) unset( _srcs )
set( _var _src ) set( _var _srcs )
set( _directive 1 ) set( _directive 1 )
endif( ) endif( )
@ -1613,8 +1613,8 @@ macro( tde_create_translated_desktop )
# found directive "PO_DIR" # found directive "PO_DIR"
if( "+${_arg}" STREQUAL "+PO_DIR" ) if( "+${_arg}" STREQUAL "+PO_DIR" )
unset( _po_dir ) unset( _arg_po_dir )
set( _var _po_dir ) set( _var _arg_po_dir )
set( _directive 1 ) set( _directive 1 )
endif( ) endif( )
@ -1627,8 +1627,8 @@ macro( tde_create_translated_desktop )
# found directive "OUTPUT_NAME" # found directive "OUTPUT_NAME"
if( "+${_arg}" STREQUAL "+OUTPUT_NAME" ) if( "+${_arg}" STREQUAL "+OUTPUT_NAME" )
unset( _out_name ) unset( _arg_out_name )
set( _var _out_name ) set( _var _arg_out_name )
set( _directive 1 ) set( _directive 1 )
endif( ) endif( )
@ -1641,6 +1641,22 @@ macro( tde_create_translated_desktop )
endforeach( ) 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 # select a tool for merging desktop file translations
# #
# Because some of our desktop files contain underscores in variable # Because some of our desktop files contain underscores in variable
@ -1681,10 +1697,10 @@ macro( tde_create_translated_desktop )
endif( ) endif( )
endforeach( ) endforeach( )
# no source file specified! # process source files
if( NOT _src ) foreach( _src IN LISTS _srcs )
tde_message_fatal( "no source desktop file specified" )
endif( ) # get a base name and a directory
get_filename_component( _basename ${_src} ABSOLUTE ) get_filename_component( _basename ${_src} ABSOLUTE )
get_filename_component( _basedir ${_basename} PATH ) get_filename_component( _basedir ${_basename} PATH )
file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" ) file( RELATIVE_PATH _basename "${CMAKE_CURRENT_SOURCE_DIR}" "${_basename}" )
@ -1701,14 +1717,16 @@ macro( tde_create_translated_desktop )
string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" ) string( REGEX REPLACE "\\.cmake$" "" _basename "${_basename}" )
endif() endif()
# if no output name specified, use the same as source # determine output name
if( NOT _out_name ) if( _arg_out_name )
set( _out_name ${_arg_out_name} )
else()
get_filename_component( _out_name ${_basename} NAME ) get_filename_component( _out_name ${_basename} NAME )
endif( ) endif( )
# determine po directory # determine po directory
if( _po_dir ) if( _arg_po_dir )
set( _po_base ${_po_dir} ) set( _po_base ${_arg_po_dir} )
else() else()
get_filename_component( _po_base ${_basename} NAME ) get_filename_component( _po_base ${_basename} NAME )
endif() endif()
@ -1728,11 +1746,6 @@ macro( tde_create_translated_desktop )
endif( ) endif( )
endif( ) endif( )
# if no destination directory specified, install as application link
if( NOT _dest )
set( _dest ${XDG_APPS_INSTALL_DIR} )
endif( )
# are there any translations available? # are there any translations available?
unset( _translations ) unset( _translations )
if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" ) if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" )
@ -1808,6 +1821,8 @@ macro( tde_create_translated_desktop )
DESTINATION ${_dest} DESTINATION ${_dest}
) )
endforeach()
endmacro( ) endmacro( )

Loading…
Cancel
Save