cmCPackDebGenerator.h 2.2 KB

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