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


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

Although ssc builds and runs with older compilers on older systems, not
all features are available on them.


Libraries
=========

Common dependencies
-------------------
You need boost version 1.75 or better (https://boost.org), a recent
version 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/)*. Usually, an Operating
System's package system has an appropriate version ready to install.

*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/).

Once you've got them, you can run cmake from the project root
directory.

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
multilingual contexts.


Building
========

Windows
-------
To build from Visual Studio, navigate to recipe/tea, open the
appropriate .sln file, then build. Only Visual Studios 2017 / 2019 /
2022, 64 bit, have been built & tested, for intel Windows 10 & 11.
I've not built ssc using CMake under Windows.

Note the included solutions presume Microsoft's VCPKG manager. There
are alternatives.

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: similarly, if you're not using your operating system's packaged
  ICU, set ICU_ROOT to your ICU library source root directory;
- GSL: set it to your GSL root directory.


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.)
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 desired state.

The following have been successfully built as x64 amd/intel:
FreeBSD:  12.3 / 13.1
Linux:    Alma Linux 9, AOSC, Centos 8 / 9*, SUSE Tumbleweed,
          Ubuntu 20.04 / 22.04
MacOS:    Monterey, Big Sur, Catalina, Mojave, High Sierra, Sierra,
          El Capitan, and Yosemite
OpenBSD:  7.1 / 7.0 / 6.9

A build on an older operating system may result in some features being
unavailable.

* Because Centos 9 doesn't offer lsb-release, the appropriate CMake
command is:
  cmake . -DFLAVOUR=CentosOSStream -DFLAVOUR_VER=9

OpenBSD
-------
You will need to increase significantly the available memory setting
for your build account in login.conf, if you have not done so already.


Testing
=======

Windows
-------
Under Visual Studio, run ssc??-test using these arguments:

  -v -x $(ProjectDir)..\..\ssc.exe
    -f $(ProjectDir)..\toast\ssc-test\ssc.lst
(all one line)

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

CMake
-----
Under CMake, run ctest:
  ctest -V

Dimitude
--------
The testing utility is rather stupid; it will test features that are
not built, 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 the root directory to your local path.

Curl
----
This is in every standard unix flavour repository that I've met, but
not so easy for Windows. I suggest the following:

1  Install the Microsoft repository vcpkg (https://vcpkg.io)
2  Run up the visual studio 64bit native command prompt
3  Run the vcpkg bootstrap batch file, noting the comments
4  Enter "vcpkg install curl:x64-windows"
5  Add an environment variable to your account for CURL, perhaps:
    CURL=****\project\lib\vcpkg\installed\x64-windows
6  Add the installation bin directory to your local path, perhaps:
    ****\project\lib\vcpkg\installed\x64-windows\bin
7  If you plan to debug, also add debug\bin, perhaps:
    ****\project\lib\vcpkg\installed\x64-windows\debug\bin
  