gc_heap_err_str and load_image_header() are never used outside of
gc_heap.c but they are not marked static and are effectively exported
by Chibi's shared library. Since this is unlikely to be intentional,
let's hide them.
According to the Filesystem Hierarchy Standard (see "man 7 hier")
man pages should be installed into an appropriate subdirectory for
their section. Fix the installation path so that our documentation
goes into the right place.
All UNIX-like systems supported by Chibi follow FHS for man pages:
- FreeBSD
- GNU/Linux
- macOS
- Plan 9
Both SOLIBDIR and BINMODDIR install into $(PREFIX)/lib which is the same
value as LIBDIR -- the traditional name of the directory for installed
libraries. Current duplication is fine for the default installation
(with PREFIX = /usr/local) but it does not play nicely with systems
supporing multiple architectures.
For example, Debian systems allow the users to install libraries for
multiple architectures simultaneously: e.g., 32-bit and 64-bit libraries
for AMD-64 CPUs go into separate directories:
- 64-bit: /usr/lib/x86_64-linux-gnu/libchibi-scheme.so.0.8.0
- 32-bit: /usr/lib/i386-linux-gnu/libchibi-scheme.so.0.8.0
Other Linux systems (Red Hat family) use different paths like /usr/lib64
and /usr/lib, but the general idea is the same.
In order to achive this, packaging toolchain supplies appropriate value
of LIBDIR which takes care of these details more or less automagically.
However, with Chibi you currently need to additionally override SOLIBDIR
and BINMODDIR to have all the libraries installed into multiarch-enabled
locations. While definitely doable, it's not convenient.
Redefine SOLIBDIR and BINMODDIR in terms of LIBDIR so that you only need
to override LIBDIR to get the packaging correctly. This does not change
the default installation paths and it is still possible to override
these values individually if necessary.
`ALLOW_MEMORY_GROWTH=1` allows to grow the wasm vm memory space as
needed and avoid out-of-memory issues. This is for development
purpose, production build will want to set memory size to something
that is fit the application (I don't remember the actual option name,
but removing ALLOW_MEMORY_GROWTH=1 from the compilation, and
re-running the app will display the good option to use).
Using read/write/exec causes an error (or possibly abort) on systems
with W^X policies (like OpenBSD and NetBSD have by default).
Since the heap does not need to be executable, just use read/write.
When mmap fails it returns MAP_FAILED, not NULL. POSIX does not
define the value for MAP_FAILED, but on at least the BSDs and Linux
its value is ((void *) -1).
Use find instead of any so load-mime-types will get the filename
instead of #t when a mime.types file is found. Otherwise an error
occurs in load-mime-types.