Switch all interpreters to use tmpfile
This commit is contained in:
parent
461cac6d4d
commit
d6526764df
3
Makefile
3
Makefile
|
|
@ -6,6 +6,9 @@ DOCKERIMG=${SCHEME}:head
|
||||||
ifeq "${SCHEME}" "chicken"
|
ifeq "${SCHEME}" "chicken"
|
||||||
DOCKERIMG="chicken:5"
|
DOCKERIMG="chicken:5"
|
||||||
endif
|
endif
|
||||||
|
ifeq "${SCHEME}" "vicare"
|
||||||
|
DOCKERIMG="vicare"
|
||||||
|
endif
|
||||||
STATIC_LIBS=libs.util.a libs.library-util.a libs.data.a libs.srfi-64-util.a
|
STATIC_LIBS=libs.util.a libs.library-util.a libs.data.a libs.srfi-64-util.a
|
||||||
|
|
||||||
all: build-chibi
|
all: build-chibi
|
||||||
|
|
|
||||||
|
|
@ -221,13 +221,29 @@
|
||||||
(delete-file output-file))
|
(delete-file output-file))
|
||||||
(let ((shebang-line (string-append
|
(let ((shebang-line (string-append
|
||||||
(cond ((string=? compilation-target "unix")
|
(cond ((string=? compilation-target "unix")
|
||||||
"#!/usr/bin/env -S ")
|
(string-append
|
||||||
|
"#!/bin/sh"
|
||||||
|
(string #\newline)
|
||||||
|
"tmpfile=$(mktemp)"
|
||||||
|
(string #\newline)
|
||||||
|
"tail -n+7 \"$0\" > ${tmpfile}"
|
||||||
|
(string #\newline)))
|
||||||
((string=? compilation-target "windows")
|
((string=? compilation-target "windows")
|
||||||
(string-append
|
(string-append
|
||||||
"@echo off"
|
"@echo off"
|
||||||
(string #\newline)
|
(string #\newline)
|
||||||
"start")))
|
"start")))
|
||||||
scheme-command))
|
scheme-command
|
||||||
|
(cond ((string=? compilation-target "unix")
|
||||||
|
(string-append
|
||||||
|
" \"$@\""
|
||||||
|
(string #\newline)
|
||||||
|
"rm -rf ${tmpfile}"
|
||||||
|
(string #\newline)
|
||||||
|
"exit"
|
||||||
|
(string #\newline)))
|
||||||
|
((string=? compilation-target "windows")
|
||||||
|
""))))
|
||||||
(scheme-program (slurp input-file)))
|
(scheme-program (slurp input-file)))
|
||||||
(display "Creating startup script ")
|
(display "Creating startup script ")
|
||||||
(display output-file)
|
(display output-file)
|
||||||
|
|
|
||||||
102
libs/data.sld
102
libs/data.sld
|
|
@ -28,7 +28,7 @@
|
||||||
(string-append item separator))
|
(string-append item separator))
|
||||||
(append prepend-directories append-directories)))
|
(append prepend-directories append-directories)))
|
||||||
"\"")))
|
"\"")))
|
||||||
" --program "))))))
|
" --program ${tmpfile}"))))))
|
||||||
(chibi
|
(chibi
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -43,7 +43,8 @@
|
||||||
" "
|
" "
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A" " " item " "))
|
(string-append "-A" " " item " "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
(chicken
|
(chicken
|
||||||
(type . compiler)
|
(type . compiler)
|
||||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||||
|
|
@ -135,7 +136,8 @@
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A" " " item " "))
|
(string-append "-A" " " item " "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
#;(gambit
|
#;(gambit
|
||||||
(type . compiler)
|
(type . compiler)
|
||||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||||
|
|
@ -179,7 +181,8 @@
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A" " " item " "))
|
(string-append "-A" " " item " "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
(guile
|
(guile
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||||
|
|
@ -209,9 +212,7 @@
|
||||||
"-L " (dirname item) " "))
|
"-L " (dirname item) " "))
|
||||||
(append prepend-directories
|
(append prepend-directories
|
||||||
append-directories))
|
append-directories))
|
||||||
" -s"
|
" -s ${tmpfile}")))))
|
||||||
,(string #\newline)
|
|
||||||
"!#")))))
|
|
||||||
(ikarus
|
(ikarus
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -221,8 +222,7 @@
|
||||||
,@(map (lambda (item) (string-append item ":")) append-directories)
|
,@(map (lambda (item) (string-append item ":")) append-directories)
|
||||||
" ikarus "
|
" ikarus "
|
||||||
,(util-getenv "COMPILE_R7RS_IKARUS")
|
,(util-getenv "COMPILE_R7RS_IKARUS")
|
||||||
" --r6rs-script"
|
" --r6rs-script ${tmpfile}")))))
|
||||||
)))))
|
|
||||||
(ironscheme
|
(ironscheme
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -235,7 +235,8 @@
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-I \"" item "\" "))
|
(string-append "-I \"" item "\" "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
(kawa
|
(kawa
|
||||||
(type . compiler)
|
(type . compiler)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -294,15 +295,7 @@
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`("sh"
|
`("larceny -nobanner -quiet -utf8 "
|
||||||
,(string #\newline)
|
|
||||||
"filename=\"$(basename ${0})\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tmpfile=\"/tmp/larceny.${filename}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tail -n+8 \"${0}\" > \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"larceny -nobanner -quiet -utf8 "
|
|
||||||
,(if r6rs? " -r6 " " -r7 ")
|
,(if r6rs? " -r6 " " -r7 ")
|
||||||
,(util-getenv "COMPILE_R7RS_LARCENY")
|
,(util-getenv "COMPILE_R7RS_LARCENY")
|
||||||
" "
|
" "
|
||||||
|
|
@ -312,11 +305,7 @@
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A " item " "))
|
(string-append "-A " item " "))
|
||||||
append-directories)
|
append-directories)
|
||||||
" -program \"${tmpfile}\" -- \"$@\""
|
" -program ${tmpfile} --")))))
|
||||||
,(string #\newline)
|
|
||||||
"rm -rf \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"exit")))))
|
|
||||||
(loko
|
(loko
|
||||||
(type . compiler)
|
(type . compiler)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -345,28 +334,18 @@
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`("meevax "
|
`("meevax "
|
||||||
,(util-getenv "COMPILE_R7RS_MEEVAX")
|
,(util-getenv "COMPILE_R7RS_MEEVAX")
|
||||||
" "
|
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -I" " " item " "))
|
(string-append " -I" " " item " "))
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
" "
|
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -A" " " item " "))
|
(string-append " -A" " " item " "))
|
||||||
append-directories)
|
append-directories)
|
||||||
)))))
|
" ${tmpfile}")))))
|
||||||
(mit-scheme
|
(mit-scheme
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`(,"sh"
|
`("mit-scheme --batch-mode --no-init-file "
|
||||||
,(string #\newline)
|
|
||||||
"filename=\"$(basename ${0})\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tmpfile=\"/tmp/mit-scheme.${filename}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tail -n+8 \"${0}\" > \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"mit-scheme --batch-mode --no-init-file "
|
|
||||||
,@(map
|
,@(map
|
||||||
(lambda (item)
|
(lambda (item)
|
||||||
(string-append "--load "
|
(string-append "--load "
|
||||||
|
|
@ -375,12 +354,7 @@
|
||||||
item)
|
item)
|
||||||
" "))
|
" "))
|
||||||
library-files)
|
library-files)
|
||||||
" --load \"${tmpfile}\" --eval \"(exit 0)\" --args \"$@\""
|
" --load \"${tmpfile}\" --eval \"(exit 0)\" --args")))))
|
||||||
,(string #\newline)
|
|
||||||
"rm -rf \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"exit"
|
|
||||||
,(string #\newline))))))
|
|
||||||
(mosh
|
(mosh
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -393,7 +367,8 @@
|
||||||
(map (lambda (item) (string-append item ":")) dirs)))
|
(map (lambda (item) (string-append item ":")) dirs)))
|
||||||
"")
|
"")
|
||||||
" mosh "
|
" mosh "
|
||||||
,(util-getenv "COMPILE_R7RS_MOSH")))))))
|
,(util-getenv "COMPILE_R7RS_MOSH")
|
||||||
|
" ${tmpfile}"))))))
|
||||||
(racket
|
(racket
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||||
|
|
@ -415,14 +390,13 @@
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`("racket "
|
`("racket "
|
||||||
,(util-getenv "COMPILE_R7RS_RACKET")
|
,(util-getenv "COMPILE_R7RS_RACKET")
|
||||||
" "
|
,(if r6rs? " -I r6rs " " -I r7rs ")
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -S " item " "))
|
(string-append " -S " item " "))
|
||||||
(append prepend-directories
|
(append prepend-directories
|
||||||
append-directories))
|
append-directories))
|
||||||
,(if r6rs?
|
,(if r6rs? "" " --script ")
|
||||||
""
|
" ${tmpfile}"))))))
|
||||||
(string-append (string #\newline) "#lang r7rs"))))))))
|
|
||||||
(sagittarius
|
(sagittarius
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -435,20 +409,13 @@
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -A " item " "))
|
(string-append " -A " item " "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
(skint
|
(skint
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`("sh"
|
`("skint "
|
||||||
,(string #\newline)
|
|
||||||
"filename=\"$(basename ${0})\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tmpfile=\"/tmp/skint.${filename}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"tail -n+8 \"${0}\" > \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"skint "
|
|
||||||
,(util-getenv "COMPILE_R7RS_SKINT")
|
,(util-getenv "COMPILE_R7RS_SKINT")
|
||||||
" "
|
" "
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
|
|
@ -457,12 +424,7 @@
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A " item "/ "))
|
(string-append "-A " item "/ "))
|
||||||
append-directories)
|
append-directories)
|
||||||
" --program=\"${tmpfile}\" \"$@\""
|
" --program=${tmpfile}")))))
|
||||||
,(string #\newline)
|
|
||||||
"rm -rf \"${tmpfile}\""
|
|
||||||
,(string #\newline)
|
|
||||||
"exit"
|
|
||||||
,(string #\newline))))))
|
|
||||||
(stklos
|
(stklos
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -475,7 +437,8 @@
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "-A " item " "))
|
(string-append "-A " item " "))
|
||||||
append-directories))))))
|
append-directories)
|
||||||
|
" ${tmpfile}")))))
|
||||||
(tr7
|
(tr7
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -488,24 +451,21 @@
|
||||||
(string-append item ":"))
|
(string-append item ":"))
|
||||||
append-directories)
|
append-directories)
|
||||||
" tr7i "
|
" tr7i "
|
||||||
,(util-getenv "COMPILE_R7RS_TR7"))))))
|
,(util-getenv "COMPILE_R7RS_TR7")
|
||||||
|
" ${tmpfile}")))))
|
||||||
(vicare
|
(vicare
|
||||||
(type . compiler)
|
(type . compiler)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
`("vicare "
|
`("vicare "
|
||||||
" "
|
|
||||||
,(util-getenv "COMPILE_R7RS_VICARE")
|
,(util-getenv "COMPILE_R7RS_VICARE")
|
||||||
" "
|
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -I " item " "))
|
(string-append " -I " item " "))
|
||||||
prepend-directories)
|
prepend-directories)
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append " -A " item " "))
|
(string-append " -A " item " "))
|
||||||
append-directories)
|
append-directories)
|
||||||
" "
|
" --compile-program")))))
|
||||||
"--compile-program"
|
|
||||||
,input-file)))))
|
|
||||||
(ypsilon
|
(ypsilon
|
||||||
(type . interpreter)
|
(type . interpreter)
|
||||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||||
|
|
@ -521,4 +481,4 @@
|
||||||
,@(map (lambda (item)
|
,@(map (lambda (item)
|
||||||
(string-append "--sitelib=" item " "))
|
(string-append "--sitelib=" item " "))
|
||||||
append-directories)
|
append-directories)
|
||||||
" --top-level-program")))))))))
|
" --top-level-program ${tmpfile}")))))))))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue