summaryrefslogtreecommitdiff
path: root/Source/CPack
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx103
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.h45
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx183
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.h46
-rw-r--r--Source/CPack/cmCPackGenerators.cxx23
-rw-r--r--Source/CPack/cmCPackGenericGenerator.cxx23
-rw-r--r--Source/CPack/cmCPackGenericGenerator.h6
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h2
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.h2
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTGZGenerator.h2
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.cxx39
-rw-r--r--Source/CPack/cmCPackTarBZip2Generator.h4
-rw-r--r--Source/CPack/cmCPackTarCompressGenerator.h2
-rw-r--r--Source/CPack/cmCPackZIPGenerator.h2
15 files changed, 449 insertions, 35 deletions
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
new file mode 100644
index 0000000000..7d2ffb8197
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -0,0 +1,103 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "cmCPackCygwinBinaryGenerator.h"
+
+#include "cmake.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmSystemTools.h"
+#include "cmMakefile.h"
+#include "cmGeneratedFileStream.h"
+#include "cmCPackLog.h"
+
+#include <cmsys/SystemTools.hxx>
+
+//----------------------------------------------------------------------
+cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
+{
+ this->Compress = false;
+}
+
+//----------------------------------------------------------------------
+cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinBinaryGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
+ std::vector<std::string> path;
+ std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
+ if ( pkgPath.empty() )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
+ << pkgPath.c_str()
+ << std::endl);
+
+ return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
+ packageName += "-";
+ packageName += this->GetOption("CPACK_PACKAGE_VERSION");
+ packageName = cmsys::SystemTools::LowerCase(packageName);
+ std::string manifest = "/usr/share/doc/";
+ manifest += packageName;
+ manifest += "/MANIFEST";
+ std::string manifestFile
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ // Create a MANIFEST file that contains all of the files in
+ // the tar file
+ std::string tempdir = manifestFile;
+ manifestFile += manifest;
+ // create an extra scope to force the stream
+ // to create the file before the super class is called
+ {
+ cmGeneratedFileStream ofs(manifestFile.c_str());
+ for(std::vector<std::string>::const_iterator i = files.begin();
+ i != files.end(); ++i)
+ {
+ // remove the temp dir and replace with /usr
+ ofs << (*i).substr(tempdir.size()) << "\n";
+ }
+ ofs << manifest << "\n";
+ }
+ // add the manifest file to the list of all files
+ std::vector<std::string> filesWithManifest = files;
+ filesWithManifest.push_back(manifestFile);
+ // create the bzip2 tar file
+ return this->Superclass::CompressFiles(outFileName, toplevel,
+ filesWithManifest);
+}
+
+const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
+{
+ this->OutputExtension = "-";
+ this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ this->OutputExtension += ".tar.bz2";
+ return this->OutputExtension.c_str();
+}
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h
new file mode 100644
index 0000000000..c415f3292c
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h
@@ -0,0 +1,45 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef cmCPackCygwinBinaryGenerator_h
+#define cmCPackCygwinBinaryGenerator_h
+
+#include "cmCPackTarBZip2Generator.h"
+
+/** \class cmCPackCygwinBinaryGenerator
+ * \brief A generator for TarBZip2 files
+ */
+class cmCPackCygwinBinaryGenerator : public cmCPackTarBZip2Generator
+{
+public:
+ cmCPackTypeMacro(cmCPackCygwinBinaryGenerator, cmCPackTarBZip2Generator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackCygwinBinaryGenerator();
+ virtual ~cmCPackCygwinBinaryGenerator();
+protected:
+ virtual const char* GetInstallPrefix() { return "/usr"; }
+ virtual int InitializeInternal();
+ int CompressFiles(const char* outFileName, const char* toplevel,
+ const std::vector<std::string>& files);
+ virtual const char* GetOutputExtension();
+ std::string OutputExtension;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
new file mode 100644
index 0000000000..c9062550a5
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -0,0 +1,183 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "cmCPackCygwinSourceGenerator.h"
+
+#include "cmake.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmSystemTools.h"
+#include "cmMakefile.h"
+#include "cmGeneratedFileStream.h"
+#include "cmCPackLog.h"
+
+#include <cmsys/SystemTools.hxx>
+
+// Includes needed for implementation of RenameFile. This is not in
+// system tools because it is not implemented robustly enough to move
+// files across directories.
+#ifdef _WIN32
+# include <windows.h>
+# include <sys/stat.h>
+#endif
+
+//----------------------------------------------------------------------
+cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator()
+{
+ this->Compress = false;
+}
+
+//----------------------------------------------------------------------
+cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinSourceGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
+ std::vector<std::string> path;
+ std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
+ if ( pkgPath.empty() )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
+ return 0;
+ }
+ this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
+ << pkgPath.c_str()
+ << std::endl);
+
+ return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------
+int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ // Create a tar file of the sources
+ std::string packageDirFileName
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ packageDirFileName += ".tar";
+ std::string output;
+ // skip one parent up to the cmCPackTGZGenerator to create tar file
+ this->Compress = false; // just create tar not tar.gz
+ if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(),
+ toplevel, files) )
+ {
+ return 0;
+ }
+ // Now bzip2 the source tar file
+ if(!this->BZip2File(packageDirFileName.c_str()))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: "
+ << packageDirFileName.c_str());
+ return 0;
+ }
+ // Now create a tar file that contains the above .tar.bz2 file
+ // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
+ // files
+ std::string compressOutFile = packageDirFileName + ".bz2";
+ // at this point compressOutFile is the full path to
+ // _CPack_Package/.../package-2.5.0.tar.bz2
+ // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2
+ // with these
+ // _CPack_Package/.../package-2.5.0-1.patch
+ // _CPack_Package/.../package-2.5.0-1.sh
+ // _CPack_Package/.../package-2.5.0.tar.bz2
+ // the -1 is CPACK_CYGWIN_PATCH_NUMBER
+ // copy the patch file into place
+ if(!cmSystemTools::CopyFileAlways(
+ this->GetOption("CPACK_CYGWIN_PATCH_FILE"),
+ this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "problem copying: ["
+ << this->GetOption("CPACK_CYGWIN_PATCH_FILE") << "]\nto\n["
+ << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
+ return 0;
+ }
+ // copy the build script into place
+ if(!cmSystemTools::CopyFileAlways(
+ this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"),
+ this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "problem copying: "
+ << this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT") << "\nto\n"
+ << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
+ return 0;
+ }
+ // create the tar file
+ std::string outerTarFile
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ outerTarFile += "-";
+ outerTarFile += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ outerTarFile += "-src.tar";
+ std::string buildScript = cmSystemTools::GetFilenameName(
+ this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
+ std::string patchFile = cmSystemTools::GetFilenameName(
+ this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
+ std::vector<cmStdString> outerFiles;
+ std::string file = cmSystemTools::GetFilenameName(compressOutFile);
+ std::string path = cmSystemTools::GetFilenamePath(compressOutFile);
+ // a source release in cygwin should have the build script used
+ // to build the package, the patch file that is different from the
+ // regular upstream version of the sources, and a bziped tar file
+ // of the original sources
+ outerFiles.push_back(buildScript);
+ outerFiles.push_back(patchFile);
+ outerFiles.push_back(file);
+ std::string saveDir= cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(path.c_str());
+ cmSystemTools::CreateTar(outerTarFile.c_str(),
+ outerFiles, false, false);
+ cmSystemTools::ChangeDirectory(saveDir.c_str());
+ // now compress the outer tar file
+ if(!this->BZip2File(outerTarFile.c_str()))
+ {
+ return 0;
+ }
+ compressOutFile = outerTarFile;
+ compressOutFile += ".bz2";
+ // now rename the file to its final name
+ if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
+ {
+ if ( !this->RenameFile(compressOutFile.c_str(), outFileName) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \""
+ << compressOutFile.c_str() << "\" to \""
+ << (outFileName ? outFileName : "(NULL)") << std::endl);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+const char* cmCPackCygwinSourceGenerator::GetInstallPrefix()
+{
+ this->InstallPrefix = "/";
+ this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ return this->InstallPrefix.c_str();
+}
+
+const char* cmCPackCygwinSourceGenerator::GetOutputExtension()
+{
+ this->OutputExtension = "-";
+ this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
+ this->OutputExtension += "-src.tar.bz2";
+ return this->OutputExtension.c_str();
+}
+
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h
new file mode 100644
index 0000000000..a4e4656e38
--- /dev/null
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.h
@@ -0,0 +1,46 @@
+/*=========================================================================
+
+ Program: CMake - Cross-Platform Makefile Generator
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Kitware, Inc. All rights reserved.
+ See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#ifndef cmCPackCygwinSourceGenerator_h
+#define cmCPackCygwinSourceGenerator_h
+
+#include "cmCPackTarBZip2Generator.h"
+
+/** \class cmCPackCygwinSourceGenerator
+ * \brief A generator for cygwin source files
+ */
+class cmCPackCygwinSourceGenerator : public cmCPackTarBZip2Generator
+{
+public:
+ cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTarBZip2Generator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackCygwinSourceGenerator();
+ virtual ~cmCPackCygwinSourceGenerator();
+protected:
+ const char* GetInstallPrefix();
+ virtual int InitializeInternal();
+ int CompressFiles(const char* outFileName, const char* toplevel,
+ const std::vector<std::string>& files);
+ virtual const char* GetOutputExtension();
+ std::string InstallPrefix;
+ std::string OutputExtension;
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGenerators.cxx b/Source/CPack/cmCPackGenerators.cxx
index 3515e0e58e..0cabe7cb0f 100644
--- a/Source/CPack/cmCPackGenerators.cxx
+++ b/Source/CPack/cmCPackGenerators.cxx
@@ -23,8 +23,18 @@
#include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h"
#include "cmCPackSTGZGenerator.h"
-#include "cmCPackNSISGenerator.h"
-#include "cmCPackPackageMakerGenerator.h"
+#ifdef _WIN32
+# include "cmCPackNSISGenerator.h"
+#endif
+#ifdef __APPLE__
+# include "cmCPackPackageMakerGenerator.h"
+# include "cmCPackOSXX11Generator.h"
+#endif
+
+#ifdef __CYGWIN__
+# include "cmCPackCygwinBinaryGenerator.h"
+# include "cmCPackCygwinSourceGenerator.h"
+#endif
#include "cmCPackLog.h"
@@ -39,6 +49,13 @@ cmCPackGenerators::cmCPackGenerators()
this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator);
#endif
+#ifdef __CYGWIN__
+ this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
+ cmCPackCygwinBinaryGenerator::CreateGenerator);
+ this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
+ cmCPackCygwinSourceGenerator::CreateGenerator);
+#endif
+
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator);
this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
@@ -46,7 +63,7 @@ cmCPackGenerators::cmCPackGenerators()
this->RegisterGenerator("TZ", "Tar Compress compression",
cmCPackTarCompressGenerator::CreateGenerator);
#ifdef __APPLE__
- this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker compression",
+ this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
cmCPackPackageMakerGenerator::CreateGenerator);
#endif
}
diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx
index 0102689708..213f1a26f4 100644
--- a/Source/CPack/cmCPackGenericGenerator.cxx
+++ b/Source/CPack/cmCPackGenericGenerator.cxx
@@ -74,7 +74,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
tempDirectory += "/" + outName;
- outName += ".";
outName += this->GetOutputExtension();
std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
@@ -82,7 +81,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outFile = topDirectory + "/" + outName;
std::string installPrefix = tempDirectory + this->GetInstallPrefix();
-
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
@@ -106,7 +104,8 @@ int cmCPackGenericGenerator::PrepareNames()
if ( !cmSystemTools::FileExists(descFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find description file name: " << descFileName << std::endl);
+ "Cannot find description file name: ["
+ << descFileName << "]" << std::endl);
return 0;
}
std::ifstream ifs(descFileName);
@@ -152,8 +151,11 @@ int cmCPackGenericGenerator::InstallProject()
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
this->CleanTemporaryDirectory();
- const char* tempInstallDirectory
+ std::string tempInstallDirectoryWithPostfix
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ tempInstallDirectoryWithPostfix
+ += this->GetTemporaryInstallDirectoryPostfix();
+ const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
int res = 1;
if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
{
@@ -232,6 +234,7 @@ int cmCPackGenericGenerator::InstallProject()
{
std::string fileName = tempInstallDirectory;
fileName += "/" + *it;
+ fileName += cmSystemTools::GetExecutableExtension();
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
" Strip file: " << fileName.c_str()
<< std::endl);
@@ -341,7 +344,8 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
std::vector<std::string>::iterator it;
- const char* tempDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ const char* tempDir = tempInstallDirectory;
+// this->GetOption("CPACK_TEMPORARY_DIRECTORY");
for ( it = installDirectoriesVector.begin();
it != installDirectoriesVector.end();
++it )
@@ -965,17 +969,20 @@ bool cmCPackGenericGenerator::ConfigureString(const std::string& inString,
//----------------------------------------------------------------------
bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
- const char* outName)
+ const char* outName, bool copyOnly /* = false */)
{
return this->MakefileMap->ConfigureFile(inName, outName,
- false, true, false) == 1;
+ copyOnly, true, false) == 1;
}
//----------------------------------------------------------------------
int cmCPackGenericGenerator::CleanTemporaryDirectory()
{
- const char* tempInstallDirectory
+ std::string tempInstallDirectoryWithPostfix
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ tempInstallDirectoryWithPostfix
+ += this->GetTemporaryInstallDirectoryPostfix();
+ const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
if(cmsys::SystemTools::FileExists(tempInstallDirectory))
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h
index afe79c0e2b..f01188bf8e 100644
--- a/Source/CPack/cmCPackGenericGenerator.h
+++ b/Source/CPack/cmCPackGenericGenerator.h
@@ -94,15 +94,17 @@ protected:
int PrepareNames();
int InstallProject();
int CleanTemporaryDirectory();
- virtual const char* GetOutputExtension() { return "cpack"; }
+ virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return 0; }
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetInstallPath();
virtual const char* GetInstallPrefix() { return "/"; }
+ virtual const char* GetTemporaryInstallDirectoryPostfix() { return ""; }
virtual std::string FindTemplate(const char* name);
- virtual bool ConfigureFile(const char* inName, const char* outName);
+ virtual bool ConfigureFile(const char* inName, const char* outName,
+ bool copyOnly = false);
virtual bool ConfigureString(const std::string& input, std::string& output);
virtual int InitializeInternal();
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index db3fd672e6..ff075d6597 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -41,7 +41,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "exe"; }
+ virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }
bool GetListOfSubdirectories(const char* dir,
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h
index b7881de8a4..17adb148ab 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.h
+++ b/Source/CPack/cmCPackPackageMakerGenerator.h
@@ -42,7 +42,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "dmg"; }
+ virtual const char* GetOutputExtension() { return ".dmg"; }
virtual const char* GetOutputPostfix() { return "darwin"; }
virtual const char* GetInstallPrefix() { return "/usr"; }
diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h
index 5d7ead8489..79ebf34d12 100644
--- a/Source/CPack/cmCPackSTGZGenerator.h
+++ b/Source/CPack/cmCPackSTGZGenerator.h
@@ -41,7 +41,7 @@ protected:
const std::vector<std::string>& files);
virtual int InitializeInternal();
int GenerateHeader(std::ostream* os);
- virtual const char* GetOutputExtension() { return "sh"; }
+ virtual const char* GetOutputExtension() { return ".sh"; }
};
#endif
diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h
index 4323a53c1d..67c9969088 100644
--- a/Source/CPack/cmCPackTGZGenerator.h
+++ b/Source/CPack/cmCPackTGZGenerator.h
@@ -44,7 +44,7 @@ protected:
virtual int GenerateHeader(std::ostream* os);
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.gz"; }
+ virtual const char* GetOutputExtension() { return ".tar.gz"; }
bool Compress;
};
diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx
index 17efda5856..ea3035184a 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.cxx
+++ b/Source/CPack/cmCPackTarBZip2Generator.cxx
@@ -66,27 +66,17 @@ int cmCPackTarBZip2Generator::InitializeInternal()
}
//----------------------------------------------------------------------
-int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
- const char* toplevel, const std::vector<std::string>& files)
+int cmCPackTarBZip2Generator::BZip2File(const char* packageDirFileName)
{
- std::string packageDirFileName
- = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
- packageDirFileName += ".tar";
- std::string output;
- int retVal = -1;
- if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
- toplevel, files) )
- {
- return 0;
- }
-
+ int retVal = 0;
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
+ std::string output;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
- &retVal, toplevel, this->GeneratorVerbose, 0);
+ &retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
@@ -100,6 +90,27 @@ int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
+ return 1;
+}
+
+//----------------------------------------------------------------------
+int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ std::string packageDirFileName
+ = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ packageDirFileName += ".tar";
+ std::string output;
+ if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
+ toplevel, files) )
+ {
+ return 0;
+ }
+
+ if(!this->BZip2File(packageDirFileName.c_str()))
+ {
+ return 0;
+ }
std::string compressOutFile = packageDirFileName + ".bz2";
if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h
index c5c404bb12..6f30131b83 100644
--- a/Source/CPack/cmCPackTarBZip2Generator.h
+++ b/Source/CPack/cmCPackTarBZip2Generator.h
@@ -39,8 +39,8 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.bz2"; }
-
+ virtual const char* GetOutputExtension() { return ".tar.bz2"; }
+ int BZip2File(const char* filename);
int RenameFile(const char* oldname, const char* newname);
};
diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h
index 75adb22d8a..bf2d8accbb 100644
--- a/Source/CPack/cmCPackTarCompressGenerator.h
+++ b/Source/CPack/cmCPackTarCompressGenerator.h
@@ -39,7 +39,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "tar.Z"; }
+ virtual const char* GetOutputExtension() { return ".tar.Z"; }
int RenameFile(const char* oldname, const char* newname);
int GenerateHeader(std::ostream* os);
diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h
index 640ef24949..87003607a4 100644
--- a/Source/CPack/cmCPackZIPGenerator.h
+++ b/Source/CPack/cmCPackZIPGenerator.h
@@ -48,7 +48,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
- virtual const char* GetOutputExtension() { return "zip"; }
+ virtual const char* GetOutputExtension() { return ".zip"; }
int ZipStyle;
};