Automatically generate ELF metadata for each TDE executable

This is another first for a Linux desktop environment!
pull/1/head
Timothy Pearson 13 years ago
parent 42b03b0965
commit 6092ca3fd1

@ -3,6 +3,9 @@
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# (C) 2011-2012 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
@ -695,6 +698,15 @@ macro( tde_add_kpart _target )
endmacro( tde_add_kpart )
#################################################
#####
##### tde_curdatetime
macro( tde_curdatetime result )
execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} )
endmacro( tde_curdatetime )
#################################################
#####
##### tde_add_executable
@ -711,6 +723,21 @@ macro( tde_add_executable _arg_target )
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" )
tde_curdatetime( _datetime )
foreach( _arg ${ARGV} )
# this variable help us to skip
@ -760,6 +787,44 @@ macro( tde_add_executable _arg_target )
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}" )
@ -805,6 +870,18 @@ macro( tde_add_executable _arg_target )
endif( _setuid )
endif( _destination )
# embed icon, name, and metadata
set( ELF_EMBEDDING_METADATA "\"${_target}\" \"${_description}\" \"${_license}\" \"${_copyright}\" \"${_authors}\" \"${_product}\" \"${_organization}\" \"${_version}\" \"${_datetime}\" \"${_notes}\"" )
separate_arguments( ELF_EMBEDDING_METADATA )
add_custom_command(
TARGET ${_target}
POST_BUILD
COMMAND ./tdelfeditor -m ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${ELF_EMBEDDING_METADATA} || true
COMMAND ./tdelfeditor -e ${CMAKE_CURRENT_BINARY_DIR}/${_target} || true
COMMAND ./tdelfeditor -t ${CMAKE_CURRENT_BINARY_DIR}/${_target} ${_target} || true
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin
)
endmacro( tde_add_executable )

Loading…
Cancel
Save