diff --git a/Makefile b/Makefile index 427b4e97..9658141f 100644 --- a/Makefile +++ b/Makefile @@ -137,7 +137,7 @@ chibi-scheme-emscripten: VERSION include/chibi/install.h: Makefile 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_version "'$(VERSION)'"' >> $@ echo '#define sexp_release_name "'`cat RELEASE`'"' >> $@ diff --git a/Makefile.libs b/Makefile.libs index 6693b767..970d0840 100644 --- a/Makefile.libs +++ b/Makefile.libs @@ -37,6 +37,12 @@ BINMODDIR ?= $(SOLIBDIR)/chibi PKGCONFDIR ?= $(SOLIBDIR)/pkgconfig MANDIR ?= $(PREFIX)/share/man/man1 +SNOWPREFIX ?= /usr/local +SNOWLIBDIR ?= $(SNOWPREFIX)/lib +SNOWSOLIBDIR ?= $(SNOWLIBDIR) +SNOWMODDIR ?= $(SNOWPREFIX)/share/snow +SNOWBINMODDIR ?= $(SNOWSOLIBDIR)/snow + DESTDIR ?= ######################################################################## diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index ba689dc5..44fc18fd 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1378,6 +1378,24 @@ "share/snow" 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) (or (and (eq? impl 'chibi) (conf-get cfg 'chibi-path)) (let* ((prog (cond ((conf-get cfg 'scheme-script)) @@ -1656,7 +1674,7 @@ (car (get-install-dirs impl cfg))) ((conf-get cfg 'install-prefix) => (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) (cond