Attached Files | 0001-Allow-deb-and-rpm-on-OSX.patch [^] (1,281 bytes) 2012-03-24 16:18 [Show Content] [Hide Content]From 8637e7f4dd8671be4ac60ae7b90c6d51ef9c9844 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tomtheengineer@gmail.com>
Date: Fri, 23 Mar 2012 19:02:41 -0700
Subject: [PATCH] Allow deb and rpm on OSX.
Both dpkg and rpm are available on Homebrew
(http://mxcl.github.com/homebrew/)
---
Source/CPack/cmCPackGeneratorFactory.cxx | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index a04b403..695cee6 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"
@@ -72,7 +72,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
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);
--
1.7.9
0001-Only-enable-RPM-generator-if-rpmbuild-exists.patch [^] (5,988 bytes) 2012-03-29 01:27 [Show Content] [Hide Content]From a862d4ce3681cead31f9065c0a0bdcd082d7f149 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tomtheengineer@gmail.com>
Date: Wed, 28 Mar 2012 22:22:35 -0700
Subject: [PATCH] Only enable RPM generator if "rpmbuild" exists.
---
Source/CPack/cmCPackGenerator.h | 2 +
Source/CPack/cmCPackGeneratorFactory.cxx | 98 +++++++++++++++++++++---------
Source/CPack/cmCPackRPMGenerator.h | 2 +
3 files changed, 74 insertions(+), 28 deletions(-)
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 55afb44..fee3070 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -62,6 +62,8 @@ public:
{ this->GeneratorVerbose = val ?
cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
+ static bool CanGenerate() { return true; }
+
/**
* Do the actual whole package processing.
* Subclass may redefine it but its usually enough
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 695cee6..dbfdbbc 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -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(__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..9292dc0 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -35,6 +35,8 @@ public:
cmCPackRPMGenerator();
virtual ~cmCPackRPMGenerator();
+ static bool CanGenerate() { return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; }
+
protected:
virtual int InitializeInternal();
virtual int PackageFiles();
--
1.7.9
0001-CPack-allow-RPM-and-DEB-generator-to-be-used-on-OSX.patch [^] (9,211 bytes) 2012-03-30 11:17 [Show Content] [Hide Content]From acdfa441b90324cefec5327a28d24ad4ee8e43ae Mon Sep 17 00:00:00 2001
From: Eric NOULARD <eric.noulard@gmail.com>
Date: Fri, 30 Mar 2012 17:07:06 +0200
Subject: [PATCH] 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.
Inspired-By Tom Hughes <tomtheengineer@gmail.com>
---
Source/CPack/cmCPackGenerator.h | 2 +
Source/CPack/cmCPackGeneratorFactory.cxx | 102 +++++++++++++++++++++---------
Source/CPack/cmCPackRPMGenerator.h | 2 +
Tests/CMakeLists.txt | 48 +++++++++++----
4 files changed, 112 insertions(+), 42 deletions(-)
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 55afb44..fee3070 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -62,6 +62,8 @@ public:
{ this->GeneratorVerbose = val ?
cmSystemTools::OUTPUT_MERGE : cmSystemTools::OUTPUT_NONE; }
+ static bool CanGenerate() { return true; }
+
/**
* Do the actual whole package processing.
* Subclass may redefine it but its usually enough
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..9292dc0 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -35,6 +35,8 @@ public:
cmCPackRPMGenerator();
virtual ~cmCPackRPMGenerator();
+ static bool CanGenerate() { return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; }
+
protected:
virtual int InitializeInternal();
virtual int PackageFiles();
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c0b7cd6..0d0f52a 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_GENNERATORS)
+ 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")
--
1.7.9.1
|