#install Dependencies

apt install -y curl gnupg dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev unzip git
#add repo
curl -L https://nginx.org/keys/nginx_signing.key | apt-key add -
wget https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/config/apt/nginx.list -O /etc/apt/sources.list.d/nginx.list
apt update

#source Nginx
cd /usr/local/src
git clone --recursive https://github.com/google/ngx_brotli.git
apt source nginx
apt build-dep nginx -y

#
cd /usr/local/src/nginx-*/
sed -i -e 's/ssl_preread_module --with-c/ssl_preread_module --add-module=\/usr\/local\/src\/ngx_brotli --with-c/g' debian/rules
sudo dpkg-buildpackage -b -uc -us
#DEB files are in /usr/local/src
