cmake/Source/CPack/cmCPackRPMGenerator.h

73 lines
2.1 KiB
C
Raw Normal View History

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. */
#ifndef cmCPackRPMGenerator_h
#define cmCPackRPMGenerator_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include "cmCPackGenerator.h"
2016-10-30 18:24:19 +01:00
#include <string>
/** \class cmCPackRPMGenerator
* \brief A generator for RPM packages
* The idea of the CPack RPM generator is to use
* as minimal C++ code as possible.
* Ideally the C++ part of the CPack RPM generator
* will only 'execute' (aka ->ReadListFile) several
* CMake macros files.
*/
class cmCPackRPMGenerator : public cmCPackGenerator
{
public:
cmCPackTypeMacro(cmCPackRPMGenerator, cmCPackGenerator);
/**
* Construct generator
*/
cmCPackRPMGenerator();
2018-01-26 17:06:56 +01:00
~cmCPackRPMGenerator() override;
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 CPackRPM iff rpmbuild 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
2012-06-27 20:52:58 +03:00
return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false;
#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
protected:
2018-01-26 17:06:56 +01:00
int InitializeInternal() override;
int PackageFiles() 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
const char* GetOutputExtension() override { return ".rpm"; }
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;
2016-07-09 11:21:54 +02:00
void AddGeneratedPackageNames();
};
#endif