cmCPackPKGGenerator.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc.
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCPackPKGGenerator_h
  11. #define cmCPackPKGGenerator_h
  12. #include "cmCPackGenerator.h"
  13. class cmCPackComponent;
  14. class cmXMLWriter;
  15. /** \class cmCPackPKGGenerator
  16. * \brief A generator for pkg files
  17. *
  18. */
  19. class cmCPackPKGGenerator : public cmCPackGenerator
  20. {
  21. public:
  22. cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
  23. /**
  24. * Construct generator
  25. */
  26. cmCPackPKGGenerator();
  27. virtual ~cmCPackPKGGenerator();
  28. virtual bool SupportsComponentInstallation() const;
  29. protected:
  30. virtual int InitializeInternal();
  31. virtual const char* GetOutputPostfix() { return "darwin"; }
  32. // Copies or creates the resource file with the given name to the
  33. // package or package staging directory dirName. The variable
  34. // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
  35. // version of name) specifies the input file to use for this file,
  36. // which will be configured via ConfigureFile.
  37. bool CopyCreateResourceFile(const std::string& name,
  38. const std::string& dirName);
  39. bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
  40. int CopyInstallScript(const std::string& resdir, const std::string& script,
  41. const std::string& name);
  42. // Retrieve the name of package file that will be generated for this
  43. // component. The name is just the file name with extension, and
  44. // does not include the subdirectory.
  45. std::string GetPackageName(const cmCPackComponent& component);
  46. // Writes a distribution.dist file, which turns a metapackage into a
  47. // full-fledged distribution. This file is used to describe
  48. // inter-component dependencies. metapackageFile is the name of the
  49. // metapackage for the distribution. Only valid for a
  50. // component-based install.
  51. void WriteDistributionFile(const char* metapackageFile);
  52. // Subroutine of WriteDistributionFile that writes out the
  53. // dependency attributes for inter-component dependencies.
  54. void AddDependencyAttributes(const cmCPackComponent& component,
  55. std::set<const cmCPackComponent*>& visited,
  56. std::ostringstream& out);
  57. // Subroutine of WriteDistributionFile that writes out the
  58. // reverse dependency attributes for inter-component dependencies.
  59. void AddReverseDependencyAttributes(
  60. const cmCPackComponent& component,
  61. std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
  62. // Generates XML that encodes the hierarchy of component groups and
  63. // their components in a form that can be used by distribution
  64. // metapackages.
  65. void CreateChoiceOutline(const cmCPackComponentGroup& group,
  66. cmXMLWriter& xout);
  67. /// Create the "choice" XML element to describe a component group
  68. /// for the installer GUI.
  69. void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
  70. /// Create the "choice" XML element to describe a component for the
  71. /// installer GUI.
  72. void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
  73. // The PostFlight component when creating a metapackage
  74. cmCPackComponent PostFlightComponent;
  75. };
  76. #endif