Cairo has a dependency on FontConfig. FontConfig has a dependency on Freetype. I have built FreeType, but when I try to build FontConfig I get link errors as FreeType needs HarfBuzz.
When I try to build Harfbuzz, it has a dependency on FreeType. Thus we have a circular dependency. The makefiles at this point are broken: When it tries to build the tests they fail to link because they need symbols from Harbuzz itself. This is solvable by having HarfBuzz twice in the link line. Or by removing all tests which is what I did. So that solved that problem.
Harfbuzz has a file called "helper-cairo.cc". When I try to compile this it complains about a mising FontConfig header file, so clearly there is a dependency on FontConfig. However I cannot build FontConfig without first building HarfBuzz!
I do not know how to resolve this dependency. Maybe I can disable the Cairo helper when building HarfBuzz, use the resultant library to build FontConfig, then rebuild HarfBuzz with the resultant FontConfig and then rebuild FontConfig? It all seems a big nuisance.
I am building with MinGW and Windows DLLs don't like unresolved symbols, so I don't think I can resolve this with shared libraries. I am not really sure why I need HarfBuzz when linking FontConfig - maybe it is trying to build a DLL :(
Any ideas how to solve this without losing important functionality?
There is also a circular dependency between freetype and HarfBuzz.
Note that fontconfig and Cairo are only needed for the tests and tools built with HarfBuzz and thus it appears safe to configure them out:
Build Freetype using:
./configure --prefix=${PREFIX} --host=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32 --with-harfbuzz=no
Build HarfBuzz using:
./configure --prefix=${PREFIX} --host=x86_64-w64-mingw32 --with-fontconfig=no --with-cairo=no --with-sysroot=/usr/x86_64-w64-mingw32
Build Freetype using:
./configure --prefix=${PREFIX} --host=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32 --with-harfbuzz=yes
Build fontconfig.
Build Cairo.
Not fully tested yet, but should work.