[CMake] Bundle Generator Background Image/Custom .DS_Store support

David Cole david.cole at kitware.com
Thu Feb 5 13:27:06 EST 2009


I agree with Clint. This belongs in the new cmCPackDragNDropGenerator.

On Thu, Feb 5, 2009 at 1:25 PM, Clinton Stimpson <clinton at elemtech.com>wrote:

>
> cmCPackBundleGenerator has a new base class cmCPackDragNDropGenerator.  Can
> we please put this functionality there, and if necessary modify the
> CompressFiles(...) so they both get it (maybe the addition of a couple
> virtual functions would help).
> The DragNDrop generator supports multiple bundles, and uses whatever bundle
> properties were already set on the targets.  It also supports installing non
> bundle things such as readme files.  The Bundle generator is a
> specialization of the DragNDrop generator which is convenience for some.
>
> Clint
>
> Mike Arthur wrote:
>
>> Please review the attached patch for inclusion.
>>
>> It adds support to the bundle generator to add a background image and
>> .DS_Store for people (like myself/Mozilla/Last.fm) who want CPack to be able
>> to set a nice background to the Bundle without having to manually convert
>> it.
>>  ------------------------------------------------------------------------
>>
>> --- source/Source/CPack/cmCPackBundleGenerator.cxx      2009-02-04
>> 15:00:24.727403954 +0000
>> +++ cmake-patch/Source/CPack/cmCPackBundleGenerator.cxx 2009-02-05
>> 14:12:28.439443802 +0000
>> @@ -105,6 +105,14 @@
>>     this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND")     ?
>> this->GetOption("CPACK_BUNDLE_STARTUP_COMMAND") : "";
>>  +  const std::string cpack_bundle_dmg_background_image =
>> +    this->GetOption("CPACK_BUNDLE_DMG_BACKGROUND_IMAGE")
>> +    ? this->GetOption("CPACK_BUNDLE_DMG_BACKGROUND_IMAGE") : "";
>> +
>> +  const std::string cpack_bundle_dmg_ds_store =
>> +    this->GetOption("CPACK_BUNDLE_DMG_DS_STORE")
>> +    ? this->GetOption("CPACK_BUNDLE_DMG_DS_STORE") : "";
>> +
>>   // The staging directory contains everything that will end-up inside the
>>   // final disk image ...
>>   cmOStringStream staging;
>> @@ -202,6 +210,63 @@
>>       }
>>     }
>>  +  // Optionally add a custom .DS_Store file
>> +  // (e.g. for setting background/layout) ...
>> +  if(!cpack_bundle_dmg_ds_store.empty())
>> +    {
>> +    cmOStringStream package_settings_source;
>> +    package_settings_source << cpack_bundle_dmg_ds_store;
>> +
>> +    cmOStringStream package_settings_destination;
>> +    package_settings_destination << staging.str() << "/.DS_Store";
>> +
>> +    if(!this->CopyFile(package_settings_source,
>> package_settings_destination))
>> +      {
>> +      cmCPackLogger(cmCPackLog::LOG_ERROR,
>> +        "Error copying disk volume settings file.  "
>> +                    "Check the value of CPACK_BUNDLE_DMG_DS_STORE."
>> +        << std::endl);
>> +
>> +      return 0;
>> +      }
>> +    }
>> +
>> +  // Optionally add a custom background image ...
>> +  if(!cpack_bundle_dmg_background_image.empty())
>> +    {
>> +    cmOStringStream package_background_source;
>> +    package_background_source << cpack_bundle_dmg_background_image;
>> +
>> +    cmOStringStream package_background_destination;
>> +    package_background_destination << staging.str() << "/background.png";
>> +
>> +    if(!this->CopyFile(package_background_source,
>> +        package_background_destination))
>> +      {
>> +      cmCPackLogger(cmCPackLog::LOG_ERROR,
>> +        "Error copying disk volume background image.  "
>> +                    "Check the value of
>> CPACK_BUNDLE_DMG_BACKGROUND_IMAGE."
>> +        << std::endl);
>> +
>> +      return 0;
>> +      }
>> +
>> +    cmOStringStream temp_background_hiding_command;
>> +    temp_background_hiding_command <<
>> this->GetOption("CPACK_COMMAND_SETFILE");
>> +    temp_background_hiding_command << " -a V \"";
>> +    temp_background_hiding_command <<
>> package_background_destination.str();
>> +    temp_background_hiding_command << "\"";
>> +
>> +    if(!this->RunCommand(temp_background_hiding_command))
>> +      {
>> +        cmCPackLogger(cmCPackLog::LOG_ERROR,
>> +          "Error setting attributes on disk volume background image."
>> +          << std::endl);
>> +
>> +      return 0;
>> +      }
>> +    }
>> +
>>   // Create a temporary read-write disk image ...
>>   cmOStringStream temp_image;
>>   temp_image << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") <<
>> "/temp.dmg";
>>  ------------------------------------------------------------------------
>>
>> _______________________________________________
>> CMake mailing list
>> CMake at cmake.org
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090205/ed4a17c7/attachment.htm>


More information about the CMake mailing list