cmCPackDebGenerator.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmCPackDebGenerator_h
  4. #define cmCPackDebGenerator_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmCPackGenerator.h"
  7. #include <string>
  8. #include <vector>
  9. /** \class cmCPackDebGenerator
  10. * \brief A generator for Debian packages
  11. *
  12. */
  13. class cmCPackDebGenerator : public cmCPackGenerator
  14. {
  15. public:
  16. cmCPackTypeMacro(cmCPackDebGenerator, cmCPackGenerator);
  17. /**
  18. * Construct generator
  19. */
  20. cmCPackDebGenerator();
  21. ~cmCPackDebGenerator() override;
  22. static bool CanGenerate()
  23. {
  24. #ifdef __APPLE__
  25. // on MacOS enable CPackDeb iff dpkg is found
  26. std::vector<std::string> locations;
  27. locations.push_back("/sw/bin"); // Fink
  28. locations.push_back("/opt/local/bin"); // MacPorts
  29. return cmSystemTools::FindProgram("dpkg", locations) != "" ? true : false;
  30. #else
  31. // legacy behavior on other systems
  32. return true;
  33. #endif
  34. }
  35. protected:
  36. int InitializeInternal() override;
  37. /**
  38. * This method factors out the work done in component packaging case.
  39. */
  40. int PackageOnePack(std::string const& initialToplevel,
  41. std::string const& packageName);
  42. /**
  43. * The method used to package files when component
  44. * install is used. This will create one
  45. * archive for each component group.
  46. */
  47. int PackageComponents(bool ignoreGroup);
  48. /**
  49. * Special case of component install where all
  50. * components will be put in a single installer.
  51. */
  52. int PackageComponentsAllInOne(const std::string& compInstDirName);
  53. int PackageFiles() override;
  54. const char* GetOutputExtension() override { return ".deb"; }
  55. bool SupportsComponentInstallation() const override;
  56. std::string GetComponentInstallDirNameSuffix(
  57. const std::string& componentName) override;
  58. private:
  59. int createDeb();
  60. std::vector<std::string> packageFiles;
  61. };
  62. #endif