From: @davidhan008 
Reviewed-by: @anchuanxu 
Signed-off-by: @anchuanxu
This commit is contained in:
openeuler-ci-bot 2023-06-01 13:57:04 +00:00 committed by Gitee
commit 46315f2d26
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 205 additions and 0 deletions

BIN
1.9.2.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,43 @@
diff -up ./src/python/CMakeLists.txt.fixpyflann ./src/python/CMakeLists.txt
--- ./src/python/CMakeLists.txt.fixpyflann 2016-08-04 19:20:50.000000000 -0400
+++ ./src/python/CMakeLists.txt 2020-08-05 22:23:54.069400292 -0400
@@ -5,8 +5,8 @@ install( FILES ${CMAKE_CURRENT_BINARY_DI
# python instalation
-if (PYTHON_EXECUTABLE)
- install(CODE "execute_process(
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install
- WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\")")
-endif()
+#if (PYTHON_EXECUTABLE)
+# install(CODE "execute_process(
+# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install
+# WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\")")
+#endif()
diff -up ./src/python/pyflann/flann_ctypes.py.fixpyflann ./src/python/pyflann/flann_ctypes.py
--- ./src/python/pyflann/flann_ctypes.py.fixpyflann 2020-08-05 22:23:54.070400287 -0400
+++ ./src/python/pyflann/flann_ctypes.py 2020-08-05 22:26:17.075653702 -0400
@@ -150,7 +150,7 @@ def load_flann_library():
root_dir = os.path.abspath(os.path.dirname(__file__))
- libnames = ['libflann.so']
+ libnames = ['libflann.so.1.9']
libdir = 'lib'
if sys.platform == 'win32':
libnames = ['flann.dll', 'libflann.dll']
@@ -161,12 +161,7 @@ def load_flann_library():
for libname in libnames:
try:
#print 'Trying ',os.path.join(root_dir,'lib',libname)
- flannlib = cdll[os.path.join(root_dir, libdir, libname)]
- return flannlib
- except Exception:
- pass
- try:
- flannlib = cdll[os.path.join(root_dir, 'build', libdir, libname)]
+ flannlib = cdll[os.path.join(root_dir,libname)]
return flannlib
except Exception:
pass

10
flann-fix-lz4.patch Normal file
View File

@ -0,0 +1,10 @@
--- flann-1.9.2/cmake/flann.pc.in_org 2023-05-04 10:17:19.820048147 +0800
+++ flann-1.9.2/cmake/flann.pc.in 2023-05-04 10:17:35.060271401 +0800
@@ -8,6 +8,6 @@
Description: @PKG_DESC@
Version: @FLANN_VERSION@
Requires: @PKG_EXTERNAL_DEPS@
-Libs: -L${libdir} @LZ4_STATIC_LDFLAGS@ -lflann -lflann_cpp
+Libs: -L${libdir} -llz4 -lflann -lflann_cpp
Cflags: -I${includedir}

11
flann-libdir.patch Normal file
View File

@ -0,0 +1,11 @@
--- flann-1.9.2/CMakeLists.txt.orig 2021-04-12 09:15:28.000000000 +0200
+++ flann-1.9.2/CMakeLists.txt 2023-01-17 18:18:25.687565563 +0100
@@ -164,7 +164,7 @@ else()
endif()
# install and export variables
-set(config_install_dir "lib/cmake/${PROJECT_NAME}")
+set(config_install_dir "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(version_config "${generated_dir}/flann-config-version.cmake")
set(project_config "${generated_dir}/flann-config.cmake")

18
flann-python.patch Normal file
View File

@ -0,0 +1,18 @@
--- flann-1.7.1-src/src/python/CMakeLists.txt.orig 2011-12-23 12:16:09.000000000 +0100
+++ flann-1.7.1-src/src/python/CMakeLists.txt 2012-02-02 17:07:06.212529926 +0100
@@ -1,12 +1,12 @@
configure_file( setup.py.tpl setup.py )
-install( DIRECTORY pyflann DESTINATION share/flann/python )
-install( FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.py DESTINATION share/flann/python )
+#install( DIRECTORY pyflann DESTINATION share/flann/python )
+#install( FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.py DESTINATION share/flann/python )
# python instalation
if (PYTHON_EXECUTABLE)
install(CODE "execute_process(
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install --optimize=2 --root=\$ENV{DESTDIR} --prefix=${CMAKE_INSTALL_PREFIX}
WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\")")
endif()

123
flann.spec Normal file
View File

@ -0,0 +1,123 @@
%global srcname flann
%global soversion 1.9
Name: flann
Version: 1.9.2
Release: 1%{?dist}
Summary: Fast Library for Approximate Nearest Neighbors
License: BSD
URL: http://www.cs.ubc.ca/research/flann
Source0: %{version}.tar.gz
Patch0: flann-1.9.1-fixpyflann.patch
Patch1: %{name}-libdir.patch
Patch2: flann-fix-lz4.patch
Requires: lz4
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: zlib-devel
BuildRequires: hdf5-devel
BuildRequires: gtest-devel
BuildRequires: latex2html
BuildRequires: texlive-bibtex
BuildRequires: texlive-latex
BuildRequires: texlive-tetex
BuildRequires: gtest-devel
BuildRequires: gmock-devel
BuildRequires: lz4-devel
BuildRequires: python3-devel
%description
FLANN is a library for performing fast approximate nearest neighbor searches
in high dimensional spaces. It contains a collection of algorithms found
to work best for nearest neighbor search and a system for automatically
choosing the best algorithm and optimum parameters depending on the data sets.
%package devel
Summary: Development headers and libraries for flann
Requires: lz4-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
# flann/flann_mpi.hpp requires boost/mpi.hpp, which is a convenience header
# inside of the boost-devel package
Requires: boost-devel
%description devel
Development headers and libraries for flann.
%package static
Summary: Static libraries for flann
Requires: lz4-devel
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
Static libraries for flann.
%package -n python3-flann
Summary: Python bindings for flann
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-numpy
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-flann
Python 3 bindings for flann
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
mkdir build && cd build
%cmake -DBUILD_MATLAB_BINDINGS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_BINDINGS=ON ..
%make_build
%make_build doc
%install
%make_install -C build
rm -rf %{buildroot}%{_datadir}/%{name}/python
# install the python bindings
cp -r src/python/pyflann build/src/python
cp -r build/src/python src/python3
cp build/src/python/setup.py src/python3
pushd src/python3
%{__python3} setup.py install --prefix=/usr --root=%{buildroot} --install-lib=%{python3_sitearch}
popd
# get rid of duplicate shared libraries
rm -rf %{buildroot}%{python3_sitearch}/pyflann/lib
# Remove example binaries
rm -rf %{buildroot}%{_bindir}*
# Remove installed documentation, we'll install it later with the doc macro
rm -rf %{buildroot}%{_datadir}/doc/flann
%files
%doc doc/manual.pdf
%{_libdir}/*.so.%{version}
%{_libdir}/*.so.%{soversion}
%files devel
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/flann
%{_libdir}/cmake/flann
%files static
%{_libdir}/*.a
%files -n python3-%{srcname}
%{python3_sitearch}/pyflann
%{python3_sitearch}/flann-%{version}*.egg-info
%changelog
* Mon May 1 2023 will_niutao <niutao2@huawei.com> - 1.9.2-1
- Init for openEuler