Skip to content

Instantly share code, notes, and snippets.

@felixbuenemann
Created February 21, 2016 03:57
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixbuenemann/742f1fdac998b17bfcda to your computer and use it in GitHub Desktop.
Save felixbuenemann/742f1fdac998b17bfcda to your computer and use it in GitHub Desktop.
#!/bin/sh
# Script to compile vips from git for AWS lambda as dynamic binary
# Run on a fresh amzn-ami-hvm-2015.09.1.x86_64-gp2 image.
# Tested with image id ami-bff32ccc on t2.micro in eu-west-1.
set -e # abort on errors
# set -x # for debugging
echo Installing build dependencies...
sudo yum install git gcc-c++ libtool swig gtk-doc glib2-devel \
gobject-introspection-devel libxml2-devel giflib-devel libpng-devel \
libtiff-devel lcms2-devel ImageMagick-devel
if [ -e libvips ]; then
echo Fetching vips master...
cd libvips
git fetch origin
git checkout -f master
git reset --hard origin/master
else
echo Cloning vips master...
git clone --depth 1 https://github.com/jcupitt/libvips.git
cd libvips
fi
version=`awk '/AC_INIT/ {match($2,"[0-9.]+",a)}END{print a[0]}' < configure.ac`
revision=`git rev-parse --short HEAD`
echo Compiling and installing vips $version-$revision...
./bootstrap.sh
./configure --prefix=/tmp/vips --disable-introspection
make -j`nproc` install-strip clean
cd ..
tarball=vips-$version-$revision.tar.bz2
echo Creating tarball $tarball...
tar cvjf $tarball -C /tmp vips
rm -rf /tmp/vips
echo Finished...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment