BUILD NOTES
static site checker
https://ssc.lu/
(c) 2020-2023 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
-------------------
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/)*. Usually, an Operating
System's package manager has appropriate versions ready to install.

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

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.

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.

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

On low memory machines, disable the /MP switch.


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.


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.


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.

Curl
----
This is in almost every standard unix flavour repository, 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=****\vcpkg\installed\x64-windows
6  Add the installation bin directory to your local path, perhaps:
    ****\vcpkg\installed\x64-windows\bin
7  If you plan to debug, also add debug\bin, perhaps:
    ****\vcpkg\installed\x64-windows\debug\bin

Set the architecture as necessary. If you omit it, vcpkg may carefully
ignore your hardware and install x86.

Boost
-----
Boost is to C++ as breakfast is to the working day.

Most package managers support it, including vcpkg. Alternatively, build
your own version using the source found at boost.org.
