Changes

Jump to: navigation, search

Mac OS X:Build from source:Application package

3,355 bytes added, 15:46, 15 January 2018
Gramps 4.x and Git Master: Updates reflecting Py3 only building for 4.2 and later.
==Building GRAMPS Gramps from Scratch==
Building Gramps from scratch is useful to produce a version not currently available as a binary (for example, a PPC version) or to produce a complete environment for debugging and further development, including debugging of all the C libraries Gramps uses, like gtk.
This is a command-line process. It's not too difficult, but you'll be using Terminal.app, not XCode. Unfortunately, Gtk has so far resisted efforts to get it to successfully cross-compile PPC on Intel or vice-versa, so the whole process must be repeated on machines of each architecture. '''''N.B. This procedure has not been tested against OS X 10.4 Tiger. Some packages may not be compatible with that very old version of OS X.'''''
 
If you're not familiar with using the unix command line, you might find the frequent use of "~" below puzzling. It refers to the user's home directory (mine is /Users/john; if your name is John, then yours probably is too.) You can use it that way in commands if your current directory is somewhere else.
 
=== Step 1: Install Xcode ===
 
You'll need XCode, Apple's development environment. There's a copy on your OS X distribution DVD, or you can download the latest version from [http://developer.apple.com/technologies/xcode.html Apple], though you must register as a Mac developer. For Lion/Mountain Lion users, XCode is available for free from the App Store.
If you try to download Xcode, Apple will probably offer you the latest version of Xcode, irrespective of whether it runs on the version of Mac OS X you are using (Apple probably expects you to upgrade everything to the very latest). You may need to search for an earlier version. For example, as of January 2017, running Mac OS X 10.11 El Capitan it is probably best to use Xcode 7 (e.g. Xcode 7.3.1). If you are running OSX 10.7 Lion or later, you'll need to [https://live.gnome.org/GTK%2B/OSX/Building#Installing_XCode_3_on_XCode_4_systems use Xcode 3]. Building Gramps with Xcode 4.3 or later--which is what is supplied for 10.7 on--produces code that won't run. See https://bugzilla.gnome.org/show_bug.cgi?id=702908 for details.  Earlier version of Xcode were delivered as an installer in a disk image (.dmg). Xcode should be installed in the usual way by double clicking on the installer and following the instructions. Later versions of Xcode are delivered as an Application (.app) in a disk image, with instructions to copy this to your Applications folder. You probably need to run the Application to get it to install everything - if you don't, when you go on to the next step it will complain that you haven't agreed to the Xcode licence agreement. === Step 2: Install jhbuild === Next, read [http://live.gnome.org/GTK%2B/OSX/Building the build instructions for Gtk-OSX], '''''especially the Prerequisites'''''. Download and run the [http://git ''It's important that jhbuild is not confused by any existing Homebrew, MacPorts, or Fink installation.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh gtk-osx-build-install.sh] script'' For this reason, which will set up jhbuild for it can be convenient to create a new Mac User account and log in to that account if youhave either of those installed.
''Download and run the [http://git.gnome.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh gtk-osx-build-install.sh] script, which will set up jhbuild for you. (It's important is assumed here that jhbuild is not confused by any existing MacPorts or Fink installationyou have downloaded gtk-osx-build-install.'' For this reasonsh into your home directory, it can be convenient to create a new Mac User account and log in to that account if you have either of those installedrun the following command from there).
If you are running OSX 10.7 Lion or later, you'll need to [https://live.gnome.org/GTK%2B/OSX/Building#Installing_XCode_3_on_XCode_4_systems use Xcode 3]. Building Gramps with Xcode 4.3 or later sudo sh gtk-osx-which is what is supplied for 10.7 onbuild--produces code that won't run. See https://bugzilla.gnome.org/show_bug.cgi?id=702908 for detailssetup. sh
If youThis may produce a number of warnings but they can be ignored: Checking out jhbuild (7c8d34736c3804) from git... Cloning into 'jhbuild're not familiar with using the unix command line... remote: Counting objects: 45961, done. remote: Compressing objects: 100% (12945/12945), done. remote: Total 45961 (delta 35419), reused 42858 (delta 32831) Receiving objects: 100% (45961/45961), 10.11 MiB | 1.44 MiB/s, done. Resolving deltas: 100% (35419/35419), you might find the frequent use of "~" below puzzlingdone. Checking connectivity... done. It refers Switched to the usera new branch 'stable's home directory Installing jhbuild... -n WARNING: aclocal not available (usually part of package 'autoconf') -n WARNING: automake not available (usually part of package 'automake') -n WARNING: autopoint not available (usually part of package 'gettext') -n WARNING: pkg-config not available (usually part of package 'pkgconfig') -n WARNING: yelp-tools not available (mine is usually part of package 'yelp-tools') -n Configuring jhbuild without autotools -n Now type `make' to compile jhbuild Installing jhbuild configuration... Installing gtk-osx moduleset files... PATH does not contain /Users/john; if your name is Johntim/.local/bin, then yours probably it is toorecommended that you add that.) You can use it that way in commands if your current directory is somewhere else Done.
jhbuild is installed in ~/Source/jhbuild, and produces a binary which appears in ~/.local/bin. You'll want to add ~/.local/bin to your path:
export PATH=~/.local/bin:$PATH
 
Type:
python
to check which version of python you have (exit from python by typing crtl-D). For example, you may see (with Mac OS X 10.11 El Capitan):
$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
 
This shows you have Python 2.7. As described in [http://live.gnome.org/GTK%2B/OSX/Building the build instructions for Gtk-OSX], if you have a version of Python earlier than 2.5, you have to follow the special instructions to build a Python 2.7 module.
 
Now type:
jhbuild bootstrap
 
=== Step 3: Install Gramps dependencies and Gramps ===
 
==== Gramps 3.4.x ====
Next, you need a copy of the moduleset file. You *could* just pass the url to jhbuild, but it's easier to download it:
curl -o gramps.modules httphttps://sourceforgeraw.githubusercontent.netcom/pgramps-project/gramps/source/ci/maintenance/gramps34/%7E/tree/mac/gramps.modules?format=raw
That will retrieve the modules file to your current directory, which we'll assume to be ~.
The Gtk-OSX build instructions are very straightforward, but we need to deviate from them a bit to keep from doing things more than once. Run the following commands command from the terminal:
jhbuild bootstrap
jhbuild --moduleset=~/gramps.modules build meta-gtk-osx-bootstrap berkeleydb python meta-gtk-osx-core meta-gtk-osx-python gramps
to update everything that has been changed since the previous build. Most of the time nothing will have changed except gramps itself.
==== Gramps 4.0 x and Git Master Later ====
Gramps 4.0 x is updated to use the Gtk+-3 series for its GUI. This requires a couple of changes. Gramps 4.2 and later are further updated to use Python3 only, which requires more changes.
Download the modules file for the branch you want to build:
curl -o gramps.modules httphttps://sourceforgeraw.netgithubusercontent.com/gramps-project/gramps/maintenance/gramps42/pmac/gramps.modules  curl -o gramps.modules https:/source/ciraw.githubusercontent.com/maintenancegramps-project/gramps40gramps/%7Emaintenance/treegramps50/mac/gramps.modules?format=raw
or
curl -o gramps.modules httphttps://sourceforgeraw.githubusercontent.netcom/pgramps-project/gramps/source/ci/master/%7E/tree/mac/gramps.modules?format=raw
The list of targets changes to reflect using Gtk+-3:
jhbuild --moduleset=~/gramps-mac/gramps.modules build meta-gtk-osx-bootstrap meta-gtk-osx-freetype meta-gtk-osx-gtk3 berkeleydb python meta-gtk-osx-python-gtk3 gramps-git
For Gramps42 and later it's a bit simpler: jhbuild --moduleset=~/gramps-mac/gramps.modules build meta-gtk-osx-bootstrap gramps-git If you want to build the latest release tarball rather than the latest check-in, use <tt>gramps</tt> instead of <tt>gramps-git</tt> for the last module--but note that since we don't release from the <tt>master</tt> branch, <tt>gramps.modules</tt> doesn't have a <tt>gramps</tt> modulein <tt>master</tt>.
If you're planning to work on several branches, a single checkout will work: Start with <tt>master</tt>. Gramps is pure python, so once you've got everything built you need repeat this only to update the dependencies. You can quickly switch branches in your git repo with:
== Bundling ==
The next step is to create an application bundle. You'll need gtk-mac-bundler, so follow the instructions in the [httphttps://livewiki.gnome.org/Projects/GTK%2B/OSX/Bundling Gtk-OSX Wiki] to download and install it.
Assuming that your local repository wound up in <tt>~/gtk/src/gramps</tt>:

Navigation menu