diff options
-rw-r--r-- | Help/release/dev/cpack-drop-osxx11.rst | 4 | ||||
-rw-r--r-- | Modules/CPack.cmake | 5 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPack.OSXScriptLauncher.in | bin | 29592 -> 0 bytes | |||
-rw-r--r-- | Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in | bin | 362 -> 0 bytes | |||
-rw-r--r-- | Source/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Source/CPack/OSXScriptLauncher.cxx | 122 | ||||
-rw-r--r-- | Source/CPack/cmCPackGeneratorFactory.cxx | 5 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.cxx | 263 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.h | 39 | ||||
-rw-r--r-- | Tests/X11/CMakeLists.txt | 1 |
10 files changed, 5 insertions, 442 deletions
diff --git a/Help/release/dev/cpack-drop-osxx11.rst b/Help/release/dev/cpack-drop-osxx11.rst new file mode 100644 index 0000000..c8dfaff --- /dev/null +++ b/Help/release/dev/cpack-drop-osxx11.rst @@ -0,0 +1,4 @@ +cpack-drop-osxx11 +----------------- + +* The :manual:`cpack(1)` undocumented ``OSXX11`` generator has been removed. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 373a707..50a9525 100644 --- a/Modules/CPack.cmake +++ b/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) diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.in Binary files differdeleted file mode 100644 index c715860..0000000 --- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.in +++ /dev/null diff --git a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in b/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in Binary files differdeleted file mode 100644 index 5f5f17a..0000000 --- a/Modules/Internal/CPack/CPack.OSXScriptLauncher.rsrc.in +++ /dev/null diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c125378..677fd2f 100644 --- a/Source/CMakeLists.txt +++ b/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) diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx deleted file mode 100644 index b7140ab..0000000 --- a/Source/CPack/OSXScriptLauncher.cxx +++ /dev/null @@ -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; -} diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 79e344b..0b2acca 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/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); diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx deleted file mode 100644 index 563cba0..0000000 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ /dev/null @@ -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(); -} diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h deleted file mode 100644 index 6f69af8..0000000 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ /dev/null @@ -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; -}; diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt index 76ae58c..ba45e96 100644 --- a/Tests/X11/CMakeLists.txt +++ b/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) |