Open main menu

Gramps β

Changes

Mac OS X:Build from source:gtk-osx

694 bytes added, 21:40, 21 June 2009
Tested working version of instructions
This page tells how to build gramps and its supporting programs from source on Apple Mac OS X using the [http://sourceforge.net/projects/gtk-osx sourceforge gtk-osx project]. This work is experimental and changing. It would be unwise to use this software with precious data at this time. It is hoped that, in some days or weeks (June 2009) a one-click-install packaged version of Mac gramps will become available. Meanwhile, it's still necessary to have a proper Apple development system, the xCode package, which is described at the [[Mac OS X MacPorts]] page. A system that has bult gramps with MacPorts should already have everything needed to build with gtk-osx.
One advantage of the gtk-osx Mac build is that this gramps no longer needs the Quartz Mac X11 software. That reduces complexity quite a bit. An advantage compared to Macports is that this gramps is built entirely in user space, with no admin access (root login, superuser mode) needed at all. That greatly reduces the chances of messing up the system by mistake. The python interpreter, libraries and gramps code all end up in the user files of whoever builds it, instead of embedded into the system-wide file space. Each user must have their own separate copy of gramps, but most Macs have onlyone only one user anyway.
There is [http://sourceforge.net/apps/trac/gtk-osx/wiki/Build gtk-osx documentation] and [http://library.gnome.org/devel/jhbuild/unstable/ jhbuild documentation] but it shouldn't be necessary to read those if this page here works. The instructions in this page have been tested by copying them and pasting them into a shell and they have been demonstrated to make a working gramps. however, your results may vary. In fact, one day there may be a shell script to do all this, but not just yet.
To build gramps with gtk-osx:
If Macports or Fink Files are in the PATH for looking up exectuables or libraries, or if shell variables have been set up by MacPorts or Fink for their specialised build methods, gtk-osx will fail in very obscure ways.
One way of avoiding any leftovers from MacPorts or Fink is to create a new user, using sytem preferences - accounts, and log in as that user. "trial" is a suitable name for the new user. That will create a new home directory /Users/trial where everything will live. User trial will not have write permission on any other user files, so cannot mess very much up. The trial account doesn't need admin privileges, so cannot even mess anything up with sudo. The symbol ~ means "my current home directory" and can be typed at the shell instead of /Users/trial (or whatever the account is called). It is stongly suggested that creating an account specifically to build gramps, and logging in to that account, is a ''Good Thing'' during this experimental phase.
====install git====
====Get jhbuild for gtk-osx====
Get [http://downloads.sourceforge.net/sourceforge/gtk-osx/gtk-osx-build-setup.sh get-osx-build-setup.sh] by clicking on it and store it in the directory ~. (Move it there with the finder if it ended up on the desktop or in Downloads.) At the terminal window, give this program execute permission and execute by typing:
* chmod +x gtk-osx-build-setup.sh
* ./gtk-osx-build-setup.sh
The script should fetch the jhbuild code from the web. jhbuild is the tool used to control all the building here. The version fetched has been customised for gtk-osx. The script puts the jhbuild code in ~/Source, and then builds the jhbuild executable. It's supposed to end up in ~/bin/jhbuild, but it seems to get stuck in ~/.local/bin/jhbuild, a hidden directory. The command ls -la shows hidden directories, which the finder cannot usually manage.
If jhbuild hasn't appeared in ~/bin, create ~/bin and link jhbuild there by typing
Rerunning the script eventually fixed it. It's probably a problem with the server that delivers the source.
Problem: help, it's all hung up while downloading. The servers that provide the downloads for all this could be more reliable. They can hang up, literally, for hours. However, eventually, they start up again. Usually, there is no problem. It may be necessary to hit ctrl-c on the terminal, when jhbuild will ask what to do next. Continuing to fetch the source generally works.
====Set up PATH to find new programs====
* PATH=~/gtk/inst/bin:~/bin:$PATH
~/gtk/inst/bin is where jhbuild will put the programs it builds, including gramps. It's important that it is the first place that the system looks, at the front of the PATH, because jhbuild will also put a python there which has to be used in preference to any existing python program.
====Set up the jhbuild environment====
Type
====Write definitions of the new programs====
jhbuild needs a definition of the moduleset, the set of modules to build to make a program. It knows about most things (it fetches the definitions from the web) but not about a new python and not about gramps. I don't know hwo how to provide a file here in the wiki for easy downloading, so I've pasted the text in here. Copy the text from here and paste it into the new file ~/Source/jhbuild/modulesets/python-gramps.moduleswith an editor like Apple textedit or vi.
<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*-->
This file is telling jhbuild what "modules" are going to be built, what source is needed for each build, what patches are needed on the sources to make them work, and how to build them.
====Define the Patches Gramps needs for Mac====
Gramps hasn't traditionally been developed for Mac, so some things don't quite work right out of the box. jhbuild can apply patches to code after it ahs has been downloaded and before it has been built, which is very handy. It does this with the patch utility. jhbuild looks for the patch files, that drive the patching process, in the directory ~/Source/jhbuild/patches. Again, I should like to provide the file to download, but don't know how to do that, so paste this text into the file ~/Source/jhbuild/patches/gramps-3.1.2.patch.
--- configure.orig 2009-06-20 20:17:18.000000000 +0100
+++ configure 2009-06-20 20:19:28.000000000 +0100
for lpath in search:
- prog = os.path.join(lpath, 'xdg-open')
+ prog = os.path.join(lpath, utility')
if os.path.isfile(prog):
os.spawnvpe(os.P_NOWAIT, prog, [prog, norm_path], os.environ)
This gobbledegook fixes two problems.
First, it patches ~/gtk/source/grampgramps-3.1.2/configure to work around the problem that find_module() cannot handle "/" in a filename on Mac, for unknown reasons. Second, it patches ~/gtk/source/gramps-3.1.2/src/Utils.py to tell gramps how to open a file viewer on Mac, which is different from Linux.
====Build the custom python====
python is /usr/bin/python
====Build some more environment====
Type (one line at atimea time, with a long gap inbetween)
jhbuild build meta-gtk-osx-bootstrap
jhbuild build meta-gtk-osx-core
and a whole pile of text should scroll by ending in ***Success*** each time. Each step will take quite a while, time for coffee, or maybe lunch.
====Build everything else====
Type, with long gaps in between
jhbuild build meta-gtk-osx-python
jhbuild build shared-mime-info
jhbuild build -m python-gramps build customgramps
and that should build everything that gramps needs, then gramps itself.
Type
57
edits