# Maintainer: PktSurf <smlinux@pktsurf.in>
app=privoxy
version=3.0.33
build=2sml
homepage="https://www.privoxy.org/"
download="https://www.privoxy.org/sf-download-mirror/Sources/$version%20%28stable%29/privoxy-$version-stable-src.tar.gz"
desc="Web proxy with advanced filtering capabilities"
requires="zlib pcre"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  # Put the docs where we tell them to go:
  sed -i "/^DOC_DEST/s/= .*/= @docdir@/" GNUmakefile.in

  # The Makefile checks if certain config files exist, and if so, adds a
  # .new suffix.  Turn this behavior off.  We will do it below.
  sed -i "s/\[ -s \"\$(CONF_DEST)\/\$\$i\" \]/false/" GNUmakefile.in

  autoreconf -vif
}

build() {
  ./configure \
    --prefix= \
    --sbindir=/bin \
    --sysconfdir=/etc/"$app" \
    --localstatedir=/var \
    --with-docbook=no \
    --with-user=nobody \
    --enable-no-gifs \
    --enable-compression \
    --enable-large-file-support 

  make
  make install DESTDIR=$pkg

  preprunitservice -s privoxy -d

  (
    cd $pkg/etc/privoxy
    for f in config match-all.action regression-tests.action trust user.action user.filter ;
      do mv $f $f.new
    done
  )

  mkfinalpkg
}

sha512sums="
081eab421edad8c2d24c82e2e36a9dd63376844c22ffdae5f41aff187d6c279ba1bf4c1de90815b49f9bea71f68941c201189278c185c235a14949efeaa1dd99  privoxy-3.0.33.tar.lz
"
