diff options
Diffstat (limited to 'meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch')
-rw-r--r-- | meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch new file mode 100644 index 000000000..3a6f824ea --- /dev/null +++ b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch | |||
@@ -0,0 +1,113 @@ | |||
1 | diff -uNr a/cmake/FindLibunwind.cmake b/cmake/FindLibunwind.cmake | ||
2 | --- a/cmake/FindLibunwind.cmake 1970-01-01 01:00:00.000000000 +0100 | ||
3 | +++ b/cmake/FindLibunwind.cmake 2018-11-02 14:04:35.460437058 +0100 | ||
4 | @@ -0,0 +1,37 @@ | ||
5 | +# - Try to find libunwind | ||
6 | +# Once done this will define | ||
7 | +# | ||
8 | +# LIBUNWIND_FOUND - system has libunwind | ||
9 | +# unwind - cmake target for libunwind | ||
10 | + | ||
11 | +find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library") | ||
12 | +include (CheckIncludeFile) | ||
13 | +check_include_file (libunwind.h HAVE_LIBUNWIND_H) | ||
14 | +check_include_file (unwind.h HAVE_UNWIND_H) | ||
15 | + | ||
16 | +if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") | ||
17 | + set(LIBUNWIND_ARCH "arm") | ||
18 | +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR | ||
19 | + CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") | ||
20 | + set(LIBUNWIND_ARCH "x86_64") | ||
21 | +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") | ||
22 | + set(LIBUNWIND_ARCH "x86") | ||
23 | +endif() | ||
24 | + | ||
25 | +find_library (UNWIND_LIBRARY_PLATFORM NAMES "unwind-${LIBUNWIND_ARCH}" DOC "unwind library platform") | ||
26 | +if (UNWIND_LIBRARY_PLATFORM) | ||
27 | + set(HAVE_LIB_UNWIND "1") | ||
28 | +endif() | ||
29 | + | ||
30 | +include(FindPackageHandleStandardArgs) | ||
31 | +# handle the QUIETLY and REQUIRED arguments and set Libunwind_FOUND to TRUE | ||
32 | +# if all listed variables are TRUE | ||
33 | +find_package_handle_standard_args(Libunwind DEFAULT_MSG | ||
34 | + UNWIND_LIBRARY HAVE_LIBUNWIND_H HAVE_UNWIND_H HAVE_LIB_UNWIND) | ||
35 | + | ||
36 | +mark_as_advanced (UNWIND_LIBRARY UNWIND_LIBRARY_PLATFORM) | ||
37 | + | ||
38 | +add_library(unwind INTERFACE IMPORTED) | ||
39 | +set_target_properties(unwind PROPERTIES | ||
40 | + INTERFACE_LINK_LIBRARIES "${UNWIND_LIBRARY};${UNWIND_LIBRARY_PLATFORM}" | ||
41 | +) | ||
42 | diff -uNr a/CMakeLists.txt b/CMakeLists.txt | ||
43 | --- a/CMakeLists.txt 2018-11-02 14:02:21.784835854 +0100 | ||
44 | +++ b/CMakeLists.txt 2018-11-02 14:03:16.796935594 +0100 | ||
45 | @@ -58,7 +58,6 @@ | ||
46 | check_include_file (execinfo.h HAVE_EXECINFO_H) | ||
47 | check_include_file (glob.h HAVE_GLOB_H) | ||
48 | check_include_file (inttypes.h HAVE_INTTYPES_H) | ||
49 | -check_include_file (libunwind.h HAVE_LIBUNWIND_H) | ||
50 | check_include_file (memory.h HAVE_MEMORY_H) | ||
51 | check_include_file (pwd.h HAVE_PWD_H) | ||
52 | check_include_file (stdint.h HAVE_STDINT_H) | ||
53 | @@ -74,7 +73,6 @@ | ||
54 | check_include_file (syslog.h HAVE_SYSLOG_H) | ||
55 | check_include_file (ucontext.h HAVE_UCONTEXT_H) | ||
56 | check_include_file (unistd.h HAVE_UNISTD_H) | ||
57 | -check_include_file (unwind.h HAVE_UNWIND_H) | ||
58 | |||
59 | check_include_file_cxx ("ext/hash_map" HAVE_EXT_HASH_MAP) | ||
60 | check_include_file_cxx ("ext/hash_set" HAVE_EXT_HASH_SET) | ||
61 | @@ -109,10 +107,7 @@ | ||
62 | # snprintf as an inline function | ||
63 | check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF) | ||
64 | |||
65 | -check_library_exists (unwind get_static_proc_name "" HAVE_LIB_UNWIND) | ||
66 | - | ||
67 | -find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library") | ||
68 | -mark_as_advanced (UNWIND_LIBRARY) | ||
69 | +find_package(Libunwind) | ||
70 | |||
71 | check_c_source_compiles (" | ||
72 | #include <stdlib.h> | ||
73 | @@ -376,9 +371,9 @@ | ||
74 | |||
75 | set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON) | ||
76 | |||
77 | -if (UNWIND_LIBRARY) | ||
78 | - target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY}) | ||
79 | -endif (UNWIND_LIBRARY) | ||
80 | +if (Libunwind_FOUND) | ||
81 | + target_link_libraries (glog PUBLIC unwind) | ||
82 | +endif (Libunwind_FOUND) | ||
83 | |||
84 | if (HAVE_PTHREAD) | ||
85 | target_link_libraries (glog PUBLIC ${CMAKE_THREAD_LIBS_INIT}) | ||
86 | @@ -571,6 +566,7 @@ | ||
87 | install (FILES | ||
88 | ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake | ||
89 | ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake | ||
90 | + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLibunwind.cmake | ||
91 | DESTINATION lib/cmake/glog) | ||
92 | |||
93 | install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog) | ||
94 | Binary files a/.git/index and b/.git/index differ | ||
95 | diff -uNr a/glog-config.cmake.in b/glog-config.cmake.in | ||
96 | --- a/glog-config.cmake.in 2018-11-02 14:02:21.784835854 +0100 | ||
97 | +++ b/glog-config.cmake.in 2018-11-02 14:03:16.796935594 +0100 | ||
98 | @@ -4,4 +4,15 @@ | ||
99 | |||
100 | @gflags_DEPENDENCY@ | ||
101 | |||
102 | +# Record the state of the CMake module path when this script was | ||
103 | +# called so that we can ensure that we leave it in the same state on | ||
104 | +# exit as it was on entry, but modify it locally. | ||
105 | +set(UNWIND_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) | ||
106 | + | ||
107 | +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") | ||
108 | +find_dependency (Libunwind) | ||
109 | + | ||
110 | +# Restore original module path | ||
111 | +set(CMAKE_MODULE_PATH "${UNWIND_CMAKE_MODULE_PATH}") | ||
112 | + | ||
113 | include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake") | ||