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