diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6360152..6bac8374d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 913d8740d..50c55a7cf 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -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") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 9595fbd5d..8182372a0 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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}) diff --git a/Source/CPack/bills-comments.txt b/Source/CPack/bills-comments.txt index 9838c47fc..13cb6abcd 100644 --- a/Source/CPack/bills-comments.txt +++ b/Source/CPack/bills-comments.txt @@ -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() +- diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index c31de150e..7d2ffb819 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -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 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& 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::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 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(); +} diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h index add206a38..c415f3292 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.h +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h @@ -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& files); - + virtual const char* GetOutputExtension(); + std::string OutputExtension; }; #endif diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 74b745b34..ce70311bb 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -69,36 +69,29 @@ int cmCPackCygwinSourceGenerator::InitializeInternal() int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, const char* toplevel, const std::vector& 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; } diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h index 8d972885a..a4e4656e3 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.h +++ b/Source/CPack/cmCPackCygwinSourceGenerator.h @@ -26,7 +26,7 @@ class cmCPackCygwinSourceGenerator : public cmCPackTarBZip2Generator { public: - cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTGZGenerator); + cmCPackTypeMacro(cmCPackCygwinSourceGenerator, cmCPackTarBZip2Generator); /** * Construct generator diff --git a/Source/CPack/cmCPackGenerators.cxx b/Source/CPack/cmCPackGenerators.cxx index 4d0dc6839..e94fb337a 100644 --- a/Source/CPack/cmCPackGenerators.cxx +++ b/Source/CPack/cmCPackGenerators.cxx @@ -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", diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index 3e5c0c508..a491064ec 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -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::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 ) diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h index 6ff9cda43..f01188bf8 100644 --- a/Source/CPack/cmCPackGenericGenerator.h +++ b/Source/CPack/cmCPackGenericGenerator.h @@ -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& files); diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index db3fd672e..ff075d659 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -41,7 +41,7 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files); - virtual const char* GetOutputExtension() { return "exe"; } + virtual const char* GetOutputExtension() { return ".exe"; } virtual const char* GetOutputPostfix() { return "win32"; } bool GetListOfSubdirectories(const char* dir, diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 8720e79b4..caa454b08 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -40,7 +40,7 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& 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); diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index b7881de8a..17adb148a 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -42,7 +42,7 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& 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"; } diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 5d7ead848..79ebf34d1 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -41,7 +41,7 @@ protected: const std::vector& files); virtual int InitializeInternal(); int GenerateHeader(std::ostream* os); - virtual const char* GetOutputExtension() { return "sh"; } + virtual const char* GetOutputExtension() { return ".sh"; } }; #endif diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index 4323a53c1..67c996908 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -44,7 +44,7 @@ protected: virtual int GenerateHeader(std::ostream* os); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files); - virtual const char* GetOutputExtension() { return "tar.gz"; } + virtual const char* GetOutputExtension() { return ".tar.gz"; } bool Compress; }; diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 17efda585..7a52afd70 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -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& 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 ) ) { diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index c5c404bb1..6f30131b8 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -39,8 +39,8 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& 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); }; diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 75adb22d8..bf2d8accb 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -39,7 +39,7 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& 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); diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 640ef2494..87003607a 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -48,7 +48,7 @@ protected: virtual int InitializeInternal(); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files); - virtual const char* GetOutputExtension() { return "zip"; } + virtual const char* GetOutputExtension() { return ".zip"; } int ZipStyle; }; diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme index 0f33a4150..88922d3e6 100644 --- a/Source/CPack/cygwin.readme +++ b/Source/CPack/cygwin.readme @@ -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 diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt index 24f529b5c..0c274f3b0 100644 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ b/Utilities/Release/Cygwin/CMakeLists.txt @@ -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}) diff --git a/Utilities/Release/Cygwin/README.cygwin.in b/Utilities/Release/Cygwin/README.cygwin.in index 10a253bb0..6c42a4c20 100644 --- a/Utilities/Release/Cygwin/README.cygwin.in +++ b/Utilities/Release/Cygwin/README.cygwin.in @@ -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 diff --git a/Utilities/Release/Cygwin/cygwin-package.sh.in b/Utilities/Release/Cygwin/cygwin-package.sh.in index 0ce7b7e28..9730b3332 100755 --- a/Utilities/Release/Cygwin/cygwin-package.sh.in +++ b/Utilities/Release/Cygwin/cygwin-package.sh.in @@ -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} diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index b5479512e..9307f5aac 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -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 ) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 005836ad7..42b294283 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -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")