summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-01-13 21:20:19 +0100
committerMichał Górny <mgorny@gentoo.org>2024-01-14 20:23:32 +0100
commit2f9c42cb12b476a78214e2f7d5bb3f984ce05de6 (patch)
treea090b49934af522bd3f29135d3c4f7bbfeb9c5dd /dev-build/cmake/files
parentMove {dev-util → dev-build}/tinycmmc (diff)
downloadgentoo-2f9c42cb12b476a78214e2f7d5bb3f984ce05de6.tar.gz
gentoo-2f9c42cb12b476a78214e2f7d5bb3f984ce05de6.tar.bz2
gentoo-2f9c42cb12b476a78214e2f7d5bb3f984ce05de6.zip
Move {dev-util → dev-build}/cmake
Signed-off-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/34792 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-build/cmake/files')
-rw-r--r--dev-build/cmake/files/50cmake-gentoo.el4
-rw-r--r--dev-build/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch24
-rw-r--r--dev-build/cmake/files/cmake-3.14.0_rc3-prefix-dirs.patch142
-rw-r--r--dev-build/cmake/files/cmake-3.16.0_rc4-darwin-bundle.patch41
-rw-r--r--dev-build/cmake/files/cmake-3.17.0_rc1-FindBLAS.patch37
-rw-r--r--dev-build/cmake/files/cmake-3.18.0-filter_distcc_warning.patch17
-rw-r--r--dev-build/cmake/files/cmake-3.19.1-darwin-gcc.patch14
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0001-Don-t-use-.so-for-modules-on-darwin-macos.-Use-.bund.patch35
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0002-Set-some-proper-paths-to-make-cmake-find-our-tools.patch133
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0003-Prefer-pkgconfig-in-FindBLAS.patch31
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0004-Ensure-that-the-correct-version-of-Qt-is-always-used.patch54
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0005-Respect-Gentoo-s-Python-eclasses.patch63
-rw-r--r--dev-build/cmake/files/cmake-3.27.0_rc1-0006-Filter-out-distcc-warnings-to-avoid-confusing-CMake.patch26
-rw-r--r--dev-build/cmake/files/cmake-3.27.4-0001-FindPkgConfig-ignore-whitespace-separators-in-versio.patch38
-rw-r--r--dev-build/cmake/files/cmake-3.28.0-c99.patch90
-rw-r--r--dev-build/cmake/files/cmake-3.5.2-FindQt4.patch45
-rw-r--r--dev-build/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch43
-rw-r--r--dev-build/cmake/files/cmake.vim3
18 files changed, 840 insertions, 0 deletions
diff --git a/dev-build/cmake/files/50cmake-gentoo.el b/dev-build/cmake/files/50cmake-gentoo.el
new file mode 100644
index 000000000000..e4a1a6d47cbc
--- /dev/null
+++ b/dev-build/cmake/files/50cmake-gentoo.el
@@ -0,0 +1,4 @@
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'cmake-mode "cmake-mode" "Major mode for editing CMake files." t)
+(add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-mode))
+(add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-mode))
diff --git a/dev-build/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch b/dev-build/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch
new file mode 100644
index 000000000000..5f9c26658f31
--- /dev/null
+++ b/dev-build/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch
@@ -0,0 +1,24 @@
+diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
+index bffa9fb..8fc90ee 100644
+--- a/Modules/FindPythonLibs.cmake
++++ b/Modules/FindPythonLibs.cmake
+@@ -74,6 +74,19 @@ set(_Python_VERSIONS
+ ${_PYTHON_FIND_OTHER_VERSIONS}
+ )
+
++# Gentoo portage requires that you use exactly the given python version
++if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ execute_process(COMMAND python -c "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
++ OUTPUT_VARIABLE _Gentoo_Python_VERSION)
++ list(FIND _Python_VERSIONS "${_Gentoo_Python_VERSION}" _Gentoo_Python_INDEX)
++ if (_Gentoo_Python_INDEX EQUAL -1)
++ # the current Gentoo python version is not compatible with what is requested
++ set(_Python_VERSIONS)
++ else ()
++ set(_Python_VERSIONS "${_Gentoo_Python_VERSION}")
++ endif ()
++endif()
++
+ unset(_PYTHON_FIND_OTHER_VERSIONS)
+ unset(_PYTHON1_VERSIONS)
+ unset(_PYTHON2_VERSIONS)
diff --git a/dev-build/cmake/files/cmake-3.14.0_rc3-prefix-dirs.patch b/dev-build/cmake/files/cmake-3.14.0_rc3-prefix-dirs.patch
new file mode 100644
index 000000000000..9a6054e9557f
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.14.0_rc3-prefix-dirs.patch
@@ -0,0 +1,142 @@
+From 8ab270bf43f038bba4f992031508b065fa83f390 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 1 Mar 2019 23:11:41 +0100
+Subject: [PATCH] Set some proper paths to make cmake find our tools.
+
+The ebuild now adds an extra / at the end of $EPREFIX so that it is
+never the empty string (so that CMAKE_SYSTEM_PREFIX_PATH remains
+correct)
+
+Original patch by Heiko Przybyl.
+Updated by Chris Reffett (cmake-2.8.8)
+Updated by Johannes Huber (cmake-2.8.9)
+Updated by Michael Palimaka (cmake-2.8.10)
+Updated by Chris Reffett (cmake-2.8.11)
+Updated by Michael Palimaka (cmake-3.0.0)
+Updated by Lars Wendler (cmake-3.9.0_rc2)
+Updated by Benda Xu (cmake-3.13.4)
+Updated by Lars Wendler (cmake-3.14.0_rc1)
+Updated by Lars Wendler (cmake-3.14.0_rc2)
+Updated by Lars Wendler (cmake-3.14.0_rc3)
+Updated by Jacob Floyd (cmake-3.19.2)
+---
+ Modules/Platform/Darwin.cmake | 12 +++++++----
+ Modules/Platform/UnixPaths.cmake | 35 ++++++++++++++++++++++++--------
+ 2 files changed, 35 insertions(+), 12 deletions(-)
+
+diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
+index 5590433a3b..b04383e51d 100644
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -116,9 +116,9 @@ set(CMAKE_C_FRAMEWORK_SEARCH_FLAG -F)
+ set(CMAKE_CXX_FRAMEWORK_SEARCH_FLAG -F)
+ set(CMAKE_Fortran_FRAMEWORK_SEARCH_FLAG -F)
+
+-# default to searching for frameworks first
++# default to searching for frameworks last
+ if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
+- set(CMAKE_FIND_FRAMEWORK FIRST)
++ set(CMAKE_FIND_FRAMEWORK LAST)
+ endif()
+
+ # Older OS X linkers do not report their framework search path
+@@ -140,6 +140,9 @@ endif()
+
+ # set up the default search directories for frameworks
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH
++ @GENTOO_PORTAGE_EPREFIX@MacOSX.sdk/System/Library/Frameworks
++ @GENTOO_PORTAGE_EPREFIX@Frameworks
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
+ ~/Library/Frameworks
+ )
+ if(_CMAKE_OSX_SYSROOT_PATH)
+@@ -186,13 +189,15 @@ if(CMAKE_OSX_SYSROOT)
+ endif()
+ endif()
+
+-# default to searching for application bundles first
++# default to searching for application bundles last
+ if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
+- set(CMAKE_FIND_APPBUNDLE FIRST)
++ set(CMAKE_FIND_APPBUNDLE LAST)
+ endif()
+ # set up the default search directories for application bundles
+ set(_apps_paths)
+ foreach(_path
++ @GENTOO_PORTAGE_EPREFIX@Applications
++ @GENTOO_PORTAGE_EPREFIX@usr/bin
+ "~/Applications"
+ "/Applications"
+ "${OSX_DEVELOPER_ROOT}/../Applications" # Xcode 4.3+
+diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
+index 97f744d521..8d11827371 100644
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -23,7 +23,8 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
+ # search types.
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Standard
+- /usr/local /usr /
++ @GENTOO_PORTAGE_EPREFIX@usr/local @GENTOO_PORTAGE_EPREFIX@usr @GENTOO_PORTAGE_EPREFIX@
++ @GENTOO_HOST@/usr/local /usr /
+
+ # CMake install location
+ "${_CMAKE_INSTALL_DIR}"
+@@ -50,17 +51,33 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+
+ # List common include file locations not under the common prefixes.
+ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+- # X11
+- /usr/include/X11
++ @GENTOO_PORTAGE_EPREFIX@usr/include
+ )
+
+ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+- # X11
+- /usr/lib/X11
++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc
++ @GENTOO_PORTAGE_GCCLIBDIR@
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
++ )
++
++list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
++ @GENTOO_PORTAGE_EPREFIX@usr/bin
++ @GENTOO_PORTAGE_EPREFIX@bin
+ )
+
+ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc
++ @GENTOO_PORTAGE_GCCLIBDIR@
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
++ @GENTOO_HOST@/lib /usr/lib /usr/lib32 /usr/lib64 /usr/libx32
+ )
+
+ if(CMAKE_SYSROOT_COMPILE)
+@@ -73,11 +90,13 @@ endif()
+ # parsing the implicit directory information from compiler output.
+ set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
+- "${_cmake_sysroot_compile}/usr/include"
++ @GENTOO_PORTAGE_EPREFIX@usr/include
++ @GENTOO_HOST@/usr/include
+ )
+ set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
+- "${_cmake_sysroot_compile}/usr/include"
++ @GENTOO_PORTAGE_EPREFIX@usr/include
++ @GENTOO_HOST@/usr/include
+ )
+ set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
+--
+2.21.0
+
diff --git a/dev-build/cmake/files/cmake-3.16.0_rc4-darwin-bundle.patch b/dev-build/cmake/files/cmake-3.16.0_rc4-darwin-bundle.patch
new file mode 100644
index 000000000000..5aac1be55da6
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.16.0_rc4-darwin-bundle.patch
@@ -0,0 +1,41 @@
+From ce929588adf61ee24bb6850f4b9a58cc7ea224c7 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Tue, 19 Nov 2019 12:28:53 +0100
+Subject: [PATCH] Don't use .so for modules on darwin/macos. Use .bundle
+ instead.
+
+Patch by Heiko Przybyl
+
+Forward-ported from 2.8.10 to 3.4.0-rc1
+Forward-ported from 3.4.0-rc1 to 3.16.0-rc4
+
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+---
+ Modules/Platform/Darwin.cmake | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
+index 1482d76ae6..6a432963b6 100644
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -43,7 +43,7 @@ endif()
+ set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+ set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+ set(CMAKE_SHARED_MODULE_PREFIX "lib")
+-set(CMAKE_SHARED_MODULE_SUFFIX ".so")
++set(CMAKE_SHARED_MODULE_SUFFIX ".bundle")
+ set(CMAKE_MODULE_EXISTS 1)
+ set(CMAKE_DL_LIBS "")
+
+@@ -67,7 +67,7 @@ foreach(lang C CXX OBJC OBJCXX)
+ endforeach()
+
+ set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
+-set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
++set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".bundle" ".a")
+
+ # hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
+ # (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
+--
+2.24.0
+
diff --git a/dev-build/cmake/files/cmake-3.17.0_rc1-FindBLAS.patch b/dev-build/cmake/files/cmake-3.17.0_rc1-FindBLAS.patch
new file mode 100644
index 000000000000..6c919877cfd1
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.17.0_rc1-FindBLAS.patch
@@ -0,0 +1,37 @@
+From f4009d1efccf571d229e89fab846b0d5873e7a5b Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Thu, 13 Feb 2020 13:12:45 +0100
+Subject: [PATCH] Prefer pkgconfig in FindBLAS
+
+---
+ Modules/FindBLAS.cmake | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
+index 9b6d09c2f9..c2af42468c 100644
+--- a/Modules/FindBLAS.cmake
++++ b/Modules/FindBLAS.cmake
+@@ -7,6 +7,10 @@ FindBLAS
+
+ Find Basic Linear Algebra Subprograms (BLAS) library
+
++Version modified for Gentoo Linux.
++If a valid PkgConfig configuration is found, this overrides and cancels
++all further checks.
++
+ This module finds an installed Fortran library that implements the
+ BLAS linear-algebra interface (see http://www.netlib.org/blas/).
+
+@@ -107,6 +111,9 @@ if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_CO
+ endif()
+ endif()
+
++# first, try PkgConfig
++set(BLA_PREFER_PKGCONFIG On)
++
+ if(CMAKE_Fortran_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+ else()
+--
+2.25.0
+
diff --git a/dev-build/cmake/files/cmake-3.18.0-filter_distcc_warning.patch b/dev-build/cmake/files/cmake-3.18.0-filter_distcc_warning.patch
new file mode 100644
index 000000000000..07d89ee5e2b4
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.18.0-filter_distcc_warning.patch
@@ -0,0 +1,17 @@
+https://bugs.gentoo.org/691544
+
+Patch-by: Felix W. <felix.wischke@gmail.com>
+
+Forward-ported from 3.16.5 to 3.18.0
+
+--- cmake-3.18.0/Source/Checks/cm_cxx_features.cmake
++++ cmake-3.18.0/Source/Checks/cm_cxx_features.cmake
+@@ -36,6 +36,8 @@
+ string(REGEX REPLACE "[^\n]*icpc: command line warning #10121: overriding [^\n]*" "" check_output "${check_output}")
+ # Filter out ld warnings.
+ string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}")
++ # Filter out distcc.
++ string(REGEX REPLACE "[^\n]*distcc\\[[0-9]+\\][^\n]*[Ww]arning:[^\n]*" "" check_output "${check_output}")
+ # If using the feature causes warnings, treat it as broken/unavailable.
+ if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]")
+ set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
diff --git a/dev-build/cmake/files/cmake-3.19.1-darwin-gcc.patch b/dev-build/cmake/files/cmake-3.19.1-darwin-gcc.patch
new file mode 100644
index 000000000000..0f0a6b681bc7
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.19.1-darwin-gcc.patch
@@ -0,0 +1,14 @@
+grobian@gentoo.org: fix compilation on macOS using GCC
+
+compiler says it all: include memory if you use unique_ptr
+
+--- a/Source/cmMachO.h.orig 2020-11-24 14:50:26.000000000 +0100
++++ b/Source/cmMachO.h 2020-11-28 16:05:11.509620124 +0100
+@@ -6,6 +6,7 @@
+
+ #include <iosfwd>
+ #include <string>
++#include <memory>
+
+ #if !defined(CMAKE_USE_MACH_PARSER)
+ # error "This file may be included only if CMAKE_USE_MACH_PARSER is enabled."
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0001-Don-t-use-.so-for-modules-on-darwin-macos.-Use-.bund.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0001-Don-t-use-.so-for-modules-on-darwin-macos.-Use-.bund.patch
new file mode 100644
index 000000000000..ada6f7b8f5bc
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0001-Don-t-use-.so-for-modules-on-darwin-macos.-Use-.bund.patch
@@ -0,0 +1,35 @@
+From 2d155220920c8fd7ad5b4df2d5be923808ee841a Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Tue, 19 Nov 2019 12:28:53 +0100
+Subject: [PATCH 1/6] Don't use .so for modules on darwin/macos. Use .bundle
+ instead.
+
+Patch by Heiko Przybyl
+
+Forward-ported from 2.8.10 to 3.4.0-rc1
+Forward-ported from 3.4.0-rc1 to 3.16.0-rc4
+
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -42,7 +42,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+ set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+ set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so")
+ set(CMAKE_SHARED_MODULE_PREFIX "lib")
+-set(CMAKE_SHARED_MODULE_SUFFIX ".so")
++set(CMAKE_SHARED_MODULE_SUFFIX ".bundle")
+ set(CMAKE_APPLE_IMPORT_FILE_PREFIX "lib")
+ set(CMAKE_APPLE_IMPORT_FILE_SUFFIX ".tbd")
+ set(CMAKE_MODULE_EXISTS 1)
+@@ -66,7 +66,7 @@ foreach(lang C CXX OBJC OBJCXX)
+ endforeach()
+
+ set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
+-set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
++set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".bundle" ".a")
+
+ # hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
+ # (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0002-Set-some-proper-paths-to-make-cmake-find-our-tools.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0002-Set-some-proper-paths-to-make-cmake-find-our-tools.patch
new file mode 100644
index 000000000000..7ed6fb4b15b3
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0002-Set-some-proper-paths-to-make-cmake-find-our-tools.patch
@@ -0,0 +1,133 @@
+From aa8c0176389436e698e2f7e84097b4151b6477bf Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 1 Mar 2019 23:11:41 +0100
+Subject: [PATCH 2/6] Set some proper paths to make cmake find our tools.
+
+The ebuild now adds an extra / at the end of $EPREFIX so that it is
+never the empty string (so that CMAKE_SYSTEM_PREFIX_PATH remains
+correct)
+
+Original patch by Heiko Przybyl.
+Updated by Chris Reffett (cmake-2.8.8)
+Updated by Johannes Huber (cmake-2.8.9)
+Updated by Michael Palimaka (cmake-2.8.10)
+Updated by Chris Reffett (cmake-2.8.11)
+Updated by Michael Palimaka (cmake-3.0.0)
+Updated by Lars Wendler (cmake-3.9.0_rc2)
+Updated by Benda Xu (cmake-3.13.4)
+Updated by Lars Wendler (cmake-3.14.0_rc1)
+Updated by Lars Wendler (cmake-3.14.0_rc2)
+Updated by Lars Wendler (cmake-3.14.0_rc3)
+Updated by Jacob Floyd (cmake-3.19.2)
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -138,9 +138,9 @@ set(CMAKE_LINK_LIBRARY_USING_WEAK_LIBRARY_SUPPORTED TRUE)
+ set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "LINKER:-force_load <LIB_ITEM>")
+ set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED TRUE)
+
+-# default to searching for frameworks first
++# default to searching for frameworks last
+ if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
+- set(CMAKE_FIND_FRAMEWORK FIRST)
++ set(CMAKE_FIND_FRAMEWORK LAST)
+ endif()
+
+ # Older OS X linkers do not report their framework search path
+@@ -162,6 +162,9 @@ endif()
+
+ # set up the default search directories for frameworks
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH
++ @GENTOO_PORTAGE_EPREFIX@MacOSX.sdk/System/Library/Frameworks
++ @GENTOO_PORTAGE_EPREFIX@Frameworks
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
+ ~/Library/Frameworks
+ )
+ if(_CMAKE_OSX_SYSROOT_PATH)
+@@ -219,13 +222,15 @@ if(CMAKE_OSX_SYSROOT)
+ endif()
+ endif()
+
+-# default to searching for application bundles first
++# default to searching for application bundles last
+ if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
+- set(CMAKE_FIND_APPBUNDLE FIRST)
++ set(CMAKE_FIND_APPBUNDLE LAST)
+ endif()
+ # set up the default search directories for application bundles
+ set(_apps_paths)
+ foreach(_path
++ @GENTOO_PORTAGE_EPREFIX@Applications
++ @GENTOO_PORTAGE_EPREFIX@usr/bin
+ "~/Applications"
+ "/Applications"
+ "${OSX_DEVELOPER_ROOT}/../Applications" # Xcode 4.3+
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -30,7 +30,8 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
+ # synchronized
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Standard
+- /usr/local /usr /
++ @GENTOO_PORTAGE_EPREFIX@usr/local @GENTOO_PORTAGE_EPREFIX@usr @GENTOO_PORTAGE_EPREFIX@
++ @GENTOO_HOST@/usr/local /usr /
+
+ # CMake install location
+ "${_CMAKE_INSTALL_DIR}"
+@@ -58,17 +59,33 @@ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+
+ # List common include file locations not under the common prefixes.
+ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+- # X11
+- /usr/include/X11
++ @GENTOO_PORTAGE_EPREFIX@usr/include
+ )
+
+ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+- # X11
+- /usr/lib/X11
++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc
++ @GENTOO_PORTAGE_GCCLIBDIR@
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
++ )
++
++list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
++ @GENTOO_PORTAGE_EPREFIX@usr/bin
++ @GENTOO_PORTAGE_EPREFIX@bin
+ )
+
+ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc
++ @GENTOO_PORTAGE_GCCLIBDIR@
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
++ @GENTOO_HOST@/lib /usr/lib /usr/lib32 /usr/lib64 /usr/libx32
+ )
+
+ if(CMAKE_SYSROOT_COMPILE)
+@@ -81,11 +98,13 @@ endif()
+ # parsing the implicit directory information from compiler output.
+ set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}
+- "${_cmake_sysroot_compile}/usr/include"
++ @GENTOO_PORTAGE_EPREFIX@usr/include
++ @GENTOO_HOST@/usr/include
+ )
+ set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}
+- "${_cmake_sysroot_compile}/usr/include"
++ @GENTOO_PORTAGE_EPREFIX@usr/include
++ @GENTOO_HOST@/usr/include
+ )
+ set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT
+ ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES}
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0003-Prefer-pkgconfig-in-FindBLAS.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0003-Prefer-pkgconfig-in-FindBLAS.patch
new file mode 100644
index 000000000000..8e6e218b73b5
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0003-Prefer-pkgconfig-in-FindBLAS.patch
@@ -0,0 +1,31 @@
+From 9bc75325cc38962ecdd4a3ebd67ce34ea8162a45 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Thu, 13 Feb 2020 13:12:45 +0100
+Subject: [PATCH 3/6] Prefer pkgconfig in FindBLAS
+
+--- a/Modules/FindBLAS.cmake
++++ b/Modules/FindBLAS.cmake
+@@ -7,6 +7,10 @@ FindBLAS
+
+ Find Basic Linear Algebra Subprograms (BLAS) library
+
++Version modified for Gentoo Linux.
++If a valid PkgConfig configuration is found, this overrides and cancels
++all further checks.
++
+ This module finds an installed Fortran library that implements the
+ `BLAS linear-algebra interface`_.
+
+@@ -276,6 +280,9 @@ function(_add_blas_target)
+ endif()
+ endfunction()
+
++# first, try PkgConfig
++set(BLA_PREFER_PKGCONFIG ON)
++
+ if(CMAKE_Fortran_COMPILER_LOADED)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+ else()
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0004-Ensure-that-the-correct-version-of-Qt-is-always-used.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0004-Ensure-that-the-correct-version-of-Qt-is-always-used.patch
new file mode 100644
index 000000000000..5f9560c4aaa9
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0004-Ensure-that-the-correct-version-of-Qt-is-always-used.patch
@@ -0,0 +1,54 @@
+From 30cf2aa7830a09b2bc4132eb3a3920fc0853b827 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 9 Jun 2023 09:57:18 +0100
+Subject: [PATCH 4/6] Ensure that the correct version of Qt is always used.
+
+With the introduction qt-4.8.6, Qt binaries were moved from /usr/bin to
+/usr/$(get_libdir)/qt4/bin, leaving behind in their place symlinks to qtchooser.
+
+There is no guarantee to which version of Qt these symlinks might point, so it
+is necessary to find the correct version explicitly.
+
+Once qmake is found, it is queried for the correct location of all other items.
+
+Bug: https://bugs.gentoo.org/547222
+
+[imported from cmake-3.5.2-FindQt4.patch.]
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/Modules/FindQt4.cmake
++++ b/Modules/FindQt4.cmake
+@@ -478,13 +478,23 @@ function(_QT4_FIND_QMAKE QMAKE_NAMES QMAKE_RESULT VERSION_RESULT)
+
+ get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
+
+- find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
+- PATHS
+- ENV QTDIR
+- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
+- PATH_SUFFIXES bin
+- DOC "The qmake executable for the Qt installation to use"
+- )
++ if(CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
++ PATHS
++ $ENV{EPREFIX}/usr/${CMAKE_INSTALL_LIBDIR}/qt4/bin
++ $ENV{EPREFIX}/usr/bin
++ NO_DEFAULT_PATH
++ DOC "The qmake executable for the Qt installation to use"
++ )
++ else()
++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
++ PATHS
++ ENV QTDIR
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
++ PATH_SUFFIXES bin
++ DOC "The qmake executable for the Qt installation to use"
++ )
++ endif()
+
+ set(major 0)
+ if (QT_QMAKE_EXECUTABLE)
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0005-Respect-Gentoo-s-Python-eclasses.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0005-Respect-Gentoo-s-Python-eclasses.patch
new file mode 100644
index 000000000000..b8c9c1fe50b1
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0005-Respect-Gentoo-s-Python-eclasses.patch
@@ -0,0 +1,63 @@
+From 91acf58e953fd6e609788e955d84eab9822d5aa4 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 9 Jun 2023 09:58:11 +0100
+Subject: [PATCH 5/6] Respect Gentoo's Python eclasses
+
+[imported from 2.8.10.2-FindPythonLibs.patch]
+[imported from 3.9.0_rc2-FindPythonInterp.patch]
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/Modules/FindPythonInterp.cmake
++++ b/Modules/FindPythonInterp.cmake
+@@ -91,6 +91,11 @@ if(PythonInterp_FIND_VERSION)
+ else()
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+ endif()
++
++if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ set(_Python_NAMES python)
++endif()
++
+ find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
+
+ # Set up the versions we know about, in the order we will search. Always add
+@@ -115,12 +120,13 @@ unset(_PYTHON2_VERSIONS)
+ unset(_PYTHON3_VERSIONS)
+
+ # Search for newest python version if python executable isn't found
+-if(NOT PYTHON_EXECUTABLE)
++if(NOT PYTHON_EXECUTABLE AND NOT (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo))
+ foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
+ set(_Python_NAMES python${_CURRENT_VERSION})
+ if(CMAKE_HOST_WIN32)
+ list(APPEND _Python_NAMES python)
+ endif()
++
+ find_program(PYTHON_EXECUTABLE
+ NAMES ${_Python_NAMES}
+ PATHS
+--- a/Modules/FindPythonLibs.cmake
++++ b/Modules/FindPythonLibs.cmake
+@@ -130,6 +130,19 @@ if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+ endif()
+ list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
+
++# Gentoo portage requires that you use exactly the given python version
++if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ execute_process(COMMAND python -c "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
++ OUTPUT_VARIABLE _Gentoo_Python_VERSION)
++ list(FIND _Python_VERSIONS "${_Gentoo_Python_VERSION}" _Gentoo_Python_INDEX)
++ if (_Gentoo_Python_INDEX EQUAL -1)
++ # the current Gentoo python version is not compatible with what is requested
++ set(_Python_VERSIONS)
++ else ()
++ set(_Python_VERSIONS "${_Gentoo_Python_VERSION}")
++ endif ()
++endif()
++
+ unset(_PYTHON_FIND_OTHER_VERSIONS)
+ unset(_PYTHON1_VERSIONS)
+ unset(_PYTHON2_VERSIONS)
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.0_rc1-0006-Filter-out-distcc-warnings-to-avoid-confusing-CMake.patch b/dev-build/cmake/files/cmake-3.27.0_rc1-0006-Filter-out-distcc-warnings-to-avoid-confusing-CMake.patch
new file mode 100644
index 000000000000..74d74b5f12f9
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.0_rc1-0006-Filter-out-distcc-warnings-to-avoid-confusing-CMake.patch
@@ -0,0 +1,26 @@
+From f7ad7429b0b17c70b0309a5a8ee04d1afc434df0 Mon Sep 17 00:00:00 2001
+From: Felix W <felix.wischke@gmail.com>
+Date: Fri, 9 Jun 2023 09:59:41 +0100
+Subject: [PATCH 6/6] Filter out distcc warnings to avoid confusing CMake
+
+Forward-ported from 3.16.5 to 3.18.0
+
+Bug: https://bugs.gentoo.org/691544
+Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/22573
+[imported from cmake 3.18.0-filter_distcc_warning.patch]
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/Source/Checks/cm_cxx_features.cmake
++++ b/Source/Checks/cm_cxx_features.cmake
+@@ -55,6 +55,8 @@ function(cm_check_cxx_feature name)
+ string(REGEX REPLACE "[^\n]*icpc: command line warning #10121: overriding [^\n]*" "" check_output "${check_output}")
+ # Filter out ld warnings.
+ string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}")
++ # Filter out distcc.
++ string(REGEX REPLACE "[^\n]*distcc\\[[0-9]+\\][^\n]*[Ww]arning:[^\n]*" "" check_output "${check_output}")
+ # If using the feature causes warnings, treat it as broken/unavailable.
+ if(check_output MATCHES "(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]")
+ set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE)
+--
+2.41.0
+
diff --git a/dev-build/cmake/files/cmake-3.27.4-0001-FindPkgConfig-ignore-whitespace-separators-in-versio.patch b/dev-build/cmake/files/cmake-3.27.4-0001-FindPkgConfig-ignore-whitespace-separators-in-versio.patch
new file mode 100644
index 000000000000..9ee8a1c9fcbf
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.27.4-0001-FindPkgConfig-ignore-whitespace-separators-in-versio.patch
@@ -0,0 +1,38 @@
+https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8789
+
+From d47771bbb96a8435401950fb504b06003ec0babb Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Sat, 9 Sep 2023 13:45:19 +0200
+Subject: [PATCH] FindPkgConfig: ignore whitespace separators in version check
+
+The regex used to split up the version if it contains an operator fails
+if the string contains whitespaces. Resulting in an extra whitespace
+after the package name and before the package version leading to
+breakage in pkgconf and thus webkit-gtk.
+
+See:
+https://github.com/pkgconf/pkgconf/issues/317
+https://bugs.webkit.org/show_bug.cgi?id=261125
+https://bugs.gentoo.org/913644
+---
+ Modules/FindPkgConfig.cmake | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
+index 4d29f4505..6e8b78441 100644
+--- a/Modules/FindPkgConfig.cmake
++++ b/Modules/FindPkgConfig.cmake
+@@ -563,8 +563,8 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
+ set(_pkg_check_modules_exist_query)
+
+- # check whether version is given
+- if (_pkg_check_modules_pkg MATCHES "(.*[^><])(=|[><]=?)(.*)")
++ # check whether version is given while ignoring whitespace
++ if (_pkg_check_modules_pkg MATCHES "(.*[^>< \t])[ \t]*(=|[><]=?)[ \t]*(.*)")
+ set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
+ set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
+ set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
+--
+2.42.0
+
diff --git a/dev-build/cmake/files/cmake-3.28.0-c99.patch b/dev-build/cmake/files/cmake-3.28.0-c99.patch
new file mode 100644
index 000000000000..3af9a5104f66
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.28.0-c99.patch
@@ -0,0 +1,90 @@
+https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9002
+
+From 9ede6138b71ac2ab961b0954b10a9dc03cf77b37 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Thu, 23 Nov 2023 08:45:05 +0100
+Subject: [PATCH] Tests: Improve C compatibility of LoadCommand tests
+
+The previous code used `char **` and `const char **`` types as if they
+were the same. But they are distinct types in C, so when passing
+these pointers as function arguments, their types have to match.
+Future C compilers will treat this as an error, similar to what
+C++ compilers do today.
+---
+ Tests/LoadCommand/CMakeCommands/cmTestCommand.c | 13 ++++++++-----
+ .../CMakeCommands/cmTestCommand.c | 15 +++++++++------
+ 2 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+index 7176ebe9d4b..ba13727d2b8 100644
+--- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
++++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+@@ -16,14 +16,14 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
+ {
+ char* file;
+ char* str;
+- char* srcs;
++ const char* srcs;
+ const char* cstr;
+ char buffer[1024];
+ void* source_file;
+ char* args[2];
+- char* ccArgs[4];
+- char* ccDep[1];
+- char* ccOut[1];
++ const char* ccArgs[4];
++ const char* ccDep[1];
++ const char* ccOut[1];
+ cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
+
+ cmVTKWrapTclData* cdata =
+@@ -148,7 +148,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
+ if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
+ return 0;
+ }
+- info->CAPI->ExecuteCommand(mf, "SET", 2, args);
++
++ ccArgs[0] = "TEST_EXEC";
++ ccArgs[1] = "TRUE";
++ info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
+
+ /* make sure we can find the source file */
+ if (!info->CAPI->GetSource(mf, argv[1])) {
+diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+index 7176ebe9d4b..e3b332c1aa9 100644
+--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
++++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+@@ -16,14 +16,14 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
+ {
+ char* file;
+ char* str;
+- char* srcs;
+- const char* cstr;
++ const char* srcs;
++ char* cstr;
+ char buffer[1024];
+ void* source_file;
+ char* args[2];
+- char* ccArgs[4];
+- char* ccDep[1];
+- char* ccOut[1];
++ const char* ccArgs[4];
++ const char* ccDep[1];
++ const char* ccOut[1];
+ cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
+
+ cmVTKWrapTclData* cdata =
+@@ -148,7 +148,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
+ if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
+ return 0;
+ }
+- info->CAPI->ExecuteCommand(mf, "SET", 2, args);
++
++ ccArgs[0] = "TEST_EXEC";
++ ccArgs[1] = "TRUE";
++ info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
+
+ /* make sure we can find the source file */
+ if (!info->CAPI->GetSource(mf, argv[1])) {
+--
+GitLab
diff --git a/dev-build/cmake/files/cmake-3.5.2-FindQt4.patch b/dev-build/cmake/files/cmake-3.5.2-FindQt4.patch
new file mode 100644
index 000000000000..2f2764d30cf6
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.5.2-FindQt4.patch
@@ -0,0 +1,45 @@
+Ensure that the correct version of Qt is always used.
+
+With the introduction qt-4.8.6, Qt binaries were moved from /usr/bin to
+/usr/$(get_libdir)/qt4/bin, leaving behind in their place symlinks to qtchooser.
+
+There is no guarantee to which version of Qt these symlinks might point, so it
+is necessary to find the correct version explicitly.
+
+Once qmake is found, it is queried for the correct location of all other items.
+
+Gentoo-bug: 547222
+
+--- a/Modules/FindQt4.cmake
++++ b/Modules/FindQt4.cmake
+@@ -482,13 +482,23 @@
+
+ get_filename_component(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
+
+- find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
+- PATHS
+- ENV QTDIR
+- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
+- PATH_SUFFIXES bin
+- DOC "The qmake executable for the Qt installation to use"
+- )
++ if(CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
++ PATHS
++ $ENV{EPREFIX}/usr/${CMAKE_INSTALL_LIBDIR}/qt4/bin
++ $ENV{EPREFIX}/usr/bin
++ NO_DEFAULT_PATH
++ DOC "The qmake executable for the Qt installation to use"
++ )
++ else()
++ find_program(QT_QMAKE_EXECUTABLE NAMES ${QMAKE_NAME}
++ PATHS
++ ENV QTDIR
++ "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
++ PATH_SUFFIXES bin
++ DOC "The qmake executable for the Qt installation to use"
++ )
++ endif()
+
+ set(major 0)
+ if (QT_QMAKE_EXECUTABLE)
diff --git a/dev-build/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch b/dev-build/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch
new file mode 100644
index 000000000000..242392d8520e
--- /dev/null
+++ b/dev-build/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch
@@ -0,0 +1,43 @@
+From 325652950ecc5d72f0a6ac843889a048fe9e32cf Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 9 Jun 2017 02:08:03 +0200
+Subject: [PATCH] Don't mess with python versions too much
+
+---
+ Modules/FindPythonInterp.cmake | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
+index 64b98a879..73bd35b56 100644
+--- a/Modules/FindPythonInterp.cmake
++++ b/Modules/FindPythonInterp.cmake
+@@ -64,6 +64,11 @@ if(PythonInterp_FIND_VERSION)
+ else()
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+ endif()
++
++if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
++ set(_Python_NAMES python)
++endif()
++
+ find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
+
+ # Set up the versions we know about, in the order we will search. Always add
+@@ -88,12 +93,13 @@ unset(_PYTHON2_VERSIONS)
+ unset(_PYTHON3_VERSIONS)
+
+ # Search for newest python version if python executable isn't found
+-if(NOT PYTHON_EXECUTABLE)
++if(NOT PYTHON_EXECUTABLE AND NOT (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo))
+ foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
+ set(_Python_NAMES python${_CURRENT_VERSION})
+ if(CMAKE_HOST_WIN32)
+ list(APPEND _Python_NAMES python)
+ endif()
++
+ find_program(PYTHON_EXECUTABLE
+ NAMES ${_Python_NAMES}
+ PATHS
+--
+2.13.1
+
diff --git a/dev-build/cmake/files/cmake.vim b/dev-build/cmake/files/cmake.vim
new file mode 100644
index 000000000000..5cecd7d05b64
--- /dev/null
+++ b/dev-build/cmake/files/cmake.vim
@@ -0,0 +1,3 @@
+autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in runtime! indent/cmake.vim
+autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in setf cmake
+autocmd BufRead,BufNewFile *.ctest,*.ctest.in setf cmake