Packaging on MacOSX

From GRASS-Wiki
Jump to navigation Jump to search

Notes on packaging GRASS for distribution on Mac OS X. This applies to the Mac OS X application build (--enable-macosx-app) only.

The OSX app build includes its own bindist make target, which creates an OSX installer package (instead of the tarball + script that the unix build bindist creates).

bundling

There is also a bundle.make makefile fragment that is included in the main OSX makefile that is customizable to bundle dependencies and helpers into the application package, to make the app more portable to other OSX systems (so the user doesn't have to install them themselves). See bundle.make comments for details on install commands and destination paths.

A couple examples are included in bundle.make. Here are more.

wxPython

wxPython is a good one to bundle, because a python module may directly link a wx library, and the binary distribution of wxPython uses a different path for each version, and the installer will destroy previous versions. ie:

/usr/local/lib/wxPython-unicode-2.8.10.1/lib

There a couple different parts to copy, plus the GRASS startup script needs one change. In bundle.make, first, add this before the bundle-macosx: line (change the wx version to match what you have installed):

WXPREFIX=/usr/local/lib/wxPython-unicode-2.8.10.1

Then in the bundle-macosx: section (make sure to indent all lines with <tabs>), you may need to change the library versions to match what you have installed:

	${INSTALL} ${WXPREFIX}/lib/libwx_macud-2.8.0.dylib ${MACOSX_BUNDLE_PREFIX}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gl-2.8.0.dylib ${MACOSX_BUNDLE_PREFIX}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_stc-2.8.0.dylib ${MACOSX_BUNDLE_PREFIX}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gizmos-2.8.0.dylib ${MACOSX_BUNDLE_PREFIX}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gizmos_xrc-2.8.0.dylib ${MACOSX_BUNDLE_PREFIX}/lib
	cp -Rfp ${WXPREFIX}/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx ${MACOSX_BUNDLE_PREFIX}/etc/wxpython
	cp -Rfp ${WXPREFIX}/lib/python2.5/site-packages/wx-2.8-mac-unicode/wxPython ${MACOSX_BUNDLE_PREFIX}/etc/wxpython
	${INSTALL_DATA} ${WXPREFIX}/lib/python2.5/site-packages/wxversion.py ${MACOSX_BUNDLE_PREFIX}/etc/wxpython
	sed -i '' -e 's/^GRASS_WXBUNDLED=.*/GRASS_WXBUNDLED=1/' ${MACOSX_BUNDLE_PREFIX}/grass.sh

wxPython's version checking doesn't work in a bundled environment, so the GRASS_WXBUNDLED flag is set in the startup script to tell the GUI startup to skip the wx version check.