aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2015-10-11 14:24:13 +0059
committerStuart Shelton <stuart@shelton.me>2015-10-11 14:24:13 +0059
commit434e49b5302993921356b09154e355004a05a115 (patch)
treec0580a615fda16e1ef24e2a5c0a959ff24efc0bd /dev-util
parentAdd dev-perl/Net-SDP-0.07, update README.md (diff)
downloadsrcshelton-434e49b5302993921356b09154e355004a05a115.tar.gz
srcshelton-434e49b5302993921356b09154e355004a05a115.tar.bz2
srcshelton-434e49b5302993921356b09154e355004a05a115.zip
Add dev-util/cmake-3.3.1-r1, update README.md
Diffstat (limited to 'dev-util')
-rw-r--r--dev-util/cmake/Manifest15
-rw-r--r--dev-util/cmake/cmake-3.3.1-r1.ebuild202
-rw-r--r--dev-util/cmake/files/50cmake-gentoo.el4
-rw-r--r--dev-util/cmake/files/cmake-2.8.10-darwin-bundle.patch23
-rw-r--r--dev-util/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch24
-rw-r--r--dev-util/cmake/files/cmake-2.8.12.1-FindImageMagick.patch23
-rw-r--r--dev-util/cmake/files/cmake-3.0.0-FindBLAS.patch43
-rw-r--r--dev-util/cmake/files/cmake-3.0.0-FindBoost-python.patch93
-rw-r--r--dev-util/cmake/files/cmake-3.0.0-prefix-dirs.patch142
-rw-r--r--dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch43
-rw-r--r--dev-util/cmake/files/cmake-3.1.0-FindPythonInterp.patch29
-rw-r--r--dev-util/cmake/files/cmake-3.1.0-darwin-isysroot.patch48
-rw-r--r--dev-util/cmake/files/cmake-3.3.1-x32.patch278
-rw-r--r--dev-util/cmake/files/cmake.vim3
14 files changed, 970 insertions, 0 deletions
diff --git a/dev-util/cmake/Manifest b/dev-util/cmake/Manifest
new file mode 100644
index 00000000..a3f8aa11
--- /dev/null
+++ b/dev-util/cmake/Manifest
@@ -0,0 +1,15 @@
+AUX 50cmake-gentoo.el 244 SHA256 6010e6df84aa23050fcbc490ae2b22802ede0870ff2e96c43fe541e97e0d6c00 SHA512 70af0b9dd41f08531d3c754dc8af3662df8a22b469b79e8c40b7caae3205be1d4dc81d8b41837d1b6a46f2c348f5407e09e02269823c45c3366777e3bc7a0dcb WHIRLPOOL aa60ffe7e5edd00fdbb32ce2c9aee24fddd6e4d064b8bde55c7ff3b42196c3420596653aade9cc447a3293050c5ab23a27a556f26806e4d67139d264a38d1aaa
+AUX cmake-2.8.10-darwin-bundle.patch 956 SHA256 8195342561ada36d4e3796a906fc662f9f84cc470809e7596b4376f3fe90dbac SHA512 39f444f592f435fbcc865a903ccb851b6c40ddf5f3b99b986c92af6b8984978d4fa1819808f1365f53887098da8533c31f6ea29e14cb541045ed3f63fcc771e2 WHIRLPOOL c20412508cad6329bebfb152051008c5ff98f0a27657d047992f4523a213d4ee396ea23c009ad2133b283ab4518d359b2b65d5034e06bd5649a6f08d76cb5db8
+AUX cmake-2.8.10.2-FindPythonLibs.patch 968 SHA256 4a2bbd60a2c526387ac8088d6bbecff1cc4399259d737530f2d55a6afd033b15 SHA512 e42713242202409e06a1b0725c6ea0a89c6d623d143e6c06def9681b72516a760ebddeccdf16e141e6b21ced2fb63e42337536afd6ca799e6d6d8689d48037cb WHIRLPOOL f92e7981f267310e471425b9f6595c54bf6df2af3fd99a0502bebaa39d87dcc14e31389d1c1bd99271718ce6b33f837842a0cdb454de09da60df5252f86cf826
+AUX cmake-2.8.12.1-FindImageMagick.patch 1700 SHA256 042a843bc6204efee071af2cdeb451c5da3da852cba0d522dea1d264ff1014c3 SHA512 4c533e3bf3127eb0696b557fe381bfd88f3ebc70b29a33f04b7bf95fa7c765cb237abe34b6a406b452dd71fbc3d79740d58ae981eedca952f9fae272ea4f5efa WHIRLPOOL 25c5c7c47b2874b32143a9fe14443aa6da8f3abb6c92b0bd94f3848dd7d8114d901a0bc6fbb78547879f5af947f87f070e24cc2deeecd7bb4cc95290a7af7d40
+AUX cmake-3.0.0-FindBLAS.patch 1577 SHA256 25be4e8671eff94b5cb7fe955215d9b97cc39e61f7203b4eb9b28e16977c3842 SHA512 c6239fe3d8b8e437b66399a3ebdf09da94f747dc6c45aaaba43773ce29a106727c7d4f8a570e1fd9603a9cdbade6b9702398c1989267adbcc5aebbeb59d30915 WHIRLPOOL 44366678ff681b3c876c90274d3b6709ad4ef7de051663db03fecdb77baffbd87b02c5edf53126b383680a58ef4c0a0100982240e58db352c781cd204907f2bc
+AUX cmake-3.0.0-FindBoost-python.patch 6481 SHA256 bd8ff52ce3565ab67806e2417d3c1e3c05215dde1da588f65dfc8db061ea3116 SHA512 4eed678c74af89e249de7202c553825cfd0132b84d605d078c388224a1add76acef778f366bb60e52e58e9ca25a23e18f8f6bef7385a9180fb1cab7d7698ffbf WHIRLPOOL ba4965b6e390a30178cd99806eda5d1fd669ccb894ba94d1f8ea358dcfbf10f9559918711912786cc3be16569b87d931d13712bd84a433b561f1092d8c71c416
+AUX cmake-3.0.0-prefix-dirs.patch 4301 SHA256 32555d1ea3ef7a0328b28811e6792af379b8805a9349a0e135d0c77a724dc3db SHA512 ab1fec8ade01c4ae8eafa14b348ec323db0ef42c3cc8ec5a3abbe3bc045eac93db6d686207d5687f151a5ae81ea4dc039b9e601a11e1f05172b2276e3f6594a3 WHIRLPOOL b40f17bc8d273154eb4cc654b0028ee3bef003241fa4a497e9e087c9aca4f0382859659d053f7276f2c0dee18db36709f561ca63ae8f12dc712be7d58ebbcf44
+AUX cmake-3.0.2-FindLAPACK.patch 1442 SHA256 394388bdf47c995bc540537ad2cb497c719eafc5298a19d41d1a672c02d3b221 SHA512 60b673005bb3cec6830a3f68922c5661bccd8d7d39d77172d1f59383e8f9912e3e74e052d5e632479d1b091357dbabef656049dffaf705cebae9ae99ea35e74e WHIRLPOOL 7b46096381aa9a94e92c9aac80993a3da75b80203050f609adf7672ac238d4dd3ad89ff8261e87bd040a4ba5b4b1b4e73bfdf9ac3ba55b2c33a6f7800315748c
+AUX cmake-3.1.0-FindPythonInterp.patch 1072 SHA256 463c0a681b92ed02f7802153457d530109c6a6ec686d6c02968ea84085134705 SHA512 5e3445f43793fbea561d24cf502d06264f3f27134420d7df18aee678901bb895912a0b7b7f73ec7321155284f821aab5dbd6046bb050c02f58a0bd5188dc85f0 WHIRLPOOL 65aaa246da0230df4ff45a21e398224751d67820153ed5b871ee6095ae97804da98057de114354ec7ff2abb8f438fbcdd5c0b70a718fef6974d39ee69f94ca6e
+AUX cmake-3.1.0-darwin-isysroot.patch 1922 SHA256 05b3f77f8f8a25c809cf0819867fa785a739d3dc9c34e5e9fbbb6b4ad9115710 SHA512 9fcdac45f1c4d8c90839e5f4a6c9f1d28c1767bf6b1767dd7d8d04d332558ef8dc775af65926c3d08a72a6e535c063a85956bf20a10e48016fa13533037979d0 WHIRLPOOL 31ea327e6c41132923a26dfce39b19961b1862e79fcfa3f9c80773f6c3181acbf44ab655a2b837c0ab2165d918c8709aa82321958ca4e0d93277d0a2a47c1127
+AUX cmake-3.3.1-x32.patch 12008 SHA256 37948928976fdfb53f175e319f830d32867ec6234bea2a36ee2413490c3c79ed SHA512 bd860a6c7f47d453b73c771939c70a1a8a6d92287eea27481e114cd2fac4d35bec59c78d1256d09000c9f02a02dd93506b1afbd71d630f8b66e6f63472f05847 WHIRLPOOL d6f594b030f622d018ed7bb2f6bb56af87fb11657d6c2ca5e55d4e1676975f8b2ff9bd0a3312e9643abf2772866a031f089ebc1ec6ff0866afb2d9b80b8d9bca
+AUX cmake.vim 217 SHA256 7366c1d45bdcc93efb1954216a5427a5f9df7e98a1f706c357576d7835aaebc5 SHA512 2f7e9e949f8f3030a0dfcef56f4effea703ee60555c22f6a2d1dfeaf3334f33a3e88910c666f704e4ab60cde4ebb509c7d85d812a3c1627010e52fc757f15cdf WHIRLPOOL 088ae1f0a4f32ea872deaf1d4e8d21d6853d3cecb903ea8abfb06c85de8c200757c2cfb34ec25cd0d8ef2a3c12b3cc9472e9ef0b5ce3f702502100806e0e73fc
+DIST cmake-3.3.1-FindPkgConfig_remove_variable_dereference.patch 1583 SHA256 22e6672bd9356a98a0eaf667e66d926f52c4e80e53e38cb8e5cd489993e5668f SHA512 306cf4498cbad9f9c49a63c1870e04f33b5a91032508654a691fe116ec4821da98e9a1e35b6cb186bf9367ebdd9c42ac919e6fc44d2ba6938ad3bc1131b80655 WHIRLPOOL 1d30dd99ea6dc085f64c1b02ab0708f0c033e8d98f69ca431016da17eecc29f01489e5e253446bd542a4a9b770bcaee7b7a7bfa71e7520e7900094a9350c7f8f
+DIST cmake-3.3.1.tar.gz 6577869 SHA256 cd65022c6a0707f1c7112f99e9c981677fdd5518f7ddfa0f778d4cee7113e3d6 SHA512 bc60dd58f884467d7426f73c8e3e78b7ea0a0089f2577c596f34bcfc6d38dfd5d4034589c82dd9cadf138d619dbc4f0c4519faeeeef0672b4578180de21b33f1 WHIRLPOOL 631b925dc8b60f57c573d7c220aaaf4193cb7a5fbd3537e96db6e17bbe537fa89398349763fce867b0e72af591cfcbab9b8cd570a613e7933a31788cfb771f2b
+EBUILD cmake-3.3.1-r1.ebuild 5608 SHA256 0847573f426c3ee40ce6132ec54a9c86dd2656e3733c7733de354e49a998e586 SHA512 fe5b330bb4dcd7e21782bb0ecd6d5411ea0e02196e92c6291050eac7316140ab2959db3c3dad943dafc4f6b821559e4987585582ad42bcb08647fb553e491d29 WHIRLPOOL 988c4f30acaaada9095f7fe860edfdfa0884ab7131478e52f47f87155288b5d3ded59ad9cc65930b5653074e76bb0e02d7e6fa354bc0b29236a04c0fd1d043ef
diff --git a/dev-util/cmake/cmake-3.3.1-r1.ebuild b/dev-util/cmake/cmake-3.3.1-r1.ebuild
new file mode 100644
index 00000000..aed27a45
--- /dev/null
+++ b/dev-util/cmake/cmake-3.3.1-r1.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: 44dc2a2a38f7121585ec679afb6d2df75ba0faea $
+
+EAPI=5
+
+CMAKE_REMOVE_MODULES="no"
+inherit bash-completion-r1 elisp-common toolchain-funcs eutils versionator cmake-utils virtualx
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="Cross platform Make"
+HOMEPAGE="http://www.cmake.org/"
+SRC_URI="http://www.cmake.org/files/v$(get_version_component_range 1-2)/${MY_P}.tar.gz
+ http://www.cmake.org/gitweb?p=cmake.git;a=patch;h=b9ec9392da21a3421e48c6961976060d872faffb -> ${PN}-3.3.1-FindPkgConfig_remove_variable_dereference.patch"
+
+LICENSE="CMake"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~arm64 hppa ~m68k ~mips ~ppc ppc64 ~s390 ~sh ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc emacs system-jsoncpp ncurses qt4 qt5"
+
+RDEPEND="
+ >=app-arch/libarchive-3.0.0:=
+ >=dev-libs/expat-2.0.1
+ >=net-misc/curl-7.20.0-r1[ssl]
+ sys-libs/zlib
+ virtual/pkgconfig
+ emacs? ( virtual/emacs )
+ ncurses? ( sys-libs/ncurses:0= )
+ qt4? (
+ dev-qt/qtcore:4
+ dev-qt/qtgui:4
+ )
+ 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"
+
+CMAKE_BINARY="${S}/Bootstrap.cmk/cmake"
+
+PATCHES=(
+ # prefix
+ "${FILESDIR}"/${PN}-2.8.10-darwin-bundle.patch
+ "${FILESDIR}"/${PN}-3.0.0-prefix-dirs.patch
+ "${FILESDIR}"/${PN}-3.1.0-darwin-isysroot.patch
+
+ # handle gentoo packaging in find modules
+ "${FILESDIR}"/${PN}-2.8.12.1-FindImageMagick.patch
+ "${FILESDIR}"/${PN}-3.0.0-FindBLAS.patch
+ "${FILESDIR}"/${PN}-3.0.0-FindBoost-python.patch
+ "${FILESDIR}"/${PN}-3.0.2-FindLAPACK.patch
+
+ # respect python eclasses
+ "${FILESDIR}"/${PN}-2.8.10.2-FindPythonLibs.patch
+ "${FILESDIR}"/${PN}-3.1.0-FindPythonInterp.patch
+
+ # upstream fixes (can usually be removed with a version bump)
+ "${DISTDIR}"/${PN}-3.3.1-FindPkgConfig_remove_variable_dereference.patch
+
+ # fix library directories
+ "${FILESDIR}"/${PN}-3.3.1-x32.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
+
+ # 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
+ # TestUpload, which requires network access
+ "${BUILD_DIR}"/bin/ctest ${ctestargs} \
+ -E "(BootstrapTest|BundleUtilities|CTest.UpdateCVS|Fortran|Qt4Deploy|TestUpload)" \
+ || die "Tests failed"
+
+ popd > /dev/null
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+
+ # disable running of cmake in boostrap command
+ sed -i \
+ -e '/"${cmake_bootstrap_dir}\/cmake"/s/^/#DONOTRUN /' \
+ bootstrap || die "sed failed"
+
+ # 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"
+
+ cmake_src_bootstrap
+}
+
+src_configure() {
+ 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)
+ $(cmake-utils_use_build ncurses CursesDialog)
+ )
+
+ if use qt4 || 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() {
+ VIRTUALX_COMMAND="cmake_src_test" virtualmake
+}
+
+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/cmake-syntax.vim
+
+ insinto /usr/share/vim/vimfiles/indent
+ doins Auxiliary/cmake-indent.vim
+
+ insinto /usr/share/vim/vimfiles/ftdetect
+ doins "${FILESDIR}/${PN}.vim"
+
+ dobashcomp Auxiliary/bash-completion/{${PN},ctest,cpack}
+
+ rm -rf "${D}"/usr/share/cmake/{completions,editors} || die
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/dev-util/cmake/files/50cmake-gentoo.el b/dev-util/cmake/files/50cmake-gentoo.el
new file mode 100644
index 00000000..e4a1a6d4
--- /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-darwin-bundle.patch b/dev-util/cmake/files/cmake-2.8.10-darwin-bundle.patch
new file mode 100644
index 00000000..9cb4777c
--- /dev/null
+++ b/dev-util/cmake/files/cmake-2.8.10-darwin-bundle.patch
@@ -0,0 +1,23 @@
+Don't use .so for modules on darwin/macos. Use .bundle instead.
+Patch by Heiko Przybyl
+
+--- Modules/Platform/Darwin.cmake
++++ 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 "")
+
+@@ -48,7 +48,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 ".dylib" ".so" ".a")
++set(CMAKE_FIND_LIBRARY_SUFFIXES ".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-2.8.10.2-FindPythonLibs.patch b/dev-util/cmake/files/cmake-2.8.10.2-FindPythonLibs.patch
new file mode 100644
index 00000000..2a83ff7a
--- /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_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-2.8.12.1-FindImageMagick.patch b/dev-util/cmake/files/cmake-2.8.12.1-FindImageMagick.patch
new file mode 100644
index 00000000..b094f179
--- /dev/null
+++ b/dev-util/cmake/files/cmake-2.8.12.1-FindImageMagick.patch
@@ -0,0 +1,23 @@
+--- Modules/FindImageMagick.cmake
++++ Modules/FindImageMagick.cmake
+@@ -147,17 +147,17 @@
+ )
+ if(component STREQUAL "Magick++")
+ FIND_IMAGEMAGICK_API(Magick++ Magick++.h
+- Magick++ CORE_RL_Magick++_ Magick++-6.Q16 Magick++-Q16 Magick++-6.Q8 Magick++-Q8 Magick++-6.Q16HDRI Magick++-Q16HDRI Magick++-6.Q8HDRI Magick++-Q8HDRI
++ Magick++ CORE_RL_Magick++_ Magick++-6.Q64 Magick++-6.Q64HDRI Magick++-6.Q32 Magick++-6.Q32HDRI Magick++-6.Q16 Magick++-6.Q16HDRI Magick++-6.Q8 Magick++-6.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
+ elseif(component STREQUAL "MagickWand")
+ FIND_IMAGEMAGICK_API(MagickWand wand/MagickWand.h
+- Wand MagickWand CORE_RL_wand_ MagickWand-6.Q16 MagickWand-Q16 MagickWand-6.Q8 MagickWand-Q8 MagickWand-6.Q16HDRI MagickWand-Q16HDRI MagickWand-6.Q8HDRI MagickWand-Q8HDRI
++ Wand MagickWand CORE_RL_wand_ MagickWand-6.Q64 MagickWand-6.Q64HDRI MagickWand-6.Q32 MagickWand-6.Q32HDRI MagickWand-6.Q16 MagickWand-6.Q16HDRI MagickWand-6.Q8 MagickWand-6.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
+ elseif(component STREQUAL "MagickCore")
+ FIND_IMAGEMAGICK_API(MagickCore magick/MagickCore.h
+- Magick MagickCore CORE_RL_magick_ MagickCore-6.Q16 MagickCore-Q16 MagickCore-6.Q8 MagickCore-Q8 MagickCore-6.Q16HDRI MagickCore-Q16HDRI MagickCore-6.Q8HDRI MagickCore-Q8HDRI
++ Magick MagickCore CORE_RL_magick_ MagickCore-6.Q64 MagickCore-6.Q64HDRI MagickCore-6.Q32 MagickCore-6.Q32HDRI MagickCore-6.Q16 MagickCore-6.Q16HDRI MagickCore-6.Q8 MagickCore-6.Q8HDRI
+ )
+ list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY)
+ else()
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 00000000..86c5dc7f
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.0-FindBLAS.patch
@@ -0,0 +1,43 @@
+--- Modules/FindBLAS.cmake
++++ 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.0-FindBoost-python.patch b/dev-util/cmake/files/cmake-3.0.0-FindBoost-python.patch
new file mode 100644
index 00000000..a6291d2b
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.0-FindBoost-python.patch
@@ -0,0 +1,93 @@
+From 934ec9add33d413e4d5c9cec1cb3ebb5cbfd81f4 Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Thu, 19 Jun 2014 00:17:48 +1000
+Subject: [PATCH] Fix detection of PYTHON_ABI-versioned Boost Python libraries
+ wrt bug #400969.
+
+---
+ Modules/FindBoost.cmake | 41 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 41 insertions(+)
+
+diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
+index dfd4460..70bfb4f 100644
+--- a/Modules/FindBoost.cmake
++++ b/Modules/FindBoost.cmake
+@@ -952,6 +952,15 @@ 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")
++ # Get version of Python.
++ if (NOT PYTHON_EXECUTABLE)
++ #if a certain version of python was detected by cmake before use that one
++ set(PYTHON_EXECUTABLE "python")
++ endif (NOT PYTHON_EXECUTABLE)
++ execute_process(COMMAND "${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
+@@ -984,6 +993,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
+@@ -991,6 +1009,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})
+@@ -1020,6 +1045,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
+@@ -1027,6 +1061,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})
+--
+1.8.5.5
+
diff --git a/dev-util/cmake/files/cmake-3.0.0-prefix-dirs.patch b/dev-util/cmake/files/cmake-3.0.0-prefix-dirs.patch
new file mode 100644
index 00000000..5e8b81a9
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.0-prefix-dirs.patch
@@ -0,0 +1,142 @@
+From e7ce3e523f8cfa1bc749118f381753230766827f Mon Sep 17 00:00:00 2001
+From: Michael Palimaka <kensington@gentoo.org>
+Date: Thu, 19 Jun 2014 00:08:13 +1000
+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)
+---
+ Modules/Platform/Darwin.cmake | 12 +++++++----
+ Modules/Platform/UnixPaths.cmake | 43 ++++++++++++++++++++--------------------
+ 2 files changed, 29 insertions(+), 26 deletions(-)
+
+diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
+index e25df1e..9b22a6a 100644
+--- a/Modules/Platform/Darwin.cmake
++++ b/Modules/Platform/Darwin.cmake
+@@ -132,9 +132,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
+@@ -156,6 +156,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)
+@@ -187,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 20ee1d1..3481ca8 100644
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -33,6 +33,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
+@@ -53,43 +54,41 @@ endif()
+
+ # List common include file locations not under the common prefixes.
+ list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+- # Windows API on Cygwin
+- /usr/include/w32api
+-
+- # X11
+- /usr/X11R6/include /usr/include/X11
+-
+- # Other
+- /usr/pkg/include
+- /opt/csw/include /opt/include
+- /usr/openwin/include
++ @GENTOO_PORTAGE_EPREFIX@usr/include
+ )
+
+ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+- # Windows API on Cygwin
+- /usr/lib/w32api
+-
+- # X11
+- /usr/X11R6/lib /usr/lib/X11
+-
+- # Other
+- /usr/pkg/lib
+- /opt/csw/lib /opt/lib
+- /usr/openwin/lib
++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc
++ @GENTOO_PORTAGE_GCCLIBDIR@
++ @GENTOO_PORTAGE_EPREFIX@usr/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
+ )
+
+ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+- /usr/pkg/bin
++ @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/lib32
++ @GENTOO_PORTAGE_EPREFIX@usr/libx32
++ @GENTOO_PORTAGE_EPREFIX@usr/lib64
++ @GENTOO_PORTAGE_EPREFIX@usr/lib
++ @GENTOO_PORTAGE_EPREFIX@lib
++ /lib32 /libx32 /lib64 /lib /usr/lib32 /usr/libx32 /usr/lib64 /usr/lib
+ )
+
+ 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
+ )
+
+--
+1.8.5.5
+
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 00000000..57250e45
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.0.2-FindLAPACK.patch
@@ -0,0 +1,43 @@
+--- Modules/FindLAPACK.cmake.orig 2014-09-15 23:50:11.377111987 +0200
++++ Modules/FindLAPACK.cmake 2014-09-15 23:52:54.734388375 +0200
+@@ -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-FindPythonInterp.patch b/dev-util/cmake/files/cmake-3.1.0-FindPythonInterp.patch
new file mode 100644
index 00000000..78f622d8
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.1.0-FindPythonInterp.patch
@@ -0,0 +1,29 @@
+--- Modules/FindPythonInterp.cmake.orig 2015-01-06 11:50:03.376357898 +0100
++++ Modules/FindPythonInterp.cmake 2015-01-06 12:25:48.614989290 +0100
+@@ -75,6 +75,11 @@
+ else()
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
+ endif()
++
++if (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
+@@ -99,12 +104,13 @@
+ 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_BUILD_TYPE STREQUAL Gentoo)
+ foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
+ set(_Python_NAMES python${_CURRENT_VERSION})
+ if(WIN32)
+ list(APPEND _Python_NAMES python)
+ endif()
++
+ find_program(PYTHON_EXECUTABLE
+ NAMES ${_Python_NAMES}
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
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 00000000..119001ae
--- /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
+
+--- Modules/Platform/Darwin-Initialize.cmake
++++ 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.3.1-x32.patch b/dev-util/cmake/files/cmake-3.3.1-x32.patch
new file mode 100644
index 00000000..4afb032b
--- /dev/null
+++ b/dev-util/cmake/files/cmake-3.3.1-x32.patch
@@ -0,0 +1,278 @@
+--- ./Source/cmFindPackageCommand.cxx
++++ ./Source/cmFindPackageCommand.cxx
+@@ -2102,6 +2102,8 @@ bool cmFindPackageCommand::SearchPrefix(
+
+ // Construct list of common install locations (lib and share).
+ std::vector<std::string> common;
++ common.push_back("lib32");
++ common.push_back("libx32");
+ if(!this->LibraryArchitecture.empty())
+ {
+ common.push_back("lib/"+this->LibraryArchitecture);
+--- ./Source/cmExportInstallFileGenerator.cxx
++++ ./Source/cmExportInstallFileGenerator.cxx
+@@ -94,8 +94,12 @@ bool cmExportInstallFileGenerator::Gener
+ << "get_filename_component(_IMPORT_PREFIX"
+ << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
+ if(cmHasLiteralPrefix(absDestS.c_str(), "/lib/") ||
++ cmHasLiteralPrefix(absDestS.c_str(), "/lib32/") ||
++ cmHasLiteralPrefix(absDestS.c_str(), "/libx32/") ||
+ cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") ||
+ cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") ||
++ cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib32/") ||
++ cmHasLiteralPrefix(absDestS.c_str(), "/usr/libx32/") ||
+ cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/"))
+ {
+ // Handle "/usr move" symlinks created by some Linux distros.
+--- ./Modules/GNUInstallDirs.cmake
++++ ./Modules/GNUInstallDirs.cmake
+@@ -30,7 +30,7 @@
+ # ``LOCALSTATEDIR``
+ # modifiable single-machine data (var)
+ # ``LIBDIR``
+-# object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
++# object code libraries (lib{,32,x32,64} or lib/<multiarch-tuple> on Debian)
+ # ``INCLUDEDIR``
+ # C header files (include)
+ # ``OLDINCLUDEDIR``
+@@ -159,7 +159,17 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (
+ "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
+ "Please enable at least one language before including GNUInstallDirs.")
+ else()
+- if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
++ if(EXISTS /usr/lib32)
++ set(_LIBDIR_DEFAULT "lib32")
++ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
++ set(__LAST_LIBDIR_DEFAULT "lib32")
++ endif()
++ elseif(EXISTS /usr/libx32)
++ set(_LIBDIR_DEFAULT "libx32")
++ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
++ set(__LAST_LIBDIR_DEFAULT "libx32")
++ endif()
++ elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ set(_LIBDIR_DEFAULT "lib64")
+ if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
+ set(__LAST_LIBDIR_DEFAULT "lib64")
+--- ./Modules/FindArmadillo.cmake
++++ ./Modules/FindArmadillo.cmake
+@@ -45,7 +45,7 @@
+ # UNIX paths are standard, no need to write.
+ find_library(ARMADILLO_LIBRARY
+ NAMES armadillo
+- PATHS "$ENV{ProgramFiles}/Armadillo/lib" "$ENV{ProgramFiles}/Armadillo/lib64" "$ENV{ProgramFiles}/Armadillo"
++ PATHS "$ENV{ProgramFiles}/Armadillo/lib" "$ENV{ProgramFiles}/Armadillo/lib32" "$ENV{ProgramFiles}/Armadillo/libx32" "$ENV{ProgramFiles}/Armadillo/lib64" "$ENV{ProgramFiles}/Armadillo"
+ )
+ find_path(ARMADILLO_INCLUDE_DIR
+ NAMES armadillo
+--- ./Modules/CPackRPM.cmake
++++ ./Modules/CPackRPM.cmake
+@@ -362,7 +362,7 @@
+ # list of path to be excluded.
+ #
+ # * Mandatory : NO
+-# * Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include
++# * Default : /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib32 /usr/libx32 /usr/lib64 /usr/include
+ #
+ # May be used to exclude path (directories or files) from the auto-generated
+ # list of paths discovered by CPack RPM. The defaut value contains a
+@@ -607,7 +607,7 @@ function(cpack_rpm_prepare_content_list)
+ endif()
+
+ if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST)
+- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib64 /usr/include)
++ set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/share /usr/share/doc /usr/bin /usr/lib /usr/lib32 /usr/libx32 /usr/lib64 /usr/include)
+ if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION)
+ message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.")
+ list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}")
+--- ./Modules/FindPkgConfig.cmake
++++ ./Modules/FindPkgConfig.cmake
+@@ -235,10 +235,17 @@ macro(_pkg_check_modules_internal _is_re
+ list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+ endif()
+ else()
+- # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+- get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+- if(uselib64)
+- list(APPEND _lib_dirs "lib64/pkgconfig")
++ # hard-code regardless, since there's no discovery method provided
++ if(EXISTS /usr/lib32)
++ list(APPEND _lib_dirs "lib32/pkgconfig")
++ elseif(EXISTS /usr/libx32)
++ list(APPEND _lib_dirs "libx32/pkgconfig")
++ else()
++ # not debian, check the FIND_LIBRARY_USE_LIB64_PATHS property
++ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
++ if(uselib64)
++ list(APPEND _lib_dirs "lib64/pkgconfig")
++ endif()
+ endif()
+ endif()
+ endif()
+--- ./Modules/FindGLEW.cmake
++++ ./Modules/FindGLEW.cmake
+@@ -35,7 +35,7 @@
+ # License text for the above reference.)
+
+ find_path(GLEW_INCLUDE_DIR GL/glew.h)
+-find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
++find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib32 libx32 lib64)
+
+ set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
+ set(GLEW_LIBRARIES ${GLEW_LIBRARY})
+--- ./Modules/Platform/BlueGeneP-base.cmake
++++ ./Modules/Platform/BlueGeneP-base.cmake
+@@ -45,12 +45,15 @@ set(CMAKE_SYSTEM_LIBRARY_PATH
+
+ #
+ # This adds directories that find commands should specifically ignore for cross compiles.
+-# Most of these directories are the includeand lib directories for the frontend on BG/P systems.
++# Most of these directories are the include and lib directories for the frontend on BG/P systems.
+ # Not ignoring these can cause things like FindX11 to find a frontend PPC version mistakenly.
+ # We use this on BG instead of re-rooting because backend libraries are typically strewn about
+ # the filesystem, and we can't re-root ALL backend libraries to a single place.
+ #
+ set(CMAKE_SYSTEM_IGNORE_PATH
++ /lib32 /libx32
++ /usr/local/lib32 /usr/local/libx32
++ /usr/lib32 /usr/libx32
+ /lib /lib64 /include
+ /usr/lib /usr/lib64 /usr/include
+ /usr/local/lib /usr/local/lib64 /usr/local/include
+#--- ./Modules/Platform/UnixPaths.cmake
+#+++ ./Modules/Platform/UnixPaths.cmake
+#@@ -83,7 +83,7 @@ list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+# )
+#
+# list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+#- /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64
+#+ /lib /lib32 /libx32 /lib64 /usr/lib /usr/lib32 /usr/libx32 /usr/lib64
+# )
+#
+# list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
+--- ./Modules/Platform/BlueGeneQ-base.cmake
++++ ./Modules/Platform/BlueGeneQ-base.cmake
+@@ -41,6 +41,9 @@
+ # re-root ALL backend libraries to a single place.
+ #
+ set(CMAKE_SYSTEM_IGNORE_PATH
++ /lib32 /libx32
++ /usr/local/lib32 /usr/local/libx32
++ /usr/lib32 /usr/libx32
+ /lib /lib64 /include
+ /usr/lib /usr/lib64 /usr/include
+ /usr/local/lib /usr/local/lib64 /usr/local/include
+--- ./Modules/FindOpenAL.cmake
++++ ./Modules/FindOpenAL.cmake
+@@ -83,7 +83,7 @@ find_library(OPENAL_LIBRARY
+ NAMES OpenAL al openal OpenAL32
+ HINTS
+ ENV OPENALDIR
+- PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
++ PATH_SUFFIXES lib32 libx32 lib64 lib libs64 libs libs/Win32 libs/Win64
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+--- ./Modules/FindIce.cmake
++++ ./Modules/FindIce.cmake
+@@ -157,7 +157,7 @@ function(_Ice_FIND)
+ endif()
+ # Generic 64-bit and 32-bit directories
+ list(APPEND ice_binary_suffixes "bin${_x64}" "bin")
+- list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib")
++ list(APPEND ice_library_suffixes "lib32" "libx32" "${_lib64}" "lib${_x64}" "lib")
+ list(APPEND ice_include_suffixes "include")
+ list(APPEND ice_slice_suffixes "slice")
+
+--- ./Modules/FindKDE3.cmake
++++ ./Modules/FindKDE3.cmake
+@@ -230,7 +230,11 @@ set(QT_AND_KDECORE_LIBS ${QT_LIBRARIES}
+ get_filename_component(KDE3_LIB_DIR ${KDE3_KDECORE_LIBRARY} PATH )
+
+ if(NOT KDE3_LIBTOOL_DIR)
+- if(KDE3_KDECORE_LIBRARY MATCHES lib64)
++ if(KDE3_KDECORE_LIBRARY MATCHES lib32)
++ set(KDE3_LIBTOOL_DIR /lib32/kde3)
++ if(KDE3_KDECORE_LIBRARY MATCHES libx32)
++ set(KDE3_LIBTOOL_DIR /libx32/kde3)
++ elseif(KDE3_KDECORE_LIBRARY MATCHES lib64)
+ set(KDE3_LIBTOOL_DIR /lib64/kde3)
+ else()
+ set(KDE3_LIBTOOL_DIR /lib/kde3)
+--- ./Modules/FindDevIL.cmake
++++ ./Modules/FindDevIL.cmake
+@@ -56,7 +56,7 @@ find_path(IL_INCLUDE_DIR il.h
+
+ find_library(IL_LIBRARIES
+ NAMES IL DEVIL
+- PATH_SUFFIXES lib64 lib lib32
++ PATH_SUFFIXES lib lib32 libx32 lib64
+ DOC "The file that corresponds to the base il library."
+ )
+
+@@ -64,7 +64,7 @@ find_library(IL_LIBRARIES
+
+ find_library(ILUT_LIBRARIES
+ NAMES ILUT
+- PATH_SUFFIXES lib64 lib lib32
++ PATH_SUFFIXES lib lib32 libx32 lib64
+ DOC "The file that corresponds to the il (system?) utility library."
+ )
+
+@@ -72,7 +72,7 @@ find_library(ILUT_LIBRARIES
+
+ find_library(ILU_LIBRARIES
+ NAMES ILU
+- PATH_SUFFIXES lib64 lib lib32
++ PATH_SUFFIXES lib lib32 libx32 lib64
+ DOC "The file that corresponds to the il utility library."
+ )
+
+--- ./Modules/FindGTK2.cmake
++++ ./Modules/FindGTK2.cmake
+@@ -263,8 +263,12 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hd
+ find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr}
+ PATHS
+ ${_gtk2_arch_dir}
++ /usr/local/lib32
++ /usr/local/libx32
+ /usr/local/lib64
+ /usr/local/lib
++ /usr/lib32
++ /usr/libx32
+ /usr/lib64
+ /usr/lib
+ /usr/X11R6/include
+--- ./Modules/CMakeFindPackageMode.cmake
++++ ./Modules/CMakeFindPackageMode.cmake
+@@ -85,7 +85,9 @@ if(UNIX)
+ # from the outside
+ if(NOT CMAKE_SIZEOF_VOID_P)
+ set(CMAKE_SIZEOF_VOID_P 4)
+- if(EXISTS /usr/lib64)
++ if(EXISTS /usr/lib32 OR /usr/libx32)
++ set(CMAKE_SIZEOF_VOID_P 4)
++ elseif(EXISTS /usr/lib64)
+ set(CMAKE_SIZEOF_VOID_P 8)
+ else()
+ # use the file utility to check whether itself is 64 bit:
+--- ./CMakeLists.txt
++++ ./CMakeLists.txt
+@@ -540,7 +540,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ if(BUILD_CursesDialog)
+ get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
+ set(CURSES_NEED_RPATH FALSE)
+- if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
++ if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib32" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib32" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
+ set(CURSES_NEED_RPATH TRUE)
+ endif()
+ endif()
+@@ -559,7 +559,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
+ endif()
+
+ set(QT_NEED_RPATH FALSE)
+- if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
++ if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib32" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib32"AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
+ set(QT_NEED_RPATH TRUE)
+ endif()
+ endif()
diff --git a/dev-util/cmake/files/cmake.vim b/dev-util/cmake/files/cmake.vim
new file mode 100644
index 00000000..5cecd7d0
--- /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