Kaynağa Gözat

CPack: Remove undocumented deprecated OSXX11 generator

This CPack generator was never documented, and has been deprecated since
commit 2ed00e8ef8 (CPack: Deprecate OSXX11 generator, 2020-01-31,
v3.17.0-rc1~45^2).

Issue: #20235
Brad King 4 yıl önce
ebeveyn
işleme
4ef974e6cb

+ 4 - 0
Help/release/dev/cpack-drop-osxx11.rst

@@ -0,0 +1,4 @@
+cpack-drop-osxx11
+-----------------
+
+* The :manual:`cpack(1)` undocumented ``OSXX11`` generator has been removed.

+ 1 - 4
Modules/CPack.cmake

@@ -262,7 +262,7 @@ installers.  The most commonly-used variables are:
   create Start Menu shortcuts.  For example, setting this to the list
   ``ccmake;CMake`` will create a shortcut named "CMake" that will execute the
   installed executable ``ccmake``.  Not all CPack generators use it (at least
-  NSIS, WIX and OSXX11 do).
+  NSIS, and WIX do).
 
 .. variable:: CPACK_STRIP_FILES
 
@@ -658,13 +658,11 @@ if(NOT CPACK_GENERATOR)
       if(APPLE)
         option(CPACK_BINARY_BUNDLE       "Enable to build OSX bundles"      OFF)
         option(CPACK_BINARY_DRAGNDROP    "Enable to build OSX Drag And Drop package" OFF)
-        option(CPACK_BINARY_OSXX11       "Enable to build OSX X11 packages (deprecated)" OFF)
         option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages (deprecated)" OFF)
         option(CPACK_BINARY_PRODUCTBUILD "Enable to build productbuild packages" OFF)
         mark_as_advanced(
           CPACK_BINARY_BUNDLE
           CPACK_BINARY_DRAGNDROP
-          CPACK_BINARY_OSXX11
           CPACK_BINARY_PACKAGEMAKER
           CPACK_BINARY_PRODUCTBUILD
           )
@@ -717,7 +715,6 @@ if(NOT CPACK_GENERATOR)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_IFW          IFW)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NSIS         NSIS)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NUGET        NuGet)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_OSXX11       OSXX11)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PACKAGEMAKER PackageMaker)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PRODUCTBUILD productbuild)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)

BIN
Modules/Internal/CPack/CPack.OSXScriptLauncher.in


BIN
Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in


+ 0 - 8
Source/CMakeLists.txt

@@ -1109,7 +1109,6 @@ if(APPLE)
   set(CPACK_SRCS ${CPACK_SRCS}
     CPack/cmCPackBundleGenerator.cxx
     CPack/cmCPackDragNDropGenerator.cxx
-    CPack/cmCPackOSXX11Generator.cxx
     CPack/cmCPackPKGGenerator.cxx
     CPack/cmCPackPackageMakerGenerator.cxx
     CPack/cmCPackProductBuildGenerator.cxx
@@ -1146,13 +1145,6 @@ if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARI
   add_definitions(-DHAVE_FREEBSD_PKG)
 endif()
 
-if(APPLE)
-  add_executable(OSXScriptLauncher
-    CPack/OSXScriptLauncher.cxx)
-  target_link_libraries(OSXScriptLauncher cmsys)
-  target_link_libraries(OSXScriptLauncher "-framework CoreFoundation")
-endif()
-
 # Build CMake executable
 add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE})
 list(APPEND _tools cmake)

+ 0 - 122
Source/CPack/OSXScriptLauncher.cxx

