diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/cmake-2.8.6-r4.ebuild b/sdk_container/src/third_party/portage-stable/dev-util/cmake/cmake-2.8.6-r4.ebuild new file mode 100644 index 0000000000..5cb03935d6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/cmake-2.8.6-r4.ebuild @@ -0,0 +1,178 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/cmake/cmake-2.8.6-r4.ebuild,v 1.5 2011/12/14 00:20:03 ago Exp $ + +EAPI=4 + +CMAKE_REMOVE_MODULES="no" +inherit elisp-common toolchain-funcs eutils versionator flag-o-matic base cmake-utils virtualx + +MY_P="${PN}-$(replace_version_separator 3 - ${MY_PV})" + +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" + +LICENSE="CMake" +KEYWORDS="~alpha amd64 ~arm hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris" +SLOT="0" +IUSE="emacs ncurses qt4 vim-syntax" + +DEPEND=" + >=app-arch/libarchive-2.8.0 + >=net-misc/curl-7.20.0-r1[ssl] + >=dev-libs/expat-2.0.1 + dev-util/pkgconfig + sys-libs/zlib + ncurses? ( sys-libs/ncurses ) + qt4? ( x11-libs/qt-gui:4 ) +" +RDEPEND="${DEPEND} + emacs? ( virtual/emacs ) + vim-syntax? ( + || ( + app-editors/vim + app-editors/gvim + ) + ) +" + +SITEFILE="50${PN}-gentoo.el" +VIMFILE="${PN}.vim" + +S="${WORKDIR}/${MY_P}" + +CMAKE_BINARY="${S}/Bootstrap.cmk/cmake" + +# Fixme: +# Boost patchset is foobared and should respect eselect / slotting +PATCHES=( + "${FILESDIR}"/${PN}-2.6.3-darwin-bundle.patch + "${FILESDIR}"/${PN}-2.6.3-no-duplicates-in-rpath.patch + "${FILESDIR}"/${PN}-2.6.3-fix_broken_lfs_on_aix.patch + "${FILESDIR}"/${PN}-2.8.0-darwin-default-install_name.patch + "${FILESDIR}"/${PN}-2.8.1-libform.patch + "${FILESDIR}"/${PN}-2.8.4-FindPythonLibs.patch + "${FILESDIR}"/${PN}-2.8.3-more-no_host_paths.patch + "${FILESDIR}"/${PN}-2.8.3-ruby_libname.patch + "${FILESDIR}"/${PN}-2.8.4-FindBoost.patch + "${FILESDIR}"/${PN}-2.8.6-FindBLAS-2.patch + "${FILESDIR}"/${PN}-2.8.6-FindLAPACK-2.patch + "${FILESDIR}"/${PN}-2.8.6-CodeBlocks.patch + "${FILESDIR}"/${PN}-2.8.6-testsvn17.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:]]+' | egrep -o '[[:digit:]]+') + par_arg="--parallel=${par_arg}" + else + par_arg="--parallel=1" + fi + + tc-export CC CXX LD + + ./bootstrap \ + --prefix="${T}/cmakestrap/" \ + ${par_arg} \ + || die "Bootstrap failed" +} + +cmake_src_test() { + # fix OutDir test + # this is altered thanks to our eclass + sed -i -e 's:#IGNORE ::g' "${S}"/Tests/OutDir/CMakeLists.txt || die + + pushd "${CMAKE_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. + # SimpleCOnly_sdcc: sdcc choke on global cflags so just skip the test + # as it was never intended to be used this way. + "${CMAKE_BUILD_DIR}"/bin/ctest ${ctestargs} \ + -E BootstrapTest SimpleCOnly_sdcc \ + || die "Tests failed" + + popd > /dev/null +} + +pkg_setup() { + einfo "Fixing java access violations ..." + # bug 387227 + addpredict /proc/self/coredump_filter +} + +src_prepare() { + base_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() { + # make things work with gentoo java setup + # in case java-config cannot be run, the variable just becomes unset + # per bug #315229 + export JAVA_HOME=$(java-config -g JAVA_HOME 2> /dev/null) + + local mycmakeargs=( + -DCMAKE_USE_SYSTEM_LIBRARIES=ON + -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr + -DCMAKE_DOC_DIR=/share/doc/${PF} + -DCMAKE_MAN_DIR=/share/man + -DCMAKE_DATA_DIR=/share/${PN} + $(cmake-utils_use_build ncurses CursesDialog) + $(cmake-utils_use_build qt4 QtDialog) + ) + cmake-utils_src_configure +} + +src_compile() { + cmake-utils_src_compile + use emacs && elisp-compile Docs/cmake-mode.el +} + +src_test() { + VIRTUALX_COMMAND="cmake_src_test" virtualmake +} + +src_install() { + cmake-utils_src_install + if use emacs; then + elisp-install ${PN} Docs/cmake-mode.el Docs/cmake-mode.elc + elisp-site-file-install "${FILESDIR}/${SITEFILE}" + fi + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins Docs/cmake-syntax.vim + + insinto /usr/share/vim/vimfiles/indent + doins Docs/cmake-indent.vim + + insinto /usr/share/vim/vimfiles/ftdetect + doins "${FILESDIR}/${VIMFILE}" + fi +} + +pkg_postinst() { + use emacs && elisp-site-regen +} + +pkg_postrm() { + use emacs && elisp-site-regen +} diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/50cmake-gentoo.el b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/50cmake-gentoo.el new file mode 100644 index 0000000000..e4a1a6d47c --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/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/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-darwin-bundle.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-darwin-bundle.patch new file mode 100644 index 0000000000..6ee9b709df --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-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 +@@ -23,7 +23,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 "") + +@@ -45,7 +45,7 @@ + SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -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/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-fix_broken_lfs_on_aix.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-fix_broken_lfs_on_aix.patch new file mode 100644 index 0000000000..02c3011c8f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-fix_broken_lfs_on_aix.patch @@ -0,0 +1,39 @@ +http://public.kitware.com/Bug/view.php?id=7933 + +diff -ur cmake-2.6.2/Source/kwsys/kwsysPlatformTestsCXX.cxx cmake-2.6.2-p/Source/kwsys/kwsysPlatformTestsCXX.cxx +--- cmake-2.6.2/Source/kwsys/kwsysPlatformTestsCXX.cxx Wed Sep 24 20:34:37 2008 ++++ cmake-2.6.2-p/Source/kwsys/kwsysPlatformTestsCXX.cxx Tue Nov 4 11:18:32 2008 +@@ -38,6 +38,13 @@ + int main() { return 0; } + #endif + ++#ifdef TEST_KWSYS_LFS_SUPPORT ++#define _LARGE_FILES ++#include ++int main() { return 0; } ++#endif ++ ++ + #ifdef TEST_KWSYS_IOS_HAVE_STD + #include + void f(std ::ostream*) {} +diff -ur cmake-2.6.2/bootstrap cmake-2.6.2-p/bootstrap +--- cmake-2.6.2/bootstrap Wed Sep 24 20:34:33 2008 ++++ cmake-2.6.2-p/bootstrap Tue Nov 4 11:17:11 2008 +@@ -1005,6 +1005,16 @@ + echo "${cmake_cxx_compiler} does not have stl iterator_traits" + fi + ++if cmake_try_run "${cmake_cxx_compiler}" \ ++ "${cmake_cxx_flags} -DTEST_KWSYS_LFS_SUPPORT" \ ++ "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then ++ KWSYS_LFS_AVAILABLE=1 ++ echo "LFS support available" ++else ++ KWSYS_LFS_AVAILABLE=0 ++ echo "LFS support unavailable, disabled" ++fi ++ + if [ "x${KWSYS_STL_HAS_ITERATOR_TRAITS}" = "x0" ]; then + if cmake_try_run "${cmake_cxx_compiler}" \ + "${cmake_cxx_flags} -DTEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD}" \ diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-no-duplicates-in-rpath.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-no-duplicates-in-rpath.patch new file mode 100644 index 0000000000..ceb205ff58 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.6.3-no-duplicates-in-rpath.patch @@ -0,0 +1,19 @@ +Patch by Heiko Przybyl + +--- Source/cmComputeLinkInformation.cxx ++++ Source/cmComputeLinkInformation.cxx +@@ -1686,6 +1686,14 @@ std::string cmComputeLinkInformation::Ge + for(std::vector::const_iterator ri = runtimeDirs.begin(); + ri != runtimeDirs.end(); ++ri) + { ++ // Do not add duplicates. ++ // I'd like to have that check already in the list generation code ++ // but that would need lots of more changes, even in ExpandListArgument(). ++ if(*sep != '\0' && (rpath + sep).find(*ri + sep) != std::string::npos) ++ { ++ //std::cerr << "ignoring duplicate: '" << *ri << "' in '" << rpath << "'" << std::endl; ++ continue; ++ } + // Separate from previous path. + rpath += sep; + sep = this->GetRuntimeSep().c_str(); diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.0-darwin-default-install_name.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.0-darwin-default-install_name.patch new file mode 100644 index 0000000000..4ef0c7b4b6 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.0-darwin-default-install_name.patch @@ -0,0 +1,20 @@ +The install_name of a library can be compared to the ELF soname, setting +it to just the library name (libx.1.dylib) is not sufficient on Mach-O, +as it uses full paths. Most apps have no clue about that, so they don't +do something like http://www.cmake.org/pipermail/cmake/2006-June/009758.html + +Provide a sane default that will allow merging most cmake-based +packages. If this location is not correct, Portage's QA checks will +catch that. + +--- Source/cmTarget.cxx ++++ Source/cmTarget.cxx +@@ -974,7 +974,7 @@ + this->Makefile->IsOn("MINGW")); + + // Setup default property values. +- this->SetPropertyDefault("INSTALL_NAME_DIR", ""); ++ this->SetPropertyDefault("INSTALL_NAME_DIR", "${CMAKE_INSTALL_PREFIX}/lib"); + this->SetPropertyDefault("INSTALL_RPATH", ""); + this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); + this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF"); diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.1-libform.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.1-libform.patch new file mode 100644 index 0000000000..87c724776e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.1-libform.patch @@ -0,0 +1,50 @@ +diff -u -r cmake-2.8.1.medium/CMakeLists.txt cmake-2.8.1/CMakeLists.txt +--- cmake-2.8.1.medium/CMakeLists.txt 2010-03-16 21:29:28.000000000 +0100 ++++ cmake-2.8.1/CMakeLists.txt 2010-04-04 20:04:47.000000000 +0200 +@@ -314,9 +314,6 @@ + ELSE (UNIX) + SET(BUILD_CursesDialog 0) + ENDIF (UNIX) +- IF(BUILD_CursesDialog) +- ADD_SUBDIRECTORY(Source/CursesDialog/form) +- ENDIF(BUILD_CursesDialog) + ENDMACRO (CMAKE_BUILD_UTILITIES) + + +diff -u -r cmake-2.8.1.medium/Source/CursesDialog/CMakeLists.txt cmake-2.8.1/Source/CursesDialog/CMakeLists.txt +--- cmake-2.8.1.medium/Source/CursesDialog/CMakeLists.txt 2010-03-16 21:29:34.000000000 +0100 ++++ cmake-2.8.1/Source/CursesDialog/CMakeLists.txt 2010-04-04 20:01:38.000000000 +0200 +@@ -25,13 +25,18 @@ + CursesDialog/ccmake + ) + +-INCLUDE_DIRECTORIES(${CMake_SOURCE_DIR}/Source/CursesDialog/form +- ${CMake_BINARY_DIR}/Source/CursesDialog/form) + INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) + + + ADD_EXECUTABLE(ccmake ${CURSES_SRCS} ) + TARGET_LINK_LIBRARIES(ccmake CMakeLib) +-TARGET_LINK_LIBRARIES(ccmake cmForm) ++TARGET_LINK_LIBRARIES(ccmake form) ++TARGET_LINK_LIBRARIES(ccmake ${CURSES_LIBRARY}) ++IF(CURSES_EXTRA_LIBRARY) ++ TARGET_LINK_LIBRARIES(ccmake ${CURSES_EXTRA_LIBRARY}) ++ENDIF(CURSES_EXTRA_LIBRARY) ++ + + INSTALL_TARGETS(/bin ccmake) ++ ++ +diff -u -r cmake-2.8.1.medium/Source/CursesDialog/cmCursesStandardIncludes.h cmake-2.8.1/Source/CursesDialog/cmCursesStandardIncludes.h +--- cmake-2.8.1.medium/Source/CursesDialog/cmCursesStandardIncludes.h 2010-03-16 21:29:35.000000000 +0100 ++++ cmake-2.8.1/Source/CursesDialog/cmCursesStandardIncludes.h 2010-04-04 20:01:38.000000000 +0200 +@@ -15,8 +15,6 @@ + #define _MSE_INT_H + #endif + +-#include +- + #if defined(__hpux) + # define _BOOL_DEFINED + # include diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-more-no_host_paths.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-more-no_host_paths.patch new file mode 100644 index 0000000000..38bad925c3 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-more-no_host_paths.patch @@ -0,0 +1,109 @@ +Set some proper paths to make cmake find our tools. +Original patch by Heiko Przybyl + +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) + +--- cmake-2.8.3/Modules/Platform/Darwin.cmake ++++ cmake-2.8.3/Modules/Platform/Darwin.cmake +@@ -217,19 +217,23 @@ + + + +-# default to searching for frameworks first +-SET(CMAKE_FIND_FRAMEWORK FIRST) ++# default to searching for frameworks last ++SET(CMAKE_FIND_FRAMEWORK LAST) + # set up the default search directories for frameworks + SET(CMAKE_SYSTEM_FRAMEWORK_PATH ++ @GENTOO_PORTAGE_EPREFIX@Frameworks ++ @GENTOO_PORTAGE_EPREFIX@usr/lib + ~/Library/Frameworks + /Library/Frameworks + /Network/Library/Frameworks + /System/Library/Frameworks) + +-# default to searching for application bundles first +-SET(CMAKE_FIND_APPBUNDLE FIRST) ++# default to searching for application bundles last ++SET(CMAKE_FIND_APPBUNDLE LAST) + # set up the default search directories for application bundles + SET(CMAKE_SYSTEM_APPBUNDLE_PATH ++ @GENTOO_PORTAGE_EPREFIX@Applications ++ @GENTOO_PORTAGE_EPREFIX@usr/bin + ~/Applications + /Applications + /Developer/Applications) +diff -ruN cmake-2.8.3.orig/Modules/Platform/UnixPaths.cmake cmake-2.8.3/Modules/Platform/UnixPaths.cmake +--- cmake-2.8.3/Modules/Platform/UnixPaths.cmake ++++ cmake-2.8.3/Modules/Platform/UnixPaths.cmake +@@ -33,6 +33,7 @@ + # 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 +@@ -44,43 +45,39 @@ + + # 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/lib64 ++ @GENTOO_PORTAGE_EPREFIX@usr/lib32 ++ @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 ++ @GENTOO_PORTAGE_GCCLIBDIR@/gcc ++ @GENTOO_PORTAGE_GCCLIBDIR@ ++ @GENTOO_PORTAGE_EPREFIX@usr/lib64 ++ @GENTOO_PORTAGE_EPREFIX@usr/lib32 ++ @GENTOO_PORTAGE_EPREFIX@usr/lib ++ @GENTOO_PORTAGE_EPREFIX@lib + /lib /usr/lib /usr/lib32 /usr/lib64 + ) + + 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 + ) + diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-ruby_libname.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-ruby_libname.patch new file mode 100644 index 0000000000..45d2b162c5 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.3-ruby_libname.patch @@ -0,0 +1,12 @@ +diff -urN cmake-2.8.3.orig//Modules/FindRuby.cmake cmake-2.8.3//Modules/FindRuby.cmake +--- cmake-2.8.3.orig//Modules/FindRuby.cmake 2010-12-25 16:56:42.597163498 +0100 ++++ cmake-2.8.3//Modules/FindRuby.cmake 2010-12-25 16:57:55.207163499 +0100 +@@ -180,7 +180,7 @@ + + + # Determine the list of possible names for the ruby library +-SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT}) ++SET(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT}) + + IF(WIN32) + SET( _RUBY_MSVC_RUNTIME "" ) diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindBoost.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindBoost.patch new file mode 100644 index 0000000000..4a56d43a9e --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindBoost.patch @@ -0,0 +1,13 @@ +diff -urN cmake-2.8.4.old//Modules/FindBoost.cmake cmake-2.8.4/Modules/FindBoost.cmake +--- cmake-2.8.4.old//Modules/FindBoost.cmake 2011-02-20 19:32:16.528655001 +0100 ++++ cmake-2.8.4/Modules/FindBoost.cmake 2011-02-20 20:28:41.572936744 +0100 +@@ -73,6 +73,9 @@ + # binary Boost releases do so. + # + # set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") ++set(Boost_ADDITIONAL_VERSIONS "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" ++ "1.47.0" "1.47" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" ++ "1.43" "1.42.0" "1.42") + # + # ===================================== ============= ======================== + # diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindPythonLibs.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindPythonLibs.patch new file mode 100644 index 0000000000..28d2e4f879 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.4-FindPythonLibs.patch @@ -0,0 +1,12 @@ +diff -urN cmake-2.8.4.old/Modules/FindPythonLibs.cmake cmake-2.8.4/Modules/FindPythonLibs.cmake +--- cmake-2.8.4.old/Modules/FindPythonLibs.cmake 2011-02-20 19:32:16.363655002 +0100 ++++ cmake-2.8.4/Modules/FindPythonLibs.cmake 2011-02-20 19:33:51.905655001 +0100 +@@ -33,6 +33,8 @@ + ${Python_ADDITIONAL_VERSIONS} + 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + ++EXECUTE_PROCESS(COMMAND python -c "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))" ++ OUTPUT_VARIABLE _Python_VERSIONS) + FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) + STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) + IF(WIN32) diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-CodeBlocks.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-CodeBlocks.patch new file mode 100644 index 0000000000..8a8fe6f392 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-CodeBlocks.patch @@ -0,0 +1,34 @@ +From 240d39a6a4f72fe0e45fc1a1403e0b578d36a142 Mon Sep 17 00:00:00 2001 +From: Clinton Stimpson +Date: Wed, 5 Oct 2011 10:02:32 -0600 +Subject: [PATCH] Fix XML safety issue with adding preprocessor defines in CodeBlocks project. + +--- + Source/cmExtraCodeBlocksGenerator.cxx | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx +index 7db91c7..9a0b1ea 100644 +--- a/Source/cmExtraCodeBlocksGenerator.cxx ++++ b/Source/cmExtraCodeBlocksGenerator.cxx +@@ -19,6 +19,7 @@ + #include "cmGeneratedFileStream.h" + #include "cmTarget.h" + #include "cmSystemTools.h" ++#include "cmXMLSafe.h" + + #include + +@@ -585,7 +586,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, + for(std::vector::const_iterator di = defs.begin(); + di != defs.end(); ++di) + { +- fout <<" c_str() << "\" />\n"; ++ cmXMLSafe safedef(di->c_str()); ++ fout <<" \n"; + } + } + +-- +1.7.0 + diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindBLAS-2.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindBLAS-2.patch new file mode 100644 index 0000000000..16b6480f57 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindBLAS-2.patch @@ -0,0 +1,35 @@ +diff -ruN cmake-2.8.6.orig/Modules/FindBLAS.cmake cmake-2.8.6/Modules/FindBLAS.cmake +--- cmake-2.8.6.orig/Modules/FindBLAS.cmake 2011-10-04 18:09:24.000000000 +0200 ++++ cmake-2.8.6/Modules/FindBLAS.cmake 2011-11-22 23:04:17.000000000 +0100 +@@ -1,3 +1,9 @@ ++# ++# Version modified for Gentoo Linux ++# If a valid PkgConfig configuration for blas is found, this overrides and cancels ++# all further checks. ++# ++ + # - Find BLAS library + # This module finds an installed fortran library that implements the BLAS + # linear-algebra interface (see http://www.netlib.org/blas/). +@@ -39,6 +45,14 @@ + # (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(BLAS blas) ++if(NOT BLAS_FOUND) ++message(STATUS "No PkgConfig configuration for BLAS found; starting more extensive search.") ++ + include(CheckFunctionExists) + include(CheckFortranFunctionExists) + +@@ -622,3 +636,6 @@ + endif(BLA_F95) + + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) ++ ++endif(NOT BLAS_FOUND) ++ diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindLAPACK-2.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindLAPACK-2.patch new file mode 100644 index 0000000000..579a07d880 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-FindLAPACK-2.patch @@ -0,0 +1,34 @@ +--- cmake-2.8.6.orig/Modules/FindLAPACK.cmake 2011-10-09 23:38:48.956933106 +0800 ++++ cmake-2.8.6.orig/Modules/FindLAPACK.cmake 2011-10-09 23:39:52.002144646 +0800 +@@ -1,3 +1,9 @@ ++# ++# Version modified for Gentoo Linux ++# If a valid PkgConfig configuration is found, this overrides and cancels ++# all further checks. ++# ++ + # - Find LAPACK library + # This module finds an installed fortran library that implements the LAPACK + # linear-algebra interface (see http://www.netlib.org/lapack/). +@@ -36,6 +42,14 @@ + # (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(LAPACK lapack) ++if(NOT LAPACK_FOUND) ++message(STATUS "No PkgConfig configuration for LAPACK found; starting more extensive search.") ++ + set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + + get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) +@@ -304,4 +318,6 @@ + endif(NOT LAPACK_FIND_QUIETLY) + endif(BLA_F95) + + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) ++ ++endif(NOT LAPACK_FOUND) diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-testsvn17.patch b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-testsvn17.patch new file mode 100644 index 0000000000..77467676c8 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake-2.8.6-testsvn17.patch @@ -0,0 +1,30 @@ +diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in +index 97b2a07..edafb4ef 100644 +--- a/Tests/CTestUpdateSVN.cmake.in ++++ b/Tests/CTestUpdateSVN.cmake.in +@@ -23,6 +23,16 @@ file(MAKE_DIRECTORY ${TOP}/config) + set(SVNCMD ${SVN} --config-dir ${TOP}/config) + set(SVNUSER --username "test author" --non-interactive) + ++# Configure for this svn version. ++execute_process( ++ COMMAND ${SVN} help add OUTPUT_VARIABLE help_add ERROR_VARIABLE help_add ++ ) ++if("${help_add}" MATCHES "--depth") ++ set(depth_empty "--depth=empty") ++else() ++ set(depth_empty "") ++endif() ++ + #----------------------------------------------------------------------------- + # Initialize the testing directory. + message("Creating test directory...") +@@ -63,7 +73,7 @@ update_content(user-source files_added files_removed dirs_added) + if(dirs_added) + run_child( + WORKING_DIRECTORY ${TOP}/user-source +- COMMAND ${SVNCMD} add ${dirs_added} ++ COMMAND ${SVNCMD} add ${depth_empty} ${dirs_added} + ) + endif(dirs_added) + run_child( diff --git a/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake.vim b/sdk_container/src/third_party/portage-stable/dev-util/cmake/files/cmake.vim new file mode 100644 index 0000000000..5cecd7d05b --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/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/sdk_container/src/third_party/portage-stable/eclass/cmake-utils.eclass b/sdk_container/src/third_party/portage-stable/eclass/cmake-utils.eclass new file mode 100644 index 0000000000..dc1363bc4f --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/cmake-utils.eclass @@ -0,0 +1,497 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.76 2011/10/06 13:33:51 haubi Exp $ + +# @ECLASS: cmake-utils.eclass +# @MAINTAINER: +# kde@gentoo.org +# @AUTHOR: +# Tomáš Chvátal +# Maciej Mrozowski +# (undisclosed contributors) +# Original author: Zephyrus (zephyrus@mirach.it) +# @BLURB: common ebuild functions for cmake-based packages +# @DESCRIPTION: +# The cmake-utils eclass is base.eclass(5) wrapper that makes creating ebuilds for +# cmake-based packages much easier. +# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with out-of-source +# builds (default), in-source builds and an implementation of the well-known use_enable +# and use_with functions for CMake. + +# @ECLASS-VARIABLE: WANT_CMAKE +# @DESCRIPTION: +# Specify if cmake-utils eclass should depend on cmake optionaly or not. +# This is usefull when only part of aplication is using cmake build system. +# Valid values are: always [default], optional (where the value is the useflag +# used for optionality) +WANT_CMAKE="${WANT_CMAKE:-always}" + +# @ECLASS-VARIABLE: CMAKE_MIN_VERSION +# @DESCRIPTION: +# Specify the minimum required CMake version. Default is 2.8.4 +CMAKE_MIN_VERSION="${CMAKE_MIN_VERSION:-2.8.4}" + +# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST +# @DESCRIPTION: +# Space-separated list of CMake modules that will be removed in $S during src_prepare, +# in order to force packages to use the system version. +CMAKE_REMOVE_MODULES_LIST="${CMAKE_REMOVE_MODULES_LIST:-FindBLAS FindLAPACK}" + +# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES +# @DESCRIPTION: +# Do we want to remove anything? yes or whatever else for no +CMAKE_REMOVE_MODULES="${CMAKE_REMOVE_MODULES:-yes}" + +CMAKEDEPEND="" +case ${WANT_CMAKE} in + always) + ;; + *) + IUSE+=" ${WANT_CMAKE}" + CMAKEDEPEND+="${WANT_CMAKE}? ( " + ;; +esac +inherit toolchain-funcs multilib flag-o-matic base + +CMAKE_EXPF="src_compile src_test src_install" +case ${EAPI:-0} in + 4|3|2) CMAKE_EXPF+=" src_configure" ;; + 1|0) ;; + *) die "Unknown EAPI, Bug eclass maintainers." ;; +esac +EXPORT_FUNCTIONS ${CMAKE_EXPF} + +: ${DESCRIPTION:="Based on the ${ECLASS} eclass"} + +if [[ ${PN} != cmake ]]; then + CMAKEDEPEND+=">=dev-util/cmake-${CMAKE_MIN_VERSION}" +fi + +CMAKEDEPEND+=" userland_GNU? ( >=sys-apps/findutils-4.4.0 )" + +[[ ${WANT_CMAKE} = always ]] || CMAKEDEPEND+=" )" + +DEPEND="${CMAKEDEPEND}" +unset CMAKEDEPEND + +# Internal functions used by cmake-utils_use_* +_use_me_now() { + debug-print-function ${FUNCNAME} "$@" + + local uper capitalised x + [[ -z $2 ]] && die "cmake-utils_use-$1 []" + if [[ ! -z $3 ]]; then + # user specified the use name so use it + echo "-D$1$3=$(use $2 && echo ON || echo OFF)" + else + # use all various most used combinations + uper=$(echo ${2} | tr '[:lower:]' '[:upper:]') + capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g') + for x in $2 $uper $capitalised; do + echo "-D$1$x=$(use $2 && echo ON || echo OFF) " + done + fi +} +_use_me_now_inverted() { + debug-print-function ${FUNCNAME} "$@" + + local uper capitalised x + [[ -z $2 ]] && die "cmake-utils_use-$1 []" + if [[ ! -z $3 ]]; then + # user specified the use name so use it + echo "-D$1$3=$(use $2 && echo OFF || echo ON)" + else + # use all various most used combinations + uper=$(echo ${2} | tr '[:lower:]' '[:upper:]') + capitalised=$(echo ${2} | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g') + for x in $2 $uper $capitalised; do + echo "-D$1$x=$(use $2 && echo OFF || echo ON) " + done + fi +} + +# @ECLASS-VARIABLE: CMAKE_BUILD_DIR +# @DESCRIPTION: +# Build directory where all cmake processed files should be generated. +# For in-source build it's fixed to ${CMAKE_USE_DIR}. +# For out-of-source build it can be overriden, by default it uses +# ${WORKDIR}/${P}_build. + +# @ECLASS-VARIABLE: CMAKE_BUILD_TYPE +# @DESCRIPTION: +# Set to override default CMAKE_BUILD_TYPE. Only useful for packages +# known to make use of "if (CMAKE_BUILD_TYPE MATCHES xxx)". +# If about to be set - needs to be set before invoking cmake-utils_src_configure. +# You usualy do *NOT* want nor need to set it as it pulls CMake default build-type +# specific compiler flags overriding make.conf. +: ${CMAKE_BUILD_TYPE:=Gentoo} + +# @ECLASS-VARIABLE: CMAKE_IN_SOURCE_BUILD +# @DESCRIPTION: +# Set to enable in-source build. + +# @ECLASS-VARIABLE: CMAKE_USE_DIR +# @DESCRIPTION: +# Sets the directory where we are working with cmake. +# For example when application uses autotools and only one +# plugin needs to be done by cmake. +# By default it uses ${S}. + +# @ECLASS-VARIABLE: CMAKE_VERBOSE +# @DESCRIPTION: +# Set to enable verbose messages during compilation. + +# @ECLASS-VARIABLE: PREFIX +# @DESCRIPTION: +# Eclass respects PREFIX variable, though it's not recommended way to set +# install/lib/bin prefixes. +# Use -DCMAKE_INSTALL_PREFIX=... CMake variable instead. + +# @ECLASS-VARIABLE: CMAKE_BINARY +# @DESCRIPTION: +# Eclass can use different cmake binary than the one provided in by system. +: ${CMAKE_BINARY:=cmake} + +# Determine using IN or OUT source build +_check_build_dir() { + : ${CMAKE_USE_DIR:=${S}} + if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then + # we build in source dir + CMAKE_BUILD_DIR="${CMAKE_USE_DIR}" + else + : ${CMAKE_BUILD_DIR:=${WORKDIR}/${P}_build} + fi + echo ">>> Working in BUILD_DIR: \"$CMAKE_BUILD_DIR\"" +} +# @FUNCTION: cmake-utils_use_with +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_with. See ebuild(5). +# +# `cmake-utils_use_with foo FOO` echoes -DWITH_FOO=ON if foo is enabled +# and -DWITH_FOO=OFF if it is disabled. +cmake-utils_use_with() { _use_me_now WITH_ "$@" ; } + +# @FUNCTION: cmake-utils_use_enable +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use_enable foo FOO` echoes -DENABLE_FOO=ON if foo is enabled +# and -DENABLE_FOO=OFF if it is disabled. +cmake-utils_use_enable() { _use_me_now ENABLE_ "$@" ; } + +# @FUNCTION: cmake-utils_use_disable +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on inversion of use_enable. See ebuild(5). +# +# `cmake-utils_use_enable foo FOO` echoes -DDISABLE_FOO=OFF if foo is enabled +# and -DDISABLE_FOO=ON if it is disabled. +cmake-utils_use_disable() { _use_me_now_inverted DISABLE_ "$@" ; } + +# @FUNCTION: cmake-utils_use_no +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_disable. See ebuild(5). +# +# `cmake-utils_use_no foo FOO` echoes -DNO_FOO=OFF if foo is enabled +# and -DNO_FOO=ON if it is disabled. +cmake-utils_use_no() { _use_me_now_inverted NO_ "$@" ; } + +# @FUNCTION: cmake-utils_use_want +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use_want foo FOO` echoes -DWANT_FOO=ON if foo is enabled +# and -DWANT_FOO=OFF if it is disabled. +cmake-utils_use_want() { _use_me_now WANT_ "$@" ; } + +# @FUNCTION: cmake-utils_use_build +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use_build foo FOO` echoes -DBUILD_FOO=ON if foo is enabled +# and -DBUILD_FOO=OFF if it is disabled. +cmake-utils_use_build() { _use_me_now BUILD_ "$@" ; } + +# @FUNCTION: cmake-utils_use_has +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use_has foo FOO` echoes -DHAVE_FOO=ON if foo is enabled +# and -DHAVE_FOO=OFF if it is disabled. +cmake-utils_use_has() { _use_me_now HAVE_ "$@" ; } + +# @FUNCTION: cmake-utils_use_use +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use_use foo FOO` echoes -DUSE_FOO=ON if foo is enabled +# and -DUSE_FOO=OFF if it is disabled. +cmake-utils_use_use() { _use_me_now USE_ "$@" ; } + +# @FUNCTION: cmake-utils_use +# @USAGE: [flag name] +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake-utils_use foo FOO` echoes -DFOO=ON if foo is enabled +# and -DFOO=OFF if it is disabled. +cmake-utils_use() { _use_me_now "" "$@" ; } + +# Internal function for modifying hardcoded definitions. +# Removes dangerous definitions that override Gentoo settings. +_modify-cmakelists() { + debug-print-function ${FUNCNAME} "$@" + + # Only edit the files once + grep -qs "<<< Gentoo configuration >>>" CMakeLists.txt && return 0 + + # Comment out all set ( value) + # TODO Add QA checker - inform when variable being checked for below is set in CMakeLists.txt + find "${CMAKE_USE_DIR}" -name CMakeLists.txt \ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE.*)/{s/^/#IGNORE /g}' {} + \ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX.*)/{s/^/#IGNORE /g}' {} + \ + -exec sed -i -e '/^[[:space:]]*[sS][eE][tT][[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE.*)/{s/^/#IGNORE /g}' {} + \ + || die "${LINENO}: failed to disable hardcoded settings" + + # NOTE Append some useful summary here + cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_ + + MESSAGE(STATUS "<<< Gentoo configuration >>> + Build type \${CMAKE_BUILD_TYPE} + Install path \${CMAKE_INSTALL_PREFIX} + Compiler flags: + C \${CMAKE_C_FLAGS} + C++ \${CMAKE_CXX_FLAGS} + Linker flags: + Executable \${CMAKE_EXE_LINKER_FLAGS} + Module \${CMAKE_MODULE_LINKER_FLAGS} + Shared \${CMAKE_SHARED_LINKER_FLAGS}\n") + _EOF_ +} + +enable_cmake-utils_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + [[ "${CMAKE_REMOVE_MODULES}" == "yes" ]] && { + local name + for name in ${CMAKE_REMOVE_MODULES_LIST} ; do + find "${S}" -name ${name}.cmake -exec rm -v {} + + done + } + + _check_build_dir + + # check if CMakeLists.txt exist and if no then die + if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then + eerror "Unable to locate CMakeLists.txt under:" + eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\"" + eerror "Consider not inheriting the cmake eclass." + die "FATAL: Unable to find CMakeLists.txt" + fi + + # Remove dangerous things. + _modify-cmakelists + + # Fix xdg collision with sandbox + export XDG_CONFIG_HOME="${T}" + + # @SEE CMAKE_BUILD_TYPE + if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then + # Handle release builds + if ! has debug ${IUSE//+} || ! use debug; then + append-cppflags -DNDEBUG + fi + fi + + # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS) + local build_rules=${T}/gentoo_rules.cmake + cat > "${build_rules}" <<- _EOF_ + SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) + SET (CMAKE_C_COMPILE_OBJECT " ${CPPFLAGS} -o -c " CACHE STRING "C compile command" FORCE) + SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) + SET (CMAKE_CXX_COMPILE_OBJECT " ${CPPFLAGS} -o -c " CACHE STRING "C++ compile command" FORCE) + _EOF_ + + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= + + if [[ ${EPREFIX} ]]; then + cat >> "${build_rules}" <<- _EOF_ + # in Prefix we need rpath and must ensure cmake gets our default linker path + # right ... except for Darwin hosts + IF (NOT APPLE) + SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) + SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" + CACHE STRING "" FORCE) + + ELSE () + + SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX:-/usr}" CACHE STRING ""FORCE) + SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) + SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "" FORCE) + SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX:-/usr}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) + SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX:-/usr}/lib" CACHE STRING "" FORCE) + + ENDIF (NOT APPLE) + _EOF_ + fi + + # Common configure parameters (invariants) + local common_config=${T}/gentoo_common_config.cmake + local libdir=$(get_libdir) + cat > "${common_config}" <<- _EOF_ + SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) + SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries") + _EOF_ + [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" + + # Convert mycmakeargs to an array, for backwards compatibility + # Make the array a local variable since <=portage-2.1.6.x does not + # support global arrays (see bug #297255). + if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then + local mycmakeargs_local=(${mycmakeargs}) + else + local mycmakeargs_local=("${mycmakeargs[@]}") + fi + + # Common configure parameters (overridable) + # NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable + # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. + local cmakeargs=( + --no-warn-unused-cli + -C "${common_config}" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX:-/usr}" + "${mycmakeargs_local[@]}" + -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" + -DCMAKE_INSTALL_DO_STRIP=OFF + -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" + "${MYCMAKEARGS}" + ) + + mkdir -p "${CMAKE_BUILD_DIR}" + pushd "${CMAKE_BUILD_DIR}" > /dev/null + debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}" + echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" + "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed" + popd > /dev/null +} + +enable_cmake-utils_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + has src_configure ${CMAKE_EXPF} || cmake-utils_src_configure + cmake-utils_src_make "$@" +} + +# @FUNCTION: cmake-utils_src_make +# @DESCRIPTION: +# Function for building the package. Automatically detects the build type. +# All arguments are passed to emake. +cmake-utils_src_make() { + debug-print-function ${FUNCNAME} "$@" + + _check_build_dir + pushd "${CMAKE_BUILD_DIR}" > /dev/null + # first check if Makefile exist otherwise die + [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." + if [[ -n ${CMAKE_VERBOSE} ]]; then + emake VERBOSE=1 "$@" || die "Make failed!" + else + emake "$@" || die "Make failed!" + fi + popd > /dev/null +} + +enable_cmake-utils_src_install() { + debug-print-function ${FUNCNAME} "$@" + + _check_build_dir + pushd "${CMAKE_BUILD_DIR}" > /dev/null + base_src_install "$@" + popd > /dev/null + + # Backward compatibility, for non-array variables + if [[ -n "${DOCS}" ]] && [[ "$(declare -p DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then + dodoc ${DOCS} || die "dodoc failed" + fi + if [[ -n "${HTML_DOCS}" ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then + dohtml -r ${HTML_DOCS} || die "dohtml failed" + fi +} + +enable_cmake-utils_src_test() { + debug-print-function ${FUNCNAME} "$@" + local ctestargs + + _check_build_dir + pushd "${CMAKE_BUILD_DIR}" > /dev/null + [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; } + + [[ -n ${TEST_VERBOSE} ]] && ctestargs="--extra-verbose --output-on-failure" + + if ctest ${ctestargs} "$@" ; then + einfo "Tests succeeded." + else + if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then + # on request from Diego + eerror "Tests failed. Test log ${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log follows:" + eerror "--START TEST LOG--------------------------------------------------------------" + cat "${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log" + eerror "--END TEST LOG----------------------------------------------------------------" + die "Tests failed." + else + die "Tests failed. When you file a bug, please attach the following file: \n\t${CMAKE_BUILD_DIR}/Testing/Temporary/LastTest.log" + fi + fi + popd > /dev/null +} + +# @FUNCTION: cmake-utils_src_configure +# @DESCRIPTION: +# General function for configuring with cmake. Default behaviour is to start an +# out-of-source build. +cmake-utils_src_configure() { + _execute_optionaly "src_configure" "$@" +} + +# @FUNCTION: cmake-utils_src_compile +# @DESCRIPTION: +# General function for compiling with cmake. Default behaviour is to check for +# EAPI and respectively to configure as well or just compile. +# Automatically detects the build type. All arguments are passed to emake. +cmake-utils_src_compile() { + _execute_optionaly "src_compile" "$@" +} + +# @FUNCTION: cmake-utils_src_install +# @DESCRIPTION: +# Function for installing the package. Automatically detects the build type. +cmake-utils_src_install() { + _execute_optionaly "src_install" "$@" +} + +# @FUNCTION: cmake-utils_src_test +# @DESCRIPTION: +# Function for testing the package. Automatically detects the build type. +cmake-utils_src_test() { + _execute_optionaly "src_test" "$@" +} + +# Optionally executes phases based on WANT_CMAKE variable/USE flag. +_execute_optionaly() { + local phase="$1" ; shift + if [[ ${WANT_CMAKE} = always ]]; then + enable_cmake-utils_${phase} "$@" + else + use ${WANT_CMAKE} && enable_cmake-utils_${phase} "$@" + fi +}