2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc.
|
2006-01-02 07:21:05 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2006-01-02 07:21:05 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2006-01-02 07:21:05 +03:00
|
|
|
|
|
|
|
#ifndef cmCPackPackageMakerGenerator_h
|
|
|
|
#define cmCPackPackageMakerGenerator_h
|
|
|
|
|
|
|
|
|
2007-11-06 00:55:45 +03:00
|
|
|
#include "cmCPackGenerator.h"
|
2006-01-02 07:21:05 +03:00
|
|
|
|
2008-06-17 19:39:26 +04:00
|
|
|
class cmCPackComponent;
|
|
|
|
|
2006-01-02 07:21:05 +03:00
|
|
|
/** \class cmCPackPackageMakerGenerator
|
|
|
|
* \brief A generator for PackageMaker files
|
|
|
|
*
|
2006-03-09 00:33:39 +03:00
|
|
|
* http://developer.apple.com/documentation/Darwin
|
|
|
|
* /Reference/ManPages/man1/packagemaker.1.html
|
2006-01-02 07:21:05 +03:00
|
|
|
*/
|
2007-11-06 00:55:45 +03:00
|
|
|
class cmCPackPackageMakerGenerator : public cmCPackGenerator
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
|
|
|
public:
|
2007-11-06 00:55:45 +03:00
|
|
|
cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator);
|
2006-01-02 07:21:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct generator
|
|
|
|
*/
|
|
|
|
cmCPackPackageMakerGenerator();
|
|
|
|
virtual ~cmCPackPackageMakerGenerator();
|
|
|
|
|
2008-06-17 19:39:26 +04:00
|
|
|
virtual bool SupportsComponentInstallation() const;
|
|
|
|
|
2006-01-02 07:21:05 +03:00
|
|
|
protected:
|
2014-02-22 04:05:55 +04:00
|
|
|
int CopyInstallScript(const std::string& resdir,
|
|
|
|
const std::string& script,
|
|
|
|
const std::string& name);
|
2006-04-15 21:02:18 +04:00
|
|
|
virtual int InitializeInternal();
|
2010-08-11 21:48:39 +04:00
|
|
|
int PackageFiles();
|
2007-02-02 22:40:26 +03:00
|
|
|
virtual const char* GetOutputExtension() { return ".dmg"; }
|
2006-01-02 07:21:05 +03:00
|
|
|
virtual const char* GetOutputPostfix() { return "darwin"; }
|
|
|
|
|
2008-06-18 15:08:33 +04:00
|
|
|
// Copies or creates the resource file with the given name to the
|
|
|
|
// package or package staging directory dirName. The variable
|
|
|
|
// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
|
|
|
|
// version of name) specifies the input file to use for this file,
|
|
|
|
// which will be configured via ConfigureFile.
|
2014-02-08 00:02:41 +04:00
|
|
|
bool CopyCreateResourceFile(const std::string& name,
|
|
|
|
const std::string& dirName);
|
2014-02-22 04:05:55 +04:00
|
|
|
bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
|
2008-06-17 19:39:26 +04:00
|
|
|
|
|
|
|
// Run PackageMaker with the given command line, which will (if
|
|
|
|
// successful) produce the given package file. Returns true if
|
|
|
|
// PackageMaker succeeds, false otherwise.
|
|
|
|
bool RunPackageMaker(const char *command, const char *packageFile);
|
|
|
|
|
|
|
|
// Retrieve the name of package file that will be generated for this
|
|
|
|
// component. The name is just the file name with extension, and
|
|
|
|
// does not include the subdirectory.
|
|
|
|
std::string GetPackageName(const cmCPackComponent& component);
|
|
|
|
|
|
|
|
// Generate a package in the file packageFile for the given
|
|
|
|
// component. All of the files within this component are stored in
|
|
|
|
// the directory packageDir. Returns true if successful, false
|
2012-08-13 21:42:58 +04:00
|
|
|
// otherwise.
|
|
|
|
bool GenerateComponentPackage(const char *packageFile,
|
2008-06-17 19:39:26 +04:00
|
|
|
const char *packageDir,
|
|
|
|
const cmCPackComponent& component);
|
|
|
|
|
|
|
|
// Writes a distribution.dist file, which turns a metapackage into a
|
|
|
|
// full-fledged distribution. This file is used to describe
|
|
|
|
// inter-component dependencies. metapackageFile is the name of the
|
|
|
|
// metapackage for the distribution. Only valid for a
|
|
|
|
// component-based install.
|
|
|
|
void WriteDistributionFile(const char* metapackageFile);
|
|
|
|
|
|
|
|
// Subroutine of WriteDistributionFile that writes out the
|
|
|
|
// dependency attributes for inter-component dependencies.
|
|
|
|
void AddDependencyAttributes(const cmCPackComponent& component,
|
2008-07-30 21:28:17 +04:00
|
|
|
std::set<const cmCPackComponent *>& visited,
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream& out);
|
2008-06-17 19:39:26 +04:00
|
|
|
|
|
|
|
// Subroutine of WriteDistributionFile that writes out the
|
|
|
|
// reverse dependency attributes for inter-component dependencies.
|
2012-08-13 21:42:58 +04:00
|
|
|
void
|
2008-07-30 21:28:17 +04:00
|
|
|
AddReverseDependencyAttributes(const cmCPackComponent& component,
|
|
|
|
std::set<const cmCPackComponent *>& visited,
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream& out);
|
2008-06-17 19:39:26 +04:00
|
|
|
|
|
|
|
// Generates XML that encodes the hierarchy of component groups and
|
|
|
|
// their components in a form that can be used by distribution
|
2012-08-13 21:42:58 +04:00
|
|
|
// metapackages.
|
2008-06-17 19:39:26 +04:00
|
|
|
void CreateChoiceOutline(const cmCPackComponentGroup& group,
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream& out);
|
2008-06-17 19:39:26 +04:00
|
|
|
|
|
|
|
/// Create the "choice" XML element to describe a component group
|
|
|
|
/// for the installer GUI.
|
|
|
|
void CreateChoice(const cmCPackComponentGroup& group,
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream& out);
|
2008-06-17 19:39:26 +04:00
|
|
|
|
|
|
|
/// Create the "choice" XML element to describe a component for the
|
|
|
|
/// installer GUI.
|
|
|
|
void CreateChoice(const cmCPackComponent& component,
|
2015-01-05 22:31:31 +03:00
|
|
|
std::ostringstream& out);
|
2006-03-03 23:04:28 +03:00
|
|
|
|
2008-06-17 19:39:26 +04:00
|
|
|
// Escape the given string to make it usable as an XML attribute
|
|
|
|
// value.
|
|
|
|
std::string EscapeForXML(std::string str);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2012-10-27 21:07:31 +04:00
|
|
|
// The PostFlight component when creating a metapackage
|
|
|
|
cmCPackComponent PostFlightComponent;
|
|
|
|
|
2007-11-05 22:34:36 +03:00
|
|
|
double PackageMakerVersion;
|
2014-12-26 20:48:53 +03:00
|
|
|
unsigned int PackageCompatibilityVersion;
|
2006-01-02 07:21:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|