#!/usr/bin/env bash

set -euo pipefail

webp_tar_url=https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz

prepare_source() {
  cd /tmp
  wget "$webp_tar_url"
  tar -xzf /tmp/libwebp-*
  rm /tmp/libwebp-*.tar.gz
  cd /tmp/libwebp-*
}

build_and_install() {
  export MAKEFLAGS=-j`nproc`
  ./configure --enable-static --disable-shared
  make
  make install
}

prepare_source
build_and_install
