From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1034071-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 489D1138334
	for <garchives@archives.gentoo.org>; Sun,  1 Jul 2018 10:11:32 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4224EE07EF;
	Sun,  1 Jul 2018 10:11:31 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id EB87AE07EF
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Jul 2018 10:11:30 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 772C4335CAB
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Jul 2018 10:11:28 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 968A02EB
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Jul 2018 10:11:26 +0000 (UTC)
From: "Maxim Koltsov" <maksbotan@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Maxim Koltsov" <maksbotan@gentoo.org>
Message-ID: <1530439855.9140856244cc5799ca2c9d3196ec3d381414a2ab.maksbotan@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/flann/, sci-libs/flann/files/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch sci-libs/flann/flann-1.9.1-r1.ebuild sci-libs/flann/flann-9999.ebuild
X-VCS-Directories: sci-libs/flann/ sci-libs/flann/files/
X-VCS-Committer: maksbotan
X-VCS-Committer-Name: Maxim Koltsov
X-VCS-Revision: 9140856244cc5799ca2c9d3196ec3d381414a2ab
X-VCS-Branch: master
Date: Sun,  1 Jul 2018 10:11:26 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: dbde330e-0ddb-4c44-bad5-73918552e6f1
X-Archives-Hash: 852be4de75acbcfe723510cdb1a0dc51

commit:     9140856244cc5799ca2c9d3196ec3d381414a2ab
Author:     Maxim Koltsov <maksbotan <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  1 10:10:55 2018 +0000
Commit:     Maxim Koltsov <maksbotan <AT> gentoo <DOT> org>
CommitDate: Sun Jul  1 10:10:55 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91408562

sci-libs/flann: fix build with >cmake-3.10

Took patch from Buildroot project, see
https://github.com/buildroot/buildroot/commit/0c469478f64d0ddaf72c0622a1830d855306d51c

Closes: https://bugs.gentoo.org/652594
Closes: https://bugs.gentoo.org/657470
Package-Manager: Portage-2.3.41, Repoman-2.3.9

 sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch  | 80 ++++++++++++++++++++++
 .../{flann-9999.ebuild => flann-1.9.1-r1.ebuild}   | 10 ++-
 sci-libs/flann/flann-9999.ebuild                   |  4 ++
 3 files changed, 91 insertions(+), 3 deletions(-)

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
new file mode 100644
index 00000000000..b37bedcf6d5
--- /dev/null
+++ b/sci-libs/flann/files/flann-1.9.1-cmake-3.11.patch
@@ -0,0 +1,80 @@
+From fa5ec96a94646492a3f908e12905b3e48a8e800b Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Wed, 18 Apr 2018 20:24:13 +0200
+Subject: [PATCH] src/cpp: fix cmake >= 3.11 build
+
+CMake < 3.11 doesn't support add_library() without any source file
+(i.e add_library(foo SHARED)). But flann CMake use a trick that use
+an empty string "" as source list (i.e add_library(foo SHARED "")).
+This look like a bug in CMake < 3.11.
+
+With CMake >= 3.11, the new behaviour of add_library() break the
+existing flann CMake code.
+
+From CMake Changelog [1]:
+"add_library() and add_executable() commands can now be called without
+ any sources and will not complain as long as sources are added later
+ via the target_sources() command."
+
+Note: flann CMake code doesn't use target_sources() since no source file
+are provided intentionally since the flann shared library is created by
+linking with the flann_cpp_s static library with this line:
+
+target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
+
+If you try to use "add_library(flann_cpp SHARED ${CPP_SOURCES})" (as it should
+be normally done), the link fail due to already defined symbol.
+
+They are building the shared version using the static library "to speedup the
+build time" [3]
+
+This issue is already reported upstream [2] with a proposed solution.
+
+Upstream status: Pending
+
+Fixes:
+http://autobuild.buildroot.net/results/b2f/b2febfaf8c44ce477b3e4a5b9b976fd25e8d7454
+
+[1] https://cmake.org/cmake/help/v3.11/release/3.11.html
+[2] https://github.com/mariusmuja/flann/issues/369
+[3] https://github.com/mariusmuja/flann/commit/0fd62b43be2fbb0b8d791ee36290791224dc030c
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ src/cpp/CMakeLists.txt | 4 ++--
+ src/cpp/empty.cpp      | 1 +
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+ create mode 100644 src/cpp/empty.cpp
+
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
+index b44a735..a816863 100644
+--- a/src/cpp/CMakeLists.txt
++++ b/src/cpp/CMakeLists.txt
+@@ -29,7 +29,7 @@ if (BUILD_CUDA_LIB)
+ endif()
+ 
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
+-    add_library(flann_cpp SHARED "")
++    add_library(flann_cpp SHARED "empty.cpp")
+     set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
+     target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
+ 
+@@ -85,7 +85,7 @@ if (BUILD_C_BINDINGS)
+     set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
+ 
+     if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
+-        add_library(flann SHARED "")
++        add_library(flann SHARED "empty.cpp")
+         set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX)
+         target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive)
+     else()
+diff --git a/src/cpp/empty.cpp b/src/cpp/empty.cpp
+new file mode 100644
+index 0000000..40a8c17
+--- /dev/null
++++ b/src/cpp/empty.cpp
+@@ -0,0 +1 @@
++/* empty */
+-- 
+2.14.3
+

diff --git a/sci-libs/flann/flann-9999.ebuild b/sci-libs/flann/flann-1.9.1-r1.ebuild
similarity index 88%
copy from sci-libs/flann/flann-9999.ebuild
copy to sci-libs/flann/flann-1.9.1-r1.ebuild
index 06d78eb963d..fcb4ef999df 100644
--- a/sci-libs/flann/flann-9999.ebuild
+++ b/sci-libs/flann/flann-1.9.1-r1.ebuild
@@ -3,15 +3,15 @@
 
 EAPI=6
 
-inherit cmake-utils cuda flag-o-matic git-r3 toolchain-funcs
+inherit cmake-utils cuda flag-o-matic toolchain-funcs
 
 DESCRIPTION="Fast approximate nearest neighbor searches in high dimensional spaces"
 HOMEPAGE="http://www.cs.ubc.ca/research/flann/"
-EGIT_REPO_URI="https://github.com/mariusmuja/flann.git"
+SRC_URI="https://github.com/mariusmuja/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
 
 LICENSE="BSD"
 SLOT="0"
-KEYWORDS=""
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-linux ~x86-linux"
 IUSE="cuda doc examples mpi openmp octave static-libs"
 
 RDEPEND="
@@ -29,6 +29,10 @@ DEPEND="${RDEPEND}
 # readd dependencies for test suite,
 # requires multiple ruby dependencies
 
+PATCHES=(
+	"${FILESDIR}"/flann-1.9.1-cmake-3.11.patch
+)
+
 pkg_pretend() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 }

diff --git a/sci-libs/flann/flann-9999.ebuild b/sci-libs/flann/flann-9999.ebuild
index 06d78eb963d..e8b80e9f855 100644
--- a/sci-libs/flann/flann-9999.ebuild
+++ b/sci-libs/flann/flann-9999.ebuild
@@ -29,6 +29,10 @@ DEPEND="${RDEPEND}
 # readd dependencies for test suite,
 # requires multiple ruby dependencies
 
+PATCHES=(
+	"${FILESDIR}"/flann-1.9.1-cmake-3.11.patch
+)
+
 pkg_pretend() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 }