cmCPackSTGZGenerator.cxx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmCPackSTGZGenerator.h"
  14. #include "cmake.h"
  15. #include "cmGlobalGenerator.h"
  16. #include "cmLocalGenerator.h"
  17. #include "cmSystemTools.h"
  18. #include "cmMakefile.h"
  19. #include "cmCPackLog.h"
  20. //----------------------------------------------------------------------
  21. cmCPackSTGZGenerator::cmCPackSTGZGenerator()
  22. {
  23. }
  24. //----------------------------------------------------------------------
  25. cmCPackSTGZGenerator::~cmCPackSTGZGenerator()
  26. {
  27. }
  28. //----------------------------------------------------------------------
  29. int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
  30. {
  31. cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl);
  32. *os
  33. << "#!/bin/sh" << std::endl
  34. << "echo \"" << this->GetOption("CPACK_PACKAGE_NAME")
  35. << " - self-extracting archive.\"" << std::endl
  36. << "echo \"If you want to stop extracting, please press <ctrl-C>.\""
  37. << std::endl
  38. << "read line" << std::endl
  39. << "echo \"Extracting... Please wait...\"" << std::endl
  40. << "echo \"\"" << std::endl
  41. << "" << std::endl
  42. << "# take the archive portion of this file and pipe it to tar"
  43. << std::endl
  44. << "# the NUMERIC parameter in this command should be one more"
  45. << std::endl
  46. << "# than the number of lines in this header file" << std::endl
  47. << "tail +18 \"$0\" | gunzip | tar xf -" << std::endl
  48. << "" << std::endl
  49. << "exit 0" << std::endl
  50. << "echo \"\"" << std::endl
  51. << "#-----------------------------------------------------------"
  52. << std::endl
  53. << "# Start of TAR.GZ file" << std::endl
  54. << "#-----------------------------------------------------------"
  55. << std::endl;
  56. return this->Superclass::GenerateHeader(os);
  57. }