fix check for detection of installed packages on Debian

dpkg-query returns an exit code of 1 when a package is not installed,
which causes an error in the build script. Now, the full list of
packages is read and the desired packages are looked up in it which
should fix #1707
allow changing the location in which the chroot environments are created

Also document the fact they are created in /opt/wkhtmltopdf-build by
default, which was requested in #1713
prefer SUDO_USER over logname to find login for granting schroot access

SUDO_USER is reported to work more reliably in certain scenarios
(see #1713) and it can be overridden easily if running as root.
create the linux chroots under /var/chroot by default

This is a better location and more likely to have free disk space,
as /opt might be mounted with insufficient disk space (see #1713)
use gmake wherever it is available for the posix-local build

This is useful when the default make is not GNU make e.g on FreeBSD
update the installation instructions comprehensively
install debian-archive-keyring before creating the chroot environments

This is required on Ubuntu and validates that the Release signatures
are valid, and is already installed by default on Debian. Unfortunately,
there is no way we can do the same for Ubuntu as ubuntu-archive-keyring
is not yet present in the Debian stable release and the name differs
from the Ubuntu version (ubuntu-keyring vs ubuntu-archive-keyring).
improvements in building dependent libraries for Windows

In preparation for additional libraries being downloaded/compiled, a helper
function download_tarball was added and the downloading/extraction process
was made more robust in the build script.
remove dependency on libwinpthread-1.dll for the newer MinGW-w64 builds

Newer versions of MinGW-w64 introduce a dependency on it for threads
support, which is removed by passing the -static flag to the linker
and fixes #1723
do not support a debug build for OpenSSL

This is not very useful as crashes are unlikely to happen in
dependent libraries.
avoid using print statement in the build script

This ensures that the output is flushed properly when redirected to
a file, and is a step towards achieving compatibility with Python 3.
implement a more generic approach for building dependent libraries

This will allow us to build more dependent libraries in the future.
use system libraries for zlib, libpng and libjpeg

This is implemented for Windows, Linux and the POSIX builds. For OS X,
we use the bundled versions of libpng and libjpeg as they may not be
available at runtime.
make the build script more compatible with Python 3
Merge remote-tracking branch 'upstream/master'

Conflicts:
	scripts/build.py