Skip to content

Instantly share code, notes, and snippets.

@amccloud
Created December 26, 2013 19:14
Show Gist options
  • Save amccloud/8137558 to your computer and use it in GitHub Desktop.
Save amccloud/8137558 to your computer and use it in GitHub Desktop.
#!/bin/bash
PWD=`pwd`
PREFIX="$PWD/build"
EXPORT_DIR='ImageMagick.framework'
LIB_PNG='libpng-1.5.17'
LIB_IMAGEMAGICK='ImageMagick-6.8.7-8'
[[ ! -d 'jpeg-9' && ! -f 'jpegsrc.v9.tar.gz' ]] && curl -OL http://www.imagemagick.org/download/delegates/jpegsrc.v9.tar.gz
[[ ! -d $LIB_PNG && ! -f "$LIB_PNG.tar.gz" ]] && curl -OL "http://downloads.sf.net/project/libpng/libpng15/1.5.17/$LIB_PNG.tar.gz"
[[ ! -d 'tiff-4.0.3' && ! -f 'tiff-4.0.3.tar.gz' ]] && curl -OL http://www.imagemagick.org/download/delegates/tiff-4.0.3.tar.gz
[[ ! -d $LIB_IMAGEMAGICK && ! -f "$LIB_IMAGEMAGICK.tar.gz" ]] && curl -OL "http://www.imagemagick.org/download/$LIB_IMAGEMAGICK.tar.gz"
[[ ! -d 'jpeg-9' && -f 'jpegsrc.v9.tar.gz' ]] && tar -xzf jpegsrc.v9.tar.gz
[[ ! -d $LIB_PNG && -f "$LIB_PNG.tar.gz" ]] && tar -xzf "$LIB_PNG.tar.gz"
[[ ! -d 'tiff-4.0.3' && -f 'tiff-4.0.3.tar.gz' ]] && tar -xzf tiff-4.0.3.tar.gz
[[ ! -d $LIB_IMAGEMAGICK && -f "$LIB_IMAGEMAGICK.tar.gz" ]] && tar -xzf "$LIB_IMAGEMAGICK.tar.gz"
[[ -d 'jpeg-9' && -f 'jpegsrc.v9.tar.gz' ]] && rm jpegsrc.v9.tar.gz
[[ -d $LIB_PNG && -f "$LIB_PNG.tar.gz" ]] && rm "$LIB_PNG.tar.gz"
[[ -d 'tiff-4.0.3' && -f 'tiff-4.0.3.tar.gz' ]] && rm tiff-4.0.3.tar.gz
[[ -d $LIB_IMAGEMAGICK && -f "$LIB_IMAGEMAGICK.tar.gz" ]] && rm "$LIB_IMAGEMAGICK.tar.gz"
if [ ! -f "$PREFIX/lib/libjpeg.a" ]; then
cd jpeg-9
./configure --prefix=$PREFIX --disable-shared
make && make install && make distclean
cd ..
fi
if [ ! -f "$PREFIX/lib/libpng.a" ]; then
cd $LIB_PNG
./configure --prefix=$PREFIX --disable-shared
make && make install && make distclean
cd ..
fi
if [ ! -f "$PREFIX/lib/libtiff.a" ]; then
cd tiff-4.0.3
./configure --prefix=$PREFIX --disable-shared
make && make install && make distclean
cd ..
fi
if [ ! -f "$PREFIX/lib/libMagickCore-6.Q16.a" ]; then
cd $LIB_IMAGEMAGICK
[[ ! -d 'jpeg' ]] && ln -s ../jpeg-9 jpeg
[[ ! -d 'png' ]] && ln -s "../$LIB_PNG" png
[[ ! -d 'tiff' ]] && ln -s ../tiff-4.0.3 tiff
./configure --prefix=$PREFIX --disable-shared --enable-delegate-build \
--without-magick-plus-plus --without-perl --without-x \
--without-bzlib --without-freetype
make && make install && make distclean
cd ..
fi
mkdir -p $EXPORT_DIR
cp -r "$PREFIX/include/" "$EXPORT_DIR/include/"
cp $PREFIX/lib/*.a $EXPORT_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment