summaryrefslogtreecommitdiff
path: root/dev-util/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/cmake')
-rw-r--r--dev-util/cmake/Manifest25
-rw-r--r--dev-util/cmake/cmake-3.10.3.ebuild212
-rw-r--r--dev-util/cmake/cmake-3.11.3.ebuild217
-rw-r--r--dev-util/cmake/cmake-3.11.4.ebuild218
-rw-r--r--dev-util/cmake/cmake-3.12.0_rc3.ebuild217
-rw-r--r--dev-util/cmake/cmake-3.9.6.ebuild214
-rw-r--r--dev-util/cmake/files/50cmake-gentoo.el4
-rw-r--r--dev-util/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch24
-rw-r--r--dev-util/cmake/files/cmake-3.0.0-FindBLAS.patch43
-rw-r--r--dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch43
-rw-r--r--dev-util/cmake/files/cmake-3.1.0-darwin-isysroot.patch48
-rw-r--r--dev-util/cmake/files/cmake-3.11.0_rc2-FindBLAS.patch23
-rw-r--r--dev-util/cmake/files/cmake-3.11.4-libuv-1.21.patch28
-rw-r--r--dev-util/cmake/files/cmake-3.4.0_rc1-darwin-bundle.patch25
-rw-r--r--dev-util/cmake/files/cmake-3.5.2-FindQt4.patch45
-rw-r--r--dev-util/cmake/files/cmake-3.8.0_rc2-FindBoost-python.patch95
-rw-r--r--dev-util/cmake/files/cmake-3.9.0_rc2-FindImageMagick.patch47
-rw-r--r--dev-util/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch43
-rw-r--r--dev-util/cmake/files/cmake-3.9.0_rc2-prefix-dirs.patch126
-rw-r--r--dev-util/cmake/files/cmake.vim3
-rw-r--r--dev-util/cmake/metadata.xml12
21 files changed, 1712 insertions, 0 deletions
diff --git a/dev-util/cmake/Manifest b/dev-util/cmake/Manifest
new file mode 100644
index 000000000000..e931436e979d
--- /dev/null
+++ b/dev-util/cmake/Manifest
@@ -0,0 +1,25 @@
+AUX 50cmake-gentoo.el 244 BLAKE2B 1a6c7919b020b3e590a67a9a37f5afd7a56e9970274987cc785f5d5ca78e702a4387684441a68d111a2836eaa76be8ab111b03d81784acbc701b8ccc726f9a2a SHA512 70af0b9dd41f08531d3c754dc8af3662df8a22b469b79e8c40b7caae3205be1d4dc81d8b41837d1b6a46f2c348f5407e09e02269823c45c3366777e3bc7a0dcb
+AUX cmake-2.8.10.2-FindPythonLibs.patch 990 BLAKE2B af80335e802c198287315da4ebce193d81ceec00a1e13ec084b80bc3f3df5fb9158765c3bc02d4ed9f6972b77e66c712dd8292c12aa4aca78d178e96943639ee SHA512 c2027439ef5f53991f99db4c60f62e0164641ffce58bfbe0dd9a0b4f93f8b96f6f6e30715a3ab57a47ea7a85d7d784ad602ca74ce88b5bca1a08c538dcc9676f
+AUX cmake-3.0.0-FindBLAS.patch 1581 BLAKE2B 62493ac0ed23748be1913a919d88937c929e29a587a880335caa895c3e9046577f7978c6d85d3ed37762932b812aca407339679c4b917cceb85323130d07e79c SHA512 c73533071df93975a2dc9ba1e17fb16bd396ec816ec9b2b4b714923ea6db606baea82c378bb50d7bb9d918e54c661489265e1032b24d03b2ba924489d01510f7
+AUX cmake-3.0.2-FindLAPACK.patch 1369 BLAKE2B dea4b1299253ae61a24794de0168e869b7ae2f97392229905f47974deab148ba77eac04a6f77574be8a161eb673fd88b28187597bb9d47efd772a3b3177eafad SHA512 4f20c4475841201c28ad49539fe896345add626dad5615357ff01817e10f7315ffe39e3a8d4bd0270179d7c58e5679a5bd9ae2accc1019ecee91db380ba48577
+AUX cmake-3.1.0-darwin-isysroot.patch 1926 BLAKE2B 4e8dfc78db33e62a6234a91210f0136312dcd0fec065ba76fa0b6a9f1f3e4ae0139af700494951d999bdf2eee57a5c22db5516b8b8276f4d8be4395f2c4cb675 SHA512 0cbb55f8f5458e72b1e465577809287dcc270636aef192f039eb1e48ef78b933a7290f81c6fefb0dd1f5eb8f9d209766687ffcb4f37c702b8317f8d2e36236ad
+AUX cmake-3.11.0_rc2-FindBLAS.patch 775 BLAKE2B 89249b37ca44cc9068a5fd81350637da16c3a92a662f5b30db7e7bbfb9b47c816122bcbe31cb01845bdec760d449d0babbbcd6638ad4975b39db73c7bc5ea2e2 SHA512 ab24736b64bff1f9213f3eef7acc6a78829c875e8e5ec7b0d96ad406517e5335b0e3930ef369a9d6190d25a298c6834965e4977e5062e87595169272339f7738
+AUX cmake-3.11.4-libuv-1.21.patch 1333 BLAKE2B 685edbc90e59ddf3f5d430d50edba040703958db0bc57cfc3a5359b2aa71beb8600b2d4232225612036d00bcb9b9cbbdbb5f357f4fae492b6ed960c1a2a59bac SHA512 ea9ec5fcebd5a5988f5588b20cbf7e547065db6616476500c1d2d89c8585cf2276f7ba4fb06e85aa85ed435f81ca276c44518ce8f9f0efb6fc363f82f3b1aba4
+AUX cmake-3.4.0_rc1-darwin-bundle.patch 1043 BLAKE2B 99fc8061352b6a503f472e11045f9a99c2b980f08e9c1406722eacdd438617dccc394f53bdcaa4d93c4aa499b4615185c3ec99ccad8be3504972001498b02c48 SHA512 8c6297bf824d5a911e14004ac4c4e62d1a1528e44199d8860ca885bb1b8dd3d66a73c3db32664b830c3c635bdb498abbd5196be92ed2571cb22828d7186ff9f9
+AUX cmake-3.5.2-FindQt4.patch 1585 BLAKE2B 8cfda84c419515be57f65be7b4b22d7937b656eb7f58d61c7d9e30db9dac36e934f2a529b4ea20d69c5f8a653c727bae34374ebcb7f5017fd70df41abd538164 SHA512 bab8960bfea3c29416bdc8f39c7dee59b89bd7951752401f24eeb9161ac7bc2c6dd200cb62c6b9f964d763b5d257a94d8b04dc7090d6fa947a04f2d0c2e8c479
+AUX cmake-3.8.0_rc2-FindBoost-python.patch 6575 BLAKE2B 4a169862e81b053ea8077ed61001434ba2619230ab4a4d75a11e2ea2c18ad704792d6d37a3cfa78cb54a6bf6cd71bc9b0d6a7a1bba004a92212746001874f385 SHA512 bb156cc2b47f9928f2e6bae909e90866f4442e42d7357744aa2b00903a02a27cf8af4a788a74858bc51874c442c40788717c86e77690b91def80abaa38b90163
+AUX cmake-3.9.0_rc2-FindImageMagick.patch 2407 BLAKE2B e9390cac784eef6d3b83b88f995637098bf8ae35f53a0b2fa316081320f3901afe5eb965d011e2b944e1b1c6a59fb269b9daf28e35e94ffde9ade8576ef84788 SHA512 305cbdba81b23524403ef8eda93d494a0c3f3069e6434f0dbbd2f4e7bb2f64d503241bf5c3774631751dd26cb798472961c5565d5792e1028ca274054d2e77f1
+AUX cmake-3.9.0_rc2-FindPythonInterp.patch 1458 BLAKE2B a70945921738f00952b40a73d9ea26ecc86614aa3f12c94226aac4710dd0b9723c365b6f5def965069a54919bab13a33490facc6c5e64fad69d2e05a97d2812f SHA512 8adcb75cc035f64521e85229eb8dfa1e627326f8e189f66b707b3a0448ed3ae6acf306643026f7cbc7b924edcef73cad7a107d83162b4ca46bd6bbdc7a58af12
+AUX cmake-3.9.0_rc2-prefix-dirs.patch 4030 BLAKE2B e2cb3f630e4178ea93d5fcc7e14b529d79d84c71663054d45d32c42003c0914003ea55edaece22ac6ca29561b6740be477b0accb71f673969c910eec2d58c5a6 SHA512 116073dd2d63861cb33b7b92d07adbdfe74e05864f488be8df3a6f5b92bee76c518770ad31972323e0ed5d8c07505c7fe18105573e7f5ebeb79b193297dd2ca0
+AUX cmake.vim 217 BLAKE2B 5d2cf8b4101a7204fd27a9f21d82fea4d86fc4eeed54e062b543452dc574e73d1c80167c83eb482d9eec310950ac811ba35d3eeb97b51958f12f3adf575ddbe7 SHA512 2f7e9e949f8f3030a0dfcef56f4effea703ee60555c22f6a2d1dfeaf3334f33a3e88910c666f704e4ab60cde4ebb509c7d85d812a3c1627010e52fc757f15cdf
+DIST cmake-3.10.3.tar.gz 7825559 BLAKE2B 1db8c21abdcfac2612fa914d49f9edcf199240b714104dba1d470c8e1e487d8e6cc5d486febae88d4a71eb9419064bcf94f9bb2c779771323221c1f117baa693 SHA512 1ba6381321cb34c3c050548a1346d3b92d590a196d8aff7435c079cd485d01f7a6cd650ad97d00931aff424fcdc195bbaa6d9d7db679bf02f72f586c7b528ae4
+DIST cmake-3.11.3.tar.gz 7954155 BLAKE2B 949ee8c3dfae9d15eecdcd5c2a35fc278e84d1215858714112aea13aa5772f925a2a1b89bd39360e62b8638166038899e80ab48b6917e2c046876283d15d0218 SHA512 a91301bfb51bdf6a6c6ea71a26f05b6017eb375a4fc9c14934a83f2231d7af758bc67d8d9656111d1de56ec3df41dbcd61cb3cf50471bc0901f5bcccdf5267dc
+DIST cmake-3.11.4.tar.gz 7955301 BLAKE2B 2bad70e9e8b1a4081daf79fbec46d7389f685920d3158d05eae51fb24a0ecaad722c3e8a2eab1bcc75d599bee7a8202d432176e6ac1d87ed8815c84a7a8bb925 SHA512 c5d03ad66a004292038e49e391c390ebc328fbb089ea699742a9b75f0ada9398c3dc971b868f75d8438bf437ecbeaa62541beb53cae14a699bf244ad101a2290
+DIST cmake-3.12.0-rc3.tar.gz 8089991 BLAKE2B 306faa1f3ef03fe4e9c35f9f131ad0de9c47cae12fa918647fb52dd3a9b80346b199ce0cb432beb5a79c1789214a0573c4bd6a0a7844c5797c82635c087a2586 SHA512 ef106fd3afaa118bca4d0cd62e348d02eafa17ba0ac04360572123e1e4e65c8ba7a83e0be0e56c8b600b693f4f0dd9aaa8a1ce9311a58fe65f10a2a599895591
+DIST cmake-3.9.6.tar.gz 7705400 BLAKE2B e0a5307af0a34863c50ea6aa9323025ef588b27e648107c3a81c362ee7ae4a1d2a07cc335d816b286ce4ddb249f9c6c08c3e8cf99856c7113f3724f47c62da43 SHA512 9fda2c9ac054ef8fb1bf3885fbdec02c518da89ade220eba06b5502ac3ff300f635ec0922e61f3b2d090644fb743b8f71a04c532ab66b2d890a180cc7da54e6c
+EBUILD cmake-3.10.3.ebuild 5861 BLAKE2B bdbeccdd90de52f183d7a23bc70acc9bf181aec56d1d6515b0fb83d671f653acd24e847ca2eade51a083a31e2fade346d15922fba91e509596c0b312711f8115 SHA512 8661df8a255c2c7ead3c063bcf60504e587b8dde21e505e1adb5881890b4be47e18c67aa65ad14de514a2884459510405ec9656c77341d00dfe76dba4ee9a9d7
+EBUILD cmake-3.11.3.ebuild 5937 BLAKE2B 79adde6cac284852d5c1d8d600f3a9b21f5baa02c6f78b91b99eb279b7adf71326e4af0fd88d9a44eaf764009e189c3a3931ac7a0dc624ceb4408a70fdfb90ce SHA512 6e38533cfe49696464d130a0761b2b52d7e18e201ad447d2eef9b93f92cff2834d2d46e45920dd4c8d29acfba805d3b65e556b294fb7cb9831089a70cf88e219
+EBUILD cmake-3.11.4.ebuild 5974 BLAKE2B 833e3a47fcdad582c6d46eea9c3bea63ef4542f7ec7e5a75eb9ad62f340ce17a80e00e4375541da2a014746aeeef238999e9073dbe21edfa5915bafc91997073 SHA512 e1b1feb91dc95811783600e3a571b028ece865ee0f91f6b82b3e6fd190d350bff646292bb7b1082a65e769a8faa03d430271806102dd6d0731369cdfc8fcfd2c
+EBUILD cmake-3.12.0_rc3.ebuild 5937 BLAKE2B 79adde6cac284852d5c1d8d600f3a9b21f5baa02c6f78b91b99eb279b7adf71326e4af0fd88d9a44eaf764009e189c3a3931ac7a0dc624ceb4408a70fdfb90ce SHA512 6e38533cfe49696464d130a0761b2b52d7e18e201ad447d2eef9b93f92cff2834d2d46e45920dd4c8d29acfba805d3b65e556b294fb7cb9831089a70cf88e219
+EBUILD cmake-3.9.6.ebuild 5952 BLAKE2B 2b0c0bb6a20b30aa3b2bb5f28112423253021ac94b36ad8a1ac9bcb62a1da4fa53fb4693f460f47cc374cb0915b0e5c4e7b1f8e7d98a2b3254bb225ea2ee0fbb SHA512 4517b5a521bd3ca9dfd0b6085637a5591f6728b291bdebc4f1ae1fd37d549365866573e51803c363e3199db46a8677263054b01daeb98efa7e10009ff95b485a
+MISC metadata.xml 430 BLAKE2B af8a9e9fbd898224f970f38c42b07ab2a3f31da674056af30a8059d4378c80d201d9fa98fceffed15a5f2130767a782ea72fce642e9c4f6b5709ecf1533455e6 SHA512 9a71665c1654c038746d4cdd8217382d38493a7064cf4b6a6b12aef632b05e40e530ceb923fc389b182e1b513cbe4c149921d8036565ad8247b948640d5fa015
diff --git a/dev-util/cmake/cmake-3.10.3.ebuild b/dev-util/cmake/cmake-3.10.3.ebuild
new file mode 100644
index 000000000000..843a7d270713
--- /dev/null
+++ b/dev-util/cmake/cmake-3.10.3.ebuild
@@ -0,0 +1,212 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common eutils flag-o-matic gnome2-utils toolchain-funcs versionator virtualx xdg-utils cmake-utils
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="https://cmake.org/"
+SRC_URI="https://cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz"
+
+LICENSE="CMake"
+SLOT="0"
+[[ "${PV}" = *_rc* ]] || \
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs system-jsoncpp ncurses qt5"
+
+RDEPEND="
+ app-crypt/rhash
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=dev-libs/libuv-1.0.0:=
+ >=net-misc/curl-7.21.5[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5
+ dev-qt/qtwidgets:5
+ )
+ system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
+"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+SITEFILE="50${PN}-gentoo.el"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-3.4.0_rc1-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindImageMagick.patch
+ "${FILESDIR}"/${PN}-3.0.0-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.8.0_rc2-FindBoost-python.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+ "${FILESDIR}"/${PN}-3.5.2-FindQt4.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+)
+
+cmake_src_bootstrap() {
+ # Cleanup args to extract only JOBS.
+ # Because bootstrap does not know anything else.
+ echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
+ if [ $? -eq 0 ]; then
+ par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
+ par_arg="--parallel=${par_arg}"
+ else
+ par_arg="--parallel=1"
+ fi
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # execinfo.h on Solaris isn't quite what it is on Darwin
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i -e 's/execinfo\.h/blablabla.h/' Source/kwsys/CMakeLists.txt || die
+ fi
+
+ tc-export CC CXX LD
+
+ # bootstrap script isn't exactly /bin/sh compatible
+ ${CONFIG_SHELL:-sh} ./bootstrap \
+ --prefix="${T}/cmakestrap/" \
+ ${par_arg} \
+ || die "Bootstrap failed"
+}
+
+cmake_src_test() {
+ # fix OutDir and SelectLibraryConfigurations tests
+ # these are altered thanks to our eclass
+ sed -i -e 's:#IGNORE ::g' \
+ "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
+ || die
+
+ pushd "${BUILD_DIR}" > /dev/null
+
+ local ctestargs
+ [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
+
+ # Excluded tests:
+ # BootstrapTest: we actualy bootstrap it every time so why test it.
+ # BundleUtilities: bundle creation broken
+ # CTest.updatecvs: which fails to commit as root
+ # Fortran: requires fortran
+ # Qt4Deploy, which tries to break sandbox and ignores prefix
+ # RunCMake.CPack_RPM: breaks if app-arch/rpm is installed because
+ # debugedit binary is not in the expected location
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|RunCMake.CPack_RPM|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # Add gcc libs to the default link paths
+ sed -i \
+ -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
+ Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
+ if ! has_version \>=${CATEGORY}/${PN}-3.4.0_rc1 ; then
+ CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+ cmake_src_bootstrap
+ fi
+}
+
+src_configure() {
+ # Fix linking on Solaris
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags -lsocket -lnsl
+
+ local mycmakeargs=(
+ -DCMAKE_USE_SYSTEM_LIBRARIES=ON
+ -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
+ -DCMAKE_DOC_DIR=/share/doc/${PF}
+ -DCMAKE_MAN_DIR=/share/man
+ -DCMAKE_DATA_DIR=/share/${PN}
+ -DSPHINX_MAN=$(usex doc)
+ -DSPHINX_HTML=$(usex doc)
+ -DBUILD_CursesDialog="$(usex ncurses)"
+ )
+
+ if use qt5 ; then
+ mycmakeargs+=(
+ -DBUILD_QtDialog=ON
+ $(cmake-utils_use_find_package qt5 Qt5Widgets)
+ )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use emacs && elisp-compile Auxiliary/cmake-mode.el
+}
+
+src_test() {
+ virtx cmake_src_test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use emacs; then
+ elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+
+ insinto /usr/share/vim/vimfiles/syntax
+ doins Auxiliary/vim/syntax/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/vim/indent/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -r "${ED}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
diff --git a/dev-util/cmake/cmake-3.11.3.ebuild b/dev-util/cmake/cmake-3.11.3.ebuild
new file mode 100644
index 000000000000..050883851f5e
--- /dev/null
+++ b/dev-util/cmake/cmake-3.11.3.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common eutils flag-o-matic gnome2-utils toolchain-funcs versionator virtualx xdg-utils cmake-utils
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="https://cmake.org/"
+SRC_URI="https://cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz"
+
+LICENSE="CMake"
+SLOT="0"
+[[ "${PV}" = *_rc* ]] || \
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs system-jsoncpp ncurses qt5"
+
+RDEPEND="
+ app-crypt/rhash
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=dev-libs/libuv-1.10.0:=
+ >=net-misc/curl-7.21.5[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5
+ dev-qt/qtwidgets:5
+ )
+ system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
+"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+SITEFILE="50${PN}-gentoo.el"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-3.4.0_rc1-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-3.11.0_rc2-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+ "${FILESDIR}"/${PN}-3.5.2-FindQt4.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+)
+
+cmake_src_bootstrap() {
+ # Cleanup args to extract only JOBS.
+ # Because bootstrap does not know anything else.
+ echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
+ if [ $? -eq 0 ]; then
+ par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
+ par_arg="--parallel=${par_arg}"
+ else
+ par_arg="--parallel=1"
+ fi
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # execinfo.h on Solaris isn't quite what it is on Darwin
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i -e 's/execinfo\.h/blablabla.h/' \
+ Source/kwsys/CMakeLists.txt || die
+ fi
+
+ tc-export CC CXX LD
+
+ # bootstrap script isn't exactly /bin/sh compatible
+ ${CONFIG_SHELL:-sh} ./bootstrap \
+ --prefix="${T}/cmakestrap/" \
+ ${par_arg} \
+ || die "Bootstrap failed"
+}
+
+cmake_src_test() {
+ # fix OutDir and SelectLibraryConfigurations tests
+ # these are altered thanks to our eclass
+ sed -i -e 's:#IGNORE ::g' \
+ "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
+ || die
+
+ pushd "${BUILD_DIR}" > /dev/null
+
+ local ctestargs
+ [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
+
+ # Excluded tests:
+ # BootstrapTest: we actualy bootstrap it every time so why test it.
+ # BundleUtilities: bundle creation broken
+ # CTest.updatecvs: which fails to commit as root
+ # Fortran: requires fortran
+ # Qt4Deploy, which tries to break sandbox and ignores prefix
+ # RunCMake.CPack_RPM: breaks if app-arch/rpm is installed because
+ # debugedit binary is not in the expected location
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|RunCMake.CPack_RPM|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # disable Xcode hooks, bug #652134
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ sed -i -e 's/__APPLE__/__DISABLED_APPLE__/' \
+ Source/cmGlobalXCodeGenerator.cxx || die
+ fi
+
+ # Add gcc libs to the default link paths
+ sed -i \
+ -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
+ Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
+ if ! has_version \>=${CATEGORY}/${PN}-3.4.0_rc1 ; then
+ CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+ cmake_src_bootstrap
+ fi
+}
+
+src_configure() {
+ # Fix linking on Solaris
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags -lsocket -lnsl
+
+ local mycmakeargs=(
+ -DCMAKE_USE_SYSTEM_LIBRARIES=ON
+ -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
+ -DCMAKE_DOC_DIR=/share/doc/${PF}
+ -DCMAKE_MAN_DIR=/share/man
+ -DCMAKE_DATA_DIR=/share/${PN}
+ -DSPHINX_MAN=$(usex doc)
+ -DSPHINX_HTML=$(usex doc)
+ -DBUILD_CursesDialog="$(usex ncurses)"
+ )
+
+ if use qt5 ; then
+ mycmakeargs+=(
+ -DBUILD_QtDialog=ON
+ $(cmake-utils_use_find_package qt5 Qt5Widgets)
+ )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use emacs && elisp-compile Auxiliary/cmake-mode.el
+}
+
+src_test() {
+ virtx cmake_src_test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use emacs; then
+ elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+
+ insinto /usr/share/vim/vimfiles/syntax
+ doins Auxiliary/vim/syntax/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/vim/indent/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -r "${ED}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
diff --git a/dev-util/cmake/cmake-3.11.4.ebuild b/dev-util/cmake/cmake-3.11.4.ebuild
new file mode 100644
index 000000000000..b9e25d107095
--- /dev/null
+++ b/dev-util/cmake/cmake-3.11.4.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common eutils flag-o-matic gnome2-utils toolchain-funcs versionator virtualx xdg-utils cmake-utils
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="https://cmake.org/"
+SRC_URI="https://cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz"
+
+LICENSE="CMake"
+SLOT="0"
+[[ "${PV}" = *_rc* ]] || \
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs system-jsoncpp ncurses qt5"
+
+RDEPEND="
+ app-crypt/rhash
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=dev-libs/libuv-1.10.0:=
+ >=net-misc/curl-7.21.5[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5
+ dev-qt/qtwidgets:5
+ )
+ system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
+"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+SITEFILE="50${PN}-gentoo.el"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-3.4.0_rc1-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-3.11.0_rc2-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+ "${FILESDIR}"/${PN}-3.5.2-FindQt4.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+ "${FILESDIR}"/${P}-libuv-1.21.patch
+)
+
+cmake_src_bootstrap() {
+ # Cleanup args to extract only JOBS.
+ # Because bootstrap does not know anything else.
+ echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
+ if [ $? -eq 0 ]; then
+ par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
+ par_arg="--parallel=${par_arg}"
+ else
+ par_arg="--parallel=1"
+ fi
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # execinfo.h on Solaris isn't quite what it is on Darwin
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i -e 's/execinfo\.h/blablabla.h/' \
+ Source/kwsys/CMakeLists.txt || die
+ fi
+
+ tc-export CC CXX LD
+
+ # bootstrap script isn't exactly /bin/sh compatible
+ ${CONFIG_SHELL:-sh} ./bootstrap \
+ --prefix="${T}/cmakestrap/" \
+ ${par_arg} \
+ || die "Bootstrap failed"
+}
+
+cmake_src_test() {
+ # fix OutDir and SelectLibraryConfigurations tests
+ # these are altered thanks to our eclass
+ sed -i -e 's:#IGNORE ::g' \
+ "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
+ || die
+
+ pushd "${BUILD_DIR}" > /dev/null
+
+ local ctestargs
+ [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
+
+ # Excluded tests:
+ # BootstrapTest: we actualy bootstrap it every time so why test it.
+ # BundleUtilities: bundle creation broken
+ # CTest.updatecvs: which fails to commit as root
+ # Fortran: requires fortran
+ # Qt4Deploy, which tries to break sandbox and ignores prefix
+ # RunCMake.CPack_RPM: breaks if app-arch/rpm is installed because
+ # debugedit binary is not in the expected location
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|RunCMake.CPack_RPM|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # disable Xcode hooks, bug #652134
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ sed -i -e 's/__APPLE__/__DISABLED_APPLE__/' \
+ Source/cmGlobalXCodeGenerator.cxx || die
+ fi
+
+ # Add gcc libs to the default link paths
+ sed -i \
+ -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
+ Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
+ if ! has_version \>=${CATEGORY}/${PN}-3.4.0_rc1 ; then
+ CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+ cmake_src_bootstrap
+ fi
+}
+
+src_configure() {
+ # Fix linking on Solaris
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags -lsocket -lnsl
+
+ local mycmakeargs=(
+ -DCMAKE_USE_SYSTEM_LIBRARIES=ON
+ -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
+ -DCMAKE_DOC_DIR=/share/doc/${PF}
+ -DCMAKE_MAN_DIR=/share/man
+ -DCMAKE_DATA_DIR=/share/${PN}
+ -DSPHINX_MAN=$(usex doc)
+ -DSPHINX_HTML=$(usex doc)
+ -DBUILD_CursesDialog="$(usex ncurses)"
+ )
+
+ if use qt5 ; then
+ mycmakeargs+=(
+ -DBUILD_QtDialog=ON
+ $(cmake-utils_use_find_package qt5 Qt5Widgets)
+ )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use emacs && elisp-compile Auxiliary/cmake-mode.el
+}
+
+src_test() {
+ virtx cmake_src_test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use emacs; then
+ elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+
+ insinto /usr/share/vim/vimfiles/syntax
+ doins Auxiliary/vim/syntax/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/vim/indent/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -r "${ED}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
diff --git a/dev-util/cmake/cmake-3.12.0_rc3.ebuild b/dev-util/cmake/cmake-3.12.0_rc3.ebuild
new file mode 100644
index 000000000000..050883851f5e
--- /dev/null
+++ b/dev-util/cmake/cmake-3.12.0_rc3.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common eutils flag-o-matic gnome2-utils toolchain-funcs versionator virtualx xdg-utils cmake-utils
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="https://cmake.org/"
+SRC_URI="https://cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz"
+
+LICENSE="CMake"
+SLOT="0"
+[[ "${PV}" = *_rc* ]] || \
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs system-jsoncpp ncurses qt5"
+
+RDEPEND="
+ app-crypt/rhash
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=dev-libs/libuv-1.10.0:=
+ >=net-misc/curl-7.21.5[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5
+ dev-qt/qtwidgets:5
+ )
+ system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
+"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+SITEFILE="50${PN}-gentoo.el"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-3.4.0_rc1-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-3.11.0_rc2-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+ "${FILESDIR}"/${PN}-3.5.2-FindQt4.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+)
+
+cmake_src_bootstrap() {
+ # Cleanup args to extract only JOBS.
+ # Because bootstrap does not know anything else.
+ echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
+ if [ $? -eq 0 ]; then
+ par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
+ par_arg="--parallel=${par_arg}"
+ else
+ par_arg="--parallel=1"
+ fi
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # execinfo.h on Solaris isn't quite what it is on Darwin
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i -e 's/execinfo\.h/blablabla.h/' \
+ Source/kwsys/CMakeLists.txt || die
+ fi
+
+ tc-export CC CXX LD
+
+ # bootstrap script isn't exactly /bin/sh compatible
+ ${CONFIG_SHELL:-sh} ./bootstrap \
+ --prefix="${T}/cmakestrap/" \
+ ${par_arg} \
+ || die "Bootstrap failed"
+}
+
+cmake_src_test() {
+ # fix OutDir and SelectLibraryConfigurations tests
+ # these are altered thanks to our eclass
+ sed -i -e 's:#IGNORE ::g' \
+ "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
+ || die
+
+ pushd "${BUILD_DIR}" > /dev/null
+
+ local ctestargs
+ [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
+
+ # Excluded tests:
+ # BootstrapTest: we actualy bootstrap it every time so why test it.
+ # BundleUtilities: bundle creation broken
+ # CTest.updatecvs: which fails to commit as root
+ # Fortran: requires fortran
+ # Qt4Deploy, which tries to break sandbox and ignores prefix
+ # RunCMake.CPack_RPM: breaks if app-arch/rpm is installed because
+ # debugedit binary is not in the expected location
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|RunCMake.CPack_RPM|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # disable Xcode hooks, bug #652134
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ sed -i -e 's/__APPLE__/__DISABLED_APPLE__/' \
+ Source/cmGlobalXCodeGenerator.cxx || die
+ fi
+
+ # Add gcc libs to the default link paths
+ sed -i \
+ -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
+ Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
+ if ! has_version \>=${CATEGORY}/${PN}-3.4.0_rc1 ; then
+ CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+ cmake_src_bootstrap
+ fi
+}
+
+src_configure() {
+ # Fix linking on Solaris
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags -lsocket -lnsl
+
+ local mycmakeargs=(
+ -DCMAKE_USE_SYSTEM_LIBRARIES=ON
+ -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
+ -DCMAKE_DOC_DIR=/share/doc/${PF}
+ -DCMAKE_MAN_DIR=/share/man
+ -DCMAKE_DATA_DIR=/share/${PN}
+ -DSPHINX_MAN=$(usex doc)
+ -DSPHINX_HTML=$(usex doc)
+ -DBUILD_CursesDialog="$(usex ncurses)"
+ )
+
+ if use qt5 ; then
+ mycmakeargs+=(
+ -DBUILD_QtDialog=ON
+ $(cmake-utils_use_find_package qt5 Qt5Widgets)
+ )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use emacs && elisp-compile Auxiliary/cmake-mode.el
+}
+
+src_test() {
+ virtx cmake_src_test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use emacs; then
+ elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+
+ insinto /usr/share/vim/vimfiles/syntax
+ doins Auxiliary/vim/syntax/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/vim/indent/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -r "${ED}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
diff --git a/dev-util/cmake/cmake-3.9.6.ebuild b/dev-util/cmake/cmake-3.9.6.ebuild
new file mode 100644
index 000000000000..3b09404e21f0
--- /dev/null
+++ b/dev-util/cmake/cmake-3.9.6.ebuild
@@ -0,0 +1,214 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common eutils flag-o-matic gnome2-utils toolchain-funcs versionator virtualx xdg-utils cmake-utils
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="https://cmake.org/"
+SRC_URI="https://cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz"
+
+LICENSE="CMake"
+SLOT="0"
+[[ "${PV}" = *_rc* ]] || \
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs server system-jsoncpp ncurses qt5"
+
+RDEPEND="
+ app-crypt/rhash
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=net-misc/curl-7.21.5[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5
+ dev-qt/qtwidgets:5
+ )
+ server? ( >=dev-libs/libuv-1.0.0:= )
+ system-jsoncpp? ( >=dev-libs/jsoncpp-0.6.0_rc2:0= )
+"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+"
+
+S="${WORKDIR}/${MY_P}"
+
+SITEFILE="50${PN}-gentoo.el"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-3.4.0_rc1-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindImageMagick.patch
+ "${FILESDIR}"/${PN}-3.0.0-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.8.0_rc2-FindBoost-python.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+ "${FILESDIR}"/${PN}-3.5.2-FindQt4.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.9.0_rc2-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+)
+
+cmake_src_bootstrap() {
+ # Cleanup args to extract only JOBS.
+ # Because bootstrap does not know anything else.
+ echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' > /dev/null
+ if [ $? -eq 0 ]; then
+ par_arg=$(echo ${MAKEOPTS} | egrep -o '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' | tail -n1 | egrep -o '[[:digit:]]+')
+ par_arg="--parallel=${par_arg}"
+ else
+ par_arg="--parallel=1"
+ fi
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # execinfo.h on Solaris isn't quite what it is on Darwin
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i -e 's/execinfo\.h/blablabla.h/' Source/kwsys/CMakeLists.txt || die
+ fi
+
+ tc-export CC CXX LD
+
+ # bootstrap script isn't exactly /bin/sh compatible
+ ${CONFIG_SHELL:-sh} ./bootstrap \
+ --prefix="${T}/cmakestrap/" \
+ ${par_arg} \
+ || die "Bootstrap failed"
+}
+
+cmake_src_test() {
+ # fix OutDir and SelectLibraryConfigurations tests
+ # these are altered thanks to our eclass
+ sed -i -e 's:#IGNORE ::g' \
+ "${S}"/Tests/{OutDir,CMakeOnly/SelectLibraryConfigurations}/CMakeLists.txt \
+ || die
+
+ pushd "${BUILD_DIR}" > /dev/null
+
+ local ctestargs
+ [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure"
+
+ # Excluded tests:
+ # BootstrapTest: we actualy bootstrap it every time so why test it.
+ # BundleUtilities: bundle creation broken
+ # CTest.updatecvs: which fails to commit as root
+ # Fortran: requires fortran
+ # Qt4Deploy, which tries to break sandbox and ignores prefix
+ # RunCMake.CPack_RPM: breaks if app-arch/rpm is installed because
+ # debugedit binary is not in the expected location
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|RunCMake.CPack_RPM|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # Add gcc libs to the default link paths
+ sed -i \
+ -e "s|@GENTOO_PORTAGE_GCCLIBDIR@|${EPREFIX}/usr/${CHOST}/lib/|g" \
+ -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}/|g" \
+ Modules/Platform/{UnixPaths,Darwin}.cmake || die "sed failed"
+ if ! has_version \>=${CATEGORY}/${PN}-3.4.0_rc1 ; then
+ CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+ cmake_src_bootstrap
+ fi
+}
+
+src_configure() {
+ # Fix linking on Solaris
+ [[ ${CHOST} == *-solaris* ]] && append-ldflags -lsocket -lnsl
+
+ local mycmakeargs=(
+ -DCMAKE_USE_SYSTEM_LIBRARIES=ON
+ -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=$(usex system-jsoncpp)
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr
+ -DCMAKE_DOC_DIR=/share/doc/${PF}
+ -DCMAKE_MAN_DIR=/share/man
+ -DCMAKE_DATA_DIR=/share/${PN}
+ -DSPHINX_MAN=$(usex doc)
+ -DSPHINX_HTML=$(usex doc)
+ -DBUILD_CursesDialog="$(usex ncurses)"
+ -DCMake_ENABLE_SERVER_MODE="$(usex server)"
+ -DCMAKE_USE_LIBUV="$(usex server)"
+ )
+
+ if use qt5 ; then
+ mycmakeargs+=(
+ -DBUILD_QtDialog=ON
+ $(cmake-utils_use_find_package qt5 Qt5Widgets)
+ )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use emacs && elisp-compile Auxiliary/cmake-mode.el
+}
+
+src_test() {
+ virtx cmake_src_test
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use emacs; then
+ elisp-install ${PN} Auxiliary/cmake-mode.el Auxiliary/cmake-mode.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+
+ insinto /usr/share/vim/vimfiles/syntax
+ doins Auxiliary/vim/syntax/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/vim/indent/cmake.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -r "${ED}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use qt5; then
+ gnome2_icon_cache_update
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ fi
+}
diff --git a/dev-util/cmake/files/50cmake-gentoo.el b/dev-util/cmake/files/50cmake-gentoo.el
new file mode 100644
index 000000000000..e4a1a6d47cbc
--- /dev/null
+++ b/dev-util/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-util/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch b/dev-util/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch
new file mode 100644
index 000000000000..5f9c26658f31
--- /dev/null
+++ b/dev-util/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-util/cmake/files/cmake-3.0.0-FindBLAS.patch b/dev-util/cmake/files/cmake-3.0.0-FindBLAS.patch
new file mode 100644
index 000000000000..342a4319798d
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.0-FindBLAS.patch
@@ -0,0 +1,43 @@
+--- a/Modules/FindBLAS.cmake
++++ b/Modules/FindBLAS.cmake
+@@ -4,6 +4,10 @@
+ #
+ # Find 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/). The
+ # list of libraries searched for is taken from the autoconf macro file,
+@@ -50,6 +54,23 @@
+ # (To distribute this file outside of CMake, substitute the full
+ # License text for the above reference.)
+
++# first, try PkgConfig
++#
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(PC_BLAS blas)
++if(PC_BLAS_FOUND)
++ foreach(PC_LIB ${PC_BLAS_LIBRARIES})
++ find_library(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_BLAS_LIBRARY_DIRS} )
++ if (NOT ${PC_LIB}_LIBRARY)
++ message(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_BLAS_LIBRARY_DIRS}")
++ endif (NOT ${PC_LIB}_LIBRARY)
++ list(APPEND BLAS_LIBRARIES ${${PC_LIB}_LIBRARY})
++ endforeach(PC_LIB)
++ find_package_handle_standard_args(BLAS DEFAULT_MSG BLAS_LIBRARIES)
++ mark_as_advanced(BLAS_LIBRARIES)
++else(PC_BLAS_FOUND)
++message(STATUS "No PkgConfig configuration for BLAS found; starting more extensive search.")
++
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+
+@@ -688,3 +709,5 @@
+ endif()
+
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
++
++endif(PC_BLAS_FOUND)
diff --git a/dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch b/dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch
new file mode 100644
index 000000000000..321f05302aa1
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch
@@ -0,0 +1,43 @@
+--- a/Modules/FindLAPACK.cmake
++++ b/Modules/FindLAPACK.cmake
+@@ -4,6 +4,10 @@
+ #
+ # Find LAPACK 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
+ # LAPACK linear-algebra interface (see http://www.netlib.org/lapack/).
+ #
+@@ -140,6 +144,23 @@
+
+ endmacro()
+
++#
++# first, try PkgConfig
++#
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(PC_LAPACK lapack)
++if(PC_LAPACK_FOUND)
++ foreach(PC_LIB ${PC_LAPACK_LIBRARIES})
++ find_library(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_LAPACK_LIBRARY_DIRS} )
++ if (NOT ${PC_LIB}_LIBRARY)
++ message(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_LAPACK_LIBRARY_DIRS}")
++ endif (NOT ${PC_LIB}_LIBRARY)
++ list(APPEND LAPACK_LIBRARIES ${${PC_LIB}_LIBRARY})
++ endforeach(PC_LIB)
++ find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARIES)
++ mark_as_advanced(LAPACK_LIBRARIES)
++else(PC_LAPACK_FOUND)
++message(STATUS "No PkgConfig configuration for LAPACK found; starting more extensive search.")
+
+ set(LAPACK_LINKER_FLAGS)
+ set(LAPACK_LIBRARIES)
+@@ -348,3 +369,5 @@
+ endif()
+
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
++
++endif(PC_LAPACK_FOUND)
diff --git a/dev-util/cmake/files/cmake-3.1.0-darwin-isysroot.patch b/dev-util/cmake/files/cmake-3.1.0-darwin-isysroot.patch
new file mode 100644
index 000000000000..1f3599bcc828
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.1.0-darwin-isysroot.patch
@@ -0,0 +1,48 @@
+Do not detect Xcode and set -isysroot for its SDK, since that messes up
+our toolchain, and hence makes any compilation fail, bug #445308
+
+--- a/Modules/Platform/Darwin-Initialize.cmake
++++ b/Modules/Platform/Darwin-Initialize.cmake
+@@ -1,16 +1,16 @@
+ # Ask xcode-select where to find /Developer or fall back to ancient location.
+-execute_process(COMMAND xcode-select -print-path
+- OUTPUT_VARIABLE _stdout
+- OUTPUT_STRIP_TRAILING_WHITESPACE
+- ERROR_VARIABLE _stderr
+- RESULT_VARIABLE _failed)
+-if(NOT _failed AND IS_DIRECTORY ${_stdout})
+- set(OSX_DEVELOPER_ROOT ${_stdout})
+-elseif(IS_DIRECTORY "/Developer")
+- set(OSX_DEVELOPER_ROOT "/Developer")
+-else()
++#execute_process(COMMAND xcode-select -print-path
++# OUTPUT_VARIABLE _stdout
++# OUTPUT_STRIP_TRAILING_WHITESPACE
++# ERROR_VARIABLE _stderr
++# RESULT_VARIABLE _failed)
++#if(NOT _failed AND IS_DIRECTORY ${_stdout})
++# set(OSX_DEVELOPER_ROOT ${_stdout})
++#elseif(IS_DIRECTORY "/Developer")
++# set(OSX_DEVELOPER_ROOT "/Developer")
++#else()
+ set(OSX_DEVELOPER_ROOT "")
+-endif()
++#endif()
+
+ execute_process(COMMAND sw_vers -productVersion
+ OUTPUT_VARIABLE CURRENT_OSX_VERSION
+@@ -91,10 +91,10 @@
+ # CMAKE_OSX_DEPLOYMENT_TARGET
+
+ # Set cache variable - end user may change this during ccmake or cmake-gui configure.
+-if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
+- set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
+- "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
+-endif()
++#if(_CURRENT_OSX_VERSION VERSION_GREATER 10.3)
++# set(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING
++# "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
++#endif()
+
+ #----------------------------------------------------------------------------
+ # CMAKE_OSX_SYSROOT
diff --git a/dev-util/cmake/files/cmake-3.11.0_rc2-FindBLAS.patch b/dev-util/cmake/files/cmake-3.11.0_rc2-FindBLAS.patch
new file mode 100644
index 000000000000..6bad45b20876
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.11.0_rc2-FindBLAS.patch
@@ -0,0 +1,23 @@
+--- a/Modules/FindBLAS.cmake
++++ b/Modules/FindBLAS.cmake
+@@ -4,6 +4,10 @@
+ #
+ # Find 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/). The
+ # list of libraries searched for is taken from the autoconf macro file,
+@@ -50,6 +54,9 @@
+ # (To distribute this file outside of CMake, substitute the full
+ # License text for the above reference.)
+
++# first, try PkgConfig
++set(BLA_PREFER_PKGCONFIG On)
++
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+ include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+
diff --git a/dev-util/cmake/files/cmake-3.11.4-libuv-1.21.patch b/dev-util/cmake/files/cmake-3.11.4-libuv-1.21.patch
new file mode 100644
index 000000000000..664c39aae90a
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.11.4-libuv-1.21.patch
@@ -0,0 +1,28 @@
+From 92c4b3d900a24512967a960f108d985c819fdf00 Mon Sep 17 00:00:00 2001
+From: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Sat, 23 Jun 2018 20:30:07 +0200
+Subject: [PATCH] FindLibUV: Also check uv/version.h for version detection
+
+Starting with libuv 1.21.0, libuv's headers were moved into a uv/ directory.
+Make FindLibUV aware of the file's new location for configuration to work.
+
+Upstream change: https://github.com/libuv/libuv/pull/1429
+---
+ Source/Modules/FindLibUV.cmake | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake
+index ba13d75..0554d62 100644
+--- a/Source/Modules/FindLibUV.cmake
++++ b/Source/Modules/FindLibUV.cmake
+@@ -63,6 +63,8 @@ mark_as_advanced(LibUV_INCLUDE_DIR)
+ set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+")
+ if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h")
+ file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
++elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv/version.h")
++ file(STRINGS "${LibUV_INCLUDE_DIR}/uv/version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
+ elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h")
+ file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}")
+ else()
+--
+libgit2 0.27.0
diff --git a/dev-util/cmake/files/cmake-3.4.0_rc1-darwin-bundle.patch b/dev-util/cmake/files/cmake-3.4.0_rc1-darwin-bundle.patch
new file mode 100644
index 000000000000..2808ed79f735
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.4.0_rc1-darwin-bundle.patch
@@ -0,0 +1,25 @@
+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
+
+--- cmake-3.4.0-rc1/Modules/Platform/Darwin.cmake
++++ cmake-3.4.0-rc1/Modules/Platform/Darwin.cmake
+@@ -26,7 +26,7 @@
+ 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 "")
+
+@@ -53,7 +53,7 @@
+ set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+ set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
+ set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
+-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
diff --git a/dev-util/cmake/files/cmake-3.5.2-FindQt4.patch b/dev-util/cmake/files/cmake-3.5.2-FindQt4.patch
new file mode 100644
index 000000000000..2f2764d30cf6
--- /dev/null
+++ b/dev-util/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-util/cmake/files/cmake-3.8.0_rc2-FindBoost-python.patch b/dev-util/cmake/files/cmake-3.8.0_rc2-FindBoost-python.patch
new file mode 100644
index 000000000000..441650b72a2a
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.8.0_rc2-FindBoost-python.patch
@@ -0,0 +1,95 @@
+From 7d3a5c466bf14a0c12edc6ece359012b723e39bc Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Thu, 23 Mar 2017 11:36:39 +0100
+Subject: [PATCH] Fix detection of PYTHON_ABI-versioned Boost Python libraries
+
+Gentoo-bug: 400969
+Gentoo-bug: 613442
+---
+ Modules/FindBoost.cmake | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
+index e795aadcc..11269c30b 100644
+--- a/Modules/FindBoost.cmake
++++ b/Modules/FindBoost.cmake
+@@ -1481,6 +1481,16 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
+ set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)")
+
++ if(${COMPONENT} STREQUAL "python" OR ${COMPONENT} STREQUAL "mpi_python")
++ # If a certain version of python has already been selected ensure we select the corresponding boost python version.
++ if(PYTHON_EXECUTABLE)
++ set(GENTOO_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
++ else()
++ set(GENTOO_PYTHON_EXECUTABLE "python")
++ endif()
++ execute_process(COMMAND "${GENTOO_PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write('.'.join(str(x) for x in sys.version_info[:2]))" OUTPUT_VARIABLE _python_version)
++ endif()
++
+ # Compute component-specific hints.
+ set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
+ if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
+@@ -1529,6 +1539,15 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
++ if(${COMPONENT} STREQUAL "python" OR ${COMPONENT} STREQUAL "mpi_python")
++ list(APPEND _boost_RELEASE_NAMES
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version} )
++ endif()
++
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+ list(APPEND _boost_RELEASE_NAMES
+@@ -1536,6 +1555,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
++ if(${COMPONENT} STREQUAL "python" OR ${COMPONENT} STREQUAL "mpi_python")
++ list(APPEND _boost_RELEASE_NAMES
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
++ endif()
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
+@@ -1571,6 +1597,15 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} )
++ if(${COMPONENT} STREQUAL "python" OR ${COMPONENT} STREQUAL "mpi_python")
++ list(APPEND _boost_DEBUG_NAMES
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version} )
++ endif()
+ if(_boost_STATIC_RUNTIME_WORKAROUND)
+ set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+ list(APPEND _boost_DEBUG_NAMES
+@@ -1578,6 +1613,13 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+ ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
++ if(${COMPONENT} STREQUAL "python" OR ${COMPONENT} STREQUAL "mpi_python")
++ list(APPEND _boost_DEBUG_NAMES
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
++ ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_python_version}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
++ endif()
+ endif()
+ if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+ _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
+--
+2.12.1
+
diff --git a/dev-util/cmake/files/cmake-3.9.0_rc2-FindImageMagick.patch b/dev-util/cmake/files/cmake-3.9.0_rc2-FindImageMagick.patch
new file mode 100644
index 000000000000..ce63988f2ec8
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.9.0_rc2-FindImageMagick.patch
@@ -0,0 +1,47 @@
+From f51ccd38ed85e5799b2f0a88829eb6a40574ab05 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 9 Jun 2017 02:07:11 +0200
+Subject: [PATCH] Find more variants of ImageMagick
+
+---
+ Modules/FindImageMagick.cmake | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
+index 7d5534bc2..488d7e0bf 100644
+--- a/Modules/FindImageMagick.cmake
++++ b/Modules/FindImageMagick.cmake
+@@ -196,24 +196,30 @@ foreach(component ${ImageMagick_FIND_COMPONENTS}
+ if(component STREQUAL "Magick++")
+ FIND_IMAGEMAGICK_API(Magick++ Magick++.h
+ Magick++ CORE_RL_Magick++_
++ Magick++-6.Q64 Magick++-6.Q64HDRI Magick++-6.Q32 Magick++-6.Q32HDRI
+ Magick++-Q8 Magick++-Q16 Magick++-Q16HDRI Magick++-Q8HDRI
+ Magick++-6.Q16 Magick++-6.Q8 Magick++-6.Q16HDRI Magick++-6.Q8HDRI
++ Magick++-7.Q64 Magick++-7.Q64HDRI Magick++-7.Q32 Magick++-7.Q32HDRI
+ Magick++-7.Q16 Magick++-7.Q8 Magick++-7.Q16HDRI Magick++-7.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
+ elseif(component STREQUAL "MagickWand")
+ FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h"
+ Wand MagickWand CORE_RL_wand_
++ MagickWand-6.Q64 MagickWand-6.Q64HDRI MagickWand-6.Q32 MagickWand-6.Q32HDRI
+ MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI
+ MagickWand-6.Q16 MagickWand-6.Q8 MagickWand-6.Q16HDRI MagickWand-6.Q8HDRI
++ MagickWand-7.Q64 MagickWand-7.Q64HDRI MagickWand-7.Q32 MagickWand-7.Q32HDRI
+ MagickWand-7.Q16 MagickWand-7.Q8 MagickWand-7.Q16HDRI MagickWand-7.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
+ elseif(component STREQUAL "MagickCore")
+ FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h"
+ Magick MagickCore CORE_RL_magick_
++ MagickCore-6.Q64 MagickCore-6.Q64HDRI MagickCore-6.Q32 MagickCore-6.Q32HDRI
+ MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI
+ MagickCore-6.Q16 MagickCore-6.Q8 MagickCore-6.Q16HDRI MagickCore-6.Q8HDRI
++ MagickCore-7.Q64 MagickCore-7.Q64HDRI MagickCore-7.Q32 MagickCore-7.Q32HDRI
+ MagickCore-7.Q16 MagickCore-7.Q8 MagickCore-7.Q16HDRI MagickCore-7.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
+--
+2.13.1
+
diff --git a/dev-util/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch b/dev-util/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch
new file mode 100644
index 000000000000..242392d8520e
--- /dev/null
+++ b/dev-util/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-util/cmake/files/cmake-3.9.0_rc2-prefix-dirs.patch b/dev-util/cmake/files/cmake-3.9.0_rc2-prefix-dirs.patch
new file mode 100644
index 000000000000..f4e9a27597cf
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.9.0_rc2-prefix-dirs.patch
@@ -0,0 +1,126 @@
+From b1f045122fb210728081ae2165197aebff4ee498 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 9 Jun 2017 01:47:55 +0200
+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)
+---
+ Modules/Platform/Darwin.cmake | 12 ++++++++----
+ Modules/Platform/UnixPaths.cmake | 29 ++++++++++++++++++++++++-----
+ 2 files changed, 32 insertions(+), 9 deletions(-)
+
+diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
+index 727baa6e1..543d9e034 100644
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -108,9 +108,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
+@@ -132,6 +132,8 @@ endif()
+
+ # set up the default search directories for frameworks
+ set(CMAKE_SYSTEM_FRAMEWORK_PATH
++ @GENTOO_PORTAGE_EPREFIX@Frameworks
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
+ ~/Library/Frameworks
+ )
+ if(_CMAKE_OSX_SYSROOT_PATH)
+@@ -178,13 +180,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 5687653cf..be7695898 100644
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -23,6 +23,7 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
+ # search types.
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ # Standard
++ @GENTOO_PORTAGE_EPREFIX@usr/local @GENTOO_PORTAGE_EPREFIX@usr @GENTOO_PORTAGE_EPREFIX@
+ /usr/local /usr /
+
+ # CMake install location
+@@ -50,23 +51,41 @@ 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
++ /lib /usr/lib /usr/lib32 /usr/lib64 /usr/libx32
+ )
+
+ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
++ @GENTOO_PORTAGE_EPREFIX@usr/include
+ /usr/include
+ )
+ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
++ @GENTOO_PORTAGE_EPREFIX@usr/include
+ /usr/include
+ )
+
+--
+2.13.1
+
diff --git a/dev-util/cmake/files/cmake.vim b/dev-util/cmake/files/cmake.vim
new file mode 100644
index 000000000000..5cecd7d05b64
--- /dev/null
+++ b/dev-util/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
diff --git a/dev-util/cmake/metadata.xml b/dev-util/cmake/metadata.xml
new file mode 100644
index 000000000000..c5d121a7e9cb
--- /dev/null
+++ b/dev-util/cmake/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>kde@gentoo.org</email>
+ <name>Gentoo KDE Project</name>
+ </maintainer>
+ <use>
+ <flag name="server">Enable cmake-server support.</flag>
+ <flag name="system-jsoncpp">Use system copy of <pkg>dev-libs/jsoncpp</pkg> instead of bundled one.</flag>
+ </use>
+</pkgmetadata>