After long frustration, let's do this.
We want:
- A relocatable binary (just the binary, nothing else)
- Static plugins (delegates) such as png
- Static freetype support so we can annotate images
Homebrew
Homebrew seems to be the most straightforward solution. See paragraph for the manual approach.
# Check available homebrew options
brew options imagemagick
# ok, looks like we need --without-modules --with-zero-configuration later
brew edit imagemagick
# in def install:
# --disable-shared to disallow shared libs
# now build. optionally uninstall:
brew uninstall imagemagick
brew install imagemagick --without-modules --with-zero-configuration
# your binaries are here:
echo `which convert montage compare`
A note on using freetype fonts:
because we built --with-zero-configuration, you might not be able to see any fonts to choose from. Using an absolute path to a font file as an argument to -font made this work for me, as in montage -font /path/to/arial.ttf -label ...
.
Manual
The hard way (works, but no freetype)
I'll try to stay fuzzy for future compatibility.
IMBUILD=/tmp/imbuild
mkdir $IMBUILD
# get IM (Version 7 at the moment)
mkdir im_download && cd im_download
curl -O http://www.imagemagick.org/download/ImageMagick.tar.gz
for file in *.gz ; do tar zxf $file; done
rm *.tar.gz
cd ImageM*
# get delegates
# png
curl -O http://www.imagemagick.org/download/delegates/libpng-1.6.24.tar.gz
tar zxf libpng*.gz && rm libpng*.gz && mv libpng* png && cd png
./configure --disable-shared --disable-dependency-tracking
make
cd ..
# freetype
curl -O http://www.imagemagick.org/download/delegates/freetype-2.6.5.tar.gz
tar zxf freetype*.gz && rm freetype*.gz && mv freetype* freetype && cd freetype
./configure --disable-shared --disable-dependency-tracking
make
cd ..
# tiff
curl -O http://www.imagemagick.org/download/delegates/tiff-4.0.4.tar.gz
tar zxf tiff*.gz && rm tiff*.gz && mv tiff* tiff && cd tiff
./configure --disable-shared --disable-dependency-tracking
make
cd ..
#build imagemagick (YMMV)
./configure --disable-shared --disable-dependency-tracking --enable-delegate-build --disable-installed --without-frozenpaths --prefix $IMBUILD --with-openexr=no --disable-docs --without-lcms --without-x --without-webp --without-jpeg --without-pango --enable-hdri=no --without-gvc
make install
ls $IMBUILD/bin