Changes

Jump to: navigation, search

Mac OS X:Build from source:Application package

4,162 bytes removed, 00:23, 29 March 2022
m
add-on > addon ( stick with one spelling )
==Building Gramps from Scratch==
Building Being able to building Gramps from scratch (from the fundamental Python scripts) is useful to produce a version not currently available as a binary (for exampleyour particular OS platform or version. Or, a PPC version) or to produce a complete environment for debugging and further development, including debugging of all the C libraries Gramps uses, ... like [https://www.gtk.org/ GTK].
This is a "[https://www.cybrary.it/blog/0p3n/command-line -interface-cli-vs-graphical-user-interface-gui/ command line interface]" process. It's not too difficult, but you'll be using [https://wikipedia.org/wiki/Terminal_(macOS) Terminal.app] and, 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.'''''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 [httphttps://developerwikipedia.apple.comorg/technologieswiki/xcode.html AppleXcode XCode], though you must register as a Mac developer. For Lion/Mountain Lion users, XCode is available for free from the App Storeintegrated development environment.
NextIf you're not familiar with using the unix command line, read you might find the frequent use of "~" ([httphttps://livewww.gnomedictionary.orgcom/GTK%2B/OSXbrowse/Building the build instructions for Gtk-OSXtilde?s=t tilde], '''''especially ) below puzzling. It refers to the Prerequisites''user'''. Download and run the [http:s home directory (mine is /Users/git.gnomejohn; if your name is John, then yours probably is too.org/browse/gtk-osx/plain/gtk-osx-build-setup.sh gtk-osx-build-install.sh] script, which will set up jhbuild for you) You can use it that way in commands if your current directory is somewhere else.
''It's important that jhbuild is not confused by any existing 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.=== Step 1: Install Xcode ===
If you are running OSX 10.7 Lion or later, youYou'll need a compiler. Apple provides two ways to [httpsinstall one:"Command Line Tools" installs just the command-line build environment and puts most of the header files in <tt>/usr/liveinclude</tt>.gnome.orgSimply trying to run a program that requires it like <tt>gcc</GTK%2Btt> or <tt>git</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 tt> should produce a dialog box offering to install them, but if that wondoesn't work you can run. See https:<tt>sudo xcode-select --install<//bugzillatt>.gnomeApple also has a full-featured integrated development environment called Xcode.org/show_bug.cgi?id=702908 It's available for detailsfree from the App Store.
If you're not familiar with using try to download Xcode, Apple will probably offer you the unix command linelatest version of Xcode, irrespective of whether it runs on the version of Mac OS X you are using (Apple probably expects you might find to upgrade everything to the frequent use of "~" below puzzlingvery latest). It refers You may need to the usersearch for an earlier version. For example, if you's home directory (mine is /Users/john; if your name is Johnre running Mac OS X 10.11 El Capitan, then yours it is probably is toobest to use Xcode 7 (e.g. Xcode 7.3.1) You can use it that way in commands if . Older versions of Xcode are available from [https://developer.apple.com/downloads Apple's developer site]; you'll need to register your current directory is somewhere elseAppleID for development.
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
==== Gramps 3.4.x =Step 2: Install jhbuild ===
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 httpread [https://sourceforgewiki.gnome.netorg/pProjects/grampsGTK/sourceOSX/ci/maintenance/gramps34/%7E/tree/mac/gramps.modules?format=raw That will retrieve Building the modules file to your current directory, which we'll assume to be ~.  The build instructions for 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 '''''especially the following commands 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 jhbuild by default puts everything it is building in ~/gtk (controlled by the hidden files ~/.jhbuildrc and ~/.jhbuildrc-custom ). ~/gtk/source contains the downloaded sources, and ~/gtk/inst contains the built libraries and applications. Not everything that this procedure builds will be included in the Gramps application bundle; there are some intermediate dependencies and build tools that are necessary for building everything but not required at runtime. ```That doesnPrerequisites'''''t mean that some modules can be skipped.``` At this point, you can do  jhbuild shell gramps
at the command line and run gramps''It's important that jhbuild is not confused by any existing [https://wikipedia.org/wiki/Homebrew_(package_manager) Homebrew], [https://wikipedia.org/wiki/MacPorts MacPorts], or [https://wikipedia. Most everything will work org/wiki/Fink_(see the note about spelling dictionaries abovesoftware)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 any of those installed.
Once you've done this once, you can generally get away with just running jhbuild --moduleset=~Then follow the steps under [https:/gramps-mac/grampswiki.modules build meta-gtk-osx-core meta-gtk-osx-freetype meta-gtk-osx-python grampsto update everything that has been changed since the previous build. Most of the time nothing will have changed except gramps itselfgnome.org/Projects/GTK/OSX/Building#Procedure Procedure]
==== Step 3: Install Gramps 4.0 dependencies and Git Master =Gramps ===
Gramps 4.0 is updated to use the Gtk+-3 series for its GUI. This requires a couple of changes. Download the modules file for the branch you want to build: curl -o gramps.modules httphttps://sourceforgeraw.netgithubusercontent.com/pgramps-project/gramps/source/ci/maintenance/gramps40/%7E/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
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:
==== .jhbuildrc-custom ====
It's annoying tedious and error-prone to type the long list of modules every time you want to build gramps, so . 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 '_'. == Gramps 3.x and EXIF Editing == Gramps 3.3.0 introduced a new module, EXIF Editing, which has two tricky dependencies that JHBuild doesn't know how to handle. Thanks to Gtk+-3, these have been replaced in Gramps-4.0 (and <tt>master</tt>) with a module that JHBuild ''can'' build, so '''these instructions apply only to Gramps-3.4.x'''. In order to evade the persnickityness of jhbuild's dependencies, they're given as "soft" dependencies -- you have to add them to your modules list. If you don't, Gramps will still build fine, you'll just get a warning notice about Exiv2 not being installed. '''Warning:'''Boost-python will not successfully build with either the 10.6 (Snow Leopard) or 10.7 (Lion) SDKs. With 10.7 it won't build at all; with 10.6, it will build but will crash Python on import. Consequently you can't build EXIF editing using Lion or later, since earlier SDKs are not available. The first is [http://www.boost.org/libs/python/doc/ Boost-python], a python interface for C++ provided as part of [http://www.boost.org/ Boost]. It uses its own build system, bjam. Since jhbuild doesn't know how to use bjam, it will download the package for you, then error out. Select item 4, "start a shell", and do the following: cd tools/build/v2 ./bootstrap.sh --with-toolset=darwin ./bjam --prefix="$PREFIX" install cd ../../.. bjam toolset=darwin address-model=32 --prefix=$PREFIX --with-python --cmd-or-prefix=$PYTHON cxxflags="$CXXFLAGS" cflags="$CFLAGS" linkflags="$LDFLAGS" install
Once Do be aware thatdefining new global variables will elicit a warning from <tt>jhbuild</tt> so be careful to prefix any top-level variables with '_'s done, quit the shell and select "2" (ignore error) twice to move on to the next library, [http://tilloy.net/dev/pyexiv2/ PyExiv2], which also uses a different build system, [httphttps://www.sconsdictionary.orgcom/ SCons]. The SCons folks are bright enough to use distutils, which JHBuild ''can'' handle, so that gets built and installed for you. JHBuild will stop again after downloading and extracting PyExiv for you, so once again select "4" to start a shell and run the following: export CXXFLAGS="$CXXFLAGS -I$PREFIXbrowse/include" export CFLAGSunderscore?s="$CFLAGS -I$PREFIX/include" export LDFLAGS="$LDFLAGS -lpython2.7" scons scons install ln $PREFIX/lib/python2.7/site-packages/libexiv2python.dylib $PREFIX/lib/python2.7/site-packages/libexiv2python.so install_name_tool -id python2.7/site-packages/libexiv2python.dylib $PREFIX/lib/python2.7/site-packages/libexiv2python.dylibQuit the shell and pick "2" a few more times to move on to the next modulet underscore]).
=== Webkit ===
Gramps has an optional dependency on [https://webkit.org/ WebKit], which is used for the <tt>html-renderer</tt> add-onaddon. If for some reason you want to use this add-onaddon, add <tt>WebKit</tt> to your list of dependencies but be aware that it may take a long time to build.'''''WebKit will not build on 10.4 (Tiger) or earlier systems, nor will it build against a 10.4 SDK. You must be running 10.5 (Leopard) or newer for this procedure to succeed!'''''
== 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>:
Now open a jhbuild shell and run the bundler:
jhbuild shell
chmod +w $PREFIX/lib/libpython2.7.dylib
gtk-mac-bundler ~/gtk/src/gramps/mac/gramps.bundle
== Packaging ==
To make an uploadable disk image, create a folder named "Gramps-arch-version", replacing "arch" with either Intel or PPC and "version" with the current version number. Drag your app bundle to this directory. Open your build directory and copy (option-drag) the files "FAQ", "COPYING", "README", and "NEWS" to the Gramps folder you just made. Rename each to have a ".txt" extension so that they're readable with QuickLook. You might also rename COPYING to License.txt so that it's its meaning is more clear to users who aren't familiar with the GPL.
Now open Applications>Utilities>Disk Utility and select File>New Image From Folder and select your folder, then approve the name and location. You'll have a dmg ready for distribution.

Navigation menu