-
Notifications
You must be signed in to change notification settings - Fork 30
How to build Gem on macOS Sierra (10.12)
This document describes how to build Gem on macOS Sierra (10.12).
It's worth nothing that Gem is currently in a kind of limbo as far as video playback on recent macOS releases. This is because Apple depreciated the QuickTime framework many years ago in favour of the AVFoundation framework, however the transition is not easy and will require some hard work from very generous developers. So, in the meantime, you can build Gem on macOS Sierra, but you won't get video.
You obviously need macOS Sierra.
If you want to keep your working OS clean of your experiments, you can do all
the following in a Virtual Machine, e.g. using Vagrant
(which wraps virtualisation software like parallels
or virtualbox
)
and this Vagrant box.
$ vagrant init jhcook/macos-sierra
$ vagrant up
$ vagrant ssh
Note, that macOS must only only run on Apple-branded computers.
You need a recent version of Pure Data
(Pd). The latest one can be found on
http://puredata.info/downloads.
Pd-extended is long dead and only your grandpa runs 32-bit software. The 64-bit version of Pd is what you want.
The downloaded app will be called something like "Pd-0.49-1.app" but you can safely rename this to "Pd.app" because we're not animals.
You need to download the Xcode Command Line tools. They come with Xcode but if you don't want to install full Xcode development package, you can run the following in a terminal:
$ xcode-select --install
and then click Install rather than Get Xcode.
Homebrew is a package manager for OSX that provides various libraries. It is not strictly necessary to build Gem, but it comes in handy if you want to install third-party libraries.
To install it, paste the command from their homepage:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
With a recent enough brew
installation, you can install most dependencies with a single command:
$ brew bundle --no-upgrade --file=.git-ci/macOS.brew
pkg-config
eases the use of various development packages:
$ brew install pkg-config
You will need automake
to make it happen:
$ brew install automake
The autoconfig will expect libtool
to be installed:
$ brew install libtool
And finally you also need the GNU tool gettext
:
$ brew install gettext
(There is some advice floating about to --force
link gettext
. Do not do
this! You risk making your system unstable.)
When working with git repositories, having a ~/Developer directory is nice. You can create it in Finder, or in Terminal:
$ cd
$ mkdir Developer
$ cd Developer
Or you can place it anywhere you like.
Now to clone Gem:
$ git clone https://github.com/umlaeute/Gem.git
$ cd Gem
If you've followed the instructions in "Build Dependencies, the easy way", you already have all those things installed. No need to do it again.
Gem has a plug-in system which adds functionality depending on installed libraries.
You do not need to install any of these, and my preference is always to stick with the least and go from there.
To build Gem with support for jpeg and tiff images:
$ brew install jpeg libtiff
At the time of writing, building Gem with ImageMagick installed will fail, so
avoid installing that for the moment. (See
https://github.com/umlaeute/Gem/issues/134)
If you want to render fancy 3D fonts and such:
$ brew install ftgl
macOS comes with an OpenGL framework but you can enable other outputs by adding some libraries:
$ brew install sdl glfw glfw@2
The following steps will build Gem from the commandline using autotools
.
I assume that you have changed your working directory to the Gem root.
If you have cloned the git repository, you have to build the building tool
yourself. However, the provided autogen.sh
won't work, because it expects
gettext
to be in your PATH
(which it should not be). But since you installed
it via Homebrew, you can prepare the installation anyway.
$ /usr/local/opt/gettext/bin/gettextize
$ autoreconf --install --verbose
(n.b. this does exactly what autogen.sh
would have done anyway.)
After many years of warning, Apple has removed some very old frameworks that were depreciated many years prior.
The Carbon framework was deprecated in OS X 10.8 (released in 2012).
The QuickTime framework was deprecated in OS X 10.9 (released in 2013).
Neither of these frameworks are available on 64-bit systems. To appropriately configure the build chain for Gem, you used to need to disable these frameworks by adding:
--without-QuickTime-framework --without-Carbon-framework
to your final configure command. Luckily, the configure script will detect automatically, whether it can use these frameworks.
Since ImageMagick currently causes the build to fail, you need to disable that too:
--without-ImageMagick
If you chose not to install ftgl
(but why would you?):
--without-ftgl
Now that you've cleared the cruft, you'll also need to specify where the build chain can find Pd, which will be something like:
--with-pd=/Applications/Pd.app/Contents/Resources
Keep in mind that your Pd.app might be called something funky like "Pd-0.49-1.app" if you haven't renamed it.
If you have Pd.app installed in ~/Applications you want:
--with-pd=$HOME/Applications/Pd.app/Contents/Resources
And since you're dealing with a MacOS GUI, you want the following:
--with-defaultwindow=gemmacoswindow
OR since you prefer a different window toolkit like GLFW3, you want the following:
--with-defaultwindow=gemglfw3window
Your complete configure command will look something like this (w/ MacOS Window):
./configure --with-pd=/Applications/Pd.app/Contents/Resources --with-defaultwindow=gemmacoswindow
OR something like this (w/ GLFW3 Window):
./configure --with-pd=/Applications/Pd.app/Contents/Resources --with-defaultwindow=gemglfw3window
If all goes off without a hitch, you can move on to...
Then build with:
$ make
And you're finally ready to install Gem! The default will install in
/usr/local
, which is not very user-friendly, so we will add:
libdir=~/Library/Pd/ prefix=/Applications/Pd.app/Contents/Resources
This installs all the Gem externals in the usual Pd externals location, but installs the Gem library itself inside Pd.app. If you'd rather keep Gem outside the Pd.app you can use the less aesthetically pleasing:
libdir=~/Library/Pd/ prefix=~/Library/Pd/Gem/stuff
n.b. This means the library files will show up in the help browser, which is annoying. The choice is yours.
To finally install Gem in ~/Library/Pd/:
make install libdir=~/Library/Pd/ prefix=/Applications/Pd.app/Contents/Resources
OR to install to ~/Documents/Pd/externals/ (created by Deken >= 0.48.0)
make install libdir=~/Documents/Pd/externals/ prefix=~/Documents/Pd/externals/Gem/stuff
MORE HELP: Gem comes with a localdeps.macos.sh script that helps embedding libraries with a distributable directory and which is used by our [CI]
make install DESTDIR=$(pwd) libdir=/ extradir=/Gem
find Gem -type f "(" -name "*.pd_darwin" -o -name "*.d_*" -o -name "*.so") -exec .git-ci/[localdeps.macos.sh](http://localdeps.macos.sh/) {} +
(which will add all required dylibs to the Gem/ folder an update the rpaths in the binaries accordingly). After that, you can copy the Gem/ folder to another machine.
Launch Pd.app and you will now be pleasantly surprised to find that nothing has changed. You still need to load the Gem library on startup!
Open Pd > Preferences > Startup... and click New.... Enter "Gem" and click OK.
Restart Pd.app and you should see something like this in the console:
GEM: Graphics Environment for Multimedia
GEM: ver: 0.93.git 3788266f
GEM: compiled on Apr 15 2017
GEM: maintained by IOhannes m zmoelnig
GEM: Authors : Mark Danks (original version)
GEM: Chris Clepper
GEM: Cyrille Henry
GEM: IOhannes m zmoelnig
GEM: with help by Guenter Geiger, Daniel Heckenberg, James Tittle, Hans-Christoph Steiner, et al.
GEM: found a bug? miss a feature? please report it:
GEM: homepage http://gem.iem.at/
GEM: bug-tracker http://sourceforge.net/projects/pd-gem/
GEM: mailing-list http://lists.puredata.info/listinfo/gem-dev/
GEM: compiled for MMX/SSE2 architecture
GEM: using SSE2 optimization
GEM: detected 8 CPUs
GEM: image loading support: SGI jpeg tiff
GEM: image saving support: SGI jpeg tiff
To take it for a test drive, open Help > Browser... > Gem/ > examples/ and anything in there.