On 2025/01/13 08:53, Kirill Bychkov wrote:
> Hi!
> It looks like that flann ships broken .pc file. With this
> installed graphics/hugin fails to build with
> "undefined reference to LZ4_compress_HC_continue" error.
> 
> Should we fix flann itself as done in FreeBSD:

That's not actually the reason for hugin failing; the local patch needs
to be removed, and with that, it builds without touching the pkg-config
file.

I think that flann should be fixed anyway, if somebody just uses the
output from pkg-config --libs flann it will break (it's ok with hugin
because of cmake). I prefer patches instead of sed, they're more likely
to get cleaned up if something changes upstream). Diffs for both:

Index: graphics/hugin/Makefile
===================================================================
RCS file: /cvs/ports/graphics/hugin/Makefile,v
diff -u -p -r1.92 Makefile
--- graphics/hugin/Makefile     21 Dec 2024 11:38:15 -0000      1.92
+++ graphics/hugin/Makefile     13 Jan 2025 09:32:32 -0000
@@ -9,10 +9,9 @@ EXTRACT_SUFX = .tar.bz2
 # not needed for releases, but makes RCs/betas easier to work with
 PKGNAME =      ${DISTNAME:S/_//:L}
 WRKDIST =      ${WRKDIR}/${DISTNAME:C/_.*//}
-REVISION =     0
+REVISION =     1
 
 SHARED_LIBS +=  celeste                   4.0
-SHARED_LIBS +=  flann_cpp                 4.0
 SHARED_LIBS +=  huginbase                 8.0
 SHARED_LIBS +=  huginbasewx               7.0
 SHARED_LIBS +=  icpfindlib                5.0
@@ -28,9 +27,10 @@ MAINTAINER = Kirill Bychkov <kirby@openb
 # GPLv2+
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += ${COMPILER_LIBCXX} GL GLU Iex-3_3 OpenEXR-3_3
-WANTLIB += IlmThread-3_3 Imath-3_1 X11 boost_filesystem-mt boost_system-mt
-WANTLIB += c exiv2 epoxy fftw3 jpeg lcms2 m pano13 png ${MODPY_WANTLIB} sqlite3
+WANTLIB += ${COMPILER_LIBCXX} ${MODPY_WANTLIB}
+WANTLIB += GL GLU Iex-3_3 IlmThread-3_3 Imath-3_1 OpenEXR-3_3
+WANTLIB += X11 boost_filesystem-mt boost_system-mt c epoxy exiv2
+WANTLIB += fftw3 flann flann_cpp jpeg lcms2 lz4 m pano13 png sqlite3
 WANTLIB += tiff vigraimpex wx_baseu-3.2 wx_baseu_net-3.2 wx_baseu_xml-3.2
 WANTLIB += wx_gtk3u_aui-3.2 wx_gtk3u_core-3.2 wx_gtk3u_gl-3.2
 WANTLIB += wx_gtk3u_html-3.2 wx_gtk3u_propgrid-3.2 wx_gtk3u_qa-3.2
@@ -56,6 +56,7 @@ LIB_DEPENDS =         devel/boost \
                        graphics/libpano13>=2.9.19 \
                        graphics/lensfun \
                        graphics/vigra \
+                       math/flann \
                        x11/wxWidgets>=3.0.4
 
 MODULES =              devel/cmake lang/python
Index: graphics/hugin/patches/patch-CMakeModules_FindFLANN_cmake
===================================================================
RCS file: graphics/hugin/patches/patch-CMakeModules_FindFLANN_cmake
diff -N graphics/hugin/patches/patch-CMakeModules_FindFLANN_cmake
--- graphics/hugin/patches/patch-CMakeModules_FindFLANN_cmake   12 Jan 2025 
16:44:30 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-Index: CMakeModules/FindFLANN.cmake
---- CMakeModules/FindFLANN.cmake.orig
-+++ CMakeModules/FindFLANN.cmake
-@@ -8,27 +8,7 @@
- # FLANN_LIBRARIES
- # FLANN_FOUND
- 
--if(UNIX)
--  find_package(PkgConfig QUIET)
--  pkg_check_modules(FLANN flann)
--else()
--  find_path(FLANN_INCLUDE_DIRS flann/flann.hpp)
--
--  if(FLANN_INCLUDE_DIRS)
--    find_library(FLANN_LIBRARIES flann_cpp)
--    if(FLANN_LIBRARIES)
--      set(FLANN_FOUND "YES")
--    endif()
--  else()
--    set(FLANN_FOUND "NO")
--  endif()
--endif()
--
--if(FLANN_FOUND)
--    MESSAGE(STATUS "flann library found")
--else()
-   message(STATUS "flann library not found. falling back to included copy")
-   set(FLANN_LIBRARIES "flann_cpp")
-   set(FLANN_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src/foreign")
--endif()
- 
Index: graphics/hugin/pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/hugin/pkg/PLIST,v
diff -u -p -r1.28 PLIST
--- graphics/hugin/pkg/PLIST    29 May 2024 08:04:35 -0000      1.28
+++ graphics/hugin/pkg/PLIST    13 Jan 2025 09:32:32 -0000
@@ -32,7 +32,6 @@
 @bin bin/vig_optimize
 lib/hugin/
 @lib lib/hugin/libceleste.so.${LIBceleste_VERSION}
-@lib lib/hugin/libflann_cpp.so.${LIBflann_cpp_VERSION}
 @lib 
lib/hugin/libhugin_python_interface.so.${LIBhugin_python_interface_VERSION}
 @lib lib/hugin/libhuginbase.so.${LIBhuginbase_VERSION}
 @lib lib/hugin/libhuginbasewx.so.${LIBhuginbasewx_VERSION}
Index: math/flann/Makefile
===================================================================
RCS file: /cvs/ports/math/flann/Makefile,v
diff -u -p -r1.1.1.1 Makefile
--- math/flann/Makefile 27 Dec 2024 16:13:10 -0000      1.1.1.1
+++ math/flann/Makefile 13 Jan 2025 09:32:32 -0000
@@ -1,6 +1,7 @@
 COMMENT =              fast library for approximate nearest neighbors
 
 DIST_TUPLE +=          github flann-lib flann 1.9.2 .
+REVISION =             0
 
 SHARED_LIBS +=         flann           0.0 # 0.0
 SHARED_LIBS +=         flann_cpp       0.0 # 0.0
Index: math/flann/patches/patch-cmake_flann_pc_in
===================================================================
RCS file: math/flann/patches/patch-cmake_flann_pc_in
diff -N math/flann/patches/patch-cmake_flann_pc_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ math/flann/patches/patch-cmake_flann_pc_in  13 Jan 2025 09:32:32 -0000
@@ -0,0 +1,13 @@
+https://github.com/flann-lib/flann/issues/466
+
+Index: cmake/flann.pc.in
+--- cmake/flann.pc.in.orig
++++ cmake/flann.pc.in
+@@ -8,6 +8,6 @@ Name: @PROJECT_NAME@
+ 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}
+ 

Reply via email to