mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Always install Snow libraries to /usr/local
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.
This commit is contained in:
parent
2b7927b9bc
commit
26061930e9
3 changed files with 26 additions and 2 deletions
2
Makefile
2
Makefile
|
@ -137,7 +137,7 @@ chibi-scheme-emscripten: VERSION
|
||||||
|
|
||||||
include/chibi/install.h: Makefile
|
include/chibi/install.h: Makefile
|
||||||
echo '#define sexp_so_extension "'$(SO)'"' > $@
|
echo '#define sexp_so_extension "'$(SO)'"' > $@
|
||||||
echo '#define sexp_default_module_path "'$(MODDIR):$(BINMODDIR)'"' >> $@
|
echo '#define sexp_default_module_path "'$(MODDIR):$(BINMODDIR):$(SNOWMODDIR):$(SNOWBINMODDIR)'"' >> $@
|
||||||
echo '#define sexp_platform "'$(PLATFORM)'"' >> $@
|
echo '#define sexp_platform "'$(PLATFORM)'"' >> $@
|
||||||
echo '#define sexp_version "'$(VERSION)'"' >> $@
|
echo '#define sexp_version "'$(VERSION)'"' >> $@
|
||||||
echo '#define sexp_release_name "'`cat RELEASE`'"' >> $@
|
echo '#define sexp_release_name "'`cat RELEASE`'"' >> $@
|
||||||
|
|
|
@ -37,6 +37,12 @@ BINMODDIR ?= $(PREFIX)/lib/chibi
|
||||||
PKGCONFDIR ?= $(SOLIBDIR)/pkgconfig
|
PKGCONFDIR ?= $(SOLIBDIR)/pkgconfig
|
||||||
MANDIR ?= $(PREFIX)/share/man/man1
|
MANDIR ?= $(PREFIX)/share/man/man1
|
||||||
|
|
||||||
|
SNOWPREFIX ?= /usr/local
|
||||||
|
SNOWLIBDIR ?= $(SNOWPREFIX)/lib
|
||||||
|
SNOWSOLIBDIR ?= $(SNOWLIBDIR)
|
||||||
|
SNOWMODDIR ?= $(SNOWPREFIX)/share/snow
|
||||||
|
SNOWBINMODDIR ?= $(SNOWSOLIBDIR)/snow
|
||||||
|
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
|
@ -1360,6 +1360,24 @@
|
||||||
"share/snow"
|
"share/snow"
|
||||||
impl)))))
|
impl)))))
|
||||||
|
|
||||||
|
(define (get-install-library-dirs impl cfg)
|
||||||
|
(case impl
|
||||||
|
((chibi)
|
||||||
|
(let* ((dirs
|
||||||
|
(reverse
|
||||||
|
(cond-expand
|
||||||
|
(chibi (eval '(current-module-path) (environment '(chibi))))
|
||||||
|
(else (process->sexp
|
||||||
|
'(chibi-scheme -q -p "(current-module-path)"))))))
|
||||||
|
(lib-dir (find (lambda (d) (string-contains d "/lib")) dirs)))
|
||||||
|
(if lib-dir
|
||||||
|
(cons lib-dir (delete lib-dir dirs))
|
||||||
|
dirs)))
|
||||||
|
(else
|
||||||
|
(list (make-path (or (conf-get cfg 'install-prefix) "/usr/local")
|
||||||
|
"lib"
|
||||||
|
impl)))))
|
||||||
|
|
||||||
(define (scheme-script-command impl cfg)
|
(define (scheme-script-command impl cfg)
|
||||||
(or (and (eq? impl 'chibi) (conf-get cfg 'chibi-path))
|
(or (and (eq? impl 'chibi) (conf-get cfg 'chibi-path))
|
||||||
(let* ((prog (cond ((conf-get cfg 'scheme-script))
|
(let* ((prog (cond ((conf-get cfg 'scheme-script))
|
||||||
|
@ -1638,7 +1656,7 @@
|
||||||
(car (get-install-dirs impl cfg)))
|
(car (get-install-dirs impl cfg)))
|
||||||
((conf-get cfg 'install-prefix)
|
((conf-get cfg 'install-prefix)
|
||||||
=> (lambda (prefix) (make-path prefix "lib" impl)))
|
=> (lambda (prefix) (make-path prefix "lib" impl)))
|
||||||
(else (make-path "/usr/local/lib" impl))))
|
(else (car (get-install-library-dirs impl cfg)))))
|
||||||
|
|
||||||
(define (get-install-binary-dir impl cfg)
|
(define (get-install-binary-dir impl cfg)
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Add table
Reference in a new issue