1 |
commit: 9140856244cc5799ca2c9d3196ec3d381414a2ab |
2 |
Author: Maxim Koltsov <maksbotan <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 1 10:10:55 2018 +0000 |
4 |
Commit: Maxim Koltsov <maksbotan <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 1 10:10:55 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91408562 |
7 |
|
8 |
sci-libs/flann: fix build with >cmake-3.10 |
9 |
|
10 |
Took patch from Buildroot project, see |
11 |
https://github.com/buildroot/buildroot/commit/0c469478f64d0ddaf72c0622a1830d855306d51c |
12 |
|
13 |
Closes: https://bugs.gentoo.org/652594 |
14 |
Closes: https://bugs.gentoo.org/657470 |
15 |
Package-Manager: Portage-2.3.41, Repoman-2.3.9 |
16 |
|
17 |
sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch | 80 ++++++++++++++++++++++ |
18 |
.../{flann-9999.ebuild => flann-1.9.1-r1.ebuild} | 10 ++- |
19 |
sci-libs/flann/flann-9999.ebuild | 4 ++ |
20 |
3 files changed, 91 insertions(+), 3 deletions(-) |
21 |
|
22 |
diff --git a/sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch b/sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..b37bedcf6d5 |
25 |
--- /dev/null |
26 |
+++ b/sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch |
27 |
@@ -0,0 +1,80 @@ |
28 |
+From fa5ec96a94646492a3f908e12905b3e48a8e800b Mon Sep 17 00:00:00 2001 |
29 |
+From: Romain Naour <romain.naour@×××××.com> |
30 |
+Date: Wed, 18 Apr 2018 20:24:13 +0200 |
31 |
+Subject: [PATCH] src/cpp: fix cmake >= 3.11 build |
32 |
+ |
33 |
+CMake < 3.11 doesn't support add_library() without any source file |
34 |
+(i.e add_library(foo SHARED)). But flann CMake use a trick that use |
35 |
+an empty string "" as source list (i.e add_library(foo SHARED "")). |
36 |
+This look like a bug in CMake < 3.11. |
37 |
+ |
38 |
+With CMake >= 3.11, the new behaviour of add_library() break the |
39 |
+existing flann CMake code. |
40 |
+ |
41 |
+From CMake Changelog [1]: |
42 |
+"add_library() and add_executable() commands can now be called without |
43 |
+ any sources and will not complain as long as sources are added later |
44 |
+ via the target_sources() command." |
45 |
+ |
46 |
+Note: flann CMake code doesn't use target_sources() since no source file |
47 |
+are provided intentionally since the flann shared library is created by |
48 |
+linking with the flann_cpp_s static library with this line: |
49 |
+ |
50 |
+target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive) |
51 |
+ |
52 |
+If you try to use "add_library(flann_cpp SHARED ${CPP_SOURCES})" (as it should |
53 |
+be normally done), the link fail due to already defined symbol. |
54 |
+ |
55 |
+They are building the shared version using the static library "to speedup the |
56 |
+build time" [3] |
57 |
+ |
58 |
+This issue is already reported upstream [2] with a proposed solution. |
59 |
+ |
60 |
+Upstream status: Pending |
61 |
+ |
62 |
+Fixes: |
63 |
+http://autobuild.buildroot.net/results/b2f/b2febfaf8c44ce477b3e4a5b9b976fd25e8d7454 |
64 |
+ |
65 |
+[1] https://cmake.org/cmake/help/v3.11/release/3.11.html |
66 |
+[2] https://github.com/mariusmuja/flann/issues/369 |
67 |
+[3] https://github.com/mariusmuja/flann/commit/0fd62b43be2fbb0b8d791ee36290791224dc030c |
68 |
+ |
69 |
+Signed-off-by: Romain Naour <romain.naour@×××××.com> |
70 |
+--- |
71 |
+ src/cpp/CMakeLists.txt | 4 ++-- |
72 |
+ src/cpp/empty.cpp | 1 + |
73 |
+ 2 files changed, 3 insertions(+), 2 deletions(-) |
74 |
+ create mode 100644 src/cpp/empty.cpp |
75 |
+ |
76 |
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt |
77 |
+index b44a735..a816863 100644 |
78 |
+--- a/src/cpp/CMakeLists.txt |
79 |
++++ b/src/cpp/CMakeLists.txt |
80 |
+@@ -29,7 +29,7 @@ if (BUILD_CUDA_LIB) |
81 |
+ endif() |
82 |
+ |
83 |
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC) |
84 |
+- add_library(flann_cpp SHARED "") |
85 |
++ add_library(flann_cpp SHARED "empty.cpp") |
86 |
+ set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX) |
87 |
+ target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive) |
88 |
+ |
89 |
+@@ -85,7 +85,7 @@ if (BUILD_C_BINDINGS) |
90 |
+ set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC) |
91 |
+ |
92 |
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC) |
93 |
+- add_library(flann SHARED "") |
94 |
++ add_library(flann SHARED "empty.cpp") |
95 |
+ set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX) |
96 |
+ target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive) |
97 |
+ else() |
98 |
+diff --git a/src/cpp/empty.cpp b/src/cpp/empty.cpp |
99 |
+new file mode 100644 |
100 |
+index 0000000..40a8c17 |
101 |
+--- /dev/null |
102 |
++++ b/src/cpp/empty.cpp |
103 |
+@@ -0,0 +1 @@ |
104 |
++/* empty */ |
105 |
+-- |
106 |
+2.14.3 |
107 |
+ |
108 |
|
109 |
diff --git a/sci-libs/flann/flann-9999.ebuild b/sci-libs/flann/flann-1.9.1-r1.ebuild |
110 |
similarity index 88% |
111 |
copy from sci-libs/flann/flann-9999.ebuild |
112 |
copy to sci-libs/flann/flann-1.9.1-r1.ebuild |
113 |
index 06d78eb963d..fcb4ef999df 100644 |
114 |
--- a/sci-libs/flann/flann-9999.ebuild |
115 |
+++ b/sci-libs/flann/flann-1.9.1-r1.ebuild |
116 |
@@ -3,15 +3,15 @@ |
117 |
|
118 |
EAPI=6 |
119 |
|
120 |
-inherit cmake-utils cuda flag-o-matic git-r3 toolchain-funcs |
121 |
+inherit cmake-utils cuda flag-o-matic toolchain-funcs |
122 |
|
123 |
DESCRIPTION="Fast approximate nearest neighbor searches in high dimensional spaces" |
124 |
HOMEPAGE="http://www.cs.ubc.ca/research/flann/" |
125 |
-EGIT_REPO_URI="https://github.com/mariusmuja/flann.git" |
126 |
+SRC_URI="https://github.com/mariusmuja/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" |
127 |
|
128 |
LICENSE="BSD" |
129 |
SLOT="0" |
130 |
-KEYWORDS="" |
131 |
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-linux ~x86-linux" |
132 |
IUSE="cuda doc examples mpi openmp octave static-libs" |
133 |
|
134 |
RDEPEND=" |
135 |
@@ -29,6 +29,10 @@ DEPEND="${RDEPEND} |
136 |
# readd dependencies for test suite, |
137 |
# requires multiple ruby dependencies |
138 |
|
139 |
+PATCHES=( |
140 |
+ "${FILESDIR}"/flann-1.9.1-cmake-3.11.patch |
141 |
+) |
142 |
+ |
143 |
pkg_pretend() { |
144 |
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp |
145 |
} |
146 |
|
147 |
diff --git a/sci-libs/flann/flann-9999.ebuild b/sci-libs/flann/flann-9999.ebuild |
148 |
index 06d78eb963d..e8b80e9f855 100644 |
149 |
--- a/sci-libs/flann/flann-9999.ebuild |
150 |
+++ b/sci-libs/flann/flann-9999.ebuild |
151 |
@@ -29,6 +29,10 @@ DEPEND="${RDEPEND} |
152 |
# readd dependencies for test suite, |
153 |
# requires multiple ruby dependencies |
154 |
|
155 |
+PATCHES=( |
156 |
+ "${FILESDIR}"/flann-1.9.1-cmake-3.11.patch |
157 |
+) |
158 |
+ |
159 |
pkg_pretend() { |
160 |
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp |
161 |
} |