Packaging on MacOSX

From GRASS-Wiki
Jump to: navigation, 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 are a couple different parts to copy. Plus, the GRASS startup script needs one change (this is done by the additions to bundle.make). 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 ${INST_DIR_TARGET}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gl-2.8.0.dylib ${INST_DIR_TARGET}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_stc-2.8.0.dylib ${INST_DIR_TARGET}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gizmos-2.8.0.dylib ${INST_DIR_TARGET}/lib
	${INSTALL} ${WXPREFIX}/lib/libwx_macud_gizmos_xrc-2.8.0.dylib ${INST_DIR_TARGET}/lib
	cp -Rfp ${WXPREFIX}/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx ${INST_DIR_TARGET}/etc/python
	cp -Rfp ${WXPREFIX}/lib/python2.5/site-packages/wx-2.8-mac-unicode/wxPython ${INST_DIR_TARGET}/etc/python
	cp -fp ${WXPREFIX}/lib/python2.5/site-packages/wxversion.py ${INST_DIR_TARGET}/etc/python
	sed -i '' -e 's/^GRASS_WXBUNDLED=.*/GRASS_WXBUNDLED=1/' ${INST_DIR_TARGET}/grass.sh

This applies to GRASS 6.5 and 7. For GRASS 6.4, change all INST_DIR_TARGET to MACOSX_BUNDLE_PREFIX above.

Note: wxPython's version checking doesn't work in a bundled environment, so the GRASS_WXBUNDLED flag is set in the startup script (that's what the sed line above does) to tell the GUI startup to skip the wx version check.