summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2020-03-12 19:49:57 +0100
committerSlávek Banko <[email protected]>2020-03-23 17:20:26 +0100
commit589e29d02047aaae584234d0568ef03da6cfd47f (patch)
treef98756d68fc029c3e84b109cbf03e8da3349eda0
parentad602fcd91eee974750a1323d6e187461b1f8210 (diff)
downloadtde-cmake-589e29d02047aaae584234d0568ef03da6cfd47f.tar.gz
tde-cmake-589e29d02047aaae584234d0568ef03da6cfd47f.zip
Use the source package date or the source git repository date
instead of the current build date. The use of a stable date is necessary to achieve reproducible builds. Signed-off-by: Slávek Banko <[email protected]>
-rw-r--r--modules/FindTDE.cmake9
-rw-r--r--modules/TDEMacros.cmake55
2 files changed, 55 insertions, 9 deletions
diff --git a/modules/FindTDE.cmake b/modules/FindTDE.cmake
index 01e6f46..ff33a13 100644
--- a/modules/FindTDE.cmake
+++ b/modules/FindTDE.cmake
@@ -89,13 +89,8 @@ if( NOT TDE_FOUND )
set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
CACHE INTERNAL "dcopidlng executable" FORCE )
- # look for SCM data if present
- 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" )
+ # read source metadata
+ tde_read_src_metadata()
message( STATUS " found 'TDE', version ${TDE_VERSION}" )
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index a5603cf..fa7934b 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -102,6 +102,47 @@ macro( tde_execute_process )
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_REVISION "${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 )
+
+
if( DEFINED MASTER_SOURCE_DIR )
return( )
endif( )
@@ -942,9 +983,16 @@ endmacro( tde_add_kpart )
#################################################
#####
##### tde_curdatetime
+
macro( tde_curdatetime result )
- tde_execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
- string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${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" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
+ string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} )
+ endif( )
endmacro( tde_curdatetime )
@@ -978,6 +1026,9 @@ macro( tde_add_executable _arg_target )
# 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} )