[vlc-commits] tools: fix cmake not finding packages on msys2

Steve Lhomme git at videolan.org
Thu Jun 18 12:45:52 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct  1 16:54:51 2018 +0200| [855ed0808e0b1bb46b5359d72ce7a8c522016515] | committer: Steve Lhomme

tools: fix cmake not finding packages on msys2

The PKG_CONFIG_PATH is converted to a Windows-like path and thus pkg-config
can't use it.

(cherry picked from commit 68fd1eaae9dc8fee485882f186a8b15b42e3a42d)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=855ed0808e0b1bb46b5359d72ce7a8c522016515
---

 extras/tools/cmake-msys-FindPkg.patch | 23 +++++++++++++++++++++++
 extras/tools/tools.mak                |  1 +
 2 files changed, 24 insertions(+)

diff --git a/extras/tools/cmake-msys-FindPkg.patch b/extras/tools/cmake-msys-FindPkg.patch
new file mode 100644
index 0000000000..6b73e9eace
--- /dev/null
+++ b/extras/tools/cmake-msys-FindPkg.patch
@@ -0,0 +1,23 @@
+--- cmake/Modules/FindPkgConfig.cmake.msys_pkg	2018-10-01 16:51:37.332632500 +0200
++++ cmake/Modules/FindPkgConfig.cmake	2018-10-01 16:51:46.815041400 +0200
+@@ -344,6 +344,20 @@ macro(_pkg_check_modules_internal _is_re
+       unset(_lib_dirs)
+       unset(_pkgconfig_path)
+     endif()
++    
++    if (CYGWIN OR MSYS)
++        # fix the PKG_CONFIG_PATH transformed into a cmake path with incorrect msys pathes
++        file(TO_CMAKE_PATH "$ENV{PKG_CONFIG_PATH}" _pkgconfig_path_cmake)
++        execute_process(
++            COMMAND sh.exe "-c" "cygpath -up '${_pkgconfig_path_cmake}'"
++            RESULT_VARIABLE _cygpath_retval
++            OUTPUT_VARIABLE _cygpath_outval
++            ERROR_VARIABLE _cygpath_error
++            OUTPUT_STRIP_TRAILING_WHITESPACE
++            ERROR_STRIP_TRAILING_WHITESPACE)
++        set(ENV{PKG_CONFIG_PATH} ${_cygpath_outval})
++        #message(STATUS "new ENV $ENV{PKG_CONFIG_PATH}")
++    endif()
+ 
+     # iterate through module list and check whether they exist and match the required version
+     foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 040dbf4499..a941edf264 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -84,6 +84,7 @@ cmake-$(CMAKE_VERSION).tar.gz:
 
 cmake: cmake-$(CMAKE_VERSION).tar.gz
 	$(UNPACK)
+	$(APPLY) cmake-msys-FindPkg.patch
 	$(APPLY) cmake-winstore.patch
 	$(MOVE)
 



More information about the vlc-commits mailing list