================================================================
BUILDING GREEK TIMES WAIS SEARCH FROM SOURCE (x64)
                  Beta 2 (v0.9.1-beta2)
================================================================

This folder contains the complete source code for Greek Times
WAIS Search Beta 2.

LICENSE
-------
The Windows port code (Win32 GUI, Winsock layer, CLI engine,
build script, and project documentation) is released under the
BSD 3-Clause License. See ..\LICENSE for the full text.

The freeWAIS-sf 2.2.14 protocol code preserved in this source
tree is governed by the CNIDR 1993 permissive license, written
by Jane Smith for the Center for Networked Information Discovery
and Retrieval at MCNC in 1993. See ..\LICENSE-CNIDR for the full
text. Both licenses are permissive; you may use, copy, modify,
distribute, and sell this software, in whole or in part, subject
to copyright preservation and the no-endorsement clauses in the
respective LICENSE files.

REQUIREMENTS
------------
* Windows 7 SP1 or newer (64-bit)
* MSYS2 installed from https://www.msys2.org/
* The UCRT64 GCC toolchain. Open the MSYS2 UCRT64 terminal
  (purple icon, NOT the regular MSYS2 terminal) and run:

    pacman -Syu
    pacman -S mingw-w64-ucrt-x86_64-gcc

  This installs GCC 15 or newer at C:\msys64\ucrt64\bin\

BUILD STEPS
-----------
1. Open PowerShell in this source\ folder.

2. Prepend the toolchain to your PATH for this session:

    $env:Path = "C:\msys64\ucrt64\bin;" + $env:Path

3. Run the build script:

    .\build_x64.bat

The build takes 10-30 seconds and produces WAIS_Search_x64.exe
(approximately 700 KB) in this folder.

WHAT THE BUILD DOES
-------------------
The build compiles 18 C source files separately and links them
together into a single statically linked Windows 64-bit
executable.

The protocol stack files (zutil, zprot, wprot, wutil, wmessage,
transprt, docid, list, ztype1, irfileio, cutil, panic, ustubs)
are unmodified freeWAIS-sf 2.2.14 code preserved byte-for-byte
from the upstream release dated June 7, 2000, the final release
of the Pfeifer/Govert lineage at Universitaet Dortmund.

The Windows port files (sockets_win, ui_win, win_stubs) and the
application files (wais_cli_engine, wais_gui_win32) are new
code written for this project under the BSD 3-Clause License.
ui_win is structurally derived from the upstream ui.c with
Windows-specific modifications layered on top, which is why it
carries both the original CNIDR header and a new modifications
notice.

The build also compiles wais.rc to embed the application icon
(wais.ico) into the executable as a Win32 resource via windres.

SECURITY HARDENING
------------------
The build script enables several modern Windows binary security
features:

* -fstack-protector-strong   (stack canary protection)
* -lssp                       (runtime support for the canaries)
* -Wl,--dynamicbase           (Address Space Layout Randomization)
* -Wl,--nxcompat              (Data Execution Prevention)
* -Wl,--high-entropy-va       (64-bit ASLR with high entropy)

These flags are typically on by default for x64 MinGW-w64
builds, but Beta 2 makes them explicit so the security posture
is visible in the build script and reproducible across builds.

EXPECTED OUTPUT
---------------
The build will produce many warnings about redefined macros
(bcopy, TELL_USER, alloca, LITTLEENDIAN, ABSOLUTE, IGNORE) and
pointer-to-integer casts in wutil.c. These are all expected and
harmless: they originate in the unmodified freeWAIS-sf 2.2.14
code, which was written for early-1990s Unix where these macros
and casting patterns were standard. The freeWAIS code has not
been modified in any way to silence these warnings, in keeping
with the project's policy of preserving the upstream source
byte-for-byte.

You will also see one warning from the resource compiler:
"src\wais.rc:31: unrecognized escape sequence". This is from
windres, is harmless, and produces a working resource binding.

Only "BUILD SUCCESSFUL: WAIS_Search_x64.exe" at the end matters.

VERIFICATION
------------
After a successful build, verify the binary with PowerShell:

    Get-FileHash WAIS_Search_x64.exe -Algorithm SHA256

The exact hash will vary slightly between rebuilds because of
PE timestamp and embedded build metadata, but the file size
should be approximately 700 KB and the binary should run when
launched (start .\WAIS_Search_x64.exe).

For the canonical Beta 2 release binary's SHA-256, see the
release notes on the GitHub Releases page.

================================================================
End of BUILD instructions
================================================================
