cmCPackRPMGenerator.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 cmCPackRPMGenerator_h
  11. #define cmCPackRPMGenerator_h
  12. #include "cmCPackGenerator.h"
  13. /** \class cmCPackRPMGenerator
  14. * \brief A generator for RPM packages
  15. * The idea of the CPack RPM generator is to use
  16. * as minimal C++ code as possible.
  17. * Ideally the C++ part of the CPack RPM generator
  18. * will only 'execute' (aka ->ReadListFile) several
  19. * CMake macros files.
  20. */
  21. class cmCPackRPMGenerator : public cmCPackGenerator
  22. {
  23. public:
  24. cmCPackTypeMacro(cmCPackRPMGenerator, cmCPackGenerator);
  25. /**
  26. * Construct generator
  27. */
  28. cmCPackRPMGenerator();
  29. ~cmCPackRPMGenerator() CM_OVERRIDE;
  30. static bool CanGenerate()
  31. {
  32. #ifdef __APPLE__
  33. // on MacOS enable CPackRPM iff rpmbuild is found
  34. std::vector<std::string> locations;
  35. locations.push_back("/sw/bin"); // Fink
  36. locations.push_back("/opt/local/bin"); // MacPorts
  37. return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false;
  38. #else
  39. // legacy behavior on other systems
  40. return true;
  41. #endif
  42. }
  43. protected:
  44. int InitializeInternal() CM_OVERRIDE;
  45. int PackageFiles() CM_OVERRIDE;
  46. /**
  47. * This method factors out the work done in component packaging case.
  48. */
  49. int PackageOnePack(std::string const& initialToplevel,
  50. std::string const& packageName);
  51. /**
  52. * The method used to package files when component
  53. * install is used. This will create one
  54. * archive for each component group.
  55. */
  56. int PackageComponents(bool ignoreGroup);
  57. /**
  58. * Special case of component install where all
  59. * components will be put in a single installer.
  60. */
  61. int PackageComponentsAllInOne(const std::string& compInstDirName);
  62. const char* GetOutputExtension() CM_OVERRIDE { return ".rpm"; }
  63. bool SupportsComponentInstallation() const CM_OVERRIDE;
  64. std::string GetComponentInstallDirNameSuffix(
  65. const std::string& componentName) CM_OVERRIDE;
  66. void AddGeneratedPackageNames();
  67. };
  68. #endif