#!/bin/bash

version='3.4.7'
prefix='/usr'
#prefix='/usr/local/squid-'${version}

if [ ! -f squid-$version.tar.xz ] ; then
    wget http://www.squid-cache.org/Versions/v3/3.4/squid-$version.tar.xz
fi
if [ ! -d squid-$version ]; then
    tar xvf squid-$version.tar.xz
fi
cd squid-$version
./configure \
  --prefix=${prefix} \
  --localstatedir=/var \
  --srcdir=. \
  --sysconfdir=/etc/squid \
  --with-default-user=proxy \
  --with-logdir=/var/log/squid \
  --with-pidfile=/var/run/squid.pid \
  --libexecdir=${prefix}/lib/squid \
  --datadir=${prefix}/share/squid
make -j 30
make install
chown proxy /var/log/squid