162
edits
Changes
From Gramps
Update for recent changes to gtk-osx and recent versions of Gramps.
Building Gramps from scratch is useful to produce a version not currently available as a binary 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 the XCodeintegrated development environment.
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, a compiler. Apple's development provides two ways to install one: "Command Line Tools" installs just the command-line build environment. There's a copy on your OS X distribution DVD, or you can download and puts most of the latest version from [http:header files in <tt>/usr/include</developertt>.apple.comSimply trying to run a program that requires it like <tt>gcc</technologiestt> or <tt>git</tt> should produce a dialog box offering to install them, but if that doesn't work you can run <tt>sudo xcode-select --install</tt>.html Apple], though you must register as also has a Mac developerfull-featured integrated development environment called Xcode. For Lion/Mountain Lion users, XCode is It's 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, if you're running Mac OS X 10.11 El Capitan it is probably best to use Xcode 7 (e.g. Xcode 7.3.1). Older versions of Xcode are available from [https://developer.apple.com/downloads Apple's developer site]; you'll need to register your AppleID for development.
=== Step 2: Install jhbuild ===
Next, read [httphttps://livewiki.gnome.org/Projects/GTK%2B/OSX/Building the build instructions for Gtk-OSX], '''''especially the Prerequisites'''''. ''It's important that jhbuild is not confused by any existing Homebrew, MacPorts, or Fink installation.'' For this reason, it can be convenient to create a new Mac User account and log in to that account if you have 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 is assumed here that you have downloaded gtk-osx-build-install.sh into your home directory, and that you run the following command from there). sudo sh gtk-osx-build-setup.sh This may produce a number of warnings but they can be ignored: Checking out jhbuild (7c8d34736c3804) from git... Cloning into 'jhbuild'... 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), done. Checking connectivity... done. Switched to a new branch 'stable' 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 (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/tim/.local/bin, it is recommended that you add that. 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: pythonto 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
=== Step 3: Install Gramps dependencies and Gramps ===
curl -o gramps.modules https://raw.githubusercontent.com/gramps-project/gramps/maintenance/gramps50/mac/gramps.modules
curl -o gramps.modules https://raw.githubusercontent.com/gramps-project/gramps/master/mac/gramps.modules
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> module in <tt>master</tt>.
==== .jhbuildrc-custom ====
It's annoying and error-prone to type the long list of modules every time you want to build gramps, so you may want to modify <tt>~/.jhbuildrc-custom</tt> to declare the <tt>moduleset</tt> and <tt>modules</tt> variables. Note that <tt>.jhbuildrc-custom</tt> is a Python file that is loaded and executed by <tt>jhbuild</tt>, so you can make it quite complex. Do beware that defining new global variables will elicit a warning from <tt>jhbuild</tt> so be sure to prefix any top-level variables with '_'.
=== Webkit ===
Gramps has an optional dependency on WebKit, which is used for the <tt>html-renderer</tt> add-on. If for some reason you want to use this add-on, add <tt>WebKit</tt> to your list of dependencies but be aware that it take a long time to build.
== Bundling ==
The next step is to create an application bundle. You'll need gtk-mac-bundler, so follow the instructions in the [https://wiki.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>:
Now open a jhbuild shell and run the bundler:
jhbuild shell
gtk-mac-bundler ~/gtk/src/gramps/mac/gramps.bundle