Compare commits

...

15 commits

Author SHA1 Message Date
Alex Shinn
c09c8788e3
Merge pull request #1035 from Retropikzel/snow-chibi-gambit
Some checks are pending
CI / macos-latest (push) Waiting to run
CI / ubuntu-latest (push) Waiting to run
Add support for Gambit to snow-chibi
2025-06-29 13:34:46 +09:00
Alex Shinn
6a15fffe4b
Merge pull request #1033 from Retropikzel/snow-chibi-racket
Add support for Racket to snow-chibi
2025-06-29 13:30:58 +09:00
retropikzel
5b6b5c6324 Check that .so and .o files exists before installing them 2025-06-28 09:57:33 +03:00
retropikzel
48ca9f9a5f Clean up the code, build both .so and o 2025-06-28 09:52:21 +03:00
retropikzel
a2591d0e4a Minor cleanup 2025-06-28 07:32:02 +03:00
retropikzel
7f2f3ba155 Add back accidentally removed stklos part 2025-06-28 07:28:34 +03:00
retropikzel
1b6c0fb9da racket-installer now returns list of installed files 2025-06-28 07:26:44 +03:00
retropikzel
2310094354 Remove debug displays 2025-06-27 07:40:34 +03:00
retropikzel
dd00829a90 Merging and fixing 2025-06-27 07:39:58 +03:00
retropikzel
ef1a2abfcc Add Racket support for snow-chibi 2025-06-26 20:21:34 +03:00
retropikzel
cd48e9973a Add Gambit support for snow-chibi 2025-06-26 20:18:54 +03:00
retropikzel
ea17a39be8 Merge remote-tracking branch 'origin/master' into snow-chibi-gambit 2025-06-26 12:51:52 +03:00
retropikzel
3b85c02e11 Add Gambit support for snow-chibi 2025-06-17 17:39:20 +03:00
retropikzel
0482dc7401 Add newline to end of .rkt file 2025-06-17 08:07:56 +03:00
retropikzel
232f2fe6e0 Add racket support for snow-chibi 2025-06-17 07:48:47 +03:00
3 changed files with 110 additions and 1 deletions

View file

@ -1661,10 +1661,12 @@ installed. The following are currently supported:
\item{chicken - version >= 4.9.0 with the \scheme{r7rs} egg}
\item{cyclone - version >= 0.5.3}
\item{foment - version >= 0.4}
\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}}
\item{larceny - version 0.98; you need to add "lib/Snow" to the paths in startup.sch}
\item{racket - version >= 8.16 with the \scheme{r7rs} pkg}
\item{sagittarius - version >= 0.98}
\item{stklos - version > 2.10}
]

View file

@ -1374,6 +1374,9 @@
(string-trim (process->string '(icyc -p "(Cyc-installation-dir 'sld)"))
char-whitespace?)))))
(list (or dir "/usr/local/share/cyclone/"))))
((gambit)
(list (make-path (get-environment-variable "HOME")
".gambit_userlib")))
((generic)
(list (make-path (or (conf-get cfg 'install-prefix)
(cond-expand (windows (get-environment-variable "LOCALAPPDATA"))
@ -1411,6 +1414,11 @@
(list (make-path
(process->string
'(stklos -e "(display (install-path #:libdir))")))))
((racket)
(list
(make-path
(process->string
'(racket -I racket/base -e "(display (find-system-path 'collects-dir))")))))
(else
(list (make-path (or (conf-get cfg 'install-prefix) "/usr/local")
"share/snow"
@ -1477,6 +1485,10 @@
(if lib-path
`(foment -A ,install-dir -A ,lib-path ,file)
`(foment -A ,install-dir ,file)))
((gambit)
(if lib-path
`(gsi -s:search=,install-dir ,lib-path ,file)
`(gsi -s:search=,install-dir ,file)))
((gauche)
(if lib-path
`(gosh -A ,install-dir -A ,lib-path ,file)
@ -1499,6 +1511,10 @@
`(larceny -r7rs -path ,(string-append install-dir ":" lib-path)
-program ,file)
`(larceny -r7rs -path ,install-dir -program ,file)))
((racket)
(if lib-path
`(racket -I r7rs -S ,install-dir -S ,lib-path --script ,file)
`(racket -I r7rs -S ,install-dir --script ,file)))
((stklos)
(if lib-path
`(stklos -A ,install-dir -A ,lib-path ,file)
@ -1636,6 +1652,7 @@
;; package information for each builtin library
(define native-srfi-support
'((foment 60)
(gambit 0 4 6 8 9 16 18 21 22 23 27 30 39 62 88 193)
(gauche 0 1 4 5 7 9 11 13 14 19 26 27 29 31 37 42 43 55)
(guile 0 1 2 4 6 8 9 10 11 13 14 16 17 18 19 23 26 27 28 30 31 34
35 37 38 39 41 42 43 45 46 55 60 61 62 64 67 69 71 87 88
@ -1702,8 +1719,10 @@
(cond
((eq? impl 'chicken) (get-install-library-dir impl cfg))
((eq? impl 'cyclone) (get-install-library-dir impl cfg))
((eq? impl 'gambit) (get-install-library-dir impl cfg))
((eq? impl 'generic) (get-install-library-dir impl cfg))
((eq? impl 'guile) (get-guile-site-dir))
((eq? impl 'racket) (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)
@ -1714,7 +1733,9 @@
(cond
((eq? impl 'chicken) (get-install-library-dir impl cfg))
((eq? impl 'cyclone) (get-install-library-dir impl cfg))
((eq? impl 'gambit) (get-install-library-dir impl cfg))
((eq? impl 'generic) (get-install-library-dir impl cfg))
((eq? impl 'racket) (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)
@ -1735,8 +1756,12 @@
(car (get-install-dirs impl cfg)))
((eq? impl 'cyclone)
(car (get-install-dirs impl cfg)))
((eq? impl 'gambit)
(car (get-install-dirs impl cfg)))
((eq? impl 'guile)
(get-guile-site-ccache-dir))
((eq? impl 'racket)
(car (get-install-dirs impl cfg)))
((eq? impl 'stklos)
(car (get-install-dirs impl cfg)))
((conf-get cfg 'install-prefix)
@ -1901,6 +1926,23 @@
(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))
(install-dir (get-install-library-dir impl cfg))
(so-path (string-append (path-strip-extension library-file) ".so"))
(dest-so-path (make-path install-dir so-path))
(o-path (string-append (path-strip-extension library-file) ".o"))
(dest-o-path (make-path install-dir o-path))
(installed-files (default-installer impl cfg library dir)))
(install-directory cfg (path-directory dest-so-path))
(when (file-exists? so-path)
(install-file cfg (make-path dir so-path) dest-so-path)
(set! installed-files (cons so-path installed-files)))
(when (file-exists? o-path)
(install-file cfg (make-path dir o-path) dest-o-path)
(set! installed-files (cons o-path installed-files)))
installed-files))
(define (guile-installer impl cfg library dir)
(let* ((source-scm-file (get-library-file cfg library))
(source-go-file (string-append
@ -1942,19 +1984,49 @@
(library-shared-include-files
impl cfg (make-path dir source-scm-file))))))))
;; Racket can only load files with .rkt suffix. So for each library we create
;; a file that sets language to r7rs and includes the .sld file
(define (racket-installer impl cfg library dir)
(let* ((source-rkt-file
(make-path dir
(string-append (path-strip-extension (get-library-file cfg library))
".rkt")))
(install-dir (get-install-source-dir impl cfg))
(dest-rkt-file
(make-path install-dir
(string-append (library->path cfg library) ".rkt")))
(path (make-path install-dir dest-rkt-file))
(include-filename (string-append
(path-strip-directory (path-strip-extension path))
".sld"))
(installed-files (default-installer impl cfg library dir)))
(with-output-to-file
source-rkt-file
(lambda ()
(map display
(list "#lang r7rs" #\newline
"(import (scheme base))" #\newline
"(include \"" include-filename "\")" #\newline))))
(install-file cfg source-rkt-file dest-rkt-file)
(cons dest-rkt-file installed-files)))
;; installers should return the list of installed files
(define (lookup-installer installer)
(case installer
((chicken) chicken-installer)
((cyclone) cyclone-installer)
((gambit) gambit-installer)
((guile) guile-installer)
((racket) racket-installer)
(else default-installer)))
(define (installer-for-implementation impl cfg)
(case impl
((chicken) 'chicken)
((cyclone) 'cyclone)
((gambit) 'gambit)
((guile) 'guile)
((racket) 'racket)
(else 'default)))
(define (install-library impl cfg library dir)
@ -2119,6 +2191,30 @@
" - install anyway?"))
library))))))
(define (gambit-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-so-file (string-append (library->path cfg library) ".so"))
(dest-o-file (string-append (library->path cfg library) ".o"))
(dest-dir (path-directory (make-path dir dest-so-file))))
;; ensure the build directory exists
(create-directory* dest-dir)
(with-directory
dir
(lambda ()
(let ((res (system 'gsc '-o dest-so-file '-dynamic src-library-file)))
(and (or (and (pair? res) (zero? (cadr res)))
(yes-or-no? cfg "gambit failed to build .so file: "
(library-name library)
" - install anyway?"))
(let ((res (system 'gsc '-o dest-o-file '-obj src-library-file)))
(and (or (and (pair? res) (zero? (cadr res)))
(yes-or-no? cfg "gambit failed to build .o file: "
(library-name library)
" - install anyway?"))
library))))))))
(define (guile-builder impl cfg library dir)
(let* ((library-file (get-library-file cfg library))
(src-library-file (make-path dir library-file))
@ -2140,12 +2236,13 @@
((chibi) chibi-builder)
((chicken) chicken-builder)
((cyclone) cyclone-builder)
((gambit) gambit-builder)
((guile) guile-builder)
(else default-builder)))
(define (builder-for-implementation impl cfg)
(case impl
((chibi chicken cyclone guile) impl)
((chibi chicken cyclone gambit guile) impl)
(else 'default)))
(define (build-library impl cfg library dir)

View file

@ -25,6 +25,10 @@
,(delay
(process->sexp
'(foment -e "(write (features))"))))
(gambit "gsc" (gsc -v) #f
,(delay
(process->sexp
'(gsc -e "(display (features))"))))
(generic "generic" #f #f
,(delay (write-string "generic\n")))
(gauche "gosh" (gosh -E "print (gauche-version)") "0.9.4"
@ -41,6 +45,10 @@
'(kawa -e "(write (features))"))))
(larceny "larceny" (larceny --version) "v0.98"
,(delay '()))
(racket "racket" (racket --version) #f
,(delay
(process->sexp
'(racket -I r7rs -e "(import (scheme base) (scheme write)) (display (features))"))))
(sagittarius "sagittarius" #f #f
,(delay
(process->sexp
@ -65,7 +73,9 @@
(define (target-is-host? impl)
(case impl
((chibi) (cond-expand (chibi #t) (else #f)))
((gambit) (cond-expand (gambit #t) (else #f)))
((gauche) (cond-expand (gauche #t) (else #f)))
((racket) (cond-expand (racket #t) (else #f)))
((sagittarius) (cond-expand (sagittarius #t) (else #f)))
((stklos) (cond-expand (stklos #t) (else #f)))
(else #f)))