How vendor\libtorrent was built
===============================

vendor\libtorrent holds libtorrent-rasterbar 2.1.3 as a prebuilt static
library with its headers, so BetaTorrent builds without this step. These are
the files it was made with, for whoever wants to rebuild or replace it.

  build-libtorrent.sh
      The build: compiles libtorrent's sources with the same compiler and the
      same defines as BetaTorrent's build.bat (the two must agree), and puts
      the library, the headers and the licence in vendor\libtorrent.
      Run it from Git Bash or MSYS2:   sh build-libtorrent.sh

  betatorrent-2.1.3-no-thread-local-destructors.patch
      The one change made to libtorrent's source. With MinGW-w64, a
      thread_local object that has a destructor is destroyed at thread exit on
      memory that was already freed, which corrupts the heap. Apply it in the
      source folder first:   patch -p1 < ../betatorrent-2.1.3-no-thread-local-destructors.patch
      The script checks at the end that no such destructor is left, and fails
      if the patch is missing.

  threading-selftest.cpp
      Shows why -D_GLIBCXX_ATOMIC_WORD_BUILTINS=1 is needed with this
      compiler (GCC 16.1 from WinLibs): it fails without the define and passes
      with it.

Folders the script expects
--------------------------

The script was run from a folder "ltbuild" next to the folders below. The
paths are set in its first lines (SRC, TC, DEPS, OUT); change them there if
your layout differs.

  ltbuild\build-libtorrent.sh                 this script
  ltbuild\libtorrent-rasterbar-2.1.3\         libtorrent's source, from
                                              https://github.com/arvidn/libtorrent/releases
                                              with the patch applied
  toolchain\bin\                              MinGW-w64: g++, ar, nm
  msys64\ucrt64\                              Boost 1.92 headers and OpenSSL 4.1.0,
                                              from MSYS2's ucrt64 packages
  projects\BetaTorrent\1.00\vendor\libtorrent where the result goes
