Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 2.84 KB

README.md

File metadata and controls

56 lines (45 loc) · 2.84 KB

StudyPack

A simple project to study packaging with CMake/CPack.

Topics to be looked at:

  • Customized STGZ template to allow pre/post install operations.
  • Checking required packages (STGZ and PackageMaker).
  • Download of components (e.g. large data files).
  • Use of BundleUtilities.
  • Update of hardcoded paths in installed files to new location.
  • Uninstallers.

The StudyPack application is just a simple C++ "Hello World" for now. We'll add more complexity (use of system/third-party libraries, GUI) later.

Specifics for CPack Generators

The builtin CPack STGZ template is fairly basic, but can be easily extended in two ways. As the template is nothing more than a Bourne shell script, it can have extra functionality added in sh as appropriate for the project. With the package encoded in the STGZ file as a gziped tar archive, we can also pack scripts into the archive and extract them for use on the fly. For example,

cat archive.tar.gz | gunzip | tar -Oxf fileinarchive.sh - | /bin/sh

If the tool is a binary, then it can only really be used post-install (Is there an 'interpreter' for Mach-O/ELF binaries?).

On Mac OS X we can use STGZ and also have the PackageMaker, DragNDrop and Bundle generators available. Which is appropriate depends on the nature of the project, and in general the recommendation appears to be that we would never use more than one. DragNDrop and Bundle generators appear to be intended for use with true and create your own bundles respectively (here a true bundle can be taken as a target with the MACOSX_BUNDLE property set. There's some discussion of this on the CMake mailing list, though this is from a couple of years ago. Note that the Bundle Generator uses the CPACK_DMG_xxx variables in addition to its own CPACK_BUNDLE_xxx set.

One nice feature to have with DragNDrop style DMGs is a custom layout in the opened Finder window. This is a little tricky as it requires a customized .DS_Store file, which can be generated by hand, or possibly OSA-script. The by hand technique relies on using Finder to layout a dummy folder and then extracting the resultant .DS_Store file that the system creates for the folder. One can also use a Disk Image to do this.

PackageMaker appears best when we need component based installs or more complicated functionality such as pre and post install steps. It can be used for Bundles, Frameworks and even plain Unix tools.