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.
--
Cheers,
Mike Arthur
http://mikearthur.co.uk/
--- 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
[email protected]
http://www.cmake.org/mailman/listinfo/cmake