Bug#948248: opencv: Doesn't build on ports without java

2020-01-11 Thread Samuel Thibault
Samuel Thibault, le ven. 10 janv. 2020 11:41:12 +0100, a ecrit:
> (as a side note, the build failure on hurd-i386 is being handled in
> https://github.com/opencv/opencv/pull/16302 )

Here is the patch applied upstream, could you apply it as well?

Thanks,
Samuel
commit e57ceea3d3769ef130465bcbe45e32d2cb2954ca
Author: Samuel Thibault 
Date:   Wed Jan 8 01:32:12 2020 +0100

Fix build on non-Linux glibc-based systems

dl functions are provided by all glibc-based systems (GNU/Linux, but
also GNU/Hurd, GNU/kFreeBSD)

diff --git a/modules/videoio/src/backend_plugin.cpp 
b/modules/videoio/src/backend_plugin.cpp
index 617c3cda29..f73a9ad7ac 100644
--- a/modules/videoio/src/backend_plugin.cpp
+++ b/modules/videoio/src/backend_plugin.cpp
@@ -21,7 +21,7 @@ using namespace std;
 
 #if defined(_WIN32)
 #include 
-#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__GLIBC__)
 #include 
 #endif
 
@@ -77,7 +77,7 @@ void* getSymbol_(LibHandle_t h, const char* symbolName)
 {
 #if defined(_WIN32)
 return (void*)GetProcAddress(h, symbolName);
-#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__GLIBC__)
 return dlsym(h, symbolName);
 #endif
 }
@@ -91,7 +91,7 @@ LibHandle_t libraryLoad_(const FileSystemPath_t& filename)
 # else
 return LoadLibraryW(filename.c_str());
 #endif
-#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__GLIBC__)
 return dlopen(filename.c_str(), RTLD_LAZY);
 #endif
 }
@@ -101,7 +101,7 @@ void libraryRelease_(LibHandle_t h)
 {
 #if defined(_WIN32)
 FreeLibrary(h);
-#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || 
defined(__FreeBSD__) || defined(__GLIBC__)
 dlclose(h);
 #endif
 }


Bug#948248: opencv: Doesn't build on ports without java

2020-01-07 Thread Samuel Thibault
Samuel Thibault, le dim. 05 janv. 2020 23:56:33 +0100, a ecrit:
> The attached patch fix that: it disables the ant, default-jdk, and
> maven-repo-helper build-deps on non-java ports, they enable the
> libopencv4.1-jni package only on java ports, and enable the dh java
> helpers and pass -DBUILD_JAVA=ON to configure only on java ports.

The attached version additionally drops the libopencv4.1-java from
libopencv-dev, otherwise it is uninstallable.

Samuel
diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur 
../tmp/opencv-4.1.2+dfsg/debian/control debian/control
--- ../tmp/opencv-4.1.2+dfsg/debian/control 2019-11-24 07:53:15.0 
+0100
+++ debian/control  2020-01-02 13:05:15.0 +0100
@@ -7,10 +7,10 @@
  Nobuhiro Iwamatsu ,
  Mo Zhou ,
 Build-Depends:
- ant,
+ ant [!hppa !hurd-any !kfreebsd-any],
  cmake (>= 2.8.7),
  debhelper (>= 11),
- default-jdk,
+ default-jdk [!hppa !hurd-any !kfreebsd-any],
  dh-python,
  doxygen,
  javahelper,
@@ -42,7 +42,7 @@
  libvtk6-dev,
  libvtkgdcm-dev [!alpha !ppc64 !riscv64 !x32],
  libgdcm-tools,
- maven-repo-helper,
+ maven-repo-helper [!hppa !hurd-any !kfreebsd-any],
  ocl-icd-opencl-dev,
  protobuf-compiler,
  python3-dev,
@@ -101,7 +101,7 @@
  libopencv-videoio-dev (= ${binary:Version}),
  libopencv-videostab-dev (= ${binary:Version}),
  libopencv-viz-dev (= ${binary:Version}),
- libopencv4.1-java (= ${source:Version}),
+ libopencv4.1-java (= ${source:Version}) [!hppa !hurd-any !kfreebsd-any],
  pkg-config,
  ${misc:Depends},
  ${shlibs:Depends},
@@ -1228,7 +1228,7 @@
 
 Package: libopencv4.1-jni
 Section: java
-Architecture: any
+Architecture: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x alpha 
ia64 m68k powerpc ppc64 riscv64 sh4 sparc64 x32
 Depends:
  libopencv-calib3d4.1 (= ${binary:Version}),
  libopencv-highgui4.1 (= ${binary:Version}),
diff --exclude .svn --exclude .git --exclude CVS --exclude .hg -ur 
../tmp/opencv-4.1.2+dfsg/debian/rules debian/rules
--- ../tmp/opencv-4.1.2+dfsg/debian/rules   2019-11-24 07:53:15.0 
+0100
+++ debian/rules2020-01-02 13:05:15.0 +0100
@@ -40,6 +40,12 @@
 CMAKE_ARCH_FLAGS += -DWITH_1394=OFF -DWITH_V4L=OFF
 endif
 
