From 1f1b361010a4a12e15bbf0857a02c5718309c24b Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 8 Aug 2022 18:43:30 +0900 Subject: [PATCH] Using Makefile-configured snow install directories. --- Makefile | 10 +++++++++- Makefile.libs | 2 +- lib/chibi/snow/commands.scm | 6 +++--- lib/chibi/snow/commands.sld | 7 +++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3549c3ad..5197ec49 100644 --- a/Makefile +++ b/Makefile @@ -90,13 +90,21 @@ chibi-scheme-emscripten: VERSION $(MAKE) distclean; \ mv "$$tempfile" chibi-scheme-emscripten) -include/chibi/install.h: Makefile +include/chibi/install.h: Makefile.libs Makefile.detect echo '#define sexp_so_extension "'$(SO)'"' > $@ echo '#define sexp_default_module_path "'$(MODDIR):$(BINMODDIR):$(SNOWMODDIR):$(SNOWBINMODDIR)'"' >> $@ echo '#define sexp_platform "'$(PLATFORM)'"' >> $@ echo '#define sexp_version "'$(CHIBI_VERSION)'"' >> $@ echo '#define sexp_release_name "'`cat RELEASE`'"' >> $@ +lib/chibi/snow/install.sld: Makefile.libs Makefile.detect + echo '(define-library (chibi snow install)' > $@ + echo ' (import (scheme base))' >> $@ + echo ' (export snow-module-directory snow-binary-module-directory)' >> $@ + echo ' (begin' >> $@ + echo ' (define snow-module-directory "'$(SNOWMODDIR)'")' >> $@ + echo ' (define snow-binary-module-directory "'$(SNOWBINMODDIR)'")))' >> $@ + %.o: %.c $(BASE_INCLUDES) $(CC) -c $(XCPPFLAGS) $(XCFLAGS) $(CLIBFLAGS) -o $@ $< diff --git a/Makefile.libs b/Makefile.libs index db6c0c6b..1237eb66 100644 --- a/Makefile.libs +++ b/Makefile.libs @@ -67,7 +67,7 @@ include Makefile.detect ######################################################################## -all-libs: $(COMPILED_LIBS) +all-libs: $(COMPILED_LIBS) lib/chibi/snow/install.sld lib/%.c: lib/%.stub $(CHIBI_FFI_DEPENDENCIES) $(CHIBI_FFI) $< diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index ba4bfbcf..38e996f5 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1650,7 +1650,7 @@ ((conf-get cfg 'install-source-dir)) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "share/snow" impl))) - (else (car (get-install-dirs impl cfg))))) + (else snow-module-directory))) (define (get-install-data-dir impl cfg) (cond @@ -1659,7 +1659,7 @@ ((conf-get cfg 'install-data-dir)) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "share/snow" impl))) - (else (car (get-install-dirs impl cfg))))) + (else snow-module-directory))) (define (get-install-library-dir impl cfg) (cond @@ -1675,7 +1675,7 @@ (car (get-install-dirs impl cfg))) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "lib" impl))) - (else (car (get-install-library-dirs impl cfg))))) + (else snow-binary-module-directory))) (define (get-install-binary-dir impl cfg) (cond diff --git a/lib/chibi/snow/commands.sld b/lib/chibi/snow/commands.sld index b31e7816..0f6fd2a7 100644 --- a/lib/chibi/snow/commands.sld +++ b/lib/chibi/snow/commands.sld @@ -59,4 +59,11 @@ ((library (srfi 151)) (import (srfi 151))) ((library (srfi 33)) (import (srfi 33))) (else (import (srfi 60)))) + (cond-expand + ((library (chibi snow install)) + (import (chibi snow install))) + (else + (begin + (define snow-module-directory "/usr/local/share/snow") + (define snow-binary-module-directory "/usr/local/lib/snow")))) (include "commands.scm"))