
This file is a HOWTO for the cross-compiling of Windows 32 and 64 bit
binary DLLs built from a tarball generated by 'make dist' in a Git
checkout.  The resulting DLLs are built with a cdecl interface compatible
with MS VC++.


Prerequisites
=============

In these steps the release or daily snapshot tarball is unpacked in
$HOME/builds for the Windows build and all operations are done from there
unless otherwise noted.

Under Linux you need at least the following packages:

mingw-w64       cross-compiler
zip             create the archive
tofrodos        convert to DOS text format (CR/LF)
groff           convert nroff manual pages to HTML

On Debian 8 (Jessie) and later versions the mingw-w64 package works and is
being used to build the daily Windows 32/64 snapshots and stable releases.
The release and daily snapshots are built in a Debian 10 (Buster) virtual
machine.

Finally, the Windows version of libusb 1.0 must be available for the USB
backends to be built.  Download the latest libusb-1.0 from:

https://sourceforge.net/projects/libusb/files/libusb-1.0/

and unzip the archive in $HOME/builds.

libusb 1.0.20 is known to work.  Presumably, any 1.X.X version should work.

Several variables may need to be set differently at the top of the script file
depending on your system.

The script now relies on a pair of environment variables to locate the needed
libusb files.

The script generates HTML documents for the included .EXE files using groff
to convert the nroff formatted man pages.


Build for Windows 32/64, cross-compile on Linux:
================================================

Extract the Hamlib tarball into $HOME/builds (if you prefer another directory
be sure to edit the BUILD_DIR variable in the build-w[32|64].sh script):

        $ tar xvfz $HOME/Downloads/hamlib-4.2~git-???????-20210214.tar.gz

Invoke the build-w[32|64].sh script (either requires a Bourne compatible
shell, e.g. bash, dash, etc.) with the name of the directory/Hamlib version to
build (you need not cd into the hamlib directory, although it won't hurt.  The
build-w[32|64].sh script uses absolute paths):

        $ build-w32.sh hamlib-4.2~git

or:

        $ build-w64.sh hamlib-4.2~git


Release Info
============

The structure of the archive is:

$ tree -d
.
|-- bin
|-- doc
|-- include
|   `-- hamlib
|-- lib
   |-- gcc
   `-- msvc

8 directories

The bin/ directory is where the executables and DLL files are placed.  Header
files are under include/Hamlib/ and compiler specific files are under lib/*.
HTML documents for the .EXE programs are in doc/ while text documents
(READMEs and such) are in the main archive directory.  The doc/ directory
contains the classic Unix manual pages converted to HTML.  The embedded
README.w[32|64]-bin.txt file generated by the build-w[32|64].sh script
describes setting the PATH environment variable in Windows 2000, Windows XP,
and Windows 7.


73, Nate, N0NB
