Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CPack / cmCPackPackageMakerGenerator.h
blob233025e045870f94fdb0525af9998d51581d4f7c
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackPackageMakerGenerator.h,v $
5 Language: C++
6 Date: $Date: 2008-07-30 17:28:17 $
7 Version: $Revision: 1.16 $
9 Copyright (c) 2002 Kitware, Inc. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef cmCPackPackageMakerGenerator_h
19 #define cmCPackPackageMakerGenerator_h
22 #include "cmCPackGenerator.h"
24 class cmCPackComponent;
26 /** \class cmCPackPackageMakerGenerator
27 * \brief A generator for PackageMaker files
29 * http://developer.apple.com/documentation/Darwin
30 * /Reference/ManPages/man1/packagemaker.1.html
32 class cmCPackPackageMakerGenerator : public cmCPackGenerator
34 public:
35 cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator);
37 /**
38 * Construct generator
40 cmCPackPackageMakerGenerator();
41 virtual ~cmCPackPackageMakerGenerator();
43 virtual bool SupportsComponentInstallation() const;
45 protected:
46 int CopyInstallScript(const char* resdir,
47 const char* script,
48 const char* name);
49 virtual int InitializeInternal();
50 int CompressFiles(const char* outFileName, const char* toplevel,
51 const std::vector<std::string>& files);
52 virtual const char* GetOutputExtension() { return ".dmg"; }
53 virtual const char* GetOutputPostfix() { return "darwin"; }
55 // Copies or creates the resource file with the given name to the
56 // package or package staging directory dirName. The variable
57 // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
58 // version of name) specifies the input file to use for this file,
59 // which will be configured via ConfigureFile.
60 bool CopyCreateResourceFile(const char* name, const char *dirName);
61 bool CopyResourcePlistFile(const char* name, const char* outName = 0);
63 // Run PackageMaker with the given command line, which will (if
64 // successful) produce the given package file. Returns true if
65 // PackageMaker succeeds, false otherwise.
66 bool RunPackageMaker(const char *command, const char *packageFile);
68 // Retrieve the name of package file that will be generated for this
69 // component. The name is just the file name with extension, and
70 // does not include the subdirectory.
71 std::string GetPackageName(const cmCPackComponent& component);
73 // Generate a package in the file packageFile for the given
74 // component. All of the files within this component are stored in
75 // the directory packageDir. Returns true if successful, false
76 // otherwise.
77 bool GenerateComponentPackage(const char *packageFile,
78 const char *packageDir,
79 const cmCPackComponent& component);
81 // Writes a distribution.dist file, which turns a metapackage into a
82 // full-fledged distribution. This file is used to describe
83 // inter-component dependencies. metapackageFile is the name of the
84 // metapackage for the distribution. Only valid for a
85 // component-based install.
86 void WriteDistributionFile(const char* metapackageFile);
88 // Subroutine of WriteDistributionFile that writes out the
89 // dependency attributes for inter-component dependencies.
90 void AddDependencyAttributes(const cmCPackComponent& component,
91 std::set<const cmCPackComponent *>& visited,
92 cmOStringStream& out);
94 // Subroutine of WriteDistributionFile that writes out the
95 // reverse dependency attributes for inter-component dependencies.
96 void
97 AddReverseDependencyAttributes(const cmCPackComponent& component,
98 std::set<const cmCPackComponent *>& visited,
99 cmOStringStream& out);
101 // Generates XML that encodes the hierarchy of component groups and
102 // their components in a form that can be used by distribution
103 // metapackages.
104 void CreateChoiceOutline(const cmCPackComponentGroup& group,
105 cmOStringStream& out);
107 /// Create the "choice" XML element to describe a component group
108 /// for the installer GUI.
109 void CreateChoice(const cmCPackComponentGroup& group,
110 cmOStringStream& out);
112 /// Create the "choice" XML element to describe a component for the
113 /// installer GUI.
114 void CreateChoice(const cmCPackComponent& component,
115 cmOStringStream& out);
117 // Escape the given string to make it usable as an XML attribute
118 // value.
119 std::string EscapeForXML(std::string str);
121 double PackageMakerVersion;
122 double PackageCompatibilityVersion;
125 #endif