chibi-run script assumes $(PWD) is at topdir. Let's remove that
assumption so that the script can be used anywhere to launch chibi from
dev environment.
'protect' used to be renamed to 'guard', after excluding 'guard'
from (scheme base). But that part is now gone. test.scm itself never
uses 'protect' directly. Remove it because it's not used.
The two procedures pretty and pretty-simply from (chibi show pretty)
should be part of (srfi 159 base). written-shared is removed from 159
because it looks like it's an addition in 166.
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.
Currently "remove" command does not know how to use sudo to remove
files installed into directories owned by root. By default Snow
installs stuff into /usr/local hierarchy and uses sudo for that.
Let's teach it to remove packages without explicit sudo too.
Snow-Chibi is a local package manager, not a system one. It can install
Scheme packages into system but they are not managed by system package
manager like dpkg, RPM, pacman, ports, etc.
Traditionally (and in accordance with Filesystem Hierarchy Standard),
/usr/local hierarchy should be used for local administrator installs --
and that's what Snow-Chibi provides.
Let's make sure that Snow-Chibi installs snowballs into /usr/local
hierarchy even if Chibi is compiled for installation into the system,
with PREFIX=/usr. Introduce a distinct bunch of variables holding paths
to library installation directories, with "SNOW" prefix:
- SNOWPREFIX - default prefix for Snow-installed stuff
- SNOWLIBDIR - custom libraries required for Snow itself
- SNOWSOLIBDIR - shared libraries required for Snow itself
- SNOWMODDIR - Snow installs Scheme modules here
- SNOWBINMODDIR - Snow installs native libraries here
All of these are set to /use/local by default, just as they are now.
However, they are not affected by regular PREFIX, LIBDIR, MODDIR, etc.
which affect only libraries bundled with Chibi.
And in order for these to work, they need to be added into the current
module path so that they can be used in parallel with system libraries.
Furthermore, we need to tweak "get-install-library-dir" function to use
those paths instead of hardcoded "/usr/local/lib" by default. Introduce
a new helper "get-install-library-dirs", similar to "get-install-dirs".
It will look up the correct installation directories in current module
path, giving preference to the ones with "/lib" in them.
With these defaults, Snow will install Scheme modules into
/usr/local/share/snow and native libraries go into /usr/local/lib/snow,
similar to how built-it libraries are installed into
/usr/local/share/chibi and /usr/local/lib/chibi is used for native code.
Of course, this can be overriden at build time by setting SNOWPREFIX or
individual SNOWMODDIR, SNOWBINMODDIR variables.
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.