BUILD NOTES
static site checker
https://ssc.lu/
(c) 2020-2024 Dylan Harris


Introduction
============
SSC can be built on various unii with CMake and gcc or clang for C++ 17
or better, or Visual Studios 2017 / 2019 / 2022 under Windows. I have
built & tested a 64-bit version in various OSs on intel/amd & arm64
(m2) architecture.

Although ssc builds with older compilers on some older systems, not all
features are available.


Libraries
=========

Common dependencies
-------------------
The Visual Studio solutions use vcpkg, so dependencies should be
automagically installed.

Otherwise, ssc needs boost version 1.75 or better (https://boost.org),
a recent copy of the ICU libraries (https://icu-project.org/),
Microsoft's GSL library (https://github.com/Microsoft/GSL) (or define
NO_GSL), and a recent version of libcurl (https://curl.se/)* (or define
NOCURL). Usually, an Operating System's package manager has appropriate
versions ready to install.

You may need to set these environment variables:
- BOOST: if you're not using your operating system's packaged flavour
  of boost, then set BOOST to your boost source root directory;
- ICU_ROOT: if you're not using your operating system's packaged ICU,
  set ICU_ROOT to your ICU source root directory;
- GSL: set it to your GSL root directory.

*libcurl requires a thread-safe underlying SSL library: see
https://curl.se/libcurl/c/threadsafe.html. 

hunspell
--------
Building SSC under unii, including macos, requires a development
installation of hunspell (https://hunspell.github.io/).

winspell
--------
The Windows build, by default, uses the native Windows spellchecker,
although, except for Windows 11, that doesn't seem to work so well in
contexts unimpaired by monolingualism.


Building
========

Windows
-------
To build from Visual Studio, navigate to recipe/tea, open the
appropriate .sln file, then build. Only Visual Studios 2017, 2019 and
2022 have been built & tested, for amd64 (x64) and arm64 (M2), under
Windows 10 & 11.

On low memory machines, disable the /MP switch.

The Visual Studio solutions use vcpkg, which resolves dependencies.
For all versions, except recent editions of Visual Studio 2022, you may
need to first download and install vcpkg yourself, from
https://vcpkg.io/.


Unii & mock Unii
----------------
You will need CMake 3.19 or better. On Linux, you will also need
lsb-release. These can be found in most distributions' standard
packages. For macos, I used macports, but brew is good too. From the
home ssc directory, compile a normal build thus:
cmake .
make
ctest
make install

For a debug build:
cmake -DCMAKE_BUILD_TYPE=Debug .
make
ctest
make install

If everything works correctly, then everything will be built, a series
of tests run, with a final result at the very end saying no failures.
Having said that, given SSC is alpha, don't be too surprised to see
some warnings or some final test errors. Note in particular that
complaints about being unable to find or copy files during testing are
not of concern, these come from scripts that set up or tear down
individual tests, and the standard commands used sometimes complain if
they can't find files they're supposed to delete, which is a bit silly
given that means things are already in the required state.

The following have, at some point, been successfully built as x64 amd:
FreeBSD:  13.2 / 13.1 / 12.4 / 12.3
Linux:    Alma Linux 9, AOSC, Centos 8 / 9, SUSE Tumbleweed,
          Ubuntu 20.04 / 22.04
MacOS:    Sonoma, Ventura, Monterey, Big Sur, Catalina, Mojave, High
          Sierra, Sierra, El Capitan, Yosemite
OpenBSD:  7.4 / 7.3 / 7.2 / 7.1 / 7.0 / 6.9 / 6.8

The following have been successfully built as arm64:
Linux:    Centos 9
MacOS:    Sonoma, Ventura

The current version of ssc requires the current version of an operating
system. Older operating systems require older versions of ssc. Not all
features work on all systems.

I've sometimes found it necessary to use cmake's
-DCMAKE_CXX_COMPILER=... switch.

Centos 9
--------
The appropriate CMake command is:
  cmake . -DFLAVOUR=CentosOSStream -DFLAVOUR_VER=9
(note the standard English spelling of flavour.)

OpenBSD
-------
You may need to increase significantly the available memory setting
for your build account in login.conf.

Macos
-----
Certain versions of macos clang produce buggy code, whether or not
optimisations are applied. Use an alternative compiler if you want
a stable executable.


Testing
=======

Windows
-------
Under Visual Studio, run ssc??-test using these arguments:
  -v -x $(ProjectDir)..\..\ssc.exe
    -f $(ProjectDir)..\toast\ssc-test\win.lst
(on one line)

Add '-d' if you want the test utility to retain temporary files.

CMake
-----
Under CMake, run ctest:
  ctest -V
(which runs ssc-test for you, using nix.lst).

Dimitude
--------
The testing utility is rather dim; it will test unbuilt features,
causing failures.

Spelling test results depend on the dictionaries installed.


Supporting libraries
====================

GSL
---
If you can't find a copy of Microsoft's GSL in your system's standard
package suite, then grab a current copy from its github repository
(https://github.com/Microsoft/GSL), then unpack, build and install it.
In Windows, remember to add its root directory to your local path.

Boost
-----
Boost is to C++ as breakfast is to the working day. Most package
managers support it. You can always build your own version using the
source found at boost.org.