@@ -1,122 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#include <cstddef>
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include <cm/memory>
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include "cmsys/FStream.hxx"
-#include "cmsys/Process.h"
-#include "cmsys/SystemTools.hxx"
-
-// For the PATH_MAX constant
-#include <sys/syslimits.h>
-
-#define DebugError(x)                                                         \
-  ofs << x << std::endl;                                                      \
-  std::cout << x << std::endl
-
-int main(int argc, char* argv[])
-{
-  // if ( cmsys::SystemTools::FileExists(
-  cmsys::ofstream ofs("/tmp/output.txt");
-
-  CFStringRef fileName;
-  CFBundleRef appBundle;
-  CFURLRef scriptFileURL;
-
-  // get CF URL for script
-  if (!(appBundle = CFBundleGetMainBundle())) {
-    DebugError("Cannot get main bundle");
-    return 1;
-  }
-  fileName = CFSTR("RuntimeScript");
-  if (!(scriptFileURL =
-          CFBundleCopyResourceURL(appBundle, fileName, nullptr, nullptr))) {
-    DebugError("CFBundleCopyResourceURL failed");
-    return 1;
-  }
-
-  // create path string
-  auto path = cm::make_unique<UInt8[]>(PATH_MAX);
-  if (!path) {
-    return 1;
-  }
-
-  // get the file system path of the url as a cstring
-  // in an encoding suitable for posix apis
-  if (!CFURLGetFileSystemRepresentation(scriptFileURL, true, path.get(),
-                                        PATH_MAX)) {
-    DebugError("CFURLGetFileSystemRepresentation failed");
-    return 1;
-  }
-
-  // dispose of the CF variable
-  CFRelease(scriptFileURL);
-
-  std::string fullScriptPath = reinterpret_cast<char*>(path.get());
-  path.reset();
-
-  if (!cmsys::SystemTools::FileExists(fullScriptPath)) {
-    return 1;
-  }
-
-  std::string scriptDirectory =
-    cmsys::SystemTools::GetFilenamePath(fullScriptPath);
-  ofs << fullScriptPath << std::endl;
-  std::vector<const char*> args;
-  args.push_back(fullScriptPath.c_str());
-  int cc;
-  for (cc = 1; cc < argc; ++cc) {
-    args.push_back(argv[cc]);
-  }
-  args.push_back(nullptr);
-
-  cmsysProcess* cp = cmsysProcess_New();
-  cmsysProcess_SetCommand(cp, args.data());
-  cmsysProcess_SetWorkingDirectory(cp, scriptDirectory.c_str());
-  cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
-  cmsysProcess_SetTimeout(cp, 0);
-  cmsysProcess_Execute(cp);
-
-  char* data;
-  int length;
-  while (cmsysProcess_WaitForData(cp, &data, &length, nullptr)) {
-    // Translate NULL characters in the output into valid text.
-    for (int i = 0; i < length; ++i) {
-      if (data[i] == '\0') {
-        data[i] = ' ';
-      }
-    }
-    std::cout.write(data, length);
-  }
-
-  cmsysProcess_WaitForExit(cp, nullptr);
-
-  bool result = true;
-  if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
-    if (cmsysProcess_GetExitValue(cp) != 0) {
-      result = false;
-    }
-  } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exception) {
-    const char* exception_str = cmsysProcess_GetExceptionString(cp);
-    std::cerr << exception_str << std::endl;
-    result = false;
-  } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Error) {
-    const char* error_str = cmsysProcess_GetErrorString(cp);
-    std::cerr << error_str << std::endl;
-    result = false;
-  } else if (cmsysProcess_GetState(cp) == cmsysProcess_State_Expired) {
-    const char* error_str = "Process terminated due to timeout\n";
-    std::cerr << error_str << std::endl;
-    result = false;
-  }
-
-  cmsysProcess_Delete(cp);
-
-  return !result;
-}

+ 0 - 5
Source/CPack/cmCPackGeneratorFactory.cxx

@@ -21,7 +21,6 @@
 #ifdef __APPLE__
 #  include "cmCPackBundleGenerator.h"
 #  include "cmCPackDragNDropGenerator.h"
-#  include "cmCPackOSXX11Generator.h"
 #  include "cmCPackPackageMakerGenerator.h"
 #  include "cmCPackProductBuildGenerator.h"
 #endif
@@ -113,10 +112,6 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
     this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
                             cmCPackPackageMakerGenerator::CreateGenerator);
   }
