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-08-08 19:33:42 +04:00
|
|
|
#ifndef cmCPackRPMGenerator_h
|
|
|
|
#define cmCPackRPMGenerator_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>
|
2007-08-08 19:33:42 +04:00
|
|
|
|
|
|
|
/** \class cmCPackRPMGenerator
|
|
|
|
* \brief A generator for RPM packages
|
2007-08-17 17:13:15 +04:00
|
|
|
* 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.
|
2007-08-08 19:33:42 +04:00
|
|
|
*/
|
2007-11-06 00:55:45 +03:00
|
|
|
class cmCPackRPMGenerator : public cmCPackGenerator
|
2007-08-08 19:33:42 +04:00
|
|
|
{
|
|
|
|
public:
|
2007-11-06 00:55:45 +03:00
|
|
|
cmCPackTypeMacro(cmCPackRPMGenerator, cmCPackGenerator);
|
2007-08-08 19:33:42 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct generator
|
|
|
|
*/
|
|
|
|
cmCPackRPMGenerator();
|
2016-06-27 22:25:27 +03:00
|
|
|
~cmCPackRPMGenerator() CM_OVERRIDE;
|
2007-08-08 19:33:42 +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 CPackRPM iff rpmbuild 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
|
2012-03-30 19:07:06 +04:00
|
|
|
return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false;
|
|
|
|
#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-08-08 19:33:42 +04:00
|
|
|
protected:
|
2016-06-27 22:25:27 +03:00
|
|
|
int InitializeInternal() CM_OVERRIDE;
|
|
|
|
int PackageFiles() 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-02-06 23:23:10 +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-15 04:01:34 +03:00
|
|
|
int PackageComponentsAllInOne(const std::string& compInstDirName);
|
2016-06-27 22:25:27 +03:00
|
|
|
const char* GetOutputExtension() CM_OVERRIDE { return ".rpm"; }
|
|
|
|
bool SupportsComponentInstallation() const CM_OVERRIDE;
|
|
|
|
std::string GetComponentInstallDirNameSuffix(
|
|
|
|
const std::string& componentName) CM_OVERRIDE;
|
2007-08-08 19:33:42 +04:00
|
|
|
|
2016-05-15 04:01:34 +03:00
|
|
|
void AddGeneratedPackageNames();
|
2007-08-08 19:33:42 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|