Building Atari800 for MS Windows
================================

Atari800 executable for Windows is built the same way as on any other Unix-like
OS: using a Unix-like environment such as Cygwin, MinGW or MSYS2.

All of these toolchains provide a Unix-like environment on Windows, so building
Atari800 with them is based on the same configure/make sequence as on other
platforms. The procedure is described in detail in DOC/INSTALL, section
"Building the Emulator on most platforms" - read it before continuing below.

There are several configure options applicable to the Windows platform:
   Type "./configure --with-video=<choice> --with-sound=<choice>" to build other
   versions. The available options are:
   * --with-video:
     * sdl - uses SDL,
     * ncurses - uses the ncurses library,
     * no - pure console interface.
   * --with-sound:
     * sdl - uses SDL,
     * no - no sound.
   You can add other configure options if desired.

The recommended version is --with-video=sdl --with-audio=sdl, as it has the
largest set of features.


Building the SDL version
------------------------

The procedure for building the SDL version is described in DOC/INSTALL, section
"Building the Emulator for SDL".


Notes on building using Cygwin
------------------------------

1. Get Cygwin at http://cygwin.com/
2. The executable requires the following DLLs: /bin/mgwz.dll and (for SDL)
   sdl.dll - copy them to the same directory as atari800.exe.


Notes on building using MinGW
-----------------------------

1. To build the SDL version with OpenGL support, get the OpenGL headers at
   http://www.libsdl.org/extras/win32/common/opengl-devel.tar.gz .
   See also http://www.libsdl.org/extras/win32/mingw32/README.txt
2. If the configure script does not find the SDL library, you might need to add
   "--with-sdl-prefix=/mingw" to the configure options.


Notes on building using MSYS2
-----------------------------

1. Install MSYS2 itself:
  - Based on:
    https://www.msys2.org/
    https://www.msys2.org/wiki/MSYS2-installation/
  a) Get the MSYS2 installer package from https://www.msys2.org/ . The
     instructions below is tailored towards MSYS2 release dated 20250221, which
     was the latest at the time of this writing.
  b) Run the installer to install the environment.
     - Note: MSYS2 provides 5 Start menu shortcuts to the MSYS shell:
     "MSYS2 MSYS" - use this and only this shell to install or remove packages.
     "MSYS2 CLANG64" - use this shell to build 64-bit programs with clang
                       compiler and UCRT64 runtime.
     "MSYS2 CLANGARM64" - use this shell to build 64-bit programs for ARM CPU
                          with clang compiler and UCRT64 runtime.
     "MSYS2 UCRT64" - use this shell to build 64-bit programs with gcc
                      compiler and UCRT64 runtime.
     "MSYS2 MinGW64" - use this shell to build 64-bit programs with gcc
                       compiler and MSVCRT runtime.
     See https://www.msys2.org/docs/environments/ for more detailed
     description.
  c) If not selected at the end of installer, run "MSYS2 MSYS" shell (from Start
     menu).
  d) Update the environment using pacman -Syuu. Run it multiple times until no
     more packages are left to update.
     Note: if after an update there appears a message to "exit pacman without
     returning to the MSYS shell", then close the MSYS shell window, and use
     Task Manager to kill the "pacman.exe" process that is left hanging. Then
     re-run "MSYS2 MSYS" to continue updating.

2. Install packages required by Atari800:
  - Note: to install a package, enter
    pacman -S <package_name1> <package_name2> ...
  a) Start the "MSYS2 MSYS" shell.
  b) If you want to regenerate the configure script, install the following
     packages:
     - autoconf
     - automake
     - perl
  c) To build Atari800, install:
     - make
     - mingw-w64-ucrt-x86_64-gcc
     - mingw-w64-ucrt-x86_64-SDL
     - mingw-w64-ucrt-x86_64-readline
     - mingw-w64-ucrt-x86_64-libpng

3. Build Atari800:
  a) Start the "MSYS2 UCRT64" shell to build the 64-bit binary.
  b) Follow the common build procedure as described in DOC/INSTALL, section
     "Building the Emulator for SDL".
  c) The executable requires the following DLLs - copy them from ucrt64/bin
     to the same directory as atari800.exe:
     - libpng16-16.dll
     - libreadline8.dll
     - libtermcap-0.dll
     - SDL.dll
     - zlib1.dll
