[LyX/2.3.x] Cmake config: Respect the patch-level while creating package from tar/zip-source

Kornel Benko kornel at lyx.org
Sat Jan 18 09:26:07 UTC 2020


commit d537d55b6955bddb55e5dff9c4b6ad34fb53d2b7
Author: Kornel Benko <kornel at lyx.org>
Date:   Sat Jan 18 10:40:31 2020 +0100

    Cmake config: Respect the patch-level while creating package from tar/zip-source
    
    Rename some variables to match the ones used by automake
    Slightly modified patch from Eugene Chornyi <technikmagma at gmail.com>
---
 CMakeLists.txt                   |   21 ++++++++++++++++-----
 development/cmake/config.h.cmake |    2 ++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c3a947..7520f11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,12 +361,19 @@ foreach(_c_l ${_config_lines} )
 		setstripped(PACKAGE_BASE ${CMAKE_MATCH_1})
 		setstripped(PACKAGE_VERSION ${CMAKE_MATCH_2})
 		setstripped(PACKAGE_BUGREPORT ${CMAKE_MATCH_3})
-		if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\)?.*$")
+		if(PACKAGE_VERSION MATCHES "^\([0-9]+\)\\.\([0-9]+\)\(\\.\([0-9]+\)\(\\.\([0-9]+\)\)?\)?.*$")
 			set(LYX_MAJOR_VERSION ${CMAKE_MATCH_1})
 			set(LYX_MINOR_VERSION ${CMAKE_MATCH_2})
-			set(LYX_PATCH_VERSION ${CMAKE_MATCH_4})
+			set(LYX_RELEASE_LEVEL ${CMAKE_MATCH_4})
+			set(LYX_RELEASE_PATCH ${CMAKE_MATCH_6})
 			set(LYX_DIR_VER "LYX_DIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
 			set(LYX_USERDIR_VER "LYX_USERDIR_${CMAKE_MATCH_1}${CMAKE_MATCH_2}x")
+			if (NOT LYX_RELEASE_LEVEL)
+				set(LYX_RELEASE_LEVEL 0)
+			endif()
+			if (NOT LYX_RELEASE_PATCH)
+				set(LYX_RELEASE_PATCH 0)
+			endif()
 			if ("${LYX_SUFFIX_VALUE}" MATCHES "")
 			  set(LYX_INSTALL_SUFFIX "${LYX_MAJOR_VERSION}.${LYX_MINOR_VERSION}")
 			else()
@@ -381,11 +388,11 @@ endforeach(_c_l)
 
 FIND_PROGRAM(LYX_GITVERSION git)
 #message(STATUS "gitversion = ${LYX_GITVERSION}")
-set(LYX_REVISION_VERSION ${LYX_PATCH_VERSION})
+set(LYX_REVISION_VERSION ${LYX_RELEASE_LEVEL})
 set(LYX_PACKAGE_RELEASE "1")
 if(LYX_GITVERSION)
   if (LYX_LOCALVERSIONING)
-    # Find the revision number and for later use
+    # Find the revision number for later use
     EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} describe --match 2.0.0 HEAD
       WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE tmp_LYX_PACKAGE_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
     if (tmp_LYX_PACKAGE_RELEASE MATCHES "^2\\.0\\.0\\-\([0-9]+\)\\-\(.*\)$")
@@ -394,10 +401,14 @@ if(LYX_GITVERSION)
       # previous svn.
       # We use this value than also to set the package-patch-value
       MATH(EXPR tmp_REVISION_VERSION "(${CMAKE_MATCH_1}+40000)")
-      set(LYX_REVISION_VERSION "${LYX_PATCH_VERSION}-${tmp_REVISION_VERSION}git")
+      set(LYX_REVISION_VERSION "${LYX_RELEASE_LEVEL}-${tmp_REVISION_VERSION}git")
       set(ENABLE_DIST ON)
     endif()
   endif()
+else()
+  if (LYX_RELEASE_PATCH GREATER 0)
+    set(LYX_REVISION_VERSION "${LYX_RELEASE_LEVEL}.${LYX_RELEASE_PATCH}")
+  endif()
 endif()
 
 # Set the programs (lyx, tex2lyx, etc.) suffix
diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake
index fd08c45..3512416 100644
--- a/development/cmake/config.h.cmake
+++ b/development/cmake/config.h.cmake
@@ -33,6 +33,8 @@
 #cmakedefine LYX_USERDIR_VER "${LYX_USERDIR_VER}"
 #define LYX_MAJOR_VERSION ${LYX_MAJOR_VERSION}
 #define LYX_MINOR_VERSION ${LYX_MINOR_VERSION}
+#define LYX_RELEASE_LEVEL ${LYX_RELEASE_LEVEL}
+#define LYX_RELEASE_PATCH ${LYX_RELEASE_PATCH}
 
 #define PROGRAM_SUFFIX "${PROGRAM_SUFFIX}"
 #define LYX_ABS_INSTALLED_DATADIR "${LYX_ABS_INSTALLED_DATADIR}"


More information about the lyx-cvs mailing list