cmCPackRPMGenerator.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. virtual ~cmCPackRPMGenerator();
  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. virtual int InitializeInternal();
  45. virtual int PackageFiles();
  46. /**
  47. * This method factors out the work done in component packaging case.
  48. */
  49. int PackageOnePack(std::string initialToplevel, std::string packageName);
  50. /**
  51. * The method used to package files when component
  52. * install is used. This will create one
  53. * archive for each component group.
  54. */
  55. int PackageComponents(bool ignoreGroup);
  56. /**
  57. * Special case of component install where all
  58. * components will be put in a single installer.
  59. */
  60. int PackageComponentsAllInOne(const std::string& compInstDirName);
  61. virtual const char* GetOutputExtension() { return ".rpm"; }
  62. virtual bool SupportsComponentInstallation() const;
  63. virtual std::string GetComponentInstallDirNameSuffix(
  64. const std::string& componentName);
  65. void AddGeneratedPackageNames();
  66. };
  67. #endif