ENH: add support for cygwin source and binary packaging

This commit is contained in:
Bill Hoffman 2007-02-02 14:40:26 -05:00
parent 1feb4a09b0
commit 4925e64b97
26 changed files with 247 additions and 90 deletions

View File

@ -388,9 +388,44 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake")
ENDIF(WIN32 AND NOT UNIX)
# cygwin specific packaging stuff
IF(CYGWIN)
SET(CPACK_PACKAGE_NAME cmake)
# setup the name of the package for cygwin cmake-2.4.3
SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
# the source has the same name as the binary
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
# Create a cygwin version number in case there are changes for cygwin
# that are not reflected upstream in CMake
SET(CPACK_CYGWIN_PATCH_NUMBER 1)
# if we are on cygwin and have cpack, then force the
# doc, data and man dirs to conform to cygwin style directories
SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}")
SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}")
SET(CMAKE_MAN_DIR "/share/man")
# let the user know we just forced these values
MESSAGE(STATUS "Setup for Cygwin packaging")
MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}")
MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}")
MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}")
# These files are required by the cmCPackCygwinSourceGenerator and the files
# put into the release tar files.
SET(CPACK_CYGWIN_BUILD_SCRIPT
"${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh")
SET(CPACK_CYGWIN_PATCH_FILE
"${CMake_BINARY_DIR}/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch")
# include the sub directory for cygwin releases
SUBDIRS(Utilities/Release/Cygwin)
# when packaging source make sure the .build directory is not included
SET(CPACK_SOURCE_IGNORE_FILES
"/CVS/" "/\\\\.build/" "/\\\\.svn/" "\\\\.swp$" "\\\\.#" "/#" "~$")
ENDIF(CYGWIN)
# include CPack model once all variables are set
INCLUDE(CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# configure the CTestScript.cmake file into the binary directory
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
@ONLY IMMEDIATE)

View File

@ -99,6 +99,10 @@ IF(NOT CPACK_GENERATOR)
SET(CPACK_GENERATOR "STGZ;TGZ;TZ")
ENDIF(APPLE)
SET(CPACK_SOURCE_GENERATOR "TGZ;TZ")
IF(CYGWIN)
SET(CPACK_SOURCE_GENERATOR "CygwinSource")
SET(CPACK_GENERATOR "CygwinBinary")
ENDIF(CYGWIN)
ELSE(UNIX)
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")

View File

@ -295,6 +295,8 @@ SET(CPACK_SRCS
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
CPack/cmCPackCygwinBinaryGenerator.cxx
CPack/cmCPackCygwinSourceGenerator.cxx
)
# Build CPackLib
ADD_LIBRARY(CPackLib ${CPACK_SRCS})

View File

@ -6,6 +6,7 @@ cmCPackGenerators -- creates cmCPackGenericGenerator's via NewGenerator
cmCPackGenericGenerator::Initialize
this->InitializeInternal
CPACK_INCLUDE_TOPLEVEL_DIRECTORY = 0 turns off
// binary package run
@ -64,3 +65,4 @@ break up cmCPackGenerator::InstallProject so it calls the following:
// run the cmake install scripts if provided
cmCPackGenerator::RunCMakeInstallScripts()
-

View File

@ -41,7 +41,7 @@ cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
//----------------------------------------------------------------------
int cmCPackCygwinBinaryGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
std::vector<std::string> path;
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
if ( pkgPath.empty() )
@ -62,13 +62,16 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
packageName += "-";
packageName += this->GetOption("CPACK_PACKAGE_VERSION");
packageName = cmsys::SystemTools::LowerCase(packageName);
std::string manifest = "/share/doc/";
std::string manifest = "/usr/share/doc/";
manifest += packageName;
manifest += "/MANIFEST";
std::string manifestFile
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
// Create a MANIFEST file that contains all of the files in
// the tar file
std::string tempdir = manifestFile;
manifestFile += manifest;
// create an extra scope to force the stream
@ -78,18 +81,23 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName,
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 << (*i).substr(tempdir.size()) << "\n";
}
ofs << "/usr" << manifest << "\n";
ofs << manifest << "\n";
}
// Now compress up everything
// add the manifest file to the list of all files
std::vector<std::string> filesWithManifest = files;
filesWithManifest.push_back(manifestFile);
// create the bzip2 tar file
return this->Superclass::CompressFiles(outFileName, toplevel,
filesWithManifest);
}
const char* cmCPackCygwinBinaryGenerator::GetOutputExtension()
{
this->OutputExtension = "-";
this->OutputExtension += this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
this->OutputExtension += ".tar.bz2";
return this->OutputExtension.c_str();
}

View File

