This should fix the build of graphics/digikam-kde4 on archs where
opencv-java is built by default (i.e., on amd64).

Please, someone with amd64, test if the build succeeds for you
(make sure you don't have opencv-java installed).

I'm CC'ing Gilles Caulier, the Digikam SC maintainer, because we
have a related conversation at KDE ReviewBoard.  Gilles, the long
linking chain of libkface is caused by opencv_contrib, which pulls
almost all other OpenCV modules in.

The gory details are below:

We have OpenCV actually somewhat broken, regarding multipackaging.
The problem is that OpenCV CMake configuration files are different
when you build -java and when you don't. And those config files go
to -m ain.  So on amd64, where we build opencv-java by default,
OpenCV CMake config do know about opencv_java.so.

Then the find_package(Foo COMPONENTS ...) comes into play.  The
OpenCV config supports such syntax, allowing you to choose the only
components you need, and by default (without specifying COMPONENTS)
you'll get the whole stuff. Which - yes - will mean getting dependency
on opencv_java, too. And that's what happens in digikam-kde4 build,
because while all CMakeLists.txt for things going in actual package
were fixed, some tests were doing find_package(OpenCV), too. And
the OpenCV CMake config _appends_ to OpenCV_LIBS variable on each
find_package(OpenCV) invocation. As a result, the mentioned tests
as well as any other stuff used target_link_libraries(foo ${OpenCV_LIBS})
got linked to the whole OpenCV, including opencv_java.

So there are a few points of brokeness:
  1) OpenCV CMake config mentioning opencv_java.so;
  2) OpenCV CMake config appending to OpenCV_LIBS; 
  3) JDK not building on all archs.

For now, here is a patch for the (2), and I'll work on getting
(1) fixed, likely - by patching the CMake config file.  Dropping
-java isn't an option for me, I'm interested in it.  For (3)... I
won't come back to JDK internals. :)

--
WBR,
  Vadim Zhukov


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/digikam-kde4/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- Makefile    18 Jul 2014 04:40:58 -0000      1.4
+++ Makefile    19 Jul 2014 18:59:13 -0000
@@ -22,7 +22,9 @@ PKGNAME-main =                ${PKGNAME}
 PKGNAME-mediawiki =    libmediawiki-1.0.0
 PKGNAME-vkontakte =    libkvkontakte-1.0.0
 
-REVISION-main =                0
+REVISION-main =                1
+REVISION-kipi =                0
+REVISION-face =                0
 
 EXTRACT_SUFX =         .tar.bz2
 