+# Java support
+ifeq (,$(findstring $(DEB_HOST_ARCH), hppa hurd-i386 kfreebsd-i386 
kfreebsd-amd64))
+DH_HELPERS = ,javahelper,jh_maven_repo_helper
+CMAKE_ARCH_FLAGS += -DBUILD_JAVA=ON
+endif
+
 # mitigate compiler OOM during build
 ifeq ($(DEB_HOST_ARCH),mipsel)
 export DEB_BUILD_OPTIONS=noopt
@@ -52,7 +58,6 @@
-GNinja \
-DANT_EXECUTABLE=/usr/bin/ant \
-DBUILD_EXAMPLES=ON \
-   -DBUILD_JAVA=ON \
-DBUILD_PROTOBUF=OFF \
-DBUILD_TESTS=ON \
-DBUILD_PERF_TESTS=OFF \
@@ -104,7 +108,7 @@
$(CMAKE_ARCH_FLAGS)
 
 %:
-   dh $@ --with python3,javahelper,jh_maven_repo_helper
+   dh $@ --with python3$(DH_HELPERS)
 
 override_dh_clean:
rm -rvf modules/python/src2/hdr_parser.pyc


Bug#948248: opencv: Doesn't build on ports without java

2020-01-05 Thread Samuel Thibault
Source: opencv
Version: 4.1.2+dfsg-5
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hello,

opencv currently doesn't build on ports without java support. The
attached patch fix that: it disables the ant, default-jdk, and
maven-repo-helper build-deps on non-java ports, they enable the
libopencv4.1-jni package only on java ports, and enable the dh java
helpers and pass -DBUILD_JAVA=ON to configure only on java ports.

Samuel

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-debug'), (500, 'proposed-updates-debug'), (500, 
'proposed-updates'), (500, 'oldstable-proposed-updates-debug'), (500, 
'oldstable-proposed-updates'), (500, 'oldoldstable'), (500, 'buildd-unstable'), 
(500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Samuel
 l'alim je sais où elle est, elle est juste à côté de la dame qui dort
 B: clairement faut revoir les priorités dans la vie
 B: une dame ça se retrouve, un uptime...
--- debian/control.original 2020-01-01 19:26:38.0 +
+++ debian/control  2020-01-02 12:53:28.0 +
@@ -7,10 +7,10 @@
  Nobuhiro Iwamatsu ,
  Mo Zhou ,
 Build-Depends:
- ant,
+ ant [!hppa !hurd-any !kfreebsd-any],
  cmake (>= 2.8.7),
  debhelper (>= 11),
- default-jdk,
+ default-jdk [!hppa !hurd-any !kfreebsd-any],
  dh-python,
  doxygen,
  javahelper,
@@ -42,7 +42,7 @@
  libvtk6-dev,
  libvtkgdcm-dev [!alpha !ppc64 !riscv64 !x32],
  libgdcm-tools,
- maven-repo-helper,
+ maven-repo-helper [!hppa !hurd-any !kfreebsd-any],
  ocl-icd-opencl-dev,
  protobuf-compiler,
  python3-dev,
@@ -1228,7 +1228,7 @@
 
 Package: libopencv4.1-jni
 Section: java
-Architecture: any
+Architecture: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x alpha 
ia64 m68k powerpc ppc64 riscv64 sh4 sparc64 x32
 Depends:
  libopencv-calib3d4.1 (= ${binary:Version}),
  libopencv-highgui4.1 (= ${binary:Version}),
--- debian/rules.original   2020-01-01 19:27:07.0 +
+++ debian/rules2020-01-05 21:45:22.0 +
@@ -40,6 +40,12 @@
 CMAKE_ARCH_FLAGS += -DWITH_1394=OFF -DWITH_V4L=OFF
 endif
 
+# Java support
+ifeq (,$(findstring $(DEB_HOST_ARCH), hppa hurd-i386 kfreebsd-i386 
kfreebsd-amd64))
+DH_HELPERS = ,javahelper,jh_maven_repo_helper
+CMAKE_ARCH_FLAGS += -DBUILD_JAVA=ON
+endif
+
 # mitigate compiler OOM during build
 ifeq ($(DEB_HOST_ARCH),mipsel)
 export DEB_BUILD_OPTIONS=noopt
@@ -52,7 +58,6 @@
-GNinja \
-DANT_EXECUTABLE=/usr/bin/ant \
-DBUILD_EXAMPLES=ON \
-   -DBUILD_JAVA=ON \
-DBUILD_PROTOBUF=OFF \
-DBUILD_TESTS=ON \
-DBUILD_PERF_TESTS=OFF \
@@ -104,7 +108,7 @@
$(CMAKE_ARCH_FLAGS)
 
 %:
-   dh $@ --with python3,javahelper,jh_maven_repo_helper
+   dh $@ --with python3$(DH_HELPERS)
 
 override_dh_clean:
rm -rvf modules/python/src2/hdr_parser.pyc