@ -33,12 +33,13 @@ public:
*/
cmCPackCygwinBinaryGenerator();
virtual ~cmCPackCygwinBinaryGenerator();
protected:
virtual const char* GetInstallPrefix() { return "/usr"; }
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension();
std::string OutputExtension;
};
#endif

View File

@ -69,36 +69,29 @@ int cmCPackCygwinSourceGenerator::InitializeInternal()
int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
{
// Create a tar file of the sources
std::string packageDirFileName
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packageDirFileName += ".tar";
std::string output;
int retVal = -1;
if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(),
// skip one parent up to the cmCPackTGZGenerator to create tar file
this->Compress = false; // just create tar not tar.gz
if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(),
toplevel, files) )
{
return 0;
}
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressBZip2.log";
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 command: "
<< dmgCmd1.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
// Now bzip2 the source tar file
if(!this->BZip2File(packageDirFileName.c_str()))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: "
<< packageDirFileName.c_str());
return 0;
}
// Now create a tar file that contains the above .tar.bz2 file
// and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY
// files
std::string compressOutFile = packageDirFileName + ".bz2";
// at this point compressOutFile is the full path to
// _CPack_Package/.../package-2.5.0.tar.bz2
@ -108,7 +101,8 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
// _CPack_Package/.../package-2.5.0-1.sh
// _CPack_Package/.../package-2.5.0.tar.bz2
// the -1 is CPACK_CYGWIN_PATCH_NUMBER
if(!cmSystemTools::CopyFileIfDifferent(
// copy the patch file into place
if(!cmSystemTools::CopyFileAlways(
this->GetOption("CPACK_CYGWIN_PATCH_FILE"),
this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
{
@ -117,7 +111,8 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0;
}
if(!cmSystemTools::CopyFileIfDifferent(
// copy the build script into place
if(!cmSystemTools::CopyFileAlways(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"),
this->GetOption("CPACK_TOPLEVEL_DIRECTORY")))
{
@ -126,7 +121,7 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0;
}
// create the tar file
std::string outerTarFile
= this->GetOption("CPACK_TEMPORARY_DIRECTORY");
outerTarFile += "-";
@ -151,6 +146,7 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
cmSystemTools::CreateTar(outerTarFile.c_str(),
outerFiles, false, false);
cmSystemTools::ChangeDirectory(saveDir.c_str());
// now compress the outer tar file
if(!this->BZip2File(outerTarFile.c_str()))
{
return 0;
@ -168,7 +164,6 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
return 0;
}
}
return 1;
}

View File

@ -26,7 +26,7 @@
class cmCPackCygwinSourceGenerator : public cmCPackTarBZip2Generator
{
public:
cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTGZGenerator);
cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTarBZip2Generator);
/**
* Construct generator

View File

@ -31,6 +31,11 @@
# include "cmCPackOSXX11Generator.h"
#endif
#ifdef __CYGWIN__
# include "cmCPackCygwinBinaryGenerator.h"
# include "cmCPackCygwinSourceGenerator.h"
#endif
#include "cmCPackLog.h"
//----------------------------------------------------------------------
@ -44,6 +49,13 @@ cmCPackGenerators::cmCPackGenerators()
this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator);
#endif
#ifdef __CYGWIN__
this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
cmCPackCygwinBinaryGenerator::CreateGenerator);
this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
cmCPackCygwinSourceGenerator::CreateGenerator);
#endif
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator);
this->RegisterGenerator("TBZ2", "Tar BZip2 compression",

View File

@ -74,7 +74,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
tempDirectory += "/" + outName;
outName += ".";
outName += this->GetOutputExtension();
std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
@ -82,7 +81,6 @@ int cmCPackGenericGenerator::PrepareNames()
std::string outFile = topDirectory + "/" + outName;
std::string installPrefix = tempDirectory + this->GetInstallPrefix();
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
@ -106,7 +104,8 @@ int cmCPackGenericGenerator::PrepareNames()
if ( !cmSystemTools::FileExists(descFileName) )
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot find description file name: " << descFileName << std::endl);
"Cannot find description file name: ["
<< descFileName << "]" << std::endl);
return 0;
}
std::ifstream ifs(descFileName);
@ -235,6 +234,7 @@ int cmCPackGenericGenerator::InstallProject()
{
std::string fileName = tempInstallDirectory;
fileName += "/" + *it;
fileName += cmSystemTools::GetExecutableExtension();
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
" Strip file: " << fileName.c_str()
<< std::endl);
@ -344,7 +344,8 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
return 0;
}
std::vector<std::string>::iterator it;
const char* tempDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
const char* tempDir = tempInstallDirectory;
// this->GetOption("CPACK_TEMPORARY_DIRECTORY");
for ( it = installDirectoriesVector.begin();
it != installDirectoriesVector.end();
++it )

View File

@ -94,7 +94,7 @@ protected:
int PrepareNames();
int InstallProject();
int CleanTemporaryDirectory();
virtual const char* GetOutputExtension() { return "cpack"; }
virtual const char* GetOutputExtension() { return ".cpack"; }
virtual const char* GetOutputPostfix() { return 0; }
virtual int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);

View File

@ -41,7 +41,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "exe"; }
virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }
bool GetListOfSubdirectories(const char* dir,

View File

@ -40,7 +40,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "dmg"; }
virtual const char* GetOutputExtension() { return ".dmg"; }
virtual const char* GetInstallPrefix() { return ".app/Contents/Resources"; }
//bool CopyCreateResourceFile(const char* name, const char* dir);

View File

@ -42,7 +42,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "dmg"; }
virtual const char* GetOutputExtension() { return ".dmg"; }
virtual const char* GetOutputPostfix() { return "darwin"; }
virtual const char* GetInstallPrefix() { return "/usr"; }

View File

@ -41,7 +41,7 @@ protected:
const std::vector<std::string>& files);
virtual int InitializeInternal();
int GenerateHeader(std::ostream* os);
virtual const char* GetOutputExtension() { return "sh"; }
virtual const char* GetOutputExtension() { return ".sh"; }
};
#endif

View File

@ -44,7 +44,7 @@ protected:
virtual int GenerateHeader(std::ostream* os);
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "tar.gz"; }
virtual const char* GetOutputExtension() { return ".tar.gz"; }
bool Compress;
};

View File

@ -65,6 +65,34 @@ int cmCPackTarBZip2Generator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
//----------------------------------------------------------------------
int cmCPackTarBZip2Generator::BZip2File(const char* packageDirFileName)
{
int retVal = 0;
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
std::string output;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
&retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal )
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressBZip2.log";
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 command: "
<< dmgCmd1.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
return 1;
}
//----------------------------------------------------------------------
int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
const char* toplevel, const std::vector<std::string>& files)
@ -80,27 +108,11 @@ int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName,
return 0;
}
cmOStringStream dmgCmd1;
dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM")
<< "\" \"" << packageDirFileName
<< "\"";
retVal = -1;
int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output,
&retVal, toplevel, this->GeneratorVerbose, 0);
if ( !res || retVal )
if(!this->BZip2File(packageDirFileName.c_str()))
{
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressBZip2.log";
cmGeneratedFileStream ofs(tmpFile.c_str());
ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl
<< "# Output:" << std::endl
<< output.c_str() << std::endl;
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 command: "
<< dmgCmd1.str().c_str() << std::endl
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
return 0;
}
std::string compressOutFile = packageDirFileName + ".bz2";
if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) )
{

View File

@ -39,8 +39,8 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "tar.bz2"; }
virtual const char* GetOutputExtension() { return ".tar.bz2"; }
int BZip2File(const char* filename);
int RenameFile(const char* oldname, const char* newname);
};

View File

@ -39,7 +39,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "tar.Z"; }
virtual const char* GetOutputExtension() { return ".tar.Z"; }
int RenameFile(const char* oldname, const char* newname);
int GenerateHeader(std::ostream* os);

View File

@ -48,7 +48,7 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
virtual const char* GetOutputExtension() { return "zip"; }
virtual const char* GetOutputExtension() { return ".zip"; }
int ZipStyle;
};

View File

@ -37,8 +37,8 @@ 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
${SOURCE_DIR}/bootstrap --prefix=/usr --datadir=/share/cmake-${VER} \
--docdir=/share/doc/cmake-${VER} --mandir=/share/man
CMAKE_DOC_DIR /share/doc/${PKG}-${VER}
CMAKE_MAN_DIR /share/man

View File

@ -14,9 +14,9 @@ MESSAGE(STATUS "Using curses version: libncurses${MAX}")
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in"
"${CMake_BINARY_DIR}/setup.hint")
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in"
"${CMake_BINARY_DIR}/Docs/@CYGWIN_PACKAGE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README")
"${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README")
INSTALL_FILES(/share/doc/Cygwin FILES
${CMake_BINARY_DIR}/Docs/@CYGWIN_PACKAGE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README
${CMake_BINARY_DIR}/Docs/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.README
)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in"
${CPACK_CYGWIN_BUILD_SCRIPT})

View File

@ -16,22 +16,22 @@ Canonical download:
------------------------------------
Build instructions:
unpack @CYGWIN_SRC_PACKAGE_NAME@.tar.bz2
unpack @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2
if you use setup to install this src package, it will be
unpacked under /usr/src automatically
cd /usr/src
./@CYGWIN_PACKAGE_NAME@.sh
./@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh all
This will create:
/usr/src/@CYGWIN_PACKAGE_NAME@.tar.bz2
/usr/src/@CYGWIN_SRC_PACKAGE_NAME@.tar.bz2
/usr/src/@CPACK_PACKAGE_FILE_NAME@.tar.bz2
/usr/src/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2
-------------------------------------------
Port Notes:
The directory /usr/share/@CPACK_CYGWIN_NAME@/include is purposely not
located at /usr/include/@CPACK_CYGWIN_NAME@ or /usr/include/cmake. The
The directory /usr/share/@CPACK_PACKAGE_FILE_NAME@/include is purposely not
located at /usr/include/@CPACK_PACKAGE_FILE_NAME@ or /usr/include/cmake. The
files it contains are not meant for inclusion in any C or C++ program.
They are used for compiling dynamically loadable CMake commands inside
projects that provide them. CMake will automatically provide the

View File

@ -1,13 +1,90 @@
tdir=`pwd`
tar xvfj @CYGWIN_SRC_PACKAGE_NAME@.tar.bz2 &&
cd @CYGWIN_SRC_PACKAGE_NAME@ &&
mkdir .build &&
cd .build &&
../bootstrap --parallel=2 &&
make -j2 &&
make test &&
./bin/cpack &&
./bin/cpack --config CPackSourceConfig.cmake
TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd`
mv @CYGWIN_SRC_PACKAGE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$tdir"
mv @CYGWIN_PACKAGE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$tdir"
# create build directory
mkdirs()
{
(
mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build"
)
}
# cd into
# untar source tree and apply patch
prep()
{
(
cd "$TOP_DIR" &&
tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2
patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" &&
mkdirs
)
}
conf()
{
(
cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
../bootstrap --parallel=2
)
}
build()
{
(
cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
make -j2 &&
make test
)
}
clean()
{
(
cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
make clean
)
}
pkg()
{
(
cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
./bin/cpack &&
mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR"
)
}
spkg()
{
(
cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" &&
./bin/cpack --config CPackSourceConfig.cmake &&
mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR"
)
}
finish()
{
(
rm -rf "@CPACK_PACKAGE_FILE_NAME@"
)
}
case $1 in
prep) prep ; STATUS=$? ;;
mkdirs) mkdirs ; STATUS=$? ;;
conf) conf ; STATUS=$? ;;
build) build ; STATUS=$? ;;
clean) clean ; STATUS=$? ;;
package) pkg ; STATUS=$? ;;
pkg) pkg ; STATUS=$? ;;
src-package) spkg ; STATUS=$? ;;
spkg) spkg ; STATUS=$? ;;
finish) finish ; STATUS=$? ;;
all) (
prep && conf && build && pkg && spkg && finish ;
STATUS=$?
) ;;
*) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;;
esac
exit ${STATUS}

View File

@ -10,6 +10,7 @@ set(RELEASE_SCRIPTS
dashsgi1_release.cmake # IRIX
dashsgi1_release64.cmake # IRIX 64
vogon_release.cmake # Windows
discworld_cygwin.cmake # Cygwin
# r36n11_aix_release.cmake # AIX 5.3
r15n65_aix_release.cmake # AIX 5.2
)

View File

@ -76,8 +76,12 @@ configure_file(${SCRIPT_PATH}/release_cmake.sh.in ${SCRIPT_FILE} @ONLY)
# run the script by starting a shell on the remote machine
# then using the script file as input to the shell
remote_command("run release_cmake-${HOST}.sh on server"
"${RUN_SHELL}" ${SCRIPT_FILE})
IF(RUN_LOCAL)
message(FATAL_ERROR "run this command: ${RUN_SHELL} ${SCRIPT_FILE}")
ELSE(RUN_LOCAL)
remote_command("run release_cmake-${HOST}.sh on server"
"${RUN_SHELL}" ${SCRIPT_FILE})
ENDIF(RUN_LOCAL)
# now figure out which types of packages were created
set(generators ${CPACK_BINARY_GENERATORS} ${CPACK_SOURCE_GENERATORS})
@ -95,6 +99,9 @@ foreach(gen ${generators})
if("${gen}" STREQUAL "TBZ2")
set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
endif("${gen}" STREQUAL "TBZ2")
if("${gen}" MATCHES "Cygwin")
set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
endif("${gen}" STREQUAL "Cygwin")
if("${gen}" STREQUAL "TZ")
set(SUFFIXES ${SUFFIXES} "*.tar.Z")
endif("${gen}" STREQUAL "TZ")