cmCPackDebGenerator.h 1.9 KB

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