@@ -76,9 +78,7 @@ WANTLIB-kipi += ${KDE4LIB}/kio ${KDE4LIB
 WANTLIB-kipi += ${KDE4LIB}/ksane
 WANTLIB-kipi += ${KDE4LIB}/nepomuk ${KDE4LIB}/nepomukutils ${KDE4LIB}/solid
 WANTLIB-kipi += ${KDE4LIB}/threadweaver
-WANTLIB-kipi += opencv_core opencv_highgui opencv_legacy
-WANTLIB-kipi += opencv_calib3d opencv_features2d opencv_flann
-WANTLIB-kipi += opencv_imgproc opencv_ml opencv_video
+WANTLIB-kipi += opencv_core
 WANTLIB-kipi += exslt gdk_pixbuf-2.0 glib-2.0 gmodule-2.0 gobject-2.0 gpod
 WANTLIB-kipi += gthread-2.0 jpeg
 WANTLIB-kipi += qjson kgeomap kqoauth kvkontakte mediawiki png qca2 soprano
@@ -223,10 +223,6 @@ TEST_IS_INTERACTIVE =      X11
 CONFIGURE_ENV =                CXXFLAGS="${CXXFLAGS} 
-DOPENBSD_LIBKDCRAW_NO_CRASH=0"
 .else
 CONFIGURE_ENV =                CXXFLAGS="${CXXFLAGS} 
-DOPENBSD_LIBKDCRAW_NO_CRASH=1"
-.endif
-
-.if ${ARCH} == "amd64"
-BUILD_DEPENDS += graphics/opencv,-java
 .endif
 
 post-extract:
Index: patches/patch-core_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/graphics/digikam-kde4/patches/patch-core_CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-core_CMakeLists_txt
--- patches/patch-core_CMakeLists_txt   9 Jul 2014 21:29:33 -0000       1.1.1.1
+++ patches/patch-core_CMakeLists_txt   19 Jul 2014 18:59:13 -0000
@@ -1,11 +1,13 @@
 $OpenBSD: patch-core_CMakeLists_txt,v 1.1.1.1 2014/07/09 21:29:33 zhuk Exp $
 1. Avoid extra library dependencies.
 2. Avoid picking up exceptions from Boost, unbreaking compilation.
---- core/CMakeLists.txt.orig   Thu Jun 26 01:57:33 2014
-+++ core/CMakeLists.txt        Wed Jul  9 21:04:26 2014
-@@ -175,12 +175,12 @@ FIND_PACKAGE(Boost) # 1.36.0)
+--- core/CMakeLists.txt.orig   Thu Jun 26 03:57:33 2014
++++ core/CMakeLists.txt        Fri Jul 18 22:56:09 2014
+@@ -174,13 +174,14 @@ FIND_PACKAGE(Boost) # 1.36.0)
+ # Therefore, first try finding OpenCV using FIND_PACKAGE(OpenCV), and if that 
fails,
  # add our FindOpenCV.cmake to the search path and search again.
  
++SET(OpenCV_LIBS)
  MESSAGE(STATUS "First try at finding OpenCV...")
 -FIND_PACKAGE(OpenCV)
 +FIND_PACKAGE(OpenCV COMPONENTS core highgui)
Index: patches/patch-core_tests_imgqsort_detectblur_CMakeLists_txt
===================================================================
RCS file: patches/patch-core_tests_imgqsort_detectblur_CMakeLists_txt
diff -N patches/patch-core_tests_imgqsort_detectblur_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_tests_imgqsort_detectblur_CMakeLists_txt 19 Jul 2014 
18:59:13 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+Limit to components needed only.
+--- core/tests/imgqsort/detectblur/CMakeLists.txt.orig Fri Jul 18 20:27:15 2014
++++ core/tests/imgqsort/detectblur/CMakeLists.txt      Fri Jul 18 20:27:47 2014
+@@ -1,5 +1,6 @@
+ cmake_minimum_required(VERSION 2.8)
+ project( DisplayImage )
+-find_package( OpenCV REQUIRED )
++SET(OpenCV_LIBS)
++find_package( OpenCV REQUIRED COMPONENTS core)
+ add_executable( detectblur detectblur.cpp )
+ target_link_libraries( detectblur ${OpenCV_LIBS} )
Index: patches/patch-core_tests_imgqsort_detectcompression_CMakeLists_txt
===================================================================
RCS file: patches/patch-core_tests_imgqsort_detectcompression_CMakeLists_txt
diff -N patches/patch-core_tests_imgqsort_detectcompression_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_tests_imgqsort_detectcompression_CMakeLists_txt  19 Jul 
2014 18:59:13 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+Avoid extra library dependencies.
+--- core/tests/imgqsort/detectcompression/CMakeLists.txt.orig  Sat Jul 19 
18:24:37 2014
++++ core/tests/imgqsort/detectcompression/CMakeLists.txt       Sat Jul 19 
21:20:28 2014
+@@ -1,5 +1,6 @@
+ cmake_minimum_required(VERSION 2.8)
+ project( DetectCompression )
+-find_package( OpenCV REQUIRED )
++SET(OpenCV_LIBS)
++find_package( OpenCV REQUIRED COMPONENTS core)
+ add_executable( detectcompression detectcompression.cpp )
+ target_link_libraries( detectcompression ${OpenCV_LIBS} )
Index: patches/patch-core_tests_imgqsort_detectnoise_CMakeLists_txt
===================================================================
RCS file: patches/patch-core_tests_imgqsort_detectnoise_CMakeLists_txt
diff -N patches/patch-core_tests_imgqsort_detectnoise_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_tests_imgqsort_detectnoise_CMakeLists_txt        19 Jul 
2014 18:59:13 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+Avoid extra library dependencies.
+--- core/tests/imgqsort/detectnoise/CMakeLists.txt.orig        Sat Jul 19 
16:50:13 2014
++++ core/tests/imgqsort/detectnoise/CMakeLists.txt     Sat Jul 19 16:50:40 2014
+@@ -1,5 +1,6 @@
+ cmake_minimum_required(VERSION 2.8)
+ project( DisplayImage )
+-find_package( OpenCV REQUIRED )
++set(OpenCV_LIBS)
++find_package( OpenCV REQUIRED COMPONENTS core)
+ add_executable( detectnoise detectnoise.cpp )
+ target_link_libraries( detectblur ${OpenCV_LIBS} )
Index: patches/patch-extra_kipi-plugins_CMakeLists_txt
===================================================================
RCS file: 
/cvs/ports/graphics/digikam-kde4/patches/patch-extra_kipi-plugins_CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-extra_kipi-plugins_CMakeLists_txt
--- patches/patch-extra_kipi-plugins_CMakeLists_txt     9 Jul 2014 21:29:33 
-0000       1.1.1.1
+++ patches/patch-extra_kipi-plugins_CMakeLists_txt     19 Jul 2014 18:59:13 
-0000
@@ -1,13 +1,14 @@
 $OpenBSD: patch-extra_kipi-plugins_CMakeLists_txt,v 1.1.1.1 2014/07/09 
21:29:33 zhuk Exp $
 Avoid extra library dependencies.
 --- extra/kipi-plugins/CMakeLists.txt.orig     Thu Jun 26 03:56:54 2014
-+++ extra/kipi-plugins/CMakeLists.txt  Mon Jun 30 23:06:11 2014
-@@ -170,7 +170,7 @@ MACRO_OPTIONAL_FIND_PACKAGE(BISON)                    
++++ extra/kipi-plugins/CMakeLists.txt  Sat Jul 19 21:20:33 2014
+@@ -170,7 +170,8 @@ MACRO_OPTIONAL_FIND_PACKAGE(BISON)                    
  MACRO_OPTIONAL_FIND_PACKAGE(KdepimLibs)                                  # 
For Calendar (libkcal).
  MACRO_OPTIONAL_FIND_PACKAGE(QCA2)                                        # 
For Shwup and YandexFotki.
  MACRO_OPTIONAL_FIND_PACKAGE(KSane)                                       # 
For AcquireImages.
 -MACRO_OPTIONAL_FIND_PACKAGE(OpenCV)                                      # 
For RemoveRedEyes.
-+MACRO_OPTIONAL_FIND_PACKAGE(OpenCV COMPONENTS core highgui legacy)       # 
For RemoveRedEyes.
++SET(OpenCV_LIBS)
++FIND_PACKAGE(OpenCV COMPONENTS core)       # For RemoveRedEyes.
  MACRO_OPTIONAL_FIND_PACKAGE(QJSON)                                       # 
For Debian Screenshots Facebook, GoogleDrive, Dropbox and Imgur.
  MACRO_OPTIONAL_FIND_PACKAGE(KGeoMap)                                     # 
For GPSSync.
  MACRO_OPTIONAL_FIND_PACKAGE(Mediawiki)                                   # 
For Mediawiki.
Index: patches/patch-extra_libkface_CMakeLists_txt
===================================================================
RCS file: 
/cvs/ports/graphics/digikam-kde4/patches/patch-extra_libkface_CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-extra_libkface_CMakeLists_txt
--- patches/patch-extra_libkface_CMakeLists_txt 9 Jul 2014 21:29:33 -0000       
1.1.1.1
+++ patches/patch-extra_libkface_CMakeLists_txt 19 Jul 2014 18:59:13 -0000
@@ -1,19 +1,21 @@
 $OpenBSD: patch-extra_libkface_CMakeLists_txt,v 1.1.1.1 2014/07/09 21:29:33 
zhuk Exp $
 Avoid extra library dependencies.
 --- extra/libkface/CMakeLists.txt.orig Thu Jun 26 03:57:02 2014
-+++ extra/libkface/CMakeLists.txt      Mon Jun 30 23:03:31 2014
-@@ -54,12 +54,12 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CUR
++++ extra/libkface/CMakeLists.txt      Sat Jul 19 21:41:23 2014
+@@ -53,13 +53,14 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CUR
+ # Therefore, first try finding OpenCV using FIND_PACKAGE(OpenCV), and if that 
fails,
  # add our FindOpenCV.cmake to the search path and search again.
  
++SET(OpenCV_LIBS)
  MESSAGE(STATUS "First try at finding OpenCV...")
 -FIND_PACKAGE(OpenCV)
-+FIND_PACKAGE(OpenCV COMPONENTS core contrib highgui)
++FIND_PACKAGE(OpenCV COMPONENTS core highgui objdetect contrib)
  
  IF (NOT OpenCV_LIBRARIES AND NOT OpenCV_LIBS)
    MESSAGE(STATUS "Could not find OpenCV normally, trying internal 
FindOpenCV.cmake")
    SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules_opencv)
 -  FIND_PACKAGE(OpenCV REQUIRED)
-+  FIND_PACKAGE(OpenCV REQUIRED COMPONENTS core contrib highgui)
++  FIND_PACKAGE(OpenCV REQUIRED COMPONENTS core highgui objdetect contrib)
  ELSE (NOT OpenCV_LIBRARIES AND NOT OpenCV_LIBS)
    MESSAGE(STATUS "Great, found OpenCV on the first try.")
  ENDIF (NOT OpenCV_LIBRARIES AND NOT OpenCV_LIBS)

Reply via email to