-  if (cmCPackOSXX11Generator::CanGenerate()) {
-    this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
-                            cmCPackOSXX11Generator::CreateGenerator);
-  }
   if (cmCPackProductBuildGenerator::CanGenerate()) {
     this->RegisterGenerator("productbuild", "Mac OSX pkg",
                             cmCPackProductBuildGenerator::CreateGenerator);

+ 0 - 263
Source/CPack/cmCPackOSXX11Generator.cxx

@@ -1,263 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#include "cmCPackOSXX11Generator.h"
-
-#include <sstream>
-
-#include "cm_sys_stat.h"
-
-#include "cmCPackGenerator.h"
-#include "cmCPackLog.h"
-#include "cmDuration.h"
-#include "cmGeneratedFileStream.h"
-#include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
-#include "cmValue.h"
-
-cmCPackOSXX11Generator::cmCPackOSXX11Generator() = default;
-
-cmCPackOSXX11Generator::~cmCPackOSXX11Generator() = default;
-
-int cmCPackOSXX11Generator::PackageFiles()
-{
-
-  cmValue cpackPackageExecutables =
-    this->GetOption("CPACK_PACKAGE_EXECUTABLES");
-  if (cpackPackageExecutables) {
-    cmCPackLogger(cmCPackLog::LOG_DEBUG,
-                  "The cpackPackageExecutables: " << cpackPackageExecutables
-                                                  << "." << std::endl);
-    std::ostringstream str;
-    std::ostringstream deleteStr;
-    std::vector<std::string> cpackPackageExecutablesVector =
-      cmExpandedList(cpackPackageExecutables);
-    if (cpackPackageExecutablesVector.size() % 2 != 0) {
-      cmCPackLogger(
-        cmCPackLog::LOG_ERROR,
-        "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and "
-        "<icon name>."
-          << std::endl);
-      return 0;
-    }
-    std::vector<std::string>::iterator it;
-    for (it = cpackPackageExecutablesVector.begin();
-         it != cpackPackageExecutablesVector.end(); ++it) {
-      std::string cpackExecutableName = *it;
-      ++it;
-      this->SetOptionIfNotSet("CPACK_EXECUTABLE_NAME", cpackExecutableName);
-    }
-  }
-
-  // Disk image directories
-  std::string diskImageDirectory = toplevel;
-  std::string diskImageBackgroundImageDir =
-    diskImageDirectory + "/.background";
-
-  // App bundle directories
-  std::string packageDirFileName = cmStrCat(
-    toplevel, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".app");
-  std::string contentsDirectory = packageDirFileName + "/Contents";
-  std::string resourcesDirectory = contentsDirectory + "/Resources";
-  std::string appDirectory = contentsDirectory + "/MacOS";
-  std::string scriptDirectory = resourcesDirectory + "/Scripts";
-  std::string resourceFileName =
-    cmStrCat(this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".rsrc");
-
-  const char* dir = resourcesDirectory.c_str();
-  const char* appdir = appDirectory.c_str();
-  const char* scrDir = scriptDirectory.c_str();
-  const char* contDir = contentsDirectory.c_str();
-  const char* rsrcFile = resourceFileName.c_str();
-  cmValue iconFile = this->GetOption("CPACK_PACKAGE_ICON");
-  if (iconFile) {
-    std::string iconFileName = cmsys::SystemTools::GetFilenameName(iconFile);
-    if (!cmSystemTools::FileExists(iconFile)) {
-      cmCPackLogger(cmCPackLog::LOG_ERROR,
-                    "Cannot find icon file: "
-                      << iconFile
-                      << ". Please check CPACK_PACKAGE_ICON setting."
-                      << std::endl);
-      return 0;
-    }
-    std::string destFileName = resourcesDirectory + "/" + iconFileName;
-    this->ConfigureFile(iconFile, destFileName, true);
-    this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName);
-  }
-
-  std::string applicationsLinkName = diskImageDirectory + "/Applications";
-  cmSystemTools::CreateSymlink("/Applications", applicationsLinkName);
-
-  if (!this->CopyResourcePlistFile("VolumeIcon.icns", diskImageDirectory,
-                                   ".VolumeIcon.icns", true) ||
-      !this->CopyResourcePlistFile("DS_Store", diskImageDirectory, ".DS_Store",
-                                   true) ||
-      !this->CopyResourcePlistFile("background.png",
-                                   diskImageBackgroundImageDir,
-                                   "background.png", true) ||
-      !this->CopyResourcePlistFile("RuntimeScript", dir) ||
-      !this->CopyResourcePlistFile("OSXX11.Info.plist", contDir,
-                                   "Info.plist") ||
-      !this->CopyResourcePlistFile("OSXX11.main.scpt", scrDir, "main.scpt",
-                                   true) ||
-      !this->CopyResourcePlistFile("OSXScriptLauncher.rsrc", dir, rsrcFile,
-                                   true) ||
-      !this->CopyResourcePlistFile(
-        "OSXScriptLauncher", appdir,
-        this->GetOption("CPACK_PACKAGE_FILE_NAME").GetCStr(), true)) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Problem copying the resource files" << std::endl);
-    return 0;
-  }
-
-  // Two of the files need to have execute permission, so ensure they do:
-  std::string runTimeScript = cmStrCat(dir, "/RuntimeScript");
-
-  std::string appScriptName =
-    cmStrCat(appdir, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
-
-  mode_t mode;
-  if (cmsys::SystemTools::GetPermissions(runTimeScript.c_str(), mode)) {
-    mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
-    cmsys::SystemTools::SetPermissions(runTimeScript.c_str(), mode);
-    cmCPackLogger(cmCPackLog::LOG_OUTPUT,
-                  "Setting: " << runTimeScript << " to permission: " << mode
-                              << std::endl);
-  }
-
-  if (cmsys::SystemTools::GetPermissions(appScriptName.c_str(), mode)) {
-    mode |= (S_IXUSR | S_IXGRP | S_IXOTH);
-    cmsys::SystemTools::SetPermissions(appScriptName.c_str(), mode);
-    cmCPackLogger(cmCPackLog::LOG_OUTPUT,
-                  "Setting: " << appScriptName << " to permission: " << mode
-                              << std::endl);
-  }
-
-  std::string output;
-  std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"),
-                                 "/hdiutilOutput.log");
-  std::ostringstream dmgCmd;
-  dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
-         << "\" create -ov -fs HFS+ -format UDZO -srcfolder \""
-         << diskImageDirectory << "\" \"" << packageFileNames[0] << "\"";
-  cmCPackLogger(cmCPackLog::LOG_VERBOSE,
-                "Compress disk image using command: " << dmgCmd.str()
-                                                      << std::endl);
-  // since we get random dashboard failures with this one
-  // try running it more than once
-  int retVal = 1;
-  bool res = false;
-  for (unsigned numTries = 10; numTries > 0; numTries--) {
-    res = cmSystemTools::RunSingleCommand(
-      dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
-      cmDuration::zero());
-    if (res && !retVal) {
-      return 1;
-    }
-    cmSystemTools::Delay(500);
-  }
-
-  cmGeneratedFileStream ofs(tmpFile);
-  ofs << "# Run command: " << dmgCmd.str() << std::endl
-      << "# Output:" << std::endl
-      << output << std::endl;
-  cmCPackLogger(cmCPackLog::LOG_ERROR,
-                "Problem running hdiutil command: "
-                  << dmgCmd.str() << std::endl
-                  << "Please check " << tmpFile << " for errors" << std::endl);
-  return 0;
-}
-
-int cmCPackOSXX11Generator::InitializeInternal()
-{
-  cmCPackLogger(cmCPackLog::LOG_WARNING,
-                "The OSXX11 generator is deprecated "
-                "and will be removed in a future version.\n");
-  cmCPackLogger(cmCPackLog::LOG_DEBUG,
-                "cmCPackOSXX11Generator::Initialize()" << std::endl);
-  std::vector<std::string> path;
-  std::string pkgPath = cmSystemTools::FindProgram("hdiutil", path, false);
-  if (pkgPath.empty()) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Cannot find hdiutil compiler" << std::endl);
-    return 0;
-  }
-  this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath);
-
-  return this->Superclass::InitializeInternal();
-}
-
-/*
-bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name)
-{
-  std::string uname = cmSystemTools::UpperCase(name);
-  std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
-  const char* inFileName = this->GetOption(cpackVar.c_str());
-  if ( !inFileName )
-    {
-    cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str()
-                  << " not specified. It should point to "
-                  << (name ? name : "(NULL)")
-                  << ".rtf, " << name
-                  << ".html, or " << name << ".txt file" << std::endl);
-    return false;
-    }
-  if ( !cmSystemTools::FileExists(inFileName) )
-    {
-    cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find "
-                  << (name ? name : "(NULL)")
-                  << " resource file: " << inFileName << std::endl);
-    return false;
-    }
-  std::string ext = cmSystemTools::GetFilenameLastExtension(inFileName);
-  if ( ext != ".rtfd" && ext != ".rtf" && ext != ".html" && ext != ".txt" )
-    {
-    cmCPackLogger(cmCPackLog::LOG_ERROR, "Bad file extension specified: "
-      << ext << ". Currently only .rtfd, .rtf, .html, and .txt files allowed."
-      << std::endl);
-    return false;
-    }
-
-  std::string destFileName = cmStrCat(
-this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/Resources/", name, ext );
-
-
-  cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
-                << (inFileName ? inFileName : "(NULL)")
-                << " to " << destFileName << std::endl);
-  this->ConfigureFile(inFileName, destFileName);
-  return true;
-}
-*/
-
-bool cmCPackOSXX11Generator::CopyResourcePlistFile(
-  const std::string& name, const std::string& dir,
-  const char* outputFileName /* = 0 */, bool copyOnly /* = false */)
-{
-  std::string inFName = cmStrCat("CPack.", name, ".in");
-  std::string inFileName = this->FindTemplate(inFName.c_str());
-  if (inFileName.empty()) {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-                  "Cannot find input file: " << inFName << std::endl);
-    return false;
-  }
-
-  if (!outputFileName) {
-    outputFileName = name.c_str();
-  }
-
-  std::string destFileName = cmStrCat(dir, '/', outputFileName);
-
-  cmCPackLogger(cmCPackLog::LOG_VERBOSE,
-                "Configure file: " << inFileName << " to " << destFileName
-                                   << std::endl);
-  this->ConfigureFile(inFileName, destFileName, copyOnly);
-  return true;
-}
-
-const char* cmCPackOSXX11Generator::GetPackagingInstallPrefix()
-{
-  this->InstallPrefix =
-    cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"),
-             ".app/Contents/Resources");
-  return this->InstallPrefix.c_str();
-}

