set -e -x

echo "Extracting pcre..."
tar xzvf nginx/pcre-8.38.tgz

echo "Extracting nginx..."
tar xzvf nginx/nginx.tar.gz

echo "Building nginx..."

pushd nginx-*
  ./configure \
    --with-debug \
    --with-pcre=../pcre-8.38 \
    --prefix=${BOSH_INSTALL_TARGET} \
    --with-http_ssl_module \
    --with-stream

  make
  make install
popd
