From cd48e9973a73b8dd82ba31eded62a65733ff3c8b Mon Sep 17 00:00:00 2001 From: retropikzel Date: Thu, 26 Jun 2025 20:18:54 +0300 Subject: [PATCH] Add Gambit support for snow-chibi --- lib/chibi/snow/commands.scm | 60 ++++++++++++++++++--- lib/chibi/snow/utils.scm | 4 +- lib/chicken/8/arvyy/.mustache.meta | 86 ------------------------------ lib/chicken/8/srfi/.64.meta | 36 ------------- 4 files changed, 56 insertions(+), 130 deletions(-) delete mode 100644 lib/chicken/8/arvyy/.mustache.meta delete mode 100644 lib/chicken/8/srfi/.64.meta diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index fa768b70..8252bdf9 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1913,6 +1913,47 @@ (cons dest-so-path (default-installer impl cfg library dir))))) +(define (gambit-installer impl cfg library dir) + (let* ((library-file (get-library-file cfg library)) + (o-file (path-replace-extension library-file "so")) + (ext (get-library-extension impl cfg)) + (dest-library-file + (string-append (library->path cfg library) "." ext)) + (dest-o-file + (string-append (library->path cfg library) ".so")) + (include-files + (library-include-files impl cfg (make-path dir library-file))) + (install-dir (get-install-source-dir impl cfg)) + (install-lib-dir (get-install-library-dir impl cfg))) + ;; install the library file + (let ((path (make-path install-dir dest-library-file)) + (o-path (make-path install-dir dest-o-file))) + (install-directory cfg (path-directory path)) + (install-file cfg (make-path dir library-file) path) + (install-file cfg (make-path dir o-file) o-path) + ;; install any includes + (cons + path + (append + (map + (lambda (x) + (let ((dest-file (make-path install-dir (path-relative x dir)))) + (install-directory cfg (path-directory dest-file)) + (install-file cfg x dest-file) + dest-file)) + include-files) + (map + (lambda (x) + (let* ((so-file (string-append x (cond-expand (macosx ".dylib") + (else ".so")))) + (dest-file (make-path install-lib-dir + (path-relative so-file dir)))) + (install-directory cfg (path-directory dest-file)) + (install-file cfg so-file dest-file) + dest-file)) + (library-shared-include-files + impl cfg (make-path dir library-file)))))))) + (define (guile-installer impl cfg library dir) (let* ((source-scm-file (get-library-file cfg library)) (source-go-file (string-append @@ -1959,6 +2000,7 @@ (case installer ((chicken) chicken-installer) ((cyclone) cyclone-installer) + ((gambit) gambit-installer) ((guile) guile-installer) (else default-installer))) @@ -1966,6 +2008,7 @@ (case impl ((chicken) 'chicken) ((cyclone) 'cyclone) + ((gambit) 'gambit) ((guile) 'guile) (else 'default))) @@ -2135,17 +2178,22 @@ (let* ((library-file (get-library-file cfg library)) (src-library-file (make-path dir library-file)) (library-dir (path-directory src-library-file)) - (dest-library-file - (string-append (library->path cfg library) ".o")) - (dest-dir - (path-directory (make-path dir dest-library-file)))) + (dest-library-file (string-append (library->path cfg library) ".so")) + (dest-dir (path-directory (make-path dir dest-library-file)))) ;; ensure the build directory exists (create-directory* dest-dir) (with-directory dir (lambda () - (and (system 'gsc src-library-file) - library))))) + (let ((res (system 'gsc + '-o dest-library-file + '-dynamic + src-library-file))) + (and (or (and (pair? res) (zero? (cadr res))) + (yes-or-no? cfg "gambit failed to build: " + (library-name library) + " - install anyway?")) + library)))))) (define (guile-builder impl cfg library dir) (let* ((library-file (get-library-file cfg library)) diff --git a/lib/chibi/snow/utils.scm b/lib/chibi/snow/utils.scm index f8179d59..98c465d0 100644 --- a/lib/chibi/snow/utils.scm +++ b/lib/chibi/snow/utils.scm @@ -25,10 +25,10 @@ ,(delay (process->sexp '(foment -e "(write (features))")))) - (gambit "gsc" (gsc -v) #f #f + (gambit "gsc" (gsc -v) #f ,(delay (process->sexp - '(gsc -e "(write (features))")))) + '(gsc -e "(display (features))")))) (generic "generic" #f #f ,(delay (write-string "generic\n"))) (gauche "gosh" (gosh -E "print (gauche-version)") "0.9.4" diff --git a/lib/chicken/8/arvyy/.mustache.meta b/lib/chicken/8/arvyy/.mustache.meta deleted file mode 100644 index bae53158..00000000 --- a/lib/chicken/8/arvyy/.mustache.meta +++ /dev/null @@ -1,86 +0,0 @@ -(package - (url "/s/gmail.com/nma.arvydas.silanskas/arvyy/mustache/1.0.2/arvyy-mustache-1.0.2.tgz") - (size 83456) - (updated "2021-11-13T10:37:49+00:00") - (created "2021-11-12T20:31:25+00:00") - (signature - (email "nma.arvydas.silanskas@gmail.com") - (digest sha-256) - (sha-256 "561374f1cfd7b784a9357e11e2070ce783154e5c7f2acf261af8702e54e55987")) - (maintainers "Arvydas Silanskas ") - (authors "Arvydas Silanskas") - (version "1.0.2") - (license mit) - (library - (name - (arvyy mustache)) - (path "arvyy/mustache.sld") - (depends - (scheme base) - (scheme case-lambda) - (scheme write) - (arvyy mustache lookup) - (arvyy mustache collection) - (arvyy mustache executor) - (arvyy mustache parser) - (arvyy mustache tokenizer) - (srfi 1))) - (library - (name - (arvyy mustache collection)) - (path "arvyy/mustache/collection.sld") - (depends - (scheme base) - (srfi 41))) - (library - (name - (arvyy mustache executor)) - (path "arvyy/mustache/executor.sld") - (depends - (scheme base) - (arvyy mustache parser))) - (library - (name - (arvyy mustache lookup)) - (path "arvyy/mustache/lookup.sld") - (depends - (scheme base))) - (library - (name - (arvyy mustache parser)) - (path "arvyy/mustache/parser.sld") - (depends - (scheme base) - (scheme write) - (scheme cxr) - (arvyy mustache tokenizer) - (srfi 1))) - (library - (name - (arvyy mustache tokenizer)) - (path "arvyy/mustache/tokenizer.sld") - (depends - (scheme base))) - (library - (name - (arvyy mustache-test)) - (path "arvyy/mustache-test.sld") - (cond-expand - (chibi - (depends - (chibi test))) - ((library (srfi 64)) - (depends - (srfi 64))) - (else - (depends))) - (depends - (scheme base) - (scheme write) - (arvyy mustache) - (srfi 41)) - (use-for test)) - (manual "readme.html") - (description "Mustache templating 1.2.1 implementation") - (test "run-tests.scm") - (installed-files "lib/chicken/8/arvyy.mustache.lookup.so" "lib/chicken/8/arvyy.mustache.lookup.import.scm" "lib/chicken/8/arvyy.mustache.collection.so" "lib/chicken/8/arvyy.mustache.collection.import.scm" "lib/chicken/8/arvyy.mustache.tokenizer.so" "lib/chicken/8/arvyy.mustache.tokenizer.import.scm" "lib/chicken/8/arvyy.mustache.parser.so" "lib/chicken/8/arvyy.mustache.parser.import.scm" "lib/chicken/8/arvyy.mustache.executor.so" "lib/chicken/8/arvyy.mustache.executor.import.scm" "lib/chicken/8/arvyy.mustache.so" "lib/chicken/8/arvyy.mustache.import.scm")) diff --git a/lib/chicken/8/srfi/.64.meta b/lib/chicken/8/srfi/.64.meta deleted file mode 100644 index 9f300b6d..00000000 --- a/lib/chicken/8/srfi/.64.meta +++ /dev/null @@ -1,36 +0,0 @@ -(package - (url "/s/fisher.cx/robert/srfi/64/0.1.0/srfi-64-0.1.0.tgz") - (size 83968) - (updated "2019-09-24T13:12:36+00:00") - (created "2019-09-24T13:12:36+00:00") - (signature - (email "robert@fisher.cx") - (digest sha-256) - (sha-256 "4cf1376ed8f674b7eb66079437c944afb3753113849acf51cde47efd17656658")) - (maintainers "Robert Fisher") - (authors "Per Bothner" "Alex Shinn" "Álvaro Castro-Castilla" "Mark H Weaver" "Donovan Kolby") - (version "0.1.0") - (library - (name - (srfi 64)) - (path "srfi/64.sld") - (depends - (scheme base) - (scheme char) - (scheme complex) - (scheme eval) - (scheme file) - (scheme read) - (scheme write))) - (library - (name - (srfi 64 test)) - (path "srfi/64/test.sld") - (depends - (scheme base) - (srfi 64)) - (use-for test)) - (manual "srfi/64.html") - (description "Reference implementation of SRFI-54: A Scheme API for test suites") - (test "run-tests.scm") - (installed-files "lib/chicken/8/srfi-64.so" "lib/chicken/8/srfi-64.import.scm"))