Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CPack/cmCPackRPMGenerator.h
5000 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
9
#include "cmCPackGenerator.h"
10
11
/** \class cmCPackRPMGenerator
12
* \brief A generator for RPM packages
13
* The idea of the CPack RPM generator is to use
14
* as minimal C++ code as possible.
15
* Ideally the C++ part of the CPack RPM generator
16
* will only 'execute' (aka ->ReadListFile) several
17
* CMake macros files.
18
*/
19
class cmCPackRPMGenerator : public cmCPackGenerator
20
{
21
public:
22
cmCPackTypeMacro(cmCPackRPMGenerator, cmCPackGenerator);
23
24
/**
25
* Construct generator
26
*/
27
cmCPackRPMGenerator();
28
~cmCPackRPMGenerator() override;
29
30
static bool CanGenerate()
31
{
32
#ifdef __APPLE__
33
// on MacOS enable CPackRPM iff rpmbuild is found
34
std::vector<std::string> locations;
35
locations.emplace_back("/sw/bin"); // Fink
36
locations.emplace_back("/opt/local/bin"); // MacPorts
37
return !cmSystemTools::FindProgram("rpmbuild").empty();
38
#else
39
// legacy behavior on other systems
40
return true;
41
#endif
42
}
43
44
protected:
45
int InitializeInternal() override;
46
int PackageFiles() override;
47
/**
48
* This method factors out the work done in component packaging case.
49
*/
50
int PackageOnePack(std::string const& initialToplevel,
51
std::string const& packageName);
52
/**
53
* The method used to package files when component
54
* install is used. This will create one
55
* archive for each component group.
56
*/
57
int PackageComponents(bool ignoreGroup);
58
/**
59
* Special case of component install where all
60
* components will be put in a single installer.
61
*/
62
int PackageComponentsAllInOne(std::string const& compInstDirName);
63
char const* GetOutputExtension() override { return ".rpm"; }
64
std::string GetSanitizedDirOrFileName(std::string const& name,
65
bool isFullName = true) const override;
66
bool SupportsComponentInstallation() const override;
67
std::string GetComponentInstallSuffix(
68
std::string const& componentName) override;
69
std::string GetComponentInstallDirNameSuffix(
70
std::string const& componentName) override;
71
72
void AddGeneratedPackageNames();
73
};
74
75