This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 8bf185c42eafb51321a9bdb6c0c2720eaebe20b8 (commit) via 2a34b579381cd73a18553c331d91b99a42292367 (commit) from ba60beb24288eae6a3dcd9424457a8a20abbd8d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8bf185c42eafb51321a9bdb6c0c2720eaebe20b8 commit 8bf185c42eafb51321a9bdb6c0c2720eaebe20b8 Merge: ba60beb 2a34b57 Author: Eric Noulard <eric.noul...@gmail.com> AuthorDate: Sun May 20 16:07:40 2012 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Sun May 20 16:07:40 2012 -0400 Merge topic 'CPack-activateRPM-DEB-onMacOS' into next 2a34b57 CPack allow RPM and DEB generator to be used on OSX. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2a34b579381cd73a18553c331d91b99a42292367 commit 2a34b579381cd73a18553c331d91b99a42292367 Author: Eric NOULARD <eric.noul...@gmail.com> AuthorDate: Fri Mar 30 17:07:06 2012 +0200 Commit: Eric NOULARD <eric.noul...@gmail.com> CommitDate: Sun May 20 22:04:32 2012 +0200 CPack allow RPM and DEB generator to be used on OSX. More generally add the check for possible generator "activation" at runtime depending on a generator specific check. The dynamic behavior is currently implemented only for MacOS and should be fully backward compatible for other system. Inspired-By Tom Hughes <tomtheengin...@gmail.com> diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index f536c47..7f2352f 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -31,6 +31,17 @@ public: cmCPackDebGenerator(); virtual ~cmCPackDebGenerator(); + static bool CanGenerate() + { +#ifdef __APPLE__ + // on MacOS enable CPackDeb iff dpkg is found + return cmSystemTools::FindProgram("dpkg") != "" ? true : false; +#else + // legacy behavior on other systems + return true; +#endif + } + protected: virtual int InitializeInternal(); /** diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 55afb44..78d2e24 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -63,6 +63,16 @@ public: cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; } /** + * Returns true if the generator may work on this system. + * Rational: + * Some CPack generator may run on some host and may not on others + * (with the same system) because some tools are missing. If the tool + * is missing then CPack won't activate (in the CPackGeneratorFactory) + * this particular generator. + */ + static bool CanGenerate() { return true; } + + /** * Do the actual whole package processing. * Subclass may redefine it but its usually enough * to redefine @ref PackageFiles, because in fact diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index a04b403..dbfdbbc 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -31,7 +31,7 @@ # include "cmCPackCygwinSourceGenerator.h" #endif -#if !defined(_WIN32) && !defined(__APPLE__) \ +#if !defined(_WIN32) \ && !defined(__QNXNTO__) && !defined(__BEOS__) # include "cmCPackDebGenerator.h" # include "cmCPackRPMGenerator.h" @@ -43,41 +43,83 @@ //---------------------------------------------------------------------- cmCPackGeneratorFactory::cmCPackGeneratorFactory() { - this->RegisterGenerator("TGZ", "Tar GZip compression", - cmCPackTGZGenerator::CreateGenerator); - this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", - cmCPackSTGZGenerator::CreateGenerator); - this->RegisterGenerator("NSIS", "Null Soft Installer", - cmCPackNSISGenerator::CreateGenerator); + if (cmCPackTGZGenerator::CanGenerate()) + { + this->RegisterGenerator("TGZ", "Tar GZip compression", + cmCPackTGZGenerator::CreateGenerator); + } + if (cmCPackSTGZGenerator::CanGenerate()) + { + this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", + cmCPackSTGZGenerator::CreateGenerator); + } + if (cmCPackNSISGenerator::CanGenerate()) + { + this->RegisterGenerator("NSIS", "Null Soft Installer", + cmCPackNSISGenerator::CreateGenerator); + } #ifdef __CYGWIN__ - this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer", - cmCPackCygwinBinaryGenerator::CreateGenerator); - this->RegisterGenerator("CygwinSource", "Cygwin Source Installer", - cmCPackCygwinSourceGenerator::CreateGenerator); + if (cmCPackCygwinBinaryGenerator::CanGenerate()) + { + this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer", + cmCPackCygwinBinaryGenerator::CreateGenerator); + } + if (cmCPackCygwinSourceGenerator::CanGenerate()) + { + this->RegisterGenerator("CygwinSource", "Cygwin Source Installer", + cmCPackCygwinSourceGenerator::CreateGenerator); + } #endif - this->RegisterGenerator("ZIP", "ZIP file format", - cmCPackZIPGenerator::CreateGenerator); - this->RegisterGenerator("TBZ2", "Tar BZip2 compression", - cmCPackTarBZip2Generator::CreateGenerator); - this->RegisterGenerator("TZ", "Tar Compress compression", - cmCPackTarCompressGenerator::CreateGenerator); + if (cmCPackZIPGenerator::CanGenerate()) + { + this->RegisterGenerator("ZIP", "ZIP file format", + cmCPackZIPGenerator::CreateGenerator); + } + if (cmCPackTarBZip2Generator::CanGenerate()) + { + this->RegisterGenerator("TBZ2", "Tar BZip2 compression", + cmCPackTarBZip2Generator::CreateGenerator); + } + if (cmCPackTarCompressGenerator::CanGenerate()) + { + this->RegisterGenerator("TZ", "Tar Compress compression", + cmCPackTarCompressGenerator::CreateGenerator); + } #ifdef __APPLE__ - this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", - cmCPackDragNDropGenerator::CreateGenerator); - this->RegisterGenerator("Bundle", "Mac OSX bundle", - cmCPackBundleGenerator::CreateGenerator); - this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", - cmCPackPackageMakerGenerator::CreateGenerator); - this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle", - cmCPackOSXX11Generator::CreateGenerator); + if (cmCPackDragNDropGenerator::CanGenerate()) + { + this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", + cmCPackDragNDropGenerator::CreateGenerator); + } + if (cmCPackBundleGenerator::CanGenerate()) + { + this->RegisterGenerator("Bundle", "Mac OSX bundle", + cmCPackBundleGenerator::CreateGenerator); + } + if (cmCPackPackageMakerGenerator::CanGenerate()) + { + this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", + cmCPackPackageMakerGenerator::CreateGenerator); + } + if (cmCPackOSXX11Generator::CanGenerate()) + { + this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle", + cmCPackOSXX11Generator::CreateGenerator); + } #endif -#if !defined(_WIN32) && !defined(__APPLE__) \ +#if !defined(_WIN32) \ && !defined(__QNXNTO__) && !defined(__BEOS__) - this->RegisterGenerator("DEB", "Debian packages", - cmCPackDebGenerator::CreateGenerator); - this->RegisterGenerator("RPM", "RPM packages", - cmCPackRPMGenerator::CreateGenerator); + if (cmCPackDebGenerator::CanGenerate()) + { + this->RegisterGenerator("DEB", "Debian packages", + cmCPackDebGenerator::CreateGenerator); + } + if (cmCPackRPMGenerator::CanGenerate()) + { + this->RegisterGenerator("RPM", "RPM packages", + cmCPackRPMGenerator::CreateGenerator); + } #endif } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 4883a0d..eec8204 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -35,6 +35,17 @@ public: cmCPackRPMGenerator(); virtual ~cmCPackRPMGenerator(); + static bool CanGenerate() + { +#ifdef __APPLE__ + // on MacOS enable CPackRPM iff rpmbuild is found + return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; +#else + // legacy behavior on other systems + return true; +#endif + } + protected: virtual int InitializeInternal(); virtual int PackageFiles(); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c0b7cd6..7ce4c2e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -699,6 +699,31 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF(CTEST_RUN_CPackComponents) IF(CTEST_RUN_CPackComponentsForAll) + # Analyze 'cpack --help' output for list of available generators: + execute_process(COMMAND ${CMAKE_CPACK_COMMAND} --help + RESULT_VARIABLE result + OUTPUT_VARIABLE stdout + ERROR_VARIABLE stderr) + + string(REPLACE ";" "\\;" stdout "${stdout}") + string(REPLACE "\n" "E;" stdout "${stdout}") + + set(collecting 0) + set(ACTIVE_CPACK_GENERATORS) + foreach(eline ${stdout}) + string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}") + if(collecting AND NOT line STREQUAL "") + string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\1" gen "${line}") + string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\2" doc "${line}") + list(APPEND ACTIVE_CPACK_GENERATORS ${gen}) + endif() + if(line STREQUAL "Generators") + set(collecting 1) + endif() + endforeach() + # ACTIVE_CPACK_GENERATORS variable + # now contains the list of 'active generators' + set(CPackComponentsForAll_EXTRA_OPTIONS) set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") # set up list of CPack generators @@ -706,18 +731,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(APPLE) list(APPEND GENLST "DragNDrop") endif(APPLE) - if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") - find_program(RPMBUILD NAMES rpmbuild) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") - if (RPMBUILD) - list(APPEND GENLST "RPM") - endif(RPMBUILD) - if (CMAKE_SYSTEM_NAME MATCHES "Linux") - find_program(DPKG NAMES dpkg) - if (DPKG) - list(APPEND GENLST "DEB") - endif(DPKG) - endif(CMAKE_SYSTEM_NAME MATCHES "Linux") + if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) + if (NOT ${RPM_ACTIVE} EQUAL -1) + list(APPEND GENLST "RPM") + endif(NOT ${RPM_ACTIVE} EQUAL -1) + endif(NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + list(FIND ACTIVE_CPACK_GENERATORS "DEB" DEB_ACTIVE) + if (NOT ${DEB_ACTIVE} EQUAL -1) + list(APPEND GENLST "DEB") + endif(NOT ${DEB_ACTIVE} EQUAL -1) + # set up list of component packaging ways list(APPEND CWAYLST "default") list(APPEND CWAYLST "OnePackPerGroup") ----------------------------------------------------------------------- Summary of changes: Source/CPack/cmCPackDebGenerator.h | 11 +++ Source/CPack/cmCPackGenerator.h | 10 +++ Source/CPack/cmCPackGeneratorFactory.cxx | 102 +++++++++++++++++++++--------- Source/CPack/cmCPackRPMGenerator.h | 11 +++ Tests/CMakeLists.txt | 48 +++++++++++---- 5 files changed, 140 insertions(+), 42 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits