summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-03-25 02:43:36 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-03-25 02:51:34 +0100
commit51411c5022e4506b632a377614ee66fee472bf9b (patch)
treeedb171ee32d16b3af75f2c776941bf56d35b476b
parent23076a668ac711ba0fb4fd10e3b615c5cc6fc1d6 (diff)
downloadtdelibs-51411c5022e4506b632a377614ee66fee472bf9b.tar.gz
tdelibs-51411c5022e4506b632a377614ee66fee472bf9b.zip
The date for updating the release information in docbook
entities is converted exclusively by cmake code instead of calling the "date" binary because it may have different options on different systems. If the file modification date is to be determined, GNU find is necessary. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 55b56c2e5010ffde0673d4a988c451be390fd817)
-rw-r--r--kdoctools/ConfigureChecks.cmake30
1 files changed, 19 insertions, 11 deletions
diff --git a/kdoctools/ConfigureChecks.cmake b/kdoctools/ConfigureChecks.cmake
index 432811825..c98843e23 100644
--- a/kdoctools/ConfigureChecks.cmake
+++ b/kdoctools/ConfigureChecks.cmake
@@ -38,23 +38,31 @@ if( NOT TDE_RELEASE_ENTITIES )
if( TDE_SCM_MODULE_DATETIME )
set( TDE_RELEASE_DATE "${TDE_SCM_MODULE_DATETIME}" )
else( )
+ if( ${CMAKE_SYSTEM_NAME} MATCHES "BSD" )
+ set( GNU_FIND_EXECUTABLE "gfind" )
+ else( )
+ set( GNU_FIND_EXECUTABLE "find" )
+ endif( )
execute_process(
- COMMAND find ${TDEVERSION_FILE} -printf "%Tm/%Te/%TY"
+ COMMAND ${GNU_FIND_EXECUTABLE} ${TDEVERSION_FILE} -printf "%Tm/%Te/%TY"
OUTPUT_VARIABLE TDE_RELEASE_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif( )
endif( )
- execute_process(
- COMMAND date +2010-%Y -d "${TDE_RELEASE_DATE}"
- OUTPUT_VARIABLE TDE_RELEASE_COPYRIGHT
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- execute_process(
- COMMAND date +%B\ %e,\ %Y -d "${TDE_RELEASE_DATE}"
- OUTPUT_VARIABLE TDE_RELEASE_DATE
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
+
+ string( REGEX REPLACE "^([0-9]+)/([0-9]+)*/([0-9]+).*" "2010-\\3"
+ TDE_RELEASE_COPYRIGHT "${TDE_RELEASE_DATE}" )
+
+ string( REGEX REPLACE "^([0-9]+)/([0-9]+)*/([0-9]+).*" "\\1"
+ _release_month_num "${TDE_RELEASE_DATE}" )
+ math( EXPR _release_month_index "${_release_month_num}-1" )
+ set( _month_names "January;February;March;April;May;June;July;August;September;October;November;December" )
+ list( GET _month_names ${_release_month_index} _release_month_name )
+ string( REGEX REPLACE
+ "^([0-9]+)/([0-9]+)*/([0-9]+).*"
+ "${_release_month_name} \\2, \\3"
+ TDE_RELEASE_DATE "${TDE_RELEASE_DATE}" )
# update entities
message( STATUS "Updating ${ENTITIES_FILE}