2016-10-30 18:24:19 +01:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2008-10-12 18:41:06 +02:00
|
|
|
#ifndef cmCPackDebGenerator_h
|
|
|
|
#define cmCPackDebGenerator_h
|
|
|
|
|
2018-01-26 17:06:56 +01:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-10-30 18:24:19 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2008-10-12 18:41:06 +02:00
|
|
|
|
2020-02-01 23:06:01 +01:00
|
|
|
#include "cmCPackGenerator.h"
|
|
|
|
|
2008-10-12 18:41:06 +02:00
|
|
|
/** \class cmCPackDebGenerator
|
|
|
|
* \brief A generator for Debian packages
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class cmCPackDebGenerator : public cmCPackGenerator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmCPackTypeMacro(cmCPackDebGenerator, cmCPackGenerator);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct generator
|
|
|
|
*/
|
|
|
|
cmCPackDebGenerator();
|
2018-01-26 17:06:56 +01:00
|
|
|
~cmCPackDebGenerator() override;
|
2008-10-12 18:41:06 +02:00
|
|
|
|
2012-06-27 20:52:58 +03:00
|
|
|
static bool CanGenerate()
|
2016-07-09 11:21:54 +02:00
|
|
|
{
|
2012-06-27 20:52:58 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
// on MacOS enable CPackDeb iff dpkg is found
|
2012-08-04 10:26:08 +03:00
|
|
|
std::vector<std::string> locations;
|
|
|
|
locations.push_back("/sw/bin"); // Fink
|
|
|
|
locations.push_back("/opt/local/bin"); // MacPorts
|
2016-07-09 11:21:54 +02:00
|
|
|
return cmSystemTools::FindProgram("dpkg", locations) != "" ? true : false;
|
2012-06-27 20:52:58 +03:00
|
|
|
#else
|
|
|
|
// legacy behavior on other systems
|
|
|
|
return true;
|
|
|
|
#endif
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
2012-06-27 20:52:58 +03:00
|
|
|
|
2008-10-12 18:41:06 +02:00
|
|
|
protected:
|
2018-01-26 17:06:56 +01:00
|
|
|
int InitializeInternal() override;
|
2011-06-19 15:41:06 +03:00
|
|
|
/**
|
|
|
|
* This method factors out the work done in component packaging case.
|
|
|
|
*/
|
2016-07-09 11:21:54 +02:00
|
|
|
int PackageOnePack(std::string const& initialToplevel,
|
|
|
|
std::string const& packageName);
|
2011-06-19 15:41:06 +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-07-09 11:21:54 +02:00
|
|
|
int PackageComponentsAllInOne(const std::string& compInstDirName);
|
2018-01-26 17:06:56 +01:00
|
|
|
int PackageFiles() override;
|
|
|
|
const char* GetOutputExtension() override { return ".deb"; }
|
|
|
|
bool SupportsComponentInstallation() const override;
|
2016-10-30 18:24:19 +01:00
|
|
|
std::string GetComponentInstallDirNameSuffix(
|
2018-01-26 17:06:56 +01:00
|
|
|
const std::string& componentName) override;
|
2011-06-19 15:41:06 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
int createDeb();
|
2018-10-28 12:09:07 +01:00
|
|
|
int createDbgsymDDeb();
|
|
|
|
|
2011-06-19 15:41:06 +03:00
|
|
|
std::vector<std::string> packageFiles;
|
2008-10-12 18:41:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|