1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc.
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
13 #ifndef cmCPackPackageMakerGenerator_h
14 #define cmCPackPackageMakerGenerator_h
17 #include "cmCPackGenerator.h"
19 class cmCPackComponent;
21 /** \class cmCPackPackageMakerGenerator
22 * \brief A generator for PackageMaker files
24 * http://developer.apple.com/documentation/Darwin
25 * /Reference/ManPages/man1/packagemaker.1.html
27 class cmCPackPackageMakerGenerator : public cmCPackGenerator
30 cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator);
35 cmCPackPackageMakerGenerator();
36 virtual ~cmCPackPackageMakerGenerator();
38 virtual bool SupportsComponentInstallation() const;
41 int CopyInstallScript(const char* resdir,
44 virtual int InitializeInternal();
46 virtual const char* GetOutputExtension() { return ".dmg"; }
47 virtual const char* GetOutputPostfix() { return "darwin"; }
49 // Copies or creates the resource file with the given name to the
50 // package or package staging directory dirName. The variable
51 // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
52 // version of name) specifies the input file to use for this file,
53 // which will be configured via ConfigureFile.
54 bool CopyCreateResourceFile(const char* name, const char *dirName);
55 bool CopyResourcePlistFile(const char* name, const char* outName = 0);
57 // Run PackageMaker with the given command line, which will (if
58 // successful) produce the given package file. Returns true if
59 // PackageMaker succeeds, false otherwise.
60 bool RunPackageMaker(const char *command, const char *packageFile);
62 // Retrieve the name of package file that will be generated for this
63 // component. The name is just the file name with extension, and
64 // does not include the subdirectory.
65 std::string GetPackageName(const cmCPackComponent& component);
67 // Generate a package in the file packageFile for the given
68 // component. All of the files within this component are stored in
69 // the directory packageDir. Returns true if successful, false
71 bool GenerateComponentPackage(const char *packageFile,
72 const char *packageDir,
73 const cmCPackComponent& component);
75 // Writes a distribution.dist file, which turns a metapackage into a
76 // full-fledged distribution. This file is used to describe
77 // inter-component dependencies. metapackageFile is the name of the
78 // metapackage for the distribution. Only valid for a
79 // component-based install.
80 void WriteDistributionFile(const char* metapackageFile);
82 // Subroutine of WriteDistributionFile that writes out the
83 // dependency attributes for inter-component dependencies.
84 void AddDependencyAttributes(const cmCPackComponent& component,
85 std::set<const cmCPackComponent *>& visited,
86 cmOStringStream& out);
88 // Subroutine of WriteDistributionFile that writes out the
89 // reverse dependency attributes for inter-component dependencies.
91 AddReverseDependencyAttributes(const cmCPackComponent& component,
92 std::set<const cmCPackComponent *>& visited,
93 cmOStringStream& out);
95 // Generates XML that encodes the hierarchy of component groups and
96 // their components in a form that can be used by distribution
98 void CreateChoiceOutline(const cmCPackComponentGroup& group,
99 cmOStringStream& out);
101 /// Create the "choice" XML element to describe a component group
102 /// for the installer GUI.
103 void CreateChoice(const cmCPackComponentGroup& group,
104 cmOStringStream& out);
106 /// Create the "choice" XML element to describe a component for the
108 void CreateChoice(const cmCPackComponent& component,
109 cmOStringStream& out);
111 // Escape the given string to make it usable as an XML attribute
113 std::string EscapeForXML(std::string str);
115 double PackageMakerVersion;
116 double PackageCompatibilityVersion;