diff options
author | Brad King <brad.king@kitware.com> | 2022-05-05 13:17:29 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-05-05 13:17:35 (GMT) |
commit | f533b548ca04775ee1e239f0ff0971a61ce61417 (patch) | |
tree | c521222851de93ee69dddcd3f14393962bb2a4c4 | |
parent | 284a3d7ae5b3e692b778ed7c236a7b3242182c59 (diff) | |
parent | c150f89f4df7dd6351094d61dca4223450cbf09c (diff) | |
download | CMake-f533b548ca04775ee1e239f0ff0971a61ce61417.zip CMake-f533b548ca04775ee1e239f0ff0971a61ce61417.tar.gz CMake-f533b548ca04775ee1e239f0ff0971a61ce61417.tar.bz2 |
Merge topic 'remove-PackageMaker-generator'
c150f89f4d CPack: Remove the deprecated PackageMaker generator
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7221
-rw-r--r-- | CMakeCPackOptions.cmake.in | 8 | ||||
-rw-r--r-- | Help/cpack_gen/packagemaker.rst | 88 | ||||
-rw-r--r-- | Help/manual/cmake-modules.7.rst | 1 | ||||
-rw-r--r-- | Help/module/CPackPackageMaker.rst | 4 | ||||
-rw-r--r-- | Help/release/3.17.rst | 2 | ||||
-rw-r--r-- | Help/release/3.23.rst | 2 | ||||
-rw-r--r-- | Help/release/dev/remove-PackageMaker-generator.rst | 5 | ||||
-rw-r--r-- | Modules/CPack.cmake | 3 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackGeneratorFactory.cxx | 5 | ||||
-rw-r--r-- | Source/CPack/cmCPackPackageMakerGenerator.cxx | 577 | ||||
-rw-r--r-- | Source/CPack/cmCPackPackageMakerGenerator.h | 50 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/CPackComponents/VerifyResult.cmake | 4 | ||||
-rw-r--r-- | Tests/CPackComponentsForAll/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/X11/CMakeLists.txt | 1 |
16 files changed, 13 insertions, 751 deletions
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 2a4bcc5..81dfeee 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -198,14 +198,6 @@ if(CPACK_GENERATOR MATCHES "IFW") endif() -if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") - if(CMAKE_PACKAGE_QTGUI) - set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications") - else() - set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr") - endif() -endif() - if("${CPACK_GENERATOR}" STREQUAL "DragNDrop") set(CPACK_DMG_BACKGROUND_IMAGE "@CMake_SOURCE_DIR@/Packaging/CMakeDMGBackground.tif") diff --git a/Help/cpack_gen/packagemaker.rst b/Help/cpack_gen/packagemaker.rst index 256446d..6614f31 100644 --- a/Help/cpack_gen/packagemaker.rst +++ b/Help/cpack_gen/packagemaker.rst @@ -1,87 +1,7 @@ CPack PackageMaker Generator ---------------------------- -PackageMaker CPack generator (macOS). - -.. deprecated:: 3.17 - - Xcode no longer distributes the PackageMaker tools. - This CPack generator will be removed in a future version of CPack. - -Variables specific to CPack PackageMaker generator -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The following variable is specific to installers built on Mac -macOS using PackageMaker: - -.. variable:: CPACK_OSX_PACKAGE_VERSION - - The version of macOS that the resulting PackageMaker archive should be - compatible with. Different versions of macOS support different - features. For example, CPack can only build component-based installers for - macOS 10.4 or newer, and can only build installers that download - components on-the-fly for macOS 10.5 or newer. If left blank, this value - will be set to the minimum version of macOS that supports the requested - features. Set this variable to some value (e.g., 10.4) only if you want to - guarantee that your installer will work on that version of macOS, and - don't mind missing extra features available in the installer shipping with - later versions of macOS. - -Background Image -"""""""""""""""" - -.. versionadded:: 3.17 - -This group of variables controls the background image of the generated -installer. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND - - Adds a background to Distribution XML if specified. The value contains the - path to image in ``Resources`` directory. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_ALIGNMENT - - Adds an ``alignment`` attribute to the background in Distribution XML. - Refer to Apple documentation for valid values. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_SCALING - - Adds a ``scaling`` attribute to the background in Distribution XML. - Refer to Apple documentation for valid values. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_MIME_TYPE - - Adds a ``mime-type`` attribute to the background in Distribution XML. - The option contains MIME type of an image. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_UTI - - Adds an ``uti`` attribute to the background in Distribution XML. - The option contains UTI type of an image. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA - - Adds a background for the Dark Aqua theme to Distribution XML if - specified. The value contains the path to image in ``Resources`` - directory. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_ALIGNMENT - - Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_ALIGNMENT` option, - but for the dark theme. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_SCALING - - Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_SCALING` option, - but for the dark theme. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_MIME_TYPE - - Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_MIME_TYPE` option, - but for the dark theme. - -.. variable:: CPACK_PACKAGEMAKER_BACKGROUND_DARKAQUA_UTI - - Does the same as :variable:`CPACK_PACKAGEMAKER_BACKGROUND_UTI` option, - but for the dark theme. +Removed. This once generated PackageMaker installers, but the +generator has been removed since CMake 3.24. Xcode no longer distributes +the PackageMaker tools. Use the :cpack_gen:`CPack productbuild Generator` +instead. diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 141eeaa..93beea9 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -317,7 +317,6 @@ used directly. /module/CPackFreeBSD /module/CPackNSIS /module/CPackNuGet - /module/CPackPackageMaker /module/CPackProductBuild /module/CPackRPM /module/CPackWIX diff --git a/Help/module/CPackPackageMaker.rst b/Help/module/CPackPackageMaker.rst deleted file mode 100644 index 226b6fd..0000000 --- a/Help/module/CPackPackageMaker.rst +++ /dev/null @@ -1,4 +0,0 @@ -CPackPackageMaker ------------------ - -The documentation for the CPack PackageMaker generator has moved here: :cpack_gen:`CPack PackageMaker Generator` diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst index abd7463..1aa475f 100644 --- a/Help/release/3.17.rst +++ b/Help/release/3.17.rst @@ -272,7 +272,7 @@ Deprecated and Removed Features of all policies are deprecated and that projects should port to the NEW behaviors. -* The :cpack_gen:`CPack PackageMaker Generator` generator has been +* The CPack ``PackageMaker`` generator has been deprecated because Xcode no longer distributes the PackageMaker tools. The undocumented ``OSXX11`` generator has also been deprecated. diff --git a/Help/release/3.23.rst b/Help/release/3.23.rst index 47c4243..70a6175 100644 --- a/Help/release/3.23.rst +++ b/Help/release/3.23.rst @@ -187,7 +187,7 @@ CPack * The ``CPack.distribution.dist.in`` template used by the :cpack_gen:`CPack productbuild Generator` and - :cpack_gen:`CPack PackageMaker Generator` was updated to use a new + CPack ``PackageMaker`` generator was updated to use a new ``CPACK_APPLE_PKG_INSTALLER_CONTENT`` variable for its main content. This replaced the previously undocumented and now deprecated ``CPACK_PACKAGEMAKER_CHOICES`` variable. diff --git a/Help/release/dev/remove-PackageMaker-generator.rst b/Help/release/dev/remove-PackageMaker-generator.rst new file mode 100644 index 0000000..f20a08c --- /dev/null +++ b/Help/release/dev/remove-PackageMaker-generator.rst @@ -0,0 +1,5 @@ +remove-PackageMaker-generator +----------------------------- + +* The deprecated ``PackageMaker`` :manual:`cpack(1)` generator has + been removed. diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 40cfde4..4934934 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -669,12 +669,10 @@ 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_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_PACKAGEMAKER CPACK_BINARY_PRODUCTBUILD ) else() @@ -726,7 +724,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_PACKAGEMAKER PackageMaker) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_PRODUCTBUILD productbuild) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_RPM RPM) cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_STGZ STGZ) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a988bf1..2deaaaa 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1121,7 +1121,6 @@ if(APPLE) CPack/cmCPackBundleGenerator.cxx CPack/cmCPackDragNDropGenerator.cxx CPack/cmCPackPKGGenerator.cxx - CPack/cmCPackPackageMakerGenerator.cxx CPack/cmCPackProductBuildGenerator.cxx ) endif() diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 0b2acca..725ea8a 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -21,7 +21,6 @@ #ifdef __APPLE__ # include "cmCPackBundleGenerator.h" # include "cmCPackDragNDropGenerator.h" -# include "cmCPackPackageMakerGenerator.h" # include "cmCPackProductBuildGenerator.h" #endif @@ -108,10 +107,6 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("Bundle", "Mac OSX bundle", cmCPackBundleGenerator::CreateGenerator); } - if (cmCPackPackageMakerGenerator::CanGenerate()) { - this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer", - cmCPackPackageMakerGenerator::CreateGenerator); - } if (cmCPackProductBuildGenerator::CanGenerate()) { this->RegisterGenerator("productbuild", "Mac OSX pkg", cmCPackProductBuildGenerator::CreateGenerator); diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx deleted file mode 100644 index a8cf1fa..0000000 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ /dev/null @@ -1,577 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmCPackPackageMakerGenerator.h" - -#include <cassert> -#include <cstdio> -#include <cstdlib> -#include <map> -#include <sstream> -#include <string> - -#include "cmsys/FStream.hxx" -#include "cmsys/RegularExpression.hxx" - -#include "cmCPackComponentGroup.h" -#include "cmCPackLog.h" -#include "cmDuration.h" -#include "cmGeneratedFileStream.h" -#include "cmStringAlgorithms.h" -#include "cmSystemTools.h" -#include "cmValue.h" -#include "cmXMLWriter.h" - -static inline unsigned int getVersion(unsigned int major, unsigned int minor) -{ - assert(major < 256 && minor < 256); - return ((major & 0xFF) << 16 | minor); -} - -cmCPackPackageMakerGenerator::cmCPackPackageMakerGenerator() -{ - this->PackageMakerVersion = 0.0; - this->PackageCompatibilityVersion = getVersion(10, 4); -} - -cmCPackPackageMakerGenerator::~cmCPackPackageMakerGenerator() = default; - -bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const -{ - return this->PackageCompatibilityVersion >= getVersion(10, 4); -} - -int cmCPackPackageMakerGenerator::PackageFiles() -{ - // TODO: Use toplevel - // It is used! Is this an obsolete comment? - - std::string resDir; // Where this package's resources will go. - std::string packageDirFileName = - this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - if (this->Components.empty()) { - packageDirFileName += ".pkg"; - resDir = - cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/Resources"); - } else { - packageDirFileName += ".mpkg"; - if (!cmsys::SystemTools::MakeDirectory(packageDirFileName.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package directory " << packageDirFileName - << std::endl); - return 0; - } - - resDir = cmStrCat(packageDirFileName, "/Contents"); - if (!cmsys::SystemTools::MakeDirectory(resDir.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package subdirectory " << resDir - << std::endl); - return 0; - } - - resDir += "/Resources"; - if (!cmsys::SystemTools::MakeDirectory(resDir.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "unable to create package subdirectory " << resDir - << std::endl); - return 0; - } - - resDir += "/en.lproj"; - } - - cmValue preflight = this->GetOption("CPACK_PREFLIGHT_SCRIPT"); - cmValue postflight = this->GetOption("CPACK_POSTFLIGHT_SCRIPT"); - cmValue postupgrade = this->GetOption("CPACK_POSTUPGRADE_SCRIPT"); - - if (this->Components.empty()) { - // Create directory structure - std::string preflightDirName = resDir + "/PreFlight"; - std::string postflightDirName = resDir + "/PostFlight"; - // if preflight or postflight scripts not there create directories - // of the same name, I think this makes it work - if (!preflight) { - if (!cmsys::SystemTools::MakeDirectory(preflightDirName.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << preflightDirName << std::endl); - return 0; - } - } - if (!postflight) { - if (!cmsys::SystemTools::MakeDirectory(postflightDirName.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating installer directory: " - << postflightDirName << 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, preflight, "preflight"); - } - if (postflight) { - this->CopyInstallScript(resDir, postflight, "postflight"); - } - if (postupgrade) { - this->CopyInstallScript(resDir, postupgrade, "postupgrade"); - } - } else if (postflight) { - // create a postflight component to house the script - this->PostFlightComponent.Name = "PostFlight"; - this->PostFlightComponent.DisplayName = "PostFlight"; - this->PostFlightComponent.Description = "PostFlight"; - this->PostFlightComponent.IsHidden = true; - - // empty directory for pkg contents - std::string packageDir = toplevel + "/" + PostFlightComponent.Name; - if (!cmsys::SystemTools::MakeDirectory(packageDir.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating component packages directory: " - << packageDir << std::endl); - return 0; - } - - // create package - std::string packageFileDir = packageDirFileName + "/Contents/Packages/"; - if (!cmsys::SystemTools::MakeDirectory(packageFileDir.c_str())) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Problem creating component PostFlight Packages directory: " - << packageFileDir << std::endl); - return 0; - } - std::string packageFile = - packageFileDir + this->GetPackageName(PostFlightComponent); - if (!this->GenerateComponentPackage( - packageFile.c_str(), packageDir.c_str(), PostFlightComponent)) { - return 0; - } - - // copy postflight script into resource directory of .pkg - std::string resourceDir = packageFile + "/Contents/Resources"; - this->CopyInstallScript(resourceDir, postflight, "postflight"); - } - - if (!this->Components.empty()) { - // Create the directory where component packages will be built. - std::string basePackageDir = - cmStrCat(packageDirFileName, "/Contents/Packages"); - if (!cmsys::SystemTools::MakeDirectory(basePackageDir.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating component packages directory: " - << basePackageDir << std::endl); - return 0; - } - - // Create the directory where downloaded component packages will - // be placed. - cmValue userUploadDirectory = this->GetOption("CPACK_UPLOAD_DIRECTORY"); - std::string uploadDirectory; - if (userUploadDirectory && !userUploadDirectory->empty()) { - uploadDirectory = userUploadDirectory; - } else { - uploadDirectory = - cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/CPackUploads"); - } - - // Create packages for each component - bool warnedAboutDownloadCompatibility = false; - - std::map<std::string, cmCPackComponent>::iterator compIt; - for (compIt = this->Components.begin(); compIt != this->Components.end(); - ++compIt) { - std::string packageFile; - if (compIt->second.IsDownloaded) { - if (this->PackageCompatibilityVersion >= getVersion(10, 5) && - this->PackageMakerVersion >= 3.0) { - // Build this package within the upload directory. - packageFile = uploadDirectory; - - if (!cmSystemTools::FileExists(uploadDirectory.c_str())) { - if (!cmSystemTools::MakeDirectory(uploadDirectory.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Unable to create package upload directory " - << uploadDirectory << std::endl); - return 0; - } - } - } else if (!warnedAboutDownloadCompatibility) { - if (this->PackageCompatibilityVersion < getVersion(10, 5)) { - cmCPackLogger( - cmCPackLog::LOG_WARNING, - "CPack warning: please set CPACK_OSX_PACKAGE_VERSION to 10.5 " - "or greater enable downloaded packages. CPack will build a " - "non-downloaded package." - << std::endl); - } - - if (this->PackageMakerVersion < 3) { - cmCPackLogger(cmCPackLog::LOG_WARNING, - "CPack warning: unable to build downloaded " - "packages with PackageMaker versions prior " - "to 3.0. CPack will build a non-downloaded package." - << std::endl); - } - - warnedAboutDownloadCompatibility = true; - } - } - - if (packageFile.empty()) { - // Build this package within the overall distribution - // metapackage. - packageFile = basePackageDir; - - // We're not downloading this component, even if the user - // requested it. - compIt->second.IsDownloaded = false; - } - - packageFile += '/'; - packageFile += GetPackageName(compIt->second); - - std::string packageDir = cmStrCat(toplevel, '/', compIt->first); - if (!this->GenerateComponentPackage( - packageFile.c_str(), packageDir.c_str(), compIt->second)) { - return 0; - } - } - } - this->SetOption("CPACK_MODULE_VERSION_SUFFIX", ""); - - // Copy or create all of the resource files we need. - if (!this->CopyCreateResourceFile("License", resDir) || - !this->CopyCreateResourceFile("ReadMe", resDir) || - !this->CopyCreateResourceFile("Welcome", resDir) || - !this->CopyResourcePlistFile("Info.plist") || - !this->CopyResourcePlistFile("Description.plist")) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem copying the resource files" << std::endl); - return 0; - } - - if (this->Components.empty()) { - // Use PackageMaker to build the package. - std::ostringstream pkgCmd; - pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") - << "\" -build -p \"" << packageDirFileName << "\""; - if (this->Components.empty()) { - pkgCmd << " -f \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - } else { - pkgCmd << " -mi \"" << this->GetOption("CPACK_TEMPORARY_DIRECTORY") - << "/packages/"; - } - pkgCmd << "\" -r \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") - << "/Resources\" -i \"" - << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") - << "/Info.plist\" -d \"" - << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") - << "/Description.plist\""; - if (this->PackageMakerVersion > 2.0) { - pkgCmd << " -v"; - } - if (!RunPackageMaker(pkgCmd.str().c_str(), packageDirFileName.c_str())) { - return 0; - } - } else { - // We have built the package in place. Generate the - // distribution.dist file to describe it for the installer. - WriteDistributionFile(packageDirFileName.c_str(), "PACKAGEMAKER"); - } - - 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 \"" - << packageDirFileName << "\" \"" << packageFileNames[0] << "\""; - std::string output; - int retVal = 1; - int numTries = 10; - bool res = false; - while (numTries > 0) { - res = cmSystemTools::RunSingleCommand( - dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, - cmDuration::zero()); - if (res && !retVal) { - numTries = -1; - break; - } - cmSystemTools::Delay(500); - numTries--; - } - if (!res || retVal) { - 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; - } - - return 1; -} - -int cmCPackPackageMakerGenerator::InitializeInternal() -{ - cmCPackLogger(cmCPackLog::LOG_WARNING, - "The PackageMaker generator is deprecated " - "and will be removed in a future version.\n"); - this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); - - // Starting with Xcode 4.3, PackageMaker is a separate app, and you - // can put it anywhere you want. So... use a variable for its location. - // People who put it in unexpected places can use the variable to tell - // us where it is. - // - // Use the following locations, in "most recent installation" order, - // to search for the PackageMaker app. Assume people who copy it into - // the new Xcode 4.3 app in "/Applications" will copy it into the nested - // Applications folder inside the Xcode bundle itself. Or directly in - // the "/Applications" directory. - // - // If found, save result in the CPACK_INSTALLER_PROGRAM variable. - - std::vector<std::string> paths; - paths.emplace_back("/Applications/Xcode.app/Contents/Applications" - "/PackageMaker.app/Contents/MacOS"); - paths.emplace_back("/Applications/Utilities" - "/PackageMaker.app/Contents/MacOS"); - paths.emplace_back("/Applications" - "/PackageMaker.app/Contents/MacOS"); - paths.emplace_back("/Developer/Applications/Utilities" - "/PackageMaker.app/Contents/MacOS"); - paths.emplace_back("/Developer/Applications" - "/PackageMaker.app/Contents/MacOS"); - - std::string pkgPath; - cmValue inst_program = this->GetOption("CPACK_INSTALLER_PROGRAM"); - if (inst_program && !inst_program->empty()) { - pkgPath = inst_program; - } else { - pkgPath = cmSystemTools::FindProgram("PackageMaker", paths, false); - if (pkgPath.empty()) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find PackageMaker compiler" << std::endl); - return 0; - } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath); - } - - // Get path to the real PackageMaker, not a symlink: - pkgPath = cmSystemTools::GetRealPath(pkgPath); - // Up from there to find the version.plist file in the "Contents" dir: - std::string contents_dir; - contents_dir = cmSystemTools::GetFilenamePath(pkgPath); - contents_dir = cmSystemTools::GetFilenamePath(contents_dir); - - std::string versionFile = contents_dir + "/version.plist"; - - if (!cmSystemTools::FileExists(versionFile.c_str())) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot find PackageMaker compiler version file: " - << versionFile << std::endl); - return 0; - } - - cmsys::ifstream ifs(versionFile.c_str()); - if (!ifs) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot open PackageMaker compiler version file" - << std::endl); - return 0; - } - - // Check the PackageMaker version - cmsys::RegularExpression rexKey("<key>CFBundleShortVersionString</key>"); - cmsys::RegularExpression rexVersion("<string>([0-9]+.[0-9.]+)</string>"); - std::string line; - bool foundKey = false; - while (cmSystemTools::GetLineFromStream(ifs, line)) { - if (rexKey.find(line)) { - foundKey = true; - break; - } - } - if (!foundKey) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Cannot find CFBundleShortVersionString in the PackageMaker compiler " - "version file" - << std::endl); - return 0; - } - if (!cmSystemTools::GetLineFromStream(ifs, line) || !rexVersion.find(line)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem reading the PackageMaker compiler version file: " - << versionFile << std::endl); - return 0; - } - this->PackageMakerVersion = atof(rexVersion.match(1).c_str()); - if (this->PackageMakerVersion < 1.0) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Require PackageMaker 1.0 or higher" << std::endl); - return 0; - } - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "PackageMaker version is: " << this->PackageMakerVersion - << std::endl); - - // Determine the package compatibility version. If it wasn't - // specified by the user, we define it based on which features the - // user requested. - cmValue packageCompat = this->GetOption("CPACK_OSX_PACKAGE_VERSION"); - if (packageCompat && !packageCompat->empty()) { - unsigned int majorVersion = 10; - unsigned int minorVersion = 5; - int res = - sscanf(packageCompat->c_str(), "%u.%u", &majorVersion, &minorVersion); - if (res == 2) { - this->PackageCompatibilityVersion = - getVersion(majorVersion, minorVersion); - } - } else if (this->GetOption("CPACK_DOWNLOAD_SITE")) { - this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.5"); - this->PackageCompatibilityVersion = getVersion(10, 5); - } else if (this->GetOption("CPACK_COMPONENTS_ALL")) { - this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.4"); - this->PackageCompatibilityVersion = getVersion(10, 4); - } else { - this->SetOption("CPACK_OSX_PACKAGE_VERSION", "10.3"); - this->PackageCompatibilityVersion = getVersion(10, 3); - } - - std::vector<std::string> no_paths; - pkgPath = cmSystemTools::FindProgram("hdiutil", no_paths, 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 cmCPackPackageMakerGenerator::RunPackageMaker(const char* command, - const char* packageFile) -{ - std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), - "/PackageMakerOutput.log"); - - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); - std::string output; - int retVal = 1; - bool res = cmSystemTools::RunSingleCommand( - command, &output, &output, &retVal, nullptr, this->GeneratorVerbose, - cmDuration::zero()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Done running package maker" << std::endl); - if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile); - ofs << "# Run command: " << command << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running PackageMaker command: " - << command << std::endl - << "Please check " << tmpFile << " for errors" - << std::endl); - return false; - } - // sometimes the command finishes but the directory is not yet - // created, so try 10 times to see if it shows up - int tries = 10; - while (tries > 0 && !cmSystemTools::FileExists(packageFile)) { - cmSystemTools::Delay(500); - tries--; - } - if (!cmSystemTools::FileExists(packageFile)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running PackageMaker command: " - << command << std::endl - << "Package not created: " << packageFile << std::endl); - return false; - } - - return true; -} - -bool cmCPackPackageMakerGenerator::GenerateComponentPackage( - const char* packageFile, const char* packageDir, - const cmCPackComponent& component) -{ - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Building component package: " << packageFile - << std::endl); - - // The command that will be used to run PackageMaker - std::ostringstream pkgCmd; - - if (this->PackageCompatibilityVersion < getVersion(10, 5) || - this->PackageMakerVersion < 3.0) { - // Create Description.plist and Info.plist files for normal Mac OS - // X packages, which work on Mac OS X 10.3 and newer. - std::string descriptionFile = - cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/', - component.Name, "-Description.plist"); - cmsys::ofstream out(descriptionFile.c_str()); - cmXMLWriter xout(out); - xout.StartDocument(); - xout.Doctype("plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"" - "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""); - xout.StartElement("plist"); - xout.Attribute("version", "1.4"); - xout.StartElement("dict"); - xout.Element("key", "IFPkgDescriptionTitle"); - xout.Element("string", component.DisplayName); - xout.Element("key", "IFPkgDescriptionVersion"); - xout.Element("string", this->GetOption("CPACK_PACKAGE_VERSION")); - xout.Element("key", "IFPkgDescriptionDescription"); - xout.Element("string", component.Description); - xout.EndElement(); // dict - xout.EndElement(); // plist - xout.EndDocument(); - out.close(); - - // Create the Info.plist file for this component - std::string moduleVersionSuffix = cmStrCat('.', component.Name); - this->SetOption("CPACK_MODULE_VERSION_SUFFIX", moduleVersionSuffix); - std::string infoFileName = cmStrCat(component.Name, "-Info.plist"); - if (!this->CopyResourcePlistFile("Info.plist", infoFileName.c_str())) { - return false; - } - - pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") - << "\" -build -p \"" << packageFile << "\"" - << " -f \"" << packageDir << "\"" - << " -i \"" << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "/" - << infoFileName << "\"" - << " -d \"" << descriptionFile << "\""; - } else { - // Create a "flat" package on Mac OS X 10.5 and newer. Flat - // packages are stored in a single file, rather than a directory - // like normal packages, and can be downloaded by the installer - // on-the-fly in Mac OS X 10.5 or newer. Thus, we need to create - // flat packages when the packages will be downloaded on the fly. - std::string pkgId = - cmStrCat("com.", this->GetOption("CPACK_PACKAGE_VENDOR"), '.', - this->GetOption("CPACK_PACKAGE_NAME"), '.', component.Name); - - pkgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") - << "\" --root \"" << packageDir << "\"" - << " --id " << pkgId << " --target " - << this->GetOption("CPACK_OSX_PACKAGE_VERSION") << " --out \"" - << packageFile << "\""; - } - - // Run PackageMaker - return RunPackageMaker(pkgCmd.str().c_str(), packageFile); -} diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h deleted file mode 100644 index cda9277..0000000 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ /dev/null @@ -1,50 +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 "cmCPackGenerator.h" -#include "cmCPackPKGGenerator.h" - -class cmCPackComponent; - -/** \class cmCPackPackageMakerGenerator - * \brief A generator for PackageMaker files - * - * http://developer.apple.com/documentation/Darwin - * /Reference/ManPages/man1/packagemaker.1.html - */ -class cmCPackPackageMakerGenerator : public cmCPackPKGGenerator -{ -public: - cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackPKGGenerator); - - /** - * Construct generator - */ - cmCPackPackageMakerGenerator(); - ~cmCPackPackageMakerGenerator() override; - bool SupportsComponentInstallation() const override; - -protected: - int InitializeInternal() override; - int PackageFiles() override; - const char* GetOutputExtension() override { return ".dmg"; } - - // Run PackageMaker with the given command line, which will (if - // successful) produce the given package file. Returns true if - // PackageMaker succeeds, false otherwise. - bool RunPackageMaker(const char* command, const char* packageFile); - - // Generate a package in the file packageFile for the given - // component. All of the files within this component are stored in - // the directory packageDir. Returns true if successful, false - // otherwise. - bool GenerateComponentPackage(const char* packageFile, - const char* packageDir, - const cmCPackComponent& component); - - double PackageMakerVersion; - unsigned int PackageCompatibilityVersion; -}; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9a4910f..9a1cf69 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -294,17 +294,6 @@ if(BUILD_TESTING) mark_as_advanced(CTEST_TEST_CTEST) endif () - # Should CPack tests be run? By default, yes, but... - # - # Disable packaging test on Apple 10.3 and below. PackageMaker starts - # DiskManagementTool as root and disowns it - # (http://lists.apple.com/archives/installer-dev/2005/Jul/msg00005.html). - # It is left holding open pipe handles and preventing ProcessUNIX from - # detecting end-of-data even after its immediate child exits. Then - # the test hangs until it times out and is killed. This is a - # well-known bug in kwsys process execution that I would love to get - # time to fix. - # option(CTEST_TEST_CPACK "Should the tests that use '--build-target package' be run?" ON) diff --git a/Tests/CPackComponents/VerifyResult.cmake b/Tests/CPackComponents/VerifyResult.cmake index c7c24fd..5e08e60 100644 --- a/Tests/CPackComponents/VerifyResult.cmake +++ b/Tests/CPackComponents/VerifyResult.cmake @@ -22,9 +22,7 @@ if(WIN32) endif() if(APPLE) - # Always expect the *.dmg installer - PackageMaker should always - # be installed on a development Mac: - # + # Always expect the *.dmg installer set(expected_file_mask "${CPackComponents_BINARY_DIR}/MyLib-*.dmg") endif() diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt index e49138a..a1a9709 100644 --- a/Tests/CPackComponentsForAll/CMakeLists.txt +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -5,7 +5,7 @@ # which supports CPack components. # # Depending on the CPack generator and on some CPACK_xxx var values -# the generator may produce a single (NSIS, PackageMaker) +# the generator may produce a single (NSIS, productbuild) # or several package files (Archive Generators, RPM, DEB) cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR) project(CPackComponentsForAll) diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt index ba45e96..b190de2 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_PACKAGEMAKER OFF CACHE BOOL "" FORCE ) set(CPACK_PACKAGE_NAME HelloWorldX11Package) set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11) endif() |