mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 19:49:51 +00:00
ENH: check in partial cygwin generator
This commit is contained in:
parent
3eec8a91fc
commit
bba61bc8a7
66
Source/CPack/bills-comments.txt
Normal file
66
Source/CPack/bills-comments.txt
Normal file
@ -0,0 +1,66 @@
|
||||
cpack.cxx
|
||||
|
||||
cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator
|
||||
- a cmCPackGenericGenerator factory
|
||||
|
||||
|
||||
cmCPackGenericGenerator::Initialize
|
||||
this->InitializeInternal
|
||||
|
||||
|
||||
// binary package run
|
||||
cmCPackGenericGenerator::ProcessGenerator // DoPackage
|
||||
cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars
|
||||
cmCPackGenericGenerator::InstallProject
|
||||
run preinstall (make preinstall/fast)
|
||||
call ReadListFile(cmake_install.cmake)
|
||||
glob recurse in install directory to get list of files
|
||||
this->CompressFiles with the list of files
|
||||
|
||||
|
||||
// source package run
|
||||
cmCPackGenericGenerator::ProcessGenerator // DoPackage
|
||||
cmCPackGenericGenerator::PrepareNames -- sets a bunch of CPACK_vars
|
||||
cmCPackGenericGenerator::InstallProject -->
|
||||
if set CPACK_INSTALLED_DIRECTORIES
|
||||
glob the files in that directory
|
||||
copy those files to the tmp install directory _CPack something
|
||||
glob recurse in install directory to get list of files
|
||||
this->CompressFiles with the list of files
|
||||
|
||||
|
||||
cmCPackGenericGenerator::InstallProject is used for both source and binary
|
||||
packages. It is controled based on values set in CPACK_ variables.
|
||||
|
||||
|
||||
InstallProject
|
||||
1. CPACK_INSTALL_COMMANDS - a list of commands used to install the package
|
||||
|
||||
2. CPACK_INSTALLED_DIRECTORIES - copy this directory to CPACK_TEMPORARY_DIRECTORY
|
||||
|
||||
3. CPACK_INSTALL_CMAKE_PROJECTS - a cmake install script
|
||||
- run make preinstall
|
||||
- run cmake_install.cmake
|
||||
- set CMAKE_INSTALL_PREFIX to the temp directory
|
||||
- CPACK_BUILD_CONFIG check this and set the BUILD_TYPE to it
|
||||
- ReadListFile on the install script cmake_install.cmake
|
||||
- run strip on the files in this var: CPACK_STRIP_FILES
|
||||
|
||||
Recommendations:
|
||||
|
||||
rename cmCPackGenerators to cmCPackGeneratorFactory
|
||||
|
||||
rename cmCPackGenericGenerator --> cmCPackGenerator
|
||||
|
||||
rename cmCPackGenericGenerator::ProcessGenerator -> cmCPackGenerator::DoPackage
|
||||
|
||||
|
||||
break up cmCPackGenerator::InstallProject so it calls the following:
|
||||
|
||||
// run user provided install commands
|
||||
cmCPackGenerator::RunInstallCommands();
|
||||
// copy entire directories that need no processing like source trees
|
||||
cmCPackGenerator::CopyPreInstalledDirectories();
|
||||
// run the cmake install scripts if provided
|
||||
cmCPackGenerator::RunCMakeInstallScripts()
|
||||
|
95
Source/CPack/cmCPackCygwinBinaryGenerator.cxx
Normal file
95
Source/CPack/cmCPackCygwinBinaryGenerator.cxx
Normal file
@ -0,0 +1,95 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: CMake - Cross-Platform Makefile Generator
|
||||
Module: $RCSfile$
|
||||
Language: C++
|
||||
Date: $Date$
|
||||
Version: $Revision$
|
||||
|
||||
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
||||
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notices for more information.
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#include "cmCPackCygwinBinaryGenerator.h"
|
||||
|
||||
#include "cmake.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmCPackLog.h"
|
||||
|
||||
#include <cmsys/SystemTools.hxx>
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator()
|
||||
{
|
||||
this->Compress = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int cmCPackCygwinBinaryGenerator::InitializeInternal()
|
||||
{
|
||||
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
|
||||
std::vector<std::string> path;
|
||||
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
|
||||
if ( pkgPath.empty() )
|
||||
{
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl);
|
||||
return 0;
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
|
||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: "
|
||||
<< pkgPath.c_str()
|
||||
<< std::endl);
|
||||
|
||||
return this->Superclass::InitializeInternal();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
|
||||
const char* toplevel, const std::vector<std::string>& files)
|
||||
{
|
||||
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
|
||||
packageName += this->GetOption("CPACK_PACKAGE_VERSION");
|
||||
packageName = cmsys::SystemTools::LowerCase(packageName);
|
||||
std::string manifest = "/share/doc/";
|
||||
manifest += packageName;
|
||||
manifest += "/MANIFEST";
|
||||
std::string manifestFile
|
||||
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
|
||||
std::string tempdir = manifestFile;
|
||||
manifestFile += manifest;
|
||||
// create an extra scope to force the stream
|
||||
// to create the file before the super class is called
|
||||
{
|
||||
cmGeneratedFileStream ofs(manifestFile.c_str());
|
||||
for(std::vector<std::string>::const_iterator i = files.begin();
|
||||
i != files.end(); ++i)
|
||||
{
|
||||
#undef cerr
|
||||
// remove the temp dir and replace with /usr
|
||||
ofs << "/usr" << (*i).substr(tempdir.size()) << "\n";
|
||||
std::cerr << "/usr" << (*i).substr(tempdir.size()) << "\n";
|
||||
|
||||
}
|
||||
ofs << "/usr" << manifest << "\n";
|
||||
}
|
||||
// Now compress up everything
|
||||
std::vector<std::string> filesWithManifest = files;
|
||||
filesWithManifest.push_back(manifestFile);
|
||||
return this->Superclass::CompressFiles(outFileName, toplevel,
|
||||
filesWithManifest);
|
||||
}
|
||||
|
44
Source/CPack/cmCPackCygwinBinaryGenerator.h
Normal file
44
Source/CPack/cmCPackCygwinBinaryGenerator.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*=========================================================================
|
||||
|
||||
Program: CMake - Cross-Platform Makefile Generator
|
||||
Module: $RCSfile$
|
||||
Language: C++
|
||||
Date: $Date$
|
||||
Version: $Revision$
|
||||
|
||||
Copyright (c) 2002 Kitware, Inc. All rights reserved.
|
||||
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. See the above copyright notices for more information.
|
||||
|
||||
=========================================================================*/
|
||||
|
||||
#ifndef cmCPackCygwinBinaryGenerator_h
|
||||
#define cmCPackCygwinBinaryGenerator_h
|
||||
|
||||
#include "cmCPackTarBZip2Generator.h"
|
||||
|
||||
/** \class cmCPackCygwinBinaryGenerator
|
||||
* \brief A generator for TarBZip2 files
|
||||
*/
|
||||
class cmCPackCygwinBinaryGenerator : public cmCPackTarBZip2Generator
|
||||
{
|
||||
public:
|
||||
cmCPackTypeMacro(cmCPackCygwinBinaryGenerator, cmCPackTarBZip2Generator);
|
||||
|
||||
/**
|
||||
* Construct generator
|
||||
*/
|
||||
cmCPackCygwinBinaryGenerator();
|
||||
virtual ~cmCPackCygwinBinaryGenerator();
|
||||
|
||||
protected:
|
||||
virtual int InitializeInternal();
|
||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||
const std::vector<std::string>& files);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -25,6 +25,7 @@
|
||||
#include "cmCPackSTGZGenerator.h"
|
||||
#include "cmCPackNSISGenerator.h"
|
||||
#include "cmCPackPackageMakerGenerator.h"
|
||||
#include "cmCPackCygwinBinaryGenerator.h"
|
||||
|
||||
#include "cmCPackLog.h"
|
||||
|
||||
@ -38,6 +39,8 @@ cmCPackGenerators::cmCPackGenerators()
|
||||
#ifdef _WIN32
|
||||
this->RegisterGenerator("NSIS", "Null Soft Installer",
|
||||
cmCPackNSISGenerator::CreateGenerator);
|
||||
// this->RegisterGenerator("Cygwin", "Cygwin Setup program",
|
||||
// cmCPackCygwinBinaryGenerator::CreateGenerator);
|
||||
#endif
|
||||
this->RegisterGenerator("ZIP", "ZIP file format",
|
||||
cmCPackZIPGenerator::CreateGenerator);
|
||||
|
@ -167,6 +167,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
ignoreFilesRegex.push_back(it->c_str());
|
||||
}
|
||||
}
|
||||
this->CleanTemporaryDirectory();
|
||||
const char* tempInstallDirectory
|
||||
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
||||
int res = 1;
|
||||
@ -189,6 +190,10 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
destDir += tempInstallDirectory;
|
||||
cmSystemTools::PutEnv(destDir.c_str());
|
||||
}
|
||||
#undef cerr
|
||||
|
||||
// If the CPackConfig file sets CPACK_INSTALL_COMMANDS then run them
|
||||
// as listed
|
||||
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
|
||||
if ( installCommands && *installCommands )
|
||||
{
|
||||
@ -199,6 +204,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
it != installCommandsVector.end();
|
||||
++it )
|
||||
{
|
||||
std::cerr << *it << "\n";
|
||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << it->c_str()
|
||||
<< std::endl);
|
||||
std::string output;
|
||||
@ -222,6 +228,10 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES
|
||||
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
|
||||
// This is used in Source packageing
|
||||
const char* installDirectories
|
||||
= this->GetOption("CPACK_INSTALLED_DIRECTORIES");
|
||||
if ( installDirectories && *installDirectories )
|
||||
@ -243,6 +253,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
it != installDirectoriesVector.end();
|
||||
++it )
|
||||
{
|
||||
std::cerr << *it << "\n";
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
|
||||
cmsys::Glob gl;
|
||||
std::string toplevel = it->c_str();
|
||||
@ -296,6 +307,9 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the project is a CMAKE project then run pre-install
|
||||
// and then read the cmake_install script to run it
|
||||
const char* cmakeProjects
|
||||
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
|
||||
const char* cmakeGenerator
|
||||
@ -321,6 +335,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
it != cmakeProjectsVector.end();
|
||||
++it )
|
||||
{
|
||||
std::cerr << *it << "\n";
|
||||
if ( it+1 == cmakeProjectsVector.end() ||
|
||||
it+2 == cmakeProjectsVector.end() ||
|
||||
it+3 == cmakeProjectsVector.end() )
|
||||
@ -430,6 +445,8 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ?????
|
||||
const char* binaryDirectories = this->GetOption("CPACK_BINARY_DIR");
|
||||
if ( binaryDirectories && !cmakeProjects )
|
||||
{
|
||||
@ -441,6 +458,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
it != binaryDirectoriesVector.end();
|
||||
++it )
|
||||
{
|
||||
std::cerr << *it << "\n";
|
||||
std::string installFile = it->c_str();
|
||||
installFile += "/cmake_install.cmake";
|
||||
cmake cm;
|
||||
@ -471,6 +489,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
cmSystemTools::PutEnv("DESTDIR=");
|
||||
}
|
||||
|
||||
std::cerr << "strip loop \n";
|
||||
const char* stripExecutable = this->GetOption("CPACK_STRIP_COMMAND");
|
||||
const char* stripFiles
|
||||
= this->GetOption("CPACK_STRIP_FILES");
|
||||
@ -485,6 +504,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||
it != stripFilesVector.end();
|
||||
++it )
|
||||
{
|
||||
std::cerr << *it << "\n";
|
||||
std::string fileName = tempInstallDirectory;
|
||||
fileName += "/" + *it;
|
||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
|
||||
@ -862,3 +882,25 @@ bool cmCPackGenericGenerator::ConfigureFile(const char* inName,
|
||||
return this->MakefileMap->ConfigureFile(inName, outName,
|
||||
false, true, false) == 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
int cmCPackGenericGenerator::CleanTemporaryDirectory()
|
||||
{
|
||||
const char* tempInstallDirectory
|
||||
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
||||
if(cmsys::SystemTools::FileExists(tempInstallDirectory))
|
||||
{
|
||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||
"- Clean temporary : "
|
||||
<< tempInstallDirectory << std::endl);
|
||||
if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory))
|
||||
{
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||
"Problem removing temporary directory: " <<
|
||||
tempInstallDirectory
|
||||
<< std::endl);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
protected:
|
||||
int PrepareNames();
|
||||
int InstallProject();
|
||||
|
||||
int CleanTemporaryDirectory();
|
||||
virtual const char* GetOutputExtension() { return "cpack"; }
|
||||
virtual const char* GetOutputPostfix() { return 0; }
|
||||
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
||||
|
69
Source/CPack/cygwin.readme
Normal file
69
Source/CPack/cygwin.readme
Normal file
@ -0,0 +1,69 @@
|
||||
http://cygwin.com/setup.html
|
||||
|
||||
|
||||
Need to produce two tar files:
|
||||
|
||||
Source-
|
||||
|
||||
- create subdirs
|
||||
- copy src
|
||||
- duplicate src
|
||||
- configure files into duplicate src
|
||||
CPack.cygwin-readme.in
|
||||
CPack.cygwin-install.sh.in
|
||||
CPack.setup.hint.in
|
||||
- diff duplicate src and orig src
|
||||
- write diff into toplevel
|
||||
- create tar file call super class
|
||||
|
||||
cmake-2.2.3-1
|
||||
|
||||
|
||||
1. a source release
|
||||
cmake-2.2.3-2-src.tar.bz2
|
||||
|
||||
cmake-2.2.3-2.patch has cmake-2.2.3/CYGWIN-PATCHES/cmake.README cmake-2.2.3/CYGWIN-PATCHES/setup.hint
|
||||
cmake-2.2.3-2.sh -> script to create cygwin release
|
||||
cmake-2.2.3.tar.bz2 -> unmodified cmake sources for 2.2.3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2 a binary release
|
||||
cmake-2.2.3-2.tar.bz2
|
||||
|
||||
normal binary release with use as the root of the tree:
|
||||
|
||||
Here is the bootstrap command used:
|
||||
|
||||
${SOURCE_DIR}/bootstrap --prefix=${PREFIX} --datadir=/share/${PKG}-${VER} \
|
||||
--docdir=/share/doc/${PKG}-${VER} --mandir=/share/man
|
||||
|
||||
CMAKE_DOC_DIR /share/doc/${PKG}-${VER}
|
||||
CMAKE_MAN_DIR /share/man
|
||||
CMAKE_DATA_DIR /share/${PKG}-${VER}
|
||||
|
||||
Here is the directory stucture:
|
||||
|
||||
usr/bin/cmake.exe
|
||||
usr/share/doc/cmake-2.2.3/MANIFEST ***
|
||||
usr/share/doc/Cygwin/cmake-2.2.3-2.README ****
|
||||
usr/share/cmake-2.2.3/Modules
|
||||
|
||||
|
||||
|
||||
usr/bin
|
||||
usr/share/cmake-2.2.3/include
|
||||
usr/share/cmake-2.2.3/Modules/Platform
|
||||
usr/share/cmake-2.2.3/Modules
|
||||
usr/share/cmake-2.2.3/Templates
|
||||
usr/share/cmake-2.2.3
|
||||
usr/share/doc/cmake-2.2.3
|
||||
usr/share/doc/Cygwin
|
||||
usr/share/doc
|
||||
usr/share/man/man1
|
||||
usr/share/man
|
||||
usr/share
|
||||
usr
|
||||
|
Loading…
Reference in New Issue
Block a user