diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-19 19:26:20 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-02-19 19:26:20 (GMT) |
commit | ee2a13b11f08efcde4ec3579763ae3236b278693 (patch) | |
tree | d723719d70a05ef8302fafa71960bda98c088407 /Source/CPack/cmCPackPackageMakerGenerator.cxx | |
parent | 4a9517a688d0bff682b538a272794000de56641d (diff) | |
download | CMake-ee2a13b11f08efcde4ec3579763ae3236b278693.zip CMake-ee2a13b11f08efcde4ec3579763ae3236b278693.tar.gz CMake-ee2a13b11f08efcde4ec3579763ae3236b278693.tar.bz2 |
ENH: install working with symlink qt tool
Diffstat (limited to 'Source/CPack/cmCPackPackageMakerGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackPackageMakerGenerator.cxx | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 1e9a3eb..a5884a9 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -38,6 +38,22 @@ cmCPackPackageMakerGenerator::~cmCPackPackageMakerGenerator() { } +int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir, + const char* script, + const char* name) +{ + std::string dst = resdir; + dst += "/"; + dst += name; + cmSystemTools::CopyFileAlways(script, dst.c_str()); + cmSystemTools::SetPermissions(dst.c_str(),0777); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + "copy script : " << script << "\ninto " << dst.c_str() << + std::endl); + + return 1; +} + //---------------------------------------------------------------------- int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, const char* toplevel, @@ -50,15 +66,51 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName, resDir += "/Resources"; std::string preflightDirName = resDir + "/PreFlight"; std::string postflightDirName = resDir + "/PostFlight"; - - if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str()) - || !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str()) ) + const char* preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT"); + const char* postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT"); + const char* postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT"); + // if preflight or postflight scripts not there create directories + // of the same name, I think this makes it work + if(!preflight) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directories: " - << preflightDirName.c_str() << " and " - << postflightDirName.c_str() << std::endl); - return 0; + if ( !cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << preflightDirName.c_str() << std::endl); + return 0; + } + } + if(!postflight) + { + if ( !cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating installer directory: " + << postflightDirName.c_str() << std::endl); + return 0; + } + } + // if preflight, postflight, or postupgrade are set + // then copy them into the resource directory and make + // them executable + if(preflight) + { + this->CopyInstallScript(resDir.c_str(), + preflight, + "preflight"); + } + if(postflight) + { + this->CopyInstallScript(resDir.c_str(), + postflight, + "postflight"); + } + if(postupgrade) + { + this->CopyInstallScript(resDir.c_str(), + postupgrade, + "postupgrade"); } if ( !this->CopyCreateResourceFile("License") |