# HG changeset patch # User Sebastien Jodogne # Date 1623243436 -7200 # Node ID d28eab3994f9212d058c65dd78e37e0ff93d1b4c # Parent 6784a119484ddf87d488aeaf3bee4c4dce162cfe hotpatch to make Orthanc 0.8.6 compile on Ubuntu 18.04 diff -r 6784a119484d -r d28eab3994f9 Resources/CMake/GoogleLogConfiguration.cmake --- a/Resources/CMake/GoogleLogConfiguration.cmake Thu Oct 15 13:56:50 2020 +0200 +++ b/Resources/CMake/GoogleLogConfiguration.cmake Wed Jun 09 14:57:16 2021 +0200 @@ -1,10 +1,30 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_LOG) SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.2) + + if (IS_DIRECTORY "${GOOGLE_LOG_SOURCES_DIR}") + set(FirstRun OFF) + else() + set(FirstRun ON) + endif() + DownloadPackage( "897fbff90d91ea2b6d6e78c8cea641cc" "http://www.orthanc-server.com/downloads/third-party/glog-0.3.2.tar.gz" "${GOOGLE_LOG_SOURCES_DIR}") + if (FirstRun) + find_program(PATCH_EXECUTABLE patch) + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${CMAKE_CURRENT_LIST_DIR}/../Patches/glog-ubuntu-18.04.diff + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (Failure) + message(FATAL_ERROR "Error while patching a file") + endif() + endif() # Glog 0.3.3 fails to build with old versions of MinGW, such as the # one installed on our Continuous Integration Server that runs diff -r 6784a119484d -r d28eab3994f9 Resources/Patches/glog-ubuntu-18.04.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/glog-ubuntu-18.04.diff Wed Jun 09 14:57:16 2021 +0200 @@ -0,0 +1,21 @@ +diff -urEb glog-0.3.2.orig/src/demangle.cc glog-0.3.2/src/demangle.cc +--- glog-0.3.2.orig/src/demangle.cc 2021-06-09 14:45:34.648501148 +0200 ++++ glog-0.3.2/src/demangle.cc 2021-06-09 14:46:07.376532698 +0200 +@@ -167,7 +167,7 @@ + // Returns true if "str" has at least "n" characters remaining. + static bool AtLeastNumCharsRemaining(const char *str, int n) { + for (int i = 0; i < n; ++i) { +- if (str == '\0') { ++ if (str[i] == '\0') { + return false; + } + } +@@ -223,7 +223,7 @@ + // Returns true and advances "mangled_cur" if we find any character in + // "char_class" at "mangled_cur" position. + static bool ParseCharClass(State *state, const char *char_class) { +- if (state->mangled_cur == '\0') { ++ if (state->mangled_cur[0] == '\0') { + return false; + } + const char *p = char_class;