+ 0 - 39
Source/CPack/cmCPackOSXX11Generator.h

@@ -1,39 +0,0 @@
-/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-   file Copyright.txt or https://cmake.org/licensing for details.  */
-#pragma once
-
-#include "cmConfigure.h" // IWYU pragma: keep
-
-#include <string>
-
-#include "cmCPackGenerator.h"
-
-/** \class cmCPackOSXX11Generator
- * \brief A generator for OSX X11 modules
- *
- * Based on Gimp.app
- */
-class cmCPackOSXX11Generator : public cmCPackGenerator
-{
-public:
-  cmCPackTypeMacro(cmCPackOSXX11Generator, cmCPackGenerator);
-
-  /**
-   * Construct generator
-   */
-  cmCPackOSXX11Generator();
-  ~cmCPackOSXX11Generator() override;
-
-protected:
-  int InitializeInternal() override;
-  int PackageFiles() override;
-  const char* GetPackagingInstallPrefix() override;
-  const char* GetOutputExtension() override { return ".dmg"; }
-
-  // bool CopyCreateResourceFile(const std::string& name,
-  //                            const std::string& dir);
-  bool CopyResourcePlistFile(const std::string& name, const std::string& dir,
-                             const char* outputFileName = nullptr,
-                             bool copyOnly = false);
-  std::string InstallPrefix;
-};

+ 0 - 1
Tests/X11/CMakeLists.txt

@@ -29,7 +29,6 @@ if(X11_FOUND)
     target_link_libraries(HelloWorldX11 ${X11_LIBRARIES})
     install(TARGETS HelloWorldX11 DESTINATION bin)
 
-    set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE)
     set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE )
     set(CPACK_PACKAGE_NAME HelloWorldX11Package)
     set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11)