mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-04 03:36:36 +02:00
Compare commits
15 commits
77a4fbd5ba
...
c09c8788e3
Author | SHA1 | Date | |
---|---|---|---|
|
c09c8788e3 | ||
|
6a15fffe4b | ||
|
5b6b5c6324 | ||
|
48ca9f9a5f | ||
|
a2591d0e4a | ||
|
7f2f3ba155 | ||
|
1b6c0fb9da | ||
|
2310094354 | ||
|
dd00829a90 | ||
|
ef1a2abfcc | ||
|
cd48e9973a | ||
|
ea17a39be8 | ||
|
3b85c02e11 | ||
|
0482dc7401 | ||
|
232f2fe6e0 |
3 changed files with 110 additions and 1 deletions
|
@ -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}
|
||||
]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue