summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>2018-11-05 08:18:47 +0100
committerArmin Kuster <akuster808@gmail.com>2018-11-15 13:18:50 -0800
commit11618247e8f871233f4924241c48ebab2aca3fd1 (patch)
tree22ebfdabdea2a0089f25ca9bdd58b5e914d112c1
parent36977b35b17d7c50e84854e9bdd72c91b208fd9d (diff)
downloadmeta-openembedded-11618247e8f871233f4924241c48ebab2aca3fd1.tar.gz
glog: updated libunwind look up function
Updated FindLinunwind cmake file to locate libunwind properly in the system. This includes settings all needed defines in config.h file, which are used for glog compilation. Changed unwind cmake target to interface, because in cross-compilation environment we could link against several libunwind shared libraries. Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-support/glog/glog/0001-find-libunwind-during-configure.patch30
-rw-r--r--meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch113
-rw-r--r--meta-oe/recipes-support/glog/glog_0.3.5.bb6
3 files changed, 115 insertions, 34 deletions
diff --git a/meta-oe/recipes-support/glog/glog/0001-find-libunwind-during-configure.patch b/meta-oe/recipes-support/glog/glog/0001-find-libunwind-during-configure.patch
deleted file mode 100644
index 33dc9d38a..000000000
--- a/meta-oe/recipes-support/glog/glog/0001-find-libunwind-during-configure.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1diff -ur git/CMakeLists.txt ../0.3.5-r0.unwind/git/CMakeLists.txt
2--- git/CMakeLists.txt 2018-10-08 08:54:15.118989400 +0200
3+++ ../0.3.5-r0.unwind/git/CMakeLists.txt 2018-10-05 16:26:59.745922318 +0200
4@@ -384,7 +384,9 @@
5 set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
6
7 if (UNWIND_LIBRARY)
8- target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
9+ add_library(unwind SHARED IMPORTED)
10+ set_target_properties(unwind PROPERTIES IMPORTED_LOCATION ${UNWIND_LIBRARY})
11+ target_link_libraries (glog PUBLIC unwind)
12 endif (UNWIND_LIBRARY)
13
14 if (HAVE_PTHREAD)
15diff -ur git/glog-config.cmake.in ../0.3.5-r0.unwind/git/glog-config.cmake.in
16--- git/glog-config.cmake.in 2018-10-08 08:54:15.122989699 +0200
17+++ ../0.3.5-r0.unwind/git/glog-config.cmake.in 2018-10-08 08:14:48.550745810 +0200
18@@ -4,4 +4,12 @@
19
20 @gflags_DEPENDENCY@
21
22+find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
23+mark_as_advanced (UNWIND_LIBRARY)
24+
25+if (UNWIND_LIBRARY)
26+ add_library(unwind SHARED IMPORTED)
27+ set_target_properties(unwind PROPERTIES IMPORTED_LOCATION ${UNWIND_LIBRARY})
28+endif (UNWIND_LIBRARY)
29+
30 include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
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 @@
1diff -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+)
42diff -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)
94Binary files a/.git/index and b/.git/index differ
95diff -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")
diff --git a/meta-oe/recipes-support/glog/glog_0.3.5.bb b/meta-oe/recipes-support/glog/glog_0.3.5.bb
index 4c1bce74e..5e58450c2 100644
--- a/meta-oe/recipes-support/glog/glog_0.3.5.bb
+++ b/meta-oe/recipes-support/glog/glog_0.3.5.bb
@@ -10,8 +10,8 @@ DEPENDS = "libunwind"
10 10
11SRC_URI = " \ 11SRC_URI = " \
12 git://github.com/google/glog.git;branch=v035 \ 12 git://github.com/google/glog.git;branch=v035 \
13 file://0001-find-libunwind-during-configure.patch \
14 file://0001-Rework-CMake-glog-VERSION-management.patch \ 13 file://0001-Rework-CMake-glog-VERSION-management.patch \
14 file://0002-Find-Libunwind-during-configure.patch \
15" 15"
16 16
17SRCREV = "a6a166db069520dbbd653c97c2e5b12e08a8bb26" 17SRCREV = "a6a166db069520dbbd653c97c2e5b12e08a8bb26"
@@ -20,8 +20,6 @@ S = "${WORKDIR}/git"
20 20
21inherit cmake 21inherit cmake
22 22
23RDEPENDS_${PN}-dev = "" 23RDEPENDS_${PN} += "libunwind"
24RRECOMMENDS_${PN}-dev = "${PN}-staticdev"
25RRECOMMENDS_${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
26 24
27EXTRA_OECMAKE += "-DBUILD_SHARED_LIBS=ON" 25EXTRA_OECMAKE += "-DBUILD_SHARED_LIBS=ON"