Note: These instructions are likely missing key details. Feedback is welcome and appreciated.
The following is my attempt at documenting the steps I took to compile the latest version of Resynthesizer on macOS Sierra (10.12.6) for GIMP 2.10.10.
Homebrew was used to fulfill as many dependencies as possible.
GIMP must be installed from source in order to provide the necessary libraries for Resynthesizer, but I was able to use the plugin with GIMP installed by Homebrew (brew cask install GIMP
). At this time, the cask provided is version 2.10.10.
- Setup build directory
- Acquire sources
- Install dependencies
- Compile GIMP
- Compile Resynthesizer
- Install Resynthesizer
# I setup my build directory as recommended by [this howto](https://www.GIMP.org/source/howtos/GIMP-git-build.html) on GIMP.org.
# It allows us to keep things contained.
# You can put your build directory wherever is convenient.
# However, it's best if it's a new, empty directory unless you know what you're doing.
# We will assume that our build directory is '~/Code/build-gimp'.
# Let's refer to this directory with a variable
PREFIX="~/Code/build-gimp"
# We need to create this directory if it does not exist.
mkdir -p $PREFIX
# We also need to create a couple other important directories.
mkdir -p $PREFIX/share # This is where config.site should be placed.
mkdir -p $PREFIX/bin
# In my case, I had installed perl from Homebrew at some point in the past.
# It did not come with a module GIMP needed to compile, so rather than install
# that module which may have worked, I symlinked the system perl into $PREFIX/bin
# to make GIMP use it instead of the Homebrew version.
# You may or may not have this issue.
# ln -s /usr/bin/perl $PREFIX/bin/perl
# Make sure you've placed 'config.site' in $PREFIX/share
# Now we're going to get the sources we need.
# Make sure we're in our build directory
cd $PREFIX
# First is GIMP
git clone https://gitlab.gnome.org/GNOME/GIMP.git
# Next is mypaint-brushes, a library required by GIMP
git clone https://github.com/mypaint/mypaint-brushes.git
# And finally, Resynthesizer
git clone git://github.com/bootchk/resynthesizer.git
# Now we need to make sure we have the proper versions of our sources
# GIMP, we're compiling for 2.10.10
cd GIMP
git checkout GIMP_2_10_10
cd ..
# mypaint-brushes, GIMP requires v1.3.x
cd mypaint-brushes
git checkout v1.3.x
cd ..
# Resynthesizer, we're compiling the latest version, so nothing to do here
# We need to install all of GIMP's dependencies. Thankfully, almost all of them are
# available in Homebrew.
# These instructions have not yet been tested on a fresh homebrew installation.
# However, I believe we have tracked down all of the dependencies.
# If any are missing, GIMP should list them in the
# next step. Please mention them in the comments.
# They should be a simple `brew install` away.
# Install build tools
brew install autoconf automake intltool libffi libtool pkg-config
# The Homebrew formula for GEGL is built without Cairo. GIMP requires GEGL with Cairo, so we must edit
# its formula before installing it.
# In the editor that appears, add 'depends_on "cairo"' and 'depends_on "pango"' with the other 'depends_on' lines.
# Then comment out or delete the '--without-cairo' line below. Save and exit the file.
brew edit gegl
# Install gegl from source so our edits are used
brew install gegl --build-from-source
# Install the rest of GIMP's dependencies
brew install babl cairo gettext gexiv2 glib-networking gtk-mac-integration lcms2 libmypaint librsvg pango poppler pygtk
# This is where things get interesting.
# We actually have to compile mypaint-brushes before GIMP, but it should be straightforward.
# Make sure our environment is setup correctly. This should be done by configure, but GIMP
# bails before configure if we don't do this early. Might as well do it now.
. share/config.site # Source config.site - sets env vars for autogen.sh, configure, and compiling.
cd mypaint-brushes
./autogen.sh
./configure --prefix=$PREFIX
make
make install
cd ..
# If all went well there should be a mypaint-data directory in share
ls -ld share/mypaint-data
# Now we build GIMP.
cd gimp
./autogen.sh --prefix=$PREFIX --without-libxpm # libxpm does not seem to be available and is unnecessary for our needs
# If you happen to encounter missing dependencies here. Please note them in the comments.
# In the meantime, you can probably find them with `brew search` and `brew install`
# Remember, we are only trying to get GIMP to build successfully. All the optional
# image libraries should not be needed (my assumption) for us to build a working
# copy of Resynthesizer. We're not going to use this copy of GIMP for actual editing tasks.
# Once you've gotten that command to complete successfully, you can proceed with the build.
make
make install
cd ..
# To verify that this worked
$PREFIX/bin/gimp # This should start the copy of GIMP that we just compiled.
# You can quit GIMP and proceed
# We're on the home stretch now
cd resynthesizer
# NOTE: @SimplyTheOther found the following change to be unnecessary on their system.
# You should be able to skip editing the Resynthesizer source. I'm going to leave
# the info here for now just in case.
#
# ** You can likely skip this ** #
# In order to get Resynthesizer to compile on macOS, I had to make a small change in the source.
# Open lib/engineTypes.h in your editor of choice.
# At the end of the file is the definition for swap_vector_elements.
# Add 'static' in front of 'inline void'.
# Save and exit.
# Without this change I was getting a 'symbol(s) not found' error.
# I got the idea to add 'static' from https://stackoverflow.com/a/19069107
# I do not know what the ramifications of this change are, I only know that it compiled and seems to work.
# ** end skip ** #
./autogen.sh --prefix=$PREFIX
make
# I don't believe `make install` will do what we want here, so skip it.
# If there are no errors, proceed to the next step.
# You could copy the plugin files to one of GIMP's default plugin directories,
# but I decided to put them in their own directory and tell GIMP about it.
mkdir plug-ins
cp src/resynthesizer/resynthesizer plug-ins/
cp src/resynthesizer-gui/resynthesizer_gui plug-ins/
cp PluginScripts/*.py plug-ins/
chmod a+x plug-ins/*.py
# Now open your system's copy of GIMP (installed by Homebrew Cask in my case),
# open Preferences, expand the folders dropdown, select Plug-ins, and add the plug-ins folder
# we just created to the list.
# Click OK. Then restart GIMP.
# Filters > Enhance > Heal Selection and several others should now be available.
Hello @ryan-robeson:
Yes, I can verify that
echo $PREFIX
shows the expected directory that I set up in Step 1.I also should clarify that where I receive the warning
aclocal-1.16: warning: couldn't open directory '/share/aclocal': No such file or directory
under Step 4 happens after I cd intomypaint-brushes
.Continuing along Step 4 (if I ignore that initial warning),
make
andmake install
in themypaint-brushes
directory do not produce warnings/errors.I then cd into
GIMP
(for me all caps) and upon running./autogen.sh --prefix=$PREFIX --without-libxpm
see the same warning (aclocal-1.16: warning: couldn't open directory '~/Code/build-gimp/share/aclocal': No such file or directory
) followed by the errors:The
config.log
file only provides the additional errors:Side note: I did notice a few different versions than you (
glib/2.62.2
andgettext/0.20.1
), which I updated in theconfig.site
file. I tried both versions of theconfig.site
file (in terms of whether I setexport ACLOCAL_FLAGS
with specific flags or not)