From 7197ac2f848c3a963f0c7011bcba49e965f3623f Mon Sep 17 00:00:00 2001 From: retropikzel Date: Mon, 16 Jun 2025 21:24:25 +0300 Subject: [PATCH 01/13] Add Mosh support to snow-chibi --- lib/chibi/snow/commands.scm | 20 ++++++++++++++++++++ lib/chibi/snow/utils.scm | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 0f4ed4d7..632ff66c 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1390,6 +1390,17 @@ (if (string? path) path "/usr/local/share/guile/")))) + ((mosh) + (with-output-to-file + (string-append (cond-expand (windows (get-environment-variable "TMP")) + (else "/tmp")) + "/snowmosh") + (lambda () + (display "(import (scheme base) (scheme write) (mosh config))") + (newline) + (display "(display (get-config \"library-path\"))"))) + (list (string-append (symbol->string (process->sexp '(mosh /tmp/snowmosh))) + "/lib"))) ((larceny) (list (make-path @@ -1482,6 +1493,10 @@ --r7rs --script ,file) `(kawa ,(string-append "-Dkawa.import.path=" install-dir) --r7rs --script ,file)))) + ((mosh) + (if lib-path + `(mosh --loadpath= ,install-dir --loadpath= ,lib-path ,file) + `(mosh --loadpath= ,install-dir ,file))) ((larceny) (if lib-path `(larceny -r7rs -path ,(string-append install-dir ":" lib-path) @@ -1625,6 +1640,7 @@ 35 37 38 39 41 42 43 45 46 55 60 61 62 64 67 69 71 87 88 98 105 111 171) (kawa 1 2 13 14 34 37 60 69 95) + (mosh) (larceny 0 1 2 4 5 6 7 8 9 11 13 14 16 17 19 22 23 25 26 27 28 29 30 31 37 38 39 41 42 43 45 48 51 54 56 59 60 61 62 63 64 66 67 69 71 74 78 86 87 95 96 98))) @@ -1681,6 +1697,7 @@ ((eq? impl 'chicken) (get-install-library-dir impl cfg)) ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) ((eq? impl 'guile) (get-guile-site-dir)) + ((eq? impl 'mosh) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-source-dir)) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "share/snow" impl))) @@ -1690,6 +1707,7 @@ (cond ((eq? impl 'chicken) (get-install-library-dir impl cfg)) ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) + ((eq? impl 'mosh) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-data-dir)) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "share/snow" impl))) @@ -1709,6 +1727,8 @@ (car (get-install-dirs impl cfg))) ((eq? impl 'guile) (get-guile-site-ccache-dir)) + ((eq? impl 'mosh) + (car (get-install-dirs impl cfg))) ((conf-get cfg 'install-prefix) => (lambda (prefix) (make-path prefix "lib" impl))) (else snow-binary-module-directory))) diff --git a/lib/chibi/snow/utils.scm b/lib/chibi/snow/utils.scm index 9b8324e3..11672504 100644 --- a/lib/chibi/snow/utils.scm +++ b/lib/chibi/snow/utils.scm @@ -37,6 +37,10 @@ ,(delay (process->sexp '(kawa -e "(write (features))")))) + (mosh "mosh" (mosh -v) #f + ,(delay + (process->sexp + '(echo "(import (scheme base) (scheme write) (mosh config)) (display (features))" > /tmp/snowmosh && mosh /tmp/snowmosh)))) (larceny "larceny" (larceny --version) "v0.98" ,(delay '())) (sagittarius "sagittarius" #f #f From d7ca98299b3dd0f0791ce47baf097f26d750a53b Mon Sep 17 00:00:00 2001 From: retropikzel Date: Thu, 26 Jun 2025 20:17:37 +0300 Subject: [PATCH 02/13] Add .class file compilation --- doc/chibi.scrbl | 2 +- lib/chibi/snow/commands.scm | 72 ++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/doc/chibi.scrbl b/doc/chibi.scrbl index 96a2d5e6..7d1a0cce 100755 --- a/doc/chibi.scrbl +++ b/doc/chibi.scrbl @@ -1663,7 +1663,7 @@ installed. The following are currently supported: \item{foment - version >= 0.4} \item{generic; By default libraries are installed into /usr/local/lib/snow or %LOCALAPPDATA%/lib/snow on windows} \item{gauche - version >= 0.9.4} -\item{kawa - version >= 2.0; you need to add the install dir to the search path, e.g. \scheme{-Dkawa.import.path=/usr/local/share/kawa}} +\item{kawa - version >= 2.0; you need to add the install dir to the search path, e.g. \scheme{-Dkawa.import.path=/usr/local/share/kawa/lib}} \item{larceny - version 0.98; you need to add "lib/Snow" to the paths in startup.sch} \item{sagittarius - version >= 0.98} \item{stklos - version > 2.10} diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 6b08cd63..790d2d7e 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1398,6 +1398,8 @@ (if (string? path) path "/usr/local/share/guile/")))) + ((kawa) + (list "/usr/local/share/kawa/lib")) ((larceny) (list (make-path @@ -1704,6 +1706,7 @@ ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) ((eq? impl 'generic) (get-install-library-dir impl cfg)) ((eq? impl 'guile) (get-guile-site-dir)) + ((eq? impl 'kawa) (get-install-library-dir impl cfg)) ((eq? impl 'stklos) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-source-dir)) ((conf-get cfg 'install-prefix) @@ -1715,6 +1718,7 @@ ((eq? impl 'chicken) (get-install-library-dir impl cfg)) ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) ((eq? impl 'generic) (get-install-library-dir impl cfg)) + ((eq? impl 'kawa) (get-install-library-dir impl cfg)) ((eq? impl 'stklos) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-data-dir)) ((conf-get cfg 'install-prefix) @@ -1737,6 +1741,8 @@ (car (get-install-dirs impl cfg))) ((eq? impl 'guile) (get-guile-site-ccache-dir)) + ((eq? impl 'kawa) + (car (get-install-dirs impl cfg))) ((eq? impl 'stklos) (car (get-install-dirs impl cfg))) ((conf-get cfg 'install-prefix) @@ -1942,12 +1948,54 @@ (library-shared-include-files impl cfg (make-path dir source-scm-file)))))))) +(define (kawa-installer impl cfg library dir) + (let* ((source-scm-file (get-library-file cfg library)) + (source-class-file (string-append + (library->path cfg library) ".class")) + (dest-scm-file + (string-append (library->path cfg library) ".scm")) + (dest-class-file + (string-append (library->path cfg library) ".class")) + (include-files + (library-include-files impl cfg (make-path dir source-scm-file))) + (install-dir (get-install-source-dir impl cfg)) + (install-lib-dir (get-install-library-dir impl cfg))) + (let ((scm-path (make-path install-dir dest-scm-file)) + (class-path (make-path install-lib-dir dest-class-file))) + (install-directory cfg (path-directory scm-path)) + (install-directory cfg (path-directory class-path)) + (install-file cfg (make-path dir source-scm-file) scm-path) + (install-file cfg (make-path dir source-class-file) class-path) + ;; install any includes + (cons + scm-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 source-scm-file)))))))) + ;; installers should return the list of installed files (define (lookup-installer installer) (case installer ((chicken) chicken-installer) ((cyclone) cyclone-installer) ((guile) guile-installer) + ((kawa) kawa-installer) (else default-installer))) (define (installer-for-implementation impl cfg) @@ -1955,6 +2003,7 @@ ((chicken) 'chicken) ((cyclone) 'cyclone) ((guile) 'guile) + ((kawa) 'kawa) (else 'default))) (define (install-library impl cfg library dir) @@ -2135,17 +2184,38 @@ (and (system 'guild 'compile '-O0 '--r7rs '-o dest-library-file src-library-file) library))))) +(define (kawa-builder impl cfg library dir) + (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) ".class")) + (dest-dir + (path-directory (make-path dir dest-library-file)))) + ;; ensure the build directory exists + (create-directory* dest-dir) + (with-directory + dir + (lambda () + (let ((res (system 'kawa '-d dir '-C src-library-file))) + (and (or (and (pair? res) (zero? (cadr res))) + (yes-or-no? cfg ".class file failed to build: " + (library-name library) + " - install anyway?")) + library)))))) + (define (lookup-builder builder) (case builder ((chibi) chibi-builder) ((chicken) chicken-builder) ((cyclone) cyclone-builder) ((guile) guile-builder) + ((kawa) kawa-builder) (else default-builder))) (define (builder-for-implementation impl cfg) (case impl - ((chibi chicken cyclone guile) impl) + ((chibi chicken cyclone guile kawa) impl) (else 'default))) (define (build-library impl cfg library dir) From 239f7d45c2cc4faea1fc98433292c9a0d996511f Mon Sep 17 00:00:00 2001 From: retropikzel Date: Thu, 26 Jun 2025 20:19:52 +0300 Subject: [PATCH 03/13] Add Mosh support for snow-chibi --- doc/chibi.scrbl | 1 + lib/chibi/snow/commands.scm | 19 +++++++++++++++++++ lib/chibi/snow/utils.scm | 2 ++ 3 files changed, 22 insertions(+) diff --git a/doc/chibi.scrbl b/doc/chibi.scrbl index 96a2d5e6..36fea628 100755 --- a/doc/chibi.scrbl +++ b/doc/chibi.scrbl @@ -1665,6 +1665,7 @@ installed. The following are currently supported: \item{gauche - version >= 0.9.4} \item{kawa - version >= 2.0; you need to add the install dir to the search path, e.g. \scheme{-Dkawa.import.path=/usr/local/share/kawa}} \item{larceny - version 0.98; you need to add "lib/Snow" to the paths in startup.sch} +\item{mosh - version >= 0.29-rc1} \item{sagittarius - version >= 0.98} \item{stklos - version > 2.10} ] diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 6b08cd63..1a072200 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1398,6 +1398,17 @@ (if (string? path) path "/usr/local/share/guile/")))) + ((mosh) + (with-output-to-file + "/tmp/mosh-helper" + (lambda () + (display "(import (scheme base) (scheme write) (mosh config)) (display (get-config \"library-path\")) (newline)") + (newline))) + (list + (string-append + (string-trim (process->string '(mosh "/tmp/mosh-helper")) + char-whitespace?) + "/lib"))) ((larceny) (list (make-path @@ -1494,6 +1505,10 @@ --r7rs --script ,file) `(kawa ,(string-append "-Dkawa.import.path=" install-dir) --r7rs --script ,file)))) + ((mosh) + (if lib-path + `(mosh --loadpath= ,install-dir --loadpath= ,lib-path ,file) + `(guile --loadpath= ,install-dir ,file))) ((larceny) (if lib-path `(larceny -r7rs -path ,(string-append install-dir ":" lib-path) @@ -1704,6 +1719,7 @@ ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) ((eq? impl 'generic) (get-install-library-dir impl cfg)) ((eq? impl 'guile) (get-guile-site-dir)) + ((eq? impl 'mosh) (get-install-library-dir impl cfg)) ((eq? impl 'stklos) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-source-dir)) ((conf-get cfg 'install-prefix) @@ -1715,6 +1731,7 @@ ((eq? impl 'chicken) (get-install-library-dir impl cfg)) ((eq? impl 'cyclone) (get-install-library-dir impl cfg)) ((eq? impl 'generic) (get-install-library-dir impl cfg)) + ((eq? impl 'mosh) (get-install-library-dir impl cfg)) ((eq? impl 'stklos) (get-install-library-dir impl cfg)) ((conf-get cfg 'install-data-dir)) ((conf-get cfg 'install-prefix) @@ -1737,6 +1754,8 @@ (car (get-install-dirs impl cfg))) ((eq? impl 'guile) (get-guile-site-ccache-dir)) + ((eq? impl 'mosh) + (car (get-install-dirs impl cfg))) ((eq? impl 'stklos) (car (get-install-dirs impl cfg))) ((conf-get cfg 'install-prefix) diff --git a/lib/chibi/snow/utils.scm b/lib/chibi/snow/utils.scm index 0bee1db5..f15456fd 100644 --- a/lib/chibi/snow/utils.scm +++ b/lib/chibi/snow/utils.scm @@ -39,6 +39,8 @@ ,(delay (process->sexp '(kawa -e "(write (features))")))) + (mosh "mosh" #f #f + ,(delay (write-string "mosh\n"))) (larceny "larceny" (larceny --version) "v0.98" ,(delay '())) (sagittarius "sagittarius" #f #f From bd3d05541bb5ba95e100ad86b1073bea23597352 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 16:37:48 +0300 Subject: [PATCH 04/13] Simplify kawa-installer --- lib/chibi/snow/commands.scm | 54 +++++++++++-------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 790d2d7e..648d6c94 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1949,45 +1949,23 @@ impl cfg (make-path dir source-scm-file)))))))) (define (kawa-installer impl cfg library dir) - (let* ((source-scm-file (get-library-file cfg library)) - (source-class-file (string-append - (library->path cfg library) ".class")) - (dest-scm-file - (string-append (library->path cfg library) ".scm")) - (dest-class-file - (string-append (library->path cfg library) ".class")) - (include-files - (library-include-files impl cfg (make-path dir source-scm-file))) + (let* ((source-class-file + (string-append dir + "/" + (path-strip-extension (get-library-file cfg library)) + ".class")) (install-dir (get-install-source-dir impl cfg)) - (install-lib-dir (get-install-library-dir impl cfg))) - (let ((scm-path (make-path install-dir dest-scm-file)) - (class-path (make-path install-lib-dir dest-class-file))) - (install-directory cfg (path-directory scm-path)) - (install-directory cfg (path-directory class-path)) - (install-file cfg (make-path dir source-scm-file) scm-path) - (install-file cfg (make-path dir source-class-file) class-path) - ;; install any includes - (cons - scm-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 source-scm-file)))))))) + (dest-class-file + (string-append install-dir + "/" + (library->path cfg library) ".class")) + (path (make-path install-dir dest-class-file)) + (include-filename (string-append + (path-strip-directory + (path-strip-extension path)) + ".sld"))) + (default-installer impl cfg library dir) + (install-file cfg source-class-file dest-class-file))) ;; installers should return the list of installed files (define (lookup-installer installer) From 12ec5bf41efbcd6209543c6b1ea1a6946565671f Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 16:44:13 +0300 Subject: [PATCH 05/13] Skip the .class file if it does not exists --- lib/chibi/snow/commands.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 648d6c94..e4685924 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1964,7 +1964,8 @@ (path-strip-directory (path-strip-extension path)) ".sld"))) - (default-installer impl cfg library dir) + (when (file-exists? source-class-file) + (default-installer impl cfg library dir)) (install-file cfg source-class-file dest-class-file))) ;; installers should return the list of installed files From 8845a7983fb23d5369460145b5ba75c3a7ce2e0f Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 16:58:57 +0300 Subject: [PATCH 06/13] Clean up the Kawa installer some more --- lib/chibi/snow/commands.scm | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index e4685924..1ea68bad 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1949,21 +1949,12 @@ impl cfg (make-path dir source-scm-file)))))))) (define (kawa-installer impl cfg library dir) - (let* ((source-class-file - (string-append dir - "/" - (path-strip-extension (get-library-file cfg library)) - ".class")) + (let* ((class-file (path-replace-extension + (get-library-file cfg library) "class")) + (source-class-file (make-path dir class-file)) (install-dir (get-install-source-dir impl cfg)) - (dest-class-file - (string-append install-dir - "/" - (library->path cfg library) ".class")) - (path (make-path install-dir dest-class-file)) - (include-filename (string-append - (path-strip-directory - (path-strip-extension path)) - ".sld"))) + (dest-class-file (make-path install-dir class-file)) + (path (make-path install-dir dest-class-file))) (when (file-exists? source-class-file) (default-installer impl cfg library dir)) (install-file cfg source-class-file dest-class-file))) From c814812879125074984dec3d8762992dcbbd69c1 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 18:57:58 +0300 Subject: [PATCH 07/13] Fix mistake in .class file checking --- lib/chibi/snow/commands.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 1ea68bad..9cfff286 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1955,9 +1955,9 @@ (install-dir (get-install-source-dir impl cfg)) (dest-class-file (make-path install-dir class-file)) (path (make-path install-dir dest-class-file))) + (default-installer impl cfg library dir) (when (file-exists? source-class-file) - (default-installer impl cfg library dir)) - (install-file cfg source-class-file dest-class-file))) + (install-file cfg source-class-file dest-class-file)))) ;; installers should return the list of installed files (define (lookup-installer installer) From c3687d22e44284a442b26bc74037070890291062 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 19:08:33 +0300 Subject: [PATCH 08/13] Return the installed files from Kawa installer --- lib/chibi/snow/commands.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 9cfff286..457ed722 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1954,10 +1954,12 @@ (source-class-file (make-path dir class-file)) (install-dir (get-install-source-dir impl cfg)) (dest-class-file (make-path install-dir class-file)) - (path (make-path install-dir dest-class-file))) - (default-installer impl cfg library dir) - (when (file-exists? source-class-file) - (install-file cfg source-class-file dest-class-file)))) + (path (make-path install-dir dest-class-file)) + (installed-files (default-installer impl cfg library dir))) + (cond ((file-exists? source-class-file) + (install-file cfg source-class-file dest-class-file) + (cons dest-class-file installed-files)) + (else installed-files)))) ;; installers should return the list of installed files (define (lookup-installer installer) From f57c1d64a4def0c41e75d0ac50bff3a030a3475e Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 27 Jun 2025 19:21:05 +0300 Subject: [PATCH 09/13] Clean up the kawa-builder code --- lib/chibi/snow/commands.scm | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 457ed722..ba10444f 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -2157,24 +2157,15 @@ library))))) (define (kawa-builder impl cfg library dir) - (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) ".class")) - (dest-dir - (path-directory (make-path dir dest-library-file)))) - ;; ensure the build directory exists - (create-directory* dest-dir) - (with-directory - dir - (lambda () - (let ((res (system 'kawa '-d dir '-C src-library-file))) - (and (or (and (pair? res) (zero? (cadr res))) - (yes-or-no? cfg ".class file failed to build: " - (library-name library) - " - install anyway?")) - library)))))) + (let* ((src-library-file (make-path dir (get-library-file cfg library))) + (res (system 'kawa + '-d dir + '-C src-library-file))) + (and (or (and (pair? res) (zero? (cadr res))) + (yes-or-no? cfg ".class file failed to build: " + (library-name library) + " - install anyway?")) + library))) (define (lookup-builder builder) (case builder From ca35369186ecb7d78aa712c9733845ca77dc7a2a Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sat, 28 Jun 2025 07:14:59 +0300 Subject: [PATCH 10/13] Switch some string-appends to make-paths --- lib/chibi/snow/commands.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 8189cfd6..a18d91b1 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1400,15 +1400,14 @@ "/usr/local/share/guile/")))) ((mosh) (with-output-to-file - (string-append (cond-expand (windows (get-environment-variable "TMP")) + (make-path (cond-expand (windows (get-environment-variable "TMP")) (else "/tmp")) - "/snowmosh") + "snowmosh") (lambda () (display "(import (scheme base) (scheme write) (mosh config))") (newline) (display "(display (get-config \"library-path\"))"))) - (list (string-append (symbol->string (process->sexp '(mosh /tmp/snowmosh))) - "/lib"))) + (list (make-path (process->sexp '(mosh /tmp/snowmosh)) "lib"))) ((larceny) (list (make-path From 4dfdacf3aca8952d01661c783061a00ea288afd7 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sat, 28 Jun 2025 07:16:58 +0300 Subject: [PATCH 11/13] Fix indentation --- lib/chibi/snow/commands.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index a18d91b1..30a262e9 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1401,8 +1401,8 @@ ((mosh) (with-output-to-file (make-path (cond-expand (windows (get-environment-variable "TMP")) - (else "/tmp")) - "snowmosh") + (else "/tmp")) + "snowmosh") (lambda () (display "(import (scheme base) (scheme write) (mosh config))") (newline) From 16b771f4d2a931a9a57d91509b59b1336f5082af Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sun, 29 Jun 2025 12:28:20 +0300 Subject: [PATCH 12/13] Use proper utilities for temporary file handling --- lib/chibi/snow/commands.scm | 17 ++++++++--------- lib/chibi/snow/utils.scm | 18 +++++++++--------- lib/chibi/snow/utils.sld | 1 + 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index 30a262e9..f7d10ddc 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1399,15 +1399,14 @@ path "/usr/local/share/guile/")))) ((mosh) - (with-output-to-file - (make-path (cond-expand (windows (get-environment-variable "TMP")) - (else "/tmp")) - "snowmosh") - (lambda () - (display "(import (scheme base) (scheme write) (mosh config))") - (newline) - (display "(display (get-config \"library-path\"))"))) - (list (make-path (process->sexp '(mosh /tmp/snowmosh)) "lib"))) + (call-with-temp-file "snow-mosh.scm" + (lambda (tmp-path out preserve) + (with-output-to-file tmp-path + (lambda () + (display "(import (scheme base) (scheme write) (mosh config))") + (newline) + (display "(display (get-config \"library-path\"))"))) + (list (make-path (process->string `(mosh ,tmp-path)) "lib"))))) ((larceny) (list (make-path diff --git a/lib/chibi/snow/utils.scm b/lib/chibi/snow/utils.scm index 8b848399..db1ac7f8 100644 --- a/lib/chibi/snow/utils.scm +++ b/lib/chibi/snow/utils.scm @@ -41,15 +41,15 @@ '(kawa -e "(write (features))")))) (mosh "mosh" (mosh -v) #f ,(delay - (let ((tmpfile (string-append (cond-expand (windows (get-environment-variable "TMP")) - (else "/tmp")) - "/snowmosh"))) - (with-output-to-file - tmpfile - (lambda () - (display "(import (scheme base) (scheme write) (mosh config)) (display (features))"))) - (process->sexp - `(mosh ,tmpfile))))) + (call-with-temp-file "snow-mosh.scm" + (lambda (tmp-path out preserve) + (with-output-to-file tmp-path + (lambda () + (display "(import (scheme base) (scheme write) (mosh config))") + (newline) + (display "(display (features))"))) + (process->sexp + `(mosh ,tmp-path)))))) (larceny "larceny" (larceny --version) "v0.98" ,(delay '())) (sagittarius "sagittarius" #f #f diff --git a/lib/chibi/snow/utils.sld b/lib/chibi/snow/utils.sld index e62d3cd0..45584967 100644 --- a/lib/chibi/snow/utils.sld +++ b/lib/chibi/snow/utils.sld @@ -20,6 +20,7 @@ (chibi pathname) (chibi process) (chibi string) + (chibi temp-file) (chibi uri)) (cond-expand (chibi (import (chibi io))) From 870070159f4ce962bc2abfee9f1fc18a8e48b984 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sun, 6 Jul 2025 13:52:31 +0300 Subject: [PATCH 13/13] Also use .sld for Kawa libraries --- doc/chibi.scrbl | 2 +- lib/chibi/snow/commands.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/chibi.scrbl b/doc/chibi.scrbl index 04f2e97c..16436348 100755 --- a/doc/chibi.scrbl +++ b/doc/chibi.scrbl @@ -1664,7 +1664,7 @@ installed. The following are currently supported: \item{gambit - version >= 4.9.3} \item{generic; By default libraries are installed into /usr/local/lib/snow or %LOCALAPPDATA%/lib/snow on windows} \item{gauche - version >= 0.9.4} -\item{kawa - version >= 2.0; you need to add the install dir to the search path, e.g. \scheme{-Dkawa.import.path=/usr/local/share/kawa/lib}} +\item{kawa - version >= 2.0; you need to add the install dir to the search path, e.g. \scheme{-Dkawa.import.path=/usr/local/share/kawa/lib/*.sld}} \item{larceny - version 0.98; you need to add "lib/Snow" to the paths in startup.sch} \item{sagittarius - version >= 0.9.13} \item{racket - version >= 8.16 with the \scheme{r7rs} pkg} diff --git a/lib/chibi/snow/commands.scm b/lib/chibi/snow/commands.scm index a43584f7..141fe3d7 100644 --- a/lib/chibi/snow/commands.scm +++ b/lib/chibi/snow/commands.scm @@ -1801,7 +1801,7 @@ (define (get-library-extension impl cfg) (or (conf-get cfg 'library-extension) (case impl - ((gauche kawa) "scm") + ((gauche) "scm") (else "sld")))) (define (install-with-sudo? cfg path)