CMake/Source/CPack/cmCPackPKGGenerator.h
Brad King 86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00

87 lines
3.2 KiB
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCPackPKGGenerator_h
#define cmCPackPKGGenerator_h
#include "cmCPackGenerator.h"
class cmCPackComponent;
class cmXMLWriter;
/** \class cmCPackPKGGenerator
* \brief A generator for pkg files
*
*/
class cmCPackPKGGenerator : public cmCPackGenerator
{
public:
cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
/**
* Construct generator
*/
cmCPackPKGGenerator();
virtual ~cmCPackPKGGenerator();
bool SupportsComponentInstallation() const CM_OVERRIDE;
protected:
int InitializeInternal() CM_OVERRIDE;
const char* GetOutputPostfix() CM_OVERRIDE { return "darwin"; }
// 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.
bool CopyCreateResourceFile(const std::string& name,
const std::string& dirName);
bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
int CopyInstallScript(const std::string& resdir, const std::string& script,
const std::string& name);
// 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);
// 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,
std::set<const cmCPackComponent*>& visited,
std::ostringstream& out);
// Subroutine of WriteDistributionFile that writes out the
// reverse dependency attributes for inter-component dependencies.
void AddReverseDependencyAttributes(
const cmCPackComponent& component,
std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
// Generates XML that encodes the hierarchy of component groups and
// their components in a form that can be used by distribution
// metapackages.
void CreateChoiceOutline(const cmCPackComponentGroup& group,
cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component group
/// for the installer GUI.
void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
/// Create the "choice" XML element to describe a component for the
/// installer GUI.
void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
// The PostFlight component when creating a metapackage
cmCPackComponent PostFlightComponent;
};
#endif