mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
ceafc6575f
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
85 lines
2.9 KiB
Diff
85 lines
2.9 KiB
Diff
From b6276044940361b2da09b41a878e507374a85377 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Hansen <bassmadrigal@users.noreply.github.com>
|
|
Date: Wed, 30 Oct 2024 16:55:51 -0700
|
|
Subject: [PATCH] Make git revision detection optional
|
|
|
|
Potentially fixes clementine-player/Clementine#7355
|
|
---
|
|
cmake/Version.cmake | 58 +++++++++++++++++++++++----------------------
|
|
1 file changed, 30 insertions(+), 28 deletions(-)
|
|
|
|
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
|
|
index ee99f6abce..8fdb523544 100644
|
|
--- a/cmake/Version.cmake
|
|
+++ b/cmake/Version.cmake
|
|
@@ -119,39 +119,41 @@ else(CLEMENTINE_VERSION_PRERELEASE)
|
|
endif(CLEMENTINE_VERSION_PRERELEASE)
|
|
|
|
# Add git revision
|
|
-if(FORCE_GIT_REVISION)
|
|
- set(GIT_REV ${FORCE_GIT_REVISION})
|
|
- set(GIT_INFO_RESULT 0)
|
|
-else(FORCE_GIT_REVISION)
|
|
- find_program(GIT_EXECUTABLE git)
|
|
- message(STATUS "Found git: ${GIT_EXECUTABLE}")
|
|
-
|
|
- if(NOT GIT_EXECUTABLE-NOTFOUND)
|
|
- execute_process(COMMAND ${GIT_EXECUTABLE} describe
|
|
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
- RESULT_VARIABLE GIT_INFO_RESULT
|
|
- OUTPUT_VARIABLE GIT_REV
|
|
- OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
- if(NOT ${GIT_INFO_RESULT} EQUAL 0)
|
|
- message(SEND_ERROR "git describe failed with code ${GIT_INFO_RESULT}: ${GIT_REV}")
|
|
+if(INCLUDE_GIT_REVISION)
|
|
+ if(FORCE_GIT_REVISION)
|
|
+ set(GIT_REV ${FORCE_GIT_REVISION})
|
|
+ set(GIT_INFO_RESULT 0)
|
|
+ else(FORCE_GIT_REVISION)
|
|
+ find_program(GIT_EXECUTABLE git)
|
|
+ message(STATUS "Found git: ${GIT_EXECUTABLE}")
|
|
+
|
|
+ if(NOT GIT_EXECUTABLE-NOTFOUND)
|
|
+ execute_process(COMMAND ${GIT_EXECUTABLE} describe
|
|
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
+ RESULT_VARIABLE GIT_INFO_RESULT
|
|
+ OUTPUT_VARIABLE GIT_REV
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
+ if(NOT ${GIT_INFO_RESULT} EQUAL 0)
|
|
+ message(SEND_ERROR "git describe failed with code ${GIT_INFO_RESULT}: ${GIT_REV}")
|
|
+ endif()
|
|
endif()
|
|
endif()
|
|
-endif()
|
|
|
|
-string(REGEX REPLACE "^(.+)-([0-9]+)-(g[a-f0-9]+)$" "\\1;\\2;\\3"
|
|
- GIT_PARTS ${GIT_REV})
|
|
+ string(REGEX REPLACE "^(.+)-([0-9]+)-(g[a-f0-9]+)$" "\\1;\\2;\\3"
|
|
+ GIT_PARTS ${GIT_REV})
|
|
|
|
-if(NOT GIT_PARTS)
|
|
- message(FATAL_ERROR "Failed to parse git revision string '${GIT_REV}'")
|
|
-endif(NOT GIT_PARTS)
|
|
+ if(NOT GIT_PARTS)
|
|
+ message(FATAL_ERROR "Failed to parse git revision string '${GIT_REV}'")
|
|
+ endif(NOT GIT_PARTS)
|
|
|
|
-list(LENGTH GIT_PARTS GIT_PARTS_LENGTH)
|
|
-if(GIT_PARTS_LENGTH EQUAL 3)
|
|
- list(GET GIT_PARTS 0 GIT_TAGNAME)
|
|
- list(GET GIT_PARTS 1 GIT_COMMITCOUNT)
|
|
- list(GET GIT_PARTS 2 GIT_SHA1)
|
|
- set(HAS_GIT_REVISION ON)
|
|
-endif(GIT_PARTS_LENGTH EQUAL 3)
|
|
+ list(LENGTH GIT_PARTS GIT_PARTS_LENGTH)
|
|
+ if(GIT_PARTS_LENGTH EQUAL 3)
|
|
+ list(GET GIT_PARTS 0 GIT_TAGNAME)
|
|
+ list(GET GIT_PARTS 1 GIT_COMMITCOUNT)
|
|
+ list(GET GIT_PARTS 2 GIT_SHA1)
|
|
+ set(HAS_GIT_REVISION ON)
|
|
+ endif(GIT_PARTS_LENGTH EQUAL 3)
|
|
+endif()
|
|
|
|
if(INCLUDE_GIT_REVISION AND HAS_GIT_REVISION)
|
|
set(CLEMENTINE_VERSION_DISPLAY "${GIT_REV}")
|
|
|