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,
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 & arm64 (m2) architecture. For now, the arm solution
should be seen as particularly hopeless.

Although ssc builds and runs with some older compilers on some 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

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

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 and arm64, under
Windows 10 & 11. I've not built ssc using CMake under Windows.

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

On low memory build 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 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:    Ventura, Monterey, Big Sur, Catalina, Mojave, High Sierra,
          Sierra, El Capitan, and Yosemite
OpenBSD:  7.3 / 7.2 / 7.1 / 7.0 / 6.9 / 6.8

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

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

Centos 9
--------
The appropriate CMake command is:
  cmake . -DFLAVOUR=CentosOSStream -DFLAVOUR_VER=9
(beware 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
(all one line)

Add '-d' if you want the test utility to retain intemediate 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 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 its 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=****\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

Adapt the architecture as necessary. If you omit it, vcpkg might
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. Many people build
their own versions using the sources found at boost.org.
