GNOME Bugzilla – Bug 747711
opencv: make cascades relocatable on win32
Last modified: 2018-11-03 13:34:13 UTC
Default cascade paths are hardcoded as: OPENCV_PREFIX + PATH_TO_CASCADE where OPENCV_PREFIX is obtained by pkg-conifg from opencv.pc First problem is that w32 pkg-config by default gets a DOS version of OPENCV_PREFIX, so the resulting cascade path is: A) Absolute B) DOS This can be fixed by passing --dont-define-prefix to pkg-config (a trick well-known to anyone who builds anything with MinGW/MSYS), which makes it output prefix that starts with '/' (usually '/mingw'). So now cascade path is: A) Absolute B) POSIX Which fixes nothing, since Windows does not understand POSIX paths. However, in this case some code and path wizardry can fix the situation (see the patch attached).
Created attachment 301379 [details] [review] W32: Make OpenCV cascades relocatable Check the profile file path. If it starts with '/', compare its betinning to the configure-time OpenCV prefix and, if they match, replace ith with the runtime OpenCV prefix. This code assumes that OPENCV_PREFIX is in non-mangled form (i.e. "/mingw", not "c:\\somewhere\\mingw"). The easiest way to accomplish this is to change configure.ac to give --dont-define-prefix option to pkg-config when it tries to find opencv prefix. However, that change is distribution-specific and not included in this commit.
I think we should do this on the Autoconf side since for instance, this is not needed when building with the Meson build system at all since it invokes pkg-config directly instead of through the shell. That makes all the paths be Windows-native ("C:\\blah\\foo\\prefix"). I'll look into this.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/239.