cmCPackPackageMakerGenerator.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmCPackPackageMakerGenerator_h
  14. #define cmCPackPackageMakerGenerator_h
  15. #include "cmCPackGenerator.h"
  16. class cmCPackComponent;
  17. /** \class cmCPackPackageMakerGenerator
  18. * \brief A generator for PackageMaker files
  19. *
  20. * http://developer.apple.com/documentation/Darwin
  21. * /Reference/ManPages/man1/packagemaker.1.html
  22. */
  23. class cmCPackPackageMakerGenerator : public cmCPackGenerator
  24. {
  25. public:
  26. cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenerator);
  27. /**
  28. * Construct generator
  29. */
  30. cmCPackPackageMakerGenerator();
  31. virtual ~cmCPackPackageMakerGenerator();
  32. virtual bool SupportsComponentInstallation() const;
  33. protected:
  34. int CopyInstallScript(const char* resdir,
  35. const char* script,
  36. const char* name);
  37. virtual int InitializeInternal();
  38. int CompressFiles(const char* outFileName, const char* toplevel,
  39. const std::vector<std::string>& files);
  40. virtual const char* GetOutputExtension() { return ".dmg"; }
  41. virtual const char* GetOutputPostfix() { return "darwin"; }
  42. bool CopyCreateResourceFile(const char* name);
  43. bool CopyResourcePlistFile(const char* name, const char* outName = 0);
  44. // Run PackageMaker with the given command line, which will (if
  45. // successful) produce the given package file. Returns true if
  46. // PackageMaker succeeds, false otherwise.
  47. bool RunPackageMaker(const char *command, const char *packageFile);
  48. // Retrieve the name of package file that will be generated for this
  49. // component. The name is just the file name with extension, and
  50. // does not include the subdirectory.
  51. std::string GetPackageName(const cmCPackComponent& component);
  52. // Generate a package in the file packageFile for the given
  53. // component. All of the files within this component are stored in
  54. // the directory packageDir. Returns true if successful, false
  55. // otherwise.
  56. bool GenerateComponentPackage(const char *packageFile,
  57. const char *packageDir,
  58. const cmCPackComponent& component);
  59. // Writes a distribution.dist file, which turns a metapackage into a
  60. // full-fledged distribution. This file is used to describe
  61. // inter-component dependencies. metapackageFile is the name of the
  62. // metapackage for the distribution. Only valid for a
  63. // component-based install.
  64. void WriteDistributionFile(const char* metapackageFile);
  65. // Subroutine of WriteDistributionFile that writes out the
  66. // dependency attributes for inter-component dependencies.
  67. void AddDependencyAttributes(const cmCPackComponent& component,
  68. cmOStringStream& out);
  69. // Subroutine of WriteDistributionFile that writes out the
  70. // reverse dependency attributes for inter-component dependencies.
  71. void AddReverseDependencyAttributes(const cmCPackComponent& component,
  72. cmOStringStream& out);
  73. // Generates XML that encodes the hierarchy of component groups and
  74. // their components in a form that can be used by distribution
  75. // metapackages.
  76. void CreateChoiceOutline(const cmCPackComponentGroup& group,
  77. cmOStringStream& out);
  78. /// Create the "choice" XML element to describe a component group
  79. /// for the installer GUI.
  80. void CreateChoice(const cmCPackComponentGroup& group,
  81. cmOStringStream& out);
  82. /// Create the "choice" XML element to describe a component for the
  83. /// installer GUI.
  84. void CreateChoice(const cmCPackComponent& component,
  85. cmOStringStream& out);
  86. // Escape the given string to make it usable as an XML attribute
  87. // value.
  88. std::string EscapeForXML(std::string str);
  89. double PackageMakerVersion;
  90. };
  91. #endif