[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#887827: marked as done (kcalcore FTCBFS: uses try_run)



Your message dated Sun, 01 Dec 2019 00:29:57 +0100
with message-id <8221958.cruZmydiMP@tuxin>
and subject line Re: Bug#887827: kcalcore FTCBFS: uses try_run
has caused the Debian Bug report #887827,
regarding kcalcore FTCBFS: uses try_run
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
887827: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=887827
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: kcalcore
Version: 4:17.08.3-1
Tags: patch upstream
User: helmutg@debian.org
Usertags: rebootstrap

kcalcore fails to cross build from source, because it uses try_run from
cmake to figure out the version of libical. Sadly, libical only makes
this easily testable with try_compile in version 3.0 and kcalcore still
uses 2.0. The version is a macro that becomes a string (in <3.0). We
cannot reasonably extract that with try_compile. Bummer.

Fortunately, libical provides a pkg-config file and that file ships a
version. Thus we can use pkg-config to extract the version. This also
means that we no longer have to guess what libraries to link to or the
like as the pkg-config file knows about such things. It all becomes a
lot easier.

After applying the attached patch (and adding pkg-config to
Build-Depends), kcalcore cross builds successfully. Can you apply it?

Helmut
Index: kcalcore-17.08.3/cmake/FindLibIcal.cmake
===================================================================
--- kcalcore-17.08.3.orig/cmake/FindLibIcal.cmake
+++ kcalcore-17.08.3/cmake/FindLibIcal.cmake
@@ -12,6 +12,8 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
+include(FindPkgConfig)
+
 if(NOT LibIcal_FIND_VERSION)
   set(LibIcal_FIND_VERSION "0.33")
 endif()
@@ -20,71 +22,20 @@
   file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
 endif()
 
-#set the root from the LibIcal_BASE environment
-file(TO_CMAKE_PATH "$ENV{LibIcal_BASE}" libical_root)
-
-#override the root from LibIcal_BASE defined to cmake
-if(DEFINED LibIcal_BASE)
-  file(TO_CMAKE_PATH "${LibIcal_BASE}" libical_root)
-endif()
-
-find_path(LibIcal_INCLUDE_DIRS
-    NAMES libical/ical.h
-    HINTS ${libical_root}/include ${_program_FILES_DIR}/libical/include
-)
-
-find_library(LibIcal_LIBRARY
-    NAMES ical libical
-    HINTS ${libical_root}/lib ${_program_FILES_DIR}/libical/lib
-)
-
-find_library(LibIcalss_LIBRARY
-    NAMES icalss libicalss
-    HINTS ${libical_root}/lib ${_program_FILES_DIR}/libical/lib
-)
-
-set(LibIcal_LIBRARIES ${LibIcal_LIBRARY} ${LibIcalss_LIBRARY})
-
-if(LibIcal_INCLUDE_DIRS AND LibIcal_LIBRARIES)
-  set(FIND_LibIcal_VERSION_SOURCE
-    "#include <libical/ical.h>\n int main()\n {\n printf(\"%s\",ICAL_VERSION);return 1;\n }\n")
-  set(FIND_LibIcal_VERSION_SOURCE_FILE ${CMAKE_BINARY_DIR}/CMakeTmp/FindLIBICAL.cxx)
-  file(WRITE "${FIND_LibIcal_VERSION_SOURCE_FILE}" "${FIND_LibIcal_VERSION_SOURCE}")
-
-  set(FIND_LibIcal_VERSION_ADD_INCLUDES
-    "-DINCLUDE_DIRECTORIES:STRING=${LibIcal_INCLUDE_DIRS}")
+pkg_check_modules(LibIcal libical>=${LibIcal_FIND_VERSION})
 
-  if(NOT CMAKE_CROSSCOMPILING)
-  try_run(RUN_RESULT COMPILE_RESULT
-    ${CMAKE_BINARY_DIR}
-    ${FIND_LibIcal_VERSION_SOURCE_FILE}
-    CMAKE_FLAGS "${FIND_LibIcal_VERSION_ADD_INCLUDES}"
-    COMPILE_OUTPUT_VARIABLE FIND_LibIcal_Compile_Output
-    RUN_OUTPUT_VARIABLE LibIcal_VERSION)
+if(LibIcal_FOUND)
+  # INCLUDE_DIRS omits standard directories, but we need it non-empty
+  if(NOT LibIcal_INCLUDE_DIRS)
+    set(LibIcal_INCLUDE_DIRS ${LibIcal_INCLUDEDIR})
   endif()
 
-  if(COMPILE_RESULT AND RUN_RESULT EQUAL 1 AND NOT CMAKE_CROSSCOMPILING)
-    message(STATUS "Found Libical version ${LibIcal_VERSION}")
-    if(${LibIcal_VERSION} VERSION_LESS ${LibIcal_FIND_VERSION})
-      message(STATUS "LibIcal version ${LibIcal_VERSION} is too old. At least version ${LibIcal_FIND_VERSION} is needed.")
-      set(LibIcal_INCLUDE_DIRS "")
-      set(LibIcal_LIBRARIES "")
-    endif()
-    if(NOT LibIcal_VERSION VERSION_LESS 0.46)
-      set(USE_ICAL_0_46 TRUE)
-    endif()
-    if(NOT LibIcal_VERSION VERSION_LESS 1.00)
-      set(USE_ICAL_1_0 TRUE)
-    endif()
-
-  else()
-    if(NOT CMAKE_CROSSCOMPILING)
-      if (NOT COMPILE_RESULT)
-        message(FATAL_ERROR "Unable to compile the libical version detection program: ${FIND_LibIcal_Compile_Output}")
-      else()
-        message(FATAL_ERROR "Unable to run the libical version detection program: it returned ${RUN_RESULT}.")
-      endif()
-    endif()
+  message(STATUS "Found Libical version ${LibIcal_VERSION}")
+  if(NOT LibIcal_VERSION VERSION_LESS 0.46)
+    set(USE_ICAL_0_46 TRUE)
+  endif()
+  if(NOT LibIcal_VERSION VERSION_LESS 1.00)
+    set(USE_ICAL_1_0 TRUE)
   endif()
 
   #compute the major and minor version numbers

--- End Message ---
--- Begin Message ---
Version: 4:18.08.3-1

The commit is included in KDE PIM 18.08, so the issue should be fixed by now.

hefee

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---

Reply to: