
There are several different ways of building and then bundling jigdo
for Windows. See git history for others. How I've done it in 2021 for
0.8.0a:

Install the Debian packages g++-mingw-w64-i686, gcc-mingw-w64-i686 for
the cross-toolchain.

2021-05-31
----------

1. Build bzip2 from scratch, to get a sane current version:

$ apt-get source bzip2
$ cd bzip2-1.0.6/

Edit Makefile to point to Windows toolchain:

CC=i686-w64-mingw32-gcc
AR=i686-w64-mingw32-ar
RANLIB=i686-w64-mingw32-ranlib

Run "make" to get the static libbz2.a

Copy that and bzlib.h into place in the "sysroot"

2. Build zlib from scratch, to get a sane current version:

$ apt-get source zlib
$ cd zlib-1.2.11.dfsg/
$ CC=/usr/bin/i686-w64-mingw32-gcc ./configure --static

Run "make"

Copy libz.a and z*.h into the "sysroot"

3. Build jigdo-file.exe

Configure things to use the right compiler and the location of the
"sysroot" where the library bits are.

$ ./configure --host i686-w64-mingw32 --with-pkg-config-prefix=/home/steve/debian/jigdo/windows-build/2021-05-31 --without-libdb --includedir=/home/steve/debian/jigdo/windows-build/2021-05-31/include
$ make

4. Grab a binary build of wget: binary build, statically linked,
   includes support for using the Windows certificate store - yay
   HTTPS!

   https://eternallybored.org/misc/wget/releases/wget-1.21.1-1-win32.zip

   Extract the following:
   * wget.exe

5. Grab the rest of the binaries we need from msys (all i686 versions):

coreutils:
   https://repo.msys2.org/msys/i686/coreutils-8.32-1-i686.pkg.tar.xz
   * basename.exe
   * dirname.exe
   * mkdir.exe
   * rm.exe
   * wc.exe

grep:
   https://repo.msys2.org/msys/i686/grep-3.0-2-i686.pkg.tar.xz
   * grep.exe

gzip:
   https://repo.msys2.org/msys/i686/gzip-1.10-1-i686.pkg.tar.xz
   * gzip.exe

sed:
   https://repo.msys2.org/msys/i686/sed-4.8-1-i686.pkg.tar.xz
   * sed.exe

bash:
   https://repo.msys2.org/msys/i686/bash-4.4.023-2-i686.pkg.tar.xz
   * sh.exe

runtime (libs):
   https://repo.msys2.org/msys/i686/msys2-runtime-3.1.7-2-i686.pkg.tar.xz
   https://repo.msys2.org/msys/i686/libiconv-1.16-2-i686.pkg.tar.zst
   https://repo.msys2.org/msys/i686/libintl-0.19.8.1-1-i686.pkg.tar.xz
   https://repo.msys2.org/msys/i686/libpcre-8.44-1-i686.pkg.tar.xz
   https://repo.msys2.org/msys/i686/gcc-libs-9.3.0-1-i686.pkg.tar.xz
   * msys-2.0.dll
   * msys-charset-1.dll
   * msys-iconv-2.dll
   * msys-intl-8.dll
   * msys-pcre-1.dll
   * msys-gcc_s-1.dll

6. For safety, validate the signatures on the binary tarballs, then
   copy all those binaries into <release>/jigdo-bin

7. Test, etc.! Make sure that large files work OK, make sure that
   https works ok, make sure that fallback mirrors work.

