2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2007-07-25 18:57:33 +04:00
|
|
|
#ifndef cmCPackDebGenerator_h
|
|
|
|
#define cmCPackDebGenerator_h
|
|
|
|
|
2016-09-07 01:21:35 +03:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2007-11-06 00:55:45 +03:00
|
|
|
#include "cmCPackGenerator.h"
|
2016-09-07 01:21:35 +03:00
|
|
|
#include "cmTypeMacro.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2007-07-25 18:57:33 +04:00
|
|
|
|
|
|
|
/** \class cmCPackDebGenerator
|
|
|
|
* \brief A generator for Debian packages
|
|
|
|
*
|
|
|
|
*/
|
2007-11-06 00:55:45 +03:00
|
|
|
class cmCPackDebGenerator : public cmCPackGenerator
|
2007-07-25 18:57:33 +04:00
|
|
|
{
|
|
|
|
public:
|
2007-11-06 00:55:45 +03:00
|
|
|
cmCPackTypeMacro(cmCPackDebGenerator, cmCPackGenerator);
|
2007-07-25 18:57:33 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct generator
|
|
|
|
*/
|
|
|
|
cmCPackDebGenerator();
|
2016-06-27 22:25:27 +03:00
|
|
|
~cmCPackDebGenerator() CM_OVERRIDE;
|
2007-07-25 18:57:33 +04:00
|
|
|
|
2012-03-30 19:07:06 +04:00
|
|
|
static bool CanGenerate()
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
2012-03-30 19:07:06 +04:00
|
|
|
#ifdef __APPLE__
|
|
|
|
// on MacOS enable CPackDeb iff dpkg is found
|
2012-07-02 21:49:07 +04:00
|
|
|
std::vector<std::string> locations;
|
2012-07-20 19:43:41 +04:00
|
|
|
locations.push_back("/sw/bin"); // Fink
|
|
|
|
locations.push_back("/opt/local/bin"); // MacPorts
|
2016-05-16 17:34:04 +03:00
|
|
|
return cmSystemTools::FindProgram("dpkg", locations) != "" ? true : false;
|
2012-03-30 19:07:06 +04:00
|
|
|
#else
|
|
|
|
// legacy behavior on other systems
|
|
|
|
return true;
|
|
|
|
#endif
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-03-30 19:07:06 +04:00
|
|
|
|
2007-07-25 18:57:33 +04:00
|
|
|
protected:
|
2016-06-27 22:25:27 +03:00
|
|
|
int InitializeInternal() CM_OVERRIDE;
|
2011-03-23 20:28:05 +03:00
|
|
|
/**
|
|
|
|
* This method factors out the work done in component packaging case.
|
|
|
|
*/
|
2016-05-26 22:58:51 +03:00
|
|
|
int PackageOnePack(std::string const& initialToplevel,
|
|
|
|
std::string const& packageName);
|
2011-03-11 10:47:15 +03:00
|
|
|
/**
|
|
|
|
* The method used to package files when component
|
|
|
|
* install is used. This will create one
|
|
|
|
* archive for each component group.
|
|
|
|
*/
|
|
|
|
int PackageComponents(bool ignoreGroup);
|
|
|
|
/**
|
|
|
|
* Special case of component install where all
|
|
|
|
* components will be put in a single installer.
|
|
|
|
*/
|
2016-05-10 19:31:05 +03:00
|
|
|
int PackageComponentsAllInOne(const std::string& compInstDirName);
|
2016-06-27 22:25:27 +03:00
|
|
|
int PackageFiles() CM_OVERRIDE;
|
|
|
|
const char* GetOutputExtension() CM_OVERRIDE { return ".deb"; }
|
|
|
|
bool SupportsComponentInstallation() const CM_OVERRIDE;
|
|
|
|
std::string GetComponentInstallDirNameSuffix(
|
|
|
|
const std::string& componentName) CM_OVERRIDE;
|
2011-03-11 10:47:15 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
int createDeb();
|
|
|
|
std::vector<std::string> packageFiles;
|
2007-07-25 18:57:33 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|