`find_program()` evaluates to `python psl-make-dafsa` on Windows, so
running it with `python` evaluates to `python python psl-make-dafsa`,
causing this error on Windows:
```
"c:/python38/python.exe" "python" "C:/projects/repos/libpsl/src/psl-make-dafsa" "--output-format=binary" "C:/projects/repos/libpsl/list/public_suffix_list.dat" "tests/psl.dafsa"
c:/python38/python.exe: can't open file 'python': [Errno 2] No such file or directory
```
In an environment where only Python 3 is installed, configure.ac finds and sets
PYTHON=python3 correctly but src/psl-make-dafsa is called directly, so the hashbang of
`#!/usr/bin/env python` is used which doesn't exist.
Fix this by explicitly running $(PYTHON) when using the tool.
Use WSAStringToAddressW() instead of inet_pton()
Undefine _WIN32_WINNT before (re)define it.
Fix if this macro is already declared somewhere.
Just add Winsock, no need to test anymore.
The number of characters must be used.
Use countof() macro instead
Improved fixes for Windows
We must link to ws2_32.lib for all Windows builds, and we need to use
workarounds for alloca() and snprintf() since Visual Studio uses
_alloca() for alloca() and provides snprintf() only on Visual Studio
2015 or later, meaning that we need to use _snprintf() here.
Also fix the parts where we run the Python scripts to generate items,
since those scripts already have shebang lines for Meson to pick up.
This adds a set of Visual Studio NMake Makefiles that can be used to
build libpsl, either as a DLL or as a static .lib. Building of the psl
tool and the tests in tests/ (but not fuzz, since those tests use
fmemopen(), that is not supported on Windows) are also supported.
A simplified "install" target is provided that copies the build
results to a default or set prefix with the pkg-config file so that
other packages (such as libsoup) with build systems that depend on this
.pc file can be built.
These files make use of autotools stuff so that they have the up-to-date
version info upon a release.
Currently, only builds using the ICU runtime/builtin or with no
runtime/builtin are supported with Visual Studio builds.
Include the Windows/Winsock2 counterparts of the networking headers on
Windows and avoid including *NIX-specific headers on Windows.
Also remove the small bits of C99isms from the code.
Large inputs on psl_registrable_domain() and psl_unregistrable_domain()
suffer from a O(N^2) behavior. This change limits N to avoid excessive
CPU usage.
At the same time we limit the fuzz corpora size to 64k which is far more
then we expect any real life domain to be.
Reported-by: OSS-Fuzz