Improvements
This commit is contained in:
parent
c47420b706
commit
5ba6b6c0b4
35
Dockerfile
35
Dockerfile
|
|
@ -1,32 +1,15 @@
|
|||
FROM debian:trixie-slim AS build
|
||||
RUN apt-get update && apt-get install -y gcc make git chicken-bin
|
||||
RUN chicken-install r7rs
|
||||
|
||||
FROM debian:trixie-slim
|
||||
RUN apt-get update && apt-get install -y gcc make git libffi-dev
|
||||
WORKDIR /build
|
||||
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 chibi
|
||||
|
||||
WORKDIR /build/chibi
|
||||
RUN make DESTDIR=/opt/compile-r7rs
|
||||
RUN make DESTDIR=/opt/compile-r7rs install
|
||||
|
||||
RUN mkdir -p /opt/compile-r7rs/bin
|
||||
RUN echo "#!/bin/sh" > /opt/compile-r7rs/bin/snow-chibi
|
||||
RUN echo "PATH=/opt/compile-r7rs/usr/local/bin:${PATH} LD_LIBRARY_PATH=/opt/compile-r7rs/usr/local/lib:/opt/compile-r7rs/usr/local/lib/chibi CHIBI_MODULE_PATH=/opt/compile-r7rs/usr/local/share/chibi:/opt/compile-r7rs/usr/local/lib/chibi /opt/compile-r7rs/usr/local/bin/chibi-scheme -I /opt/compile-r7rs/usr/local/share/chibi -I /opt/compile-r7rs/usr/local/lib/chibi -I /opt/compile/snow -mchibi.snow.commands -mchibi.snow.interface -mchibi.snow.package -mchibi.snow.utils /opt/compile-r7rs/usr/local/bin/snow-chibi.scm \"\$@\"" >> /opt/compile-r7rs/bin/snow-chibi
|
||||
RUN chmod +x /opt/compile-r7rs/bin/snow-chibi
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}
|
||||
|
||||
WORKDIR /build
|
||||
RUN snow-chibi install --impls=chicken --always-yes "(foreign c)"
|
||||
RUN snow-chibi install --impls=chicken --always-yes "(srfi 170)"
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||
RUN snow-chibi install --impls=chibi --always-yes "(foreign c)"
|
||||
RUN snow-chibi install --impls=chibi --always-yes "(srfi 170)"
|
||||
COPY Makefile .
|
||||
COPY compile-r7rs.scm .
|
||||
COPY libs libs
|
||||
RUN make build-chicken
|
||||
RUN make PREFIX=/opt/compile-r7rs install
|
||||
|
||||
FROM debian:trixie-slim
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential libffi-dev docker.io make cmake
|
||||
COPY --from=build /opt/compile-r7rs /opt/compile-r7rs
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}
|
||||
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||
RUN make build-chibi
|
||||
RUN make install
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
FROM alpine AS build
|
||||
RUN apk add make gcc chicken git
|
||||
RUN chicken-install r7rs
|
||||
|
||||
WORKDIR /build
|
||||
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 chibi
|
||||
|
||||
WORKDIR /build/chibi
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
WORKDIR /build
|
||||
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||
RUN snow-chibi install --always-yes --impls=chicken "(foreign c)"
|
||||
RUN snow-chibi install --always-yes --impls=chicken "(srfi 170)"
|
||||
COPY Makefile .
|
||||
COPY compile-r7rs.scm .
|
||||
COPY libs ./libs
|
||||
RUN make PREFIX=/opt/compile-r7rs build-chicken
|
||||
RUN make PREFIX=/opt/compile-r7rs install
|
||||
|
||||
FROM alpine
|
||||
COPY --from=build /opt/compile-r7rs /opt/compile-r7rs
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
ARG SCHEME=chibi
|
||||
ARG IMAGE=chibi:head
|
||||
FROM debian:trixie AS build
|
||||
RUN apt-get update && apt-get install -y \
|
||||
--download-only \
|
||||
--no-install-recommends \
|
||||
--no-install-suggests \
|
||||
build-essential \
|
||||
make \
|
||||
libffi-dev \
|
||||
ca-certificates \
|
||||
git \
|
||||
cmark
|
||||
FROM debian:bookworm AS cache
|
||||
RUN apt-get update && apt-get install -y gcc make git
|
||||
WORKDIR /cache
|
||||
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1
|
||||
WORKDIR /cache/chibi-scheme
|
||||
RUN make
|
||||
|
||||
ARG SCHEME=chibi
|
||||
ENV COMPILE_R7RS=${SCHEME}
|
||||
ARG IMAGE=chibi:head
|
||||
FROM schemers/${IMAGE}
|
||||
COPY --from=build /var/cache/apt/archives /debs
|
||||
RUN dpkg -i /debs/*.deb
|
||||
COPY --from=local-build-compile-r7rs /opt/compile-r7rs /opt/compile-r7rs
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}:/opt/compile-r7rs/snow-chibi/bin
|
||||
RUN apt-get update && apt-get install -y make gcc libffi-dev unzip
|
||||
COPY --from=cache /cache /cache
|
||||
WORKDIR /cache/chibi-scheme
|
||||
RUN make install
|
||||
WORKDIR /
|
||||
RUN snow-chibi install --always-yes "(foreign c)"
|
||||
RUN snow-chibi install --always-yes "(srfi 170)"
|
||||
COPY Makefile .
|
||||
COPY libs libs/
|
||||
COPY compile-r7rs.scm .
|
||||
RUN make build-chibi && make install
|
||||
|
|
|
|||
|
|
@ -1,32 +1,28 @@
|
|||
pipeline {
|
||||
|
||||
agent {
|
||||
docker {
|
||||
label 'docker-x86_64'
|
||||
image 'schemers/chibi:head'
|
||||
args '--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock'
|
||||
}
|
||||
}
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
}
|
||||
|
||||
parameters {
|
||||
booleanParam(name: 'DOCKER', defaultValue: false, description: 'Build and push docker image')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
stage('Build and install') {
|
||||
steps {
|
||||
sh "docker build -f Dockerfile --tag=local-build-compile-r7rs ."
|
||||
}
|
||||
}
|
||||
|
||||
stage('Warm up cache') {
|
||||
steps {
|
||||
sh "docker build -f Dockerfile.test --build-arg IMAGE=chibi:head --build-arg SCHEME=chibi --tag=compile-r7rs-test-chibi ."
|
||||
sh "apt-get install -y make"
|
||||
sh "make build-chibi"
|
||||
sh "make install"
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
stage('Test R6RS implementations') {
|
||||
steps {
|
||||
script {
|
||||
|
|
@ -72,54 +68,6 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Docker build/login/push x84-64') {
|
||||
agent {
|
||||
label 'linux-x86_64'
|
||||
}
|
||||
when {
|
||||
allOf {
|
||||
branch 'main'
|
||||
expression {
|
||||
return params.DOCKER
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh 'docker build . --tag=retropikzel1/compile-r7rs'
|
||||
sh 'docker login -u ${DOCKER_HUB_USERNAME} -p ${DOCKER_HUB_TOKEN}'
|
||||
sh 'docker push retropikzel1/compile-r7rs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Docker build/login/push arm') {
|
||||
agent {
|
||||
label 'linux-arm'
|
||||
}
|
||||
when {
|
||||
allOf {
|
||||
branch 'main'
|
||||
expression {
|
||||
return params.DOCKER
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh 'docker build . --tag=retropikzel1/compile-r7rs'
|
||||
sh 'docker login -u ${DOCKER_HUB_USERNAME} -p ${DOCKER_HUB_TOKEN}'
|
||||
sh 'docker push retropikzel1/compile-r7rs'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Docker logout') {
|
||||
steps {
|
||||
sh 'docker logout'
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
58
Makefile
58
Makefile
|
|
@ -6,12 +6,15 @@ DOCKERIMG=${SCHEME}:head
|
|||
ifeq "${SCHEME}" "chicken"
|
||||
DOCKERIMG="chicken:5"
|
||||
endif
|
||||
|
||||
STATIC_LIBS=libs.util.a libs.library-util.a libs.data.a libs.srfi-64-util.a
|
||||
|
||||
all:
|
||||
echo "HERE!"
|
||||
|
||||
build-chibi:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||
chmod +x compile-r7rs
|
||||
|
||||
build-chicken:
|
||||
csc -R r7rs -X r7rs -static -c -J -unit libs.util -o libs.util.o libs/util.sld
|
||||
|
|
@ -32,14 +35,17 @@ build-chicken:
|
|||
build-gauche:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "gosh -r -I ${PREFIX}/lib/compile-r7rs -I ${PREFIX}/lib/compile-r7rs/libs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||
chmod +x compile-r7rs
|
||||
|
||||
build-guile:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "guile --r7rs --auto-compile -I -q -L ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\" 2> /dev/null" >> compile-r7rs
|
||||
chmod +x compile-r7rs
|
||||
|
||||
build-kawa:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "kawa -J--add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED -J--add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED -J--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED -J--enable-native-access=ALL-UNNAMED -Dkawa.import.path=/usr/local/share/kawa/lib/*.sld:${PREFIX}/lib/compile-r7rs/*.sld --r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\" 2> /dev/null" >> compile-r7rs
|
||||
chmod +x compile-r7rs
|
||||
|
||||
#build-racket:
|
||||
#echo "#!/bin/sh" > compile-r7rs
|
||||
|
|
@ -48,24 +54,12 @@ build-kawa:
|
|||
build-sagittarius:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "sash -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||
chmod +x compile-r7rs
|
||||
|
||||
build-stklos:
|
||||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "stklos -I ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||
|
||||
docker-images: build-docker-image-debian build-docker-image-alpine
|
||||
|
||||
docker-image-debian:
|
||||
docker build . -f Dockerfile --tag=retropikzel1/compile-r7rs:latest
|
||||
|
||||
docker-image-debian-push:
|
||||
docker push retropikzel1/compile-r7rs:latest
|
||||
|
||||
docker-image-alpine:
|
||||
docker build . -f Dockerfile.alpine --tag=retropikzel1/compile-r7rs:alpine-latest
|
||||
|
||||
docker-image-alpine-push:
|
||||
docker push retropikzel1/compile-r7rs:alpine-latest
|
||||
chmod +x compile-r7rs
|
||||
|
||||
install:
|
||||
mkdir -p ${PREFIX}/bin
|
||||
|
|
@ -81,39 +75,26 @@ uninstall:
|
|||
test-r6rs:
|
||||
rm -rf ${R6RSTMP}
|
||||
mkdir -p ${R6RSTMP}
|
||||
mkdir -p ${R6RSTMP}/libs
|
||||
mkdir -p ${R6RSTMP}/libs/foo
|
||||
printf "#!r6rs\n(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > ${R6RSTMP}/libs/foo/bar.sls
|
||||
printf "#!r6rs\n(import (rnrs) (foo bar)) (baz)" > ${R6RSTMP}/main.sps
|
||||
cp -r r6rs-testfiles/* ${R6RSTMP}/
|
||||
cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.sps
|
||||
-cd ${R6RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1
|
||||
@grep "Test successfull" ${R6RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/compile-r7rs-test-result.txt && exit 1)
|
||||
cd ${R6RSTMP} && ./main 1 2 3 > test-result.txt
|
||||
@grep "Test successfull (\"1\" \"2\" \"3\")" ${R6RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/test-result.txt && exit 1)
|
||||
|
||||
test-r6rs-docker: build-local-docker
|
||||
test-r6rs-docker:
|
||||
docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r6rs"
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make SCHEME=${SCHEME} test-r6rs"
|
||||
|
||||
test-r7rs:
|
||||
rm -rf ${R7RSTMP}
|
||||
mkdir -p ${R7RSTMP}
|
||||
mkdir -p ${R7RSTMP}/libs
|
||||
mkdir -p ${R7RSTMP}/libs/foo
|
||||
mkdir -p ${R7RSTMP}/libs/hello
|
||||
echo "(import (scheme base) (foo bar) (hello world) (other hellolib)) (baz) (hello-world) (over-9000)" > ${R7RSTMP}/main.scm
|
||||
echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > ${R7RSTMP}/libs/foo/bar.scm
|
||||
echo "(define-library (foo bar) (import (scheme base) (scheme write) (hello world)) (export baz) (include \"bar.scm\"))" > ${R7RSTMP}/libs/foo/bar.sld
|
||||
echo "(define hello-world (lambda () (+ 1 1)))" > ${R7RSTMP}/libs/hello/world.scm
|
||||
echo "(define-library (hello world) (import (scheme base) (scheme write)) (export hello-world) (include \"world.scm\"))" > ${R7RSTMP}/libs/hello/world.sld
|
||||
mkdir -p ${R7RSTMP}/libs/other
|
||||
echo "(define over-9000 (lambda () (+ 1 1)))" > ${R7RSTMP}/libs/other/hellolib.scm
|
||||
echo "(define-library (other hellolib) (import (scheme base) (scheme write)) (export over-9000) (include \"hellolib.scm\"))" > ${R7RSTMP}/libs/other/hellolib.sld
|
||||
cp -r r7rs-testfiles/* ${R7RSTMP}/
|
||||
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.scm
|
||||
-cd ${R7RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1
|
||||
@grep "Test successfull" ${R7RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/compile-r7rs-test-result.txt && exit 1)
|
||||
-cd ${R7RSTMP} && ./main 1 2 3 > test-result.txt 2>&1
|
||||
@grep "Test successfull (\"1\" \"2\" \"3\")" ${R7RSTMP}/test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/test-result.txt && exit 1)
|
||||
|
||||
test-r7rs-docker: build-local-docker
|
||||
test-r7rs-docker:
|
||||
docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r7rs"
|
||||
docker run -it -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make SCHEME=${SCHEME} test-r7rs"
|
||||
|
||||
clean:
|
||||
rm -rf test-r7rs
|
||||
|
|
@ -125,6 +106,7 @@ clean:
|
|||
find . -name "*.link" -delete
|
||||
find . -name "*.meta" -delete
|
||||
find . -name "*.import.*" -delete
|
||||
rm -rf libs.library-util.c
|
||||
rm -rf dist
|
||||
rm -rf deps
|
||||
|
||||
|
|
|
|||
|
|
@ -151,13 +151,13 @@
|
|||
(define scheme-type (cdr (assoc 'type (cdr (assoc scheme data)))))
|
||||
|
||||
(define scheme-command
|
||||
(string-append (apply (cdr (assoc 'command (cdr (assoc scheme data))))
|
||||
(apply (cdr (assoc 'command (cdr (assoc scheme data))))
|
||||
(list (if input-file input-file "")
|
||||
(if output-file output-file "")
|
||||
prepend-directories
|
||||
append-directories
|
||||
library-files
|
||||
r6rs?))))
|
||||
r6rs?)))
|
||||
|
||||
(define scheme-library-command
|
||||
(lambda (library-file)
|
||||
|
|
@ -198,16 +198,18 @@
|
|||
(display "Compiling library ")
|
||||
(display file)
|
||||
(newline)
|
||||
(display "With command ")
|
||||
(display library-command)
|
||||
(for-each
|
||||
(lambda (command)
|
||||
(display "Running ")
|
||||
(write command)
|
||||
(newline)
|
||||
(display "Exit code ")
|
||||
(let ((output (c-system (string->c-utf8 library-command))))
|
||||
(when (not (= output 0))
|
||||
(error "Problem compiling libraries, exiting" output))
|
||||
(display output))
|
||||
(let ((exit-code (c-system (string->c-utf8 command))))
|
||||
(display exit-code)
|
||||
(newline)
|
||||
(newline)))
|
||||
(when (not (= exit-code 0))
|
||||
(exit exit-code))))
|
||||
library-command)))
|
||||
library-files))
|
||||
(else
|
||||
(display "Implementation has no library build command, skipping library compilation.")
|
||||
|
|
@ -217,32 +219,33 @@
|
|||
(when (and (equal? scheme-type 'interpreter) input-file)
|
||||
(when (and output-file (file-exists? output-file))
|
||||
(delete-file output-file))
|
||||
(let ((shebang-line (string-append
|
||||
(cond ((string=? compilation-target "unix")
|
||||
"#!/usr/bin/env -S ")
|
||||
((string=? compilation-target "windows")
|
||||
(string-append
|
||||
"@echo off"
|
||||
(string #\newline)
|
||||
"start")))
|
||||
scheme-command))
|
||||
(scheme-program (slurp input-file)))
|
||||
(display "Creating startup script ")
|
||||
(display output-file)
|
||||
(newline)
|
||||
(display "Containing command ")
|
||||
(display scheme-command)
|
||||
(display "Starting with ")
|
||||
(display shebang-line)
|
||||
(newline)
|
||||
(with-output-to-file
|
||||
(if (string=? compilation-target "windows")
|
||||
(string-append output-file ".bat")
|
||||
output-file)
|
||||
(lambda ()
|
||||
(cond ((string=? compilation-target "unix")
|
||||
(display "#!/bin/sh")
|
||||
(newline))
|
||||
((string=? compilation-target "windows")
|
||||
(display "@echo off")
|
||||
(display shebang-line)
|
||||
(newline)
|
||||
(display "start")))
|
||||
(display scheme-command)
|
||||
(cond ((string=? compilation-target "unix")
|
||||
(display " \"")
|
||||
(display "$@")
|
||||
(display "\"")))
|
||||
(display scheme-program)
|
||||
(newline)))
|
||||
(cond ((string=? compilation-target "unix")
|
||||
(c-system (string->c-utf8 (string-append "chmod +x " output-file))))))
|
||||
(c-system (string->c-utf8 (string-append "chmod +x " output-file)))))))
|
||||
|
||||
(when (and (equal? scheme-type 'compiler) input-file)
|
||||
(when (and output-file (file-exists? output-file))
|
||||
|
|
@ -250,10 +253,17 @@
|
|||
(display "Compiling file ")
|
||||
(display input-file)
|
||||
(newline)
|
||||
(display "With command ")
|
||||
(display scheme-command)
|
||||
(for-each
|
||||
(lambda (command)
|
||||
(display "Running ")
|
||||
(write command)
|
||||
(newline)
|
||||
(display "Exit code ")
|
||||
(display (c-system (string->c-utf8 scheme-command)))
|
||||
(let ((exit-code (c-system (string->c-utf8 command))))
|
||||
(display exit-code)
|
||||
(newline)
|
||||
(when (not (= exit-code 0))
|
||||
(exit exit-code))))
|
||||
scheme-command)
|
||||
(newline))
|
||||
|
||||
|
|
|
|||
532
libs/data.sld
532
libs/data.sld
|
|
@ -12,20 +12,23 @@
|
|||
`((chezscheme
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(let ((separator (cond-expand (windows ";") (else ":"))))
|
||||
(apply string-append
|
||||
`("scheme"
|
||||
" "
|
||||
`("chezscheme "
|
||||
,(util-getenv "COMPILE_R7RS_CHEZSCHEME")
|
||||
" "
|
||||
"--quiet"
|
||||
,(if (and (null? prepend-directories)
|
||||
(null? append-directories))
|
||||
""
|
||||
,@(map (lambda (item)
|
||||
(string-append "--libdirs " " " item ":"))
|
||||
(append prepend-directories append-directories))
|
||||
" "
|
||||
"--program"
|
||||
" "
|
||||
,input-file)))))
|
||||
(apply string-append
|
||||
(list "--libdirs "
|
||||
"\""
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append item separator))
|
||||
(append prepend-directories append-directories)))
|
||||
"\"")))
|
||||
" --program "))))))
|
||||
(chibi
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
|
|
@ -40,8 +43,7 @@
|
|||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(chicken
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
|
|
@ -56,88 +58,76 @@
|
|||
(string-replace (string-cut-from-end library-file 4) #\/ #\-)
|
||||
(string-replace (string-cut-from-end library-file 4) #\/ #\.))
|
||||
".a")))
|
||||
(apply string-append `("csc -R r7rs -X r7rs"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
`(,(string-append "csc -R r7rs -X r7rs "
|
||||
(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
" -static -c -J -o "
|
||||
,out
|
||||
out
|
||||
" "
|
||||
,(search-library-file (append prepend-directories append-directories) library-file)
|
||||
(search-library-file (append prepend-directories append-directories) library-file)
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append "-I " item " "))
|
||||
(append append-directories
|
||||
prepend-directories))
|
||||
prepend-directories)))
|
||||
"-unit "
|
||||
,unit
|
||||
" "
|
||||
"&&"
|
||||
" "
|
||||
"ar"
|
||||
" "
|
||||
"rcs"
|
||||
" "
|
||||
,static-out
|
||||
" "
|
||||
,out)))))
|
||||
unit)
|
||||
,(string-append "ar rcs " static-out " " out)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append `("csc -R r7rs -X r7rs"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
" "
|
||||
`(,(string-append "csc -R r7rs -X r7rs "
|
||||
(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
" -static "
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append "-I " item " "))
|
||||
(append append-directories prepend-directories))
|
||||
,@(map (lambda (library-file)
|
||||
(append append-directories prepend-directories)))
|
||||
(apply string-append
|
||||
(map (lambda (library-file)
|
||||
(string-append "-uses "
|
||||
(if (string-starts-with? library-file "srfi")
|
||||
(string-replace (string-cut-from-end library-file 4) #\/ #\-)
|
||||
(string-replace (string-cut-from-end library-file 4) #\/ #\.))
|
||||
" "))
|
||||
library-files)
|
||||
|
||||
library-files))
|
||||
" -output-file "
|
||||
output-file
|
||||
" "
|
||||
,output-file
|
||||
" "
|
||||
,input-file)))))
|
||||
input-file)))))
|
||||
(cyclone
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
`(,(string-append "cyclone "
|
||||
(util-getenv "COMPILE_R7RS_CYCLONE")
|
||||
" "
|
||||
(apply string-append
|
||||
`("cyclone"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_CYCLONE")
|
||||
" "
|
||||
,@(map (lambda (item) (string-append "-I " item " ")) prepend-directories)
|
||||
,@(map (lambda (item) (string-append "-A " item " ")) append-directories)
|
||||
,(search-library-file (append prepend-directories
|
||||
(map (lambda (item) (string-append "-I " item " ")) prepend-directories))
|
||||
(apply string-append
|
||||
(map (lambda (item) (string-append "-A " item " ")) append-directories))
|
||||
(search-library-file (append prepend-directories
|
||||
append-directories)
|
||||
library-file)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("cyclone "
|
||||
,(util-getenv "COMPILE_R7RS_CYCLONE")
|
||||
`(,(string-append "cyclone "
|
||||
(util-getenv "COMPILE_R7RS_CYCLONE")
|
||||
" "
|
||||
,@(map (lambda (item) (string-append "-I " item " ")) prepend-directories)
|
||||
,@(map (lambda (item) (string-append "-A " item " ")) append-directories)
|
||||
,input-file
|
||||
,(if (not (string=? (string-cut-from-end input-file 4) output-file))
|
||||
(apply string-append
|
||||
(map (lambda (item) (string-append "-I " item " ")) prepend-directories))
|
||||
(apply string-append
|
||||
(map (lambda (item) (string-append "-A " item " ")) append-directories))
|
||||
input-file)
|
||||
,(string-append (if (not (string=? (string-cut-from-end input-file 4) output-file))
|
||||
(string-append
|
||||
" && "
|
||||
"mv "
|
||||
(string-cut-from-end input-file 4)
|
||||
" "
|
||||
output-file)
|
||||
""))))))
|
||||
"sleep 0"))))))
|
||||
(foment
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("foment "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_FOMENT")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
|
|
@ -145,121 +135,99 @@
|
|||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(gambit
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
(apply string-append `("gsc -:r7rs -obj "
|
||||
,@(map (lambda (item)
|
||||
`(,(string-append "gsc "
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append item "/ "))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
,(search-library-file (append append-directories
|
||||
append-directories)))
|
||||
(search-library-file (append append-directories
|
||||
prepend-directories)
|
||||
library-file)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(let ((real
|
||||
(string-append (string-cut-from-end input-file 4)
|
||||
"-real")))
|
||||
(apply
|
||||
string-append
|
||||
`("gsc -o " ,real
|
||||
(let ((output-tmp-file (string-append output-file ".tmp")))
|
||||
`(,(string-append "echo \"#!/usr/bin/env gsi -:r7rs,search="
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append item "/ "))
|
||||
(append prepend-directories
|
||||
append-directories)))
|
||||
"\" > " output-tmp-file)
|
||||
,(string-append "cat " input-file " >> " output-tmp-file)
|
||||
,(string-append "gsc "
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append item "/ "))
|
||||
(append prepend-directories
|
||||
append-directories)))
|
||||
" -o " output-file
|
||||
" -exe -nopreload "
|
||||
,@(map (lambda (item)
|
||||
(string-append item "/ "))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
,input-file
|
||||
" && "
|
||||
"printf '#!/bin/sh\\n./" ,real
|
||||
" -:r7rs,search="
|
||||
,@(map (lambda (item)
|
||||
(string-append item "/ "))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
""
|
||||
"\\n"
|
||||
"'"
|
||||
" > " ,output-file
|
||||
" && "
|
||||
"chmod +x " ,output-file))))))
|
||||
output-tmp-file))))))
|
||||
(gauche
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("gosh "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_GAUCHE")
|
||||
" "
|
||||
" -r7 "
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I" " " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(guile
|
||||
(type . interpreter)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
(let ((library-path (search-library-file (append append-directories
|
||||
prepend-directories)
|
||||
library-file)))
|
||||
`(,(string-append "guild compile "
|
||||
(if r6rs? " --r6rs -x .sls " " --r7rs -x .sld ")
|
||||
" -O0 "
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append "-L" " " item " "))
|
||||
(append prepend-directories
|
||||
append-directories)))
|
||||
" -o "
|
||||
(string-append
|
||||
(string-cut-from-end library-path 4)
|
||||
".go")
|
||||
library-path)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("guile "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_GUILE")
|
||||
" "
|
||||
,(if r6rs? "--r6rs" "--r7rs")
|
||||
" "
|
||||
,(if r6rs? " --r6rs -x .sls " " --r7rs -x .sld ")
|
||||
,@(map (lambda (item)
|
||||
(string-append "-L" " " item " "))
|
||||
(string-append "-L " item " "
|
||||
"-L " (dirname item) " "))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
" "
|
||||
,input-file)))))
|
||||
(husk
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("huskc"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_HUSK")
|
||||
" "
|
||||
"-o"
|
||||
" "
|
||||
,output-file
|
||||
" "
|
||||
;,@(map (lambda (item) (string-append "-L" " " item " ")) prepend-directories)
|
||||
;,@(map (lambda (item) (string-append "-L" " " item " ")) append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
" -s"
|
||||
,(string #\newline)
|
||||
"!#")))))
|
||||
(ikarus
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("export IKARUS_LIBRARY_PATH="
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
append-directories)
|
||||
"\n"
|
||||
`( "IKARUS_LIBRARY_PATH="
|
||||
,@(map (lambda (item) (string-append item ":")) prepend-directories)
|
||||
,@(map (lambda (item) (string-append item ":")) append-directories)
|
||||
" ikarus "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_IKARUS")
|
||||
" "
|
||||
" --r6rs-script"
|
||||
" "
|
||||
,input-file)))))
|
||||
)))))
|
||||
(ironscheme
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("ironscheme "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_IRONSCHEME")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
|
|
@ -267,91 +235,143 @@
|
|||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I \"" item "\" "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(kawa
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("kawa"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_KAWA")
|
||||
" -J--add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED "
|
||||
" -J--add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED "
|
||||
" -J--add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED "
|
||||
" -J--enable-native-access=ALL-UNNAMED "
|
||||
"-Dkawa.import.path=\""
|
||||
,@(map (lambda (item)
|
||||
(type . compiler)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
(let* ((load-paths (apply string-append
|
||||
(append (list "-Dkawa.import.path=")
|
||||
(map (lambda (item)
|
||||
(string-append item "/*.sld:"))
|
||||
(append prepend-directories
|
||||
append-directories
|
||||
(list "/usr/local/share/kawa/lib")))
|
||||
"\" "
|
||||
"--r7rs"
|
||||
append-directories)))))
|
||||
(library-file-path (search-library-file (append prepend-directories
|
||||
append-directories)
|
||||
library-file))
|
||||
(output-dir
|
||||
(let ((output-dir "."))
|
||||
(for-each
|
||||
(lambda (dir)
|
||||
(when (string-starts-with? library-file-path
|
||||
dir)
|
||||
(set! output-dir dir)))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
output-dir))
|
||||
(classpath
|
||||
(apply
|
||||
string-append
|
||||
(map (lambda (dir)
|
||||
(string-append dir ":"))
|
||||
(append prepend-directories append-directories)))))
|
||||
`(,(string-append
|
||||
"CLASSPATH="
|
||||
classpath
|
||||
" kawa "
|
||||
(util-getenv "COMPILE_R7RS_KAWA")
|
||||
" "
|
||||
,input-file)))))
|
||||
load-paths
|
||||
" -d " output-dir
|
||||
" "
|
||||
load-paths
|
||||
" -C "
|
||||
library-file-path)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(let ((output-jar (string-append output-file ".jar"))
|
||||
(main-class
|
||||
(string-append (string-cut-from-end (path->filename input-file)
|
||||
4)))
|
||||
(kawa-jar-path "/usr/local/share/kawa/lib/kawa.jar")
|
||||
(classpath
|
||||
(apply
|
||||
string-append
|
||||
(map (lambda (dir)
|
||||
(string-append dir " "))
|
||||
(append prepend-directories append-directories))))
|
||||
(import-paths
|
||||
(apply
|
||||
string-append
|
||||
`("-Dkawa.import.path="
|
||||
,@(map (lambda (dir)
|
||||
(string-append dir "/*.sld:"))
|
||||
(append prepend-directories append-directories))
|
||||
"*.sld")))
|
||||
(class-files
|
||||
(apply
|
||||
string-append
|
||||
(map
|
||||
(lambda (lib)
|
||||
(string-append
|
||||
(string-cut-from-end
|
||||
(search-library-file (append prepend-directories
|
||||
append-directories)
|
||||
lib)
|
||||
4)
|
||||
".class "))
|
||||
library-files))))
|
||||
`(,(string-append
|
||||
"unzip -d . " kawa-jar-path)
|
||||
,(string-append
|
||||
"echo 'Main-Class: " main-class "\nClass-Path: . " classpath "' > MANIFEST.mf")
|
||||
,(string-append "kawa " import-paths " --main -C " input-file)
|
||||
,(string-append "jar cfm " output-jar " MANIFEST.mf gnu kawa " class-files " " main-class ".class")
|
||||
,(string-append "printf '#!/bin/sh\nMYSELF=$(which \"$0\" 2>/dev/null)\n[ $? -gt 0 -a -f \"$0\" ] && MYSELF=\"./$0\"\njava=java\nif test -n \"$JAVA_HOME\"; then\n java=\"$JAVA_HOME/bin/java\"\nfi\nexec \"$java\" --add-exports=java.base/jdk.internal.foreign.abi=ALL-UNNAMED --add-exports=java.base/jdk.internal.foreign.layout=ALL-UNNAMED --add-exports=java.base/jdk.internal.foreign=ALL-UNNAMED --enable-native-access=ALL-UNNAMED --enable-preview -jar $MYSELF \"$@\"\nexit 1\n' > " output-file)
|
||||
,(string-append "cat " output-jar " >> " output-file)
|
||||
,(string-append "chmod +x " output-file))))))
|
||||
(larceny
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("larceny"
|
||||
`("sh"
|
||||
,(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 ")
|
||||
,(util-getenv "COMPILE_R7RS_LARCENY")
|
||||
" "
|
||||
"-nobanner"
|
||||
" "
|
||||
"-quiet"
|
||||
" "
|
||||
"-utf8"
|
||||
" "
|
||||
,(if r6rs? "-r6rs" "-r7rs")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-I " item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
"-program"
|
||||
" "
|
||||
,input-file)))))
|
||||
" -program \"${tmpfile}\" -- \"$@\""
|
||||
,(string #\newline)
|
||||
"rm -rf \"${tmpfile}\""
|
||||
,(string #\newline)
|
||||
"exit")))))
|
||||
(loko
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(let ((out (string-cut-from-end input-file 4)))
|
||||
`(,(string-append "LOKO_LIBRARY_PATH="
|
||||
(apply string-append
|
||||
`("LOKO_LIBRARY_PATH="
|
||||
,@(map (lambda (item)
|
||||
(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
prepend-directories))
|
||||
(apply string-append
|
||||
(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
append-directories)
|
||||
" "
|
||||
append-directories))
|
||||
" loko "
|
||||
(util-getenv "COMPILE_R7RS_LOKO")
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_LOKO")
|
||||
" "
|
||||
,(if r6rs? "-std=r6rs" "-std=r7rs")
|
||||
(if r6rs? "-std=r6rs" "-std=r7rs")
|
||||
" "
|
||||
"--compile"
|
||||
" "
|
||||
,input-file
|
||||
" "
|
||||
"&&"
|
||||
" "
|
||||
"mv"
|
||||
" "
|
||||
,out
|
||||
" "
|
||||
,output-file))))))
|
||||
input-file)
|
||||
,(string-append "mv " out " " output-file))))))
|
||||
(meevax
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("meevax "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_MEEVAX")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
|
|
@ -361,15 +381,20 @@
|
|||
,@(map (lambda (item)
|
||||
(string-append "-A" " " item " "))
|
||||
append-directories)
|
||||
,input-file)))))
|
||||
)))))
|
||||
(mit-scheme
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("mit-scheme"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_MIT_SCHEME")
|
||||
" "
|
||||
`(,"sh"
|
||||
,(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
|
||||
(lambda (item)
|
||||
(string-append "--load "
|
||||
|
|
@ -378,39 +403,21 @@
|
|||
item)
|
||||
" "))
|
||||
library-files)
|
||||
" "
|
||||
"--load"
|
||||
" "
|
||||
,input-file
|
||||
" "
|
||||
"--eval \"(exit 0)\"")))))
|
||||
" --load \"${tmpfile}\" --eval \"(exit 0)\" --args \"$@\""
|
||||
,(string #\newline)
|
||||
"rm -rf \"${tmpfile}\""
|
||||
,(string #\newline)
|
||||
"exit"
|
||||
,(string #\newline))))))
|
||||
(mosh
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("mosh "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_MOSH")
|
||||
" "
|
||||
,@(map (lambda (item) (string-append "--loadpath=" item " "))
|
||||
(append append-directories prepend-directories))
|
||||
;" "
|
||||
,input-file)))))
|
||||
(picrin
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("picrin"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_PICRIN")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "-l " item " "))
|
||||
library-files)
|
||||
" "
|
||||
"-e"
|
||||
" "
|
||||
,input-file)))))
|
||||
(append append-directories prepend-directories)))))))
|
||||
(racket
|
||||
(type . interpreter)
|
||||
(library-command . ,(lambda (library-file prepend-directories append-directories r6rs?)
|
||||
|
|
@ -419,55 +426,27 @@
|
|||
library-file))
|
||||
(library-rkt-file (change-file-suffix full-path ".rkt")))
|
||||
(if r6rs?
|
||||
(apply string-append
|
||||
`("plt-r6rs"
|
||||
" "
|
||||
"--compile"
|
||||
" "
|
||||
,library-file))
|
||||
(apply string-append
|
||||
`("printf"
|
||||
" "
|
||||
`(,(string-append "plt-r6rs --compile " library-file))
|
||||
`(,(string-append "printf "
|
||||
"'#lang r7rs\\n"
|
||||
"(import (except (scheme base) let let-values let*-values string-copy string-copy! string-for-each string-map string-fill! string->list))\\n"
|
||||
"(include \""
|
||||
,(path->filename library-file)
|
||||
"\")\\n"
|
||||
"'"
|
||||
" "
|
||||
">"
|
||||
" "
|
||||
,library-rkt-file))))))
|
||||
"(include \"" (path->filename library-file) "\")\\n' > "
|
||||
library-rkt-file))))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(let ((rkt-input-file (if (string=? input-file "")
|
||||
""
|
||||
(change-file-suffix input-file ".rkt"))))
|
||||
(when (not r6rs?)
|
||||
(when (not (string=? rkt-input-file ""))
|
||||
(when (file-exists? rkt-input-file)
|
||||
(delete-file rkt-input-file))
|
||||
(with-output-to-file
|
||||
rkt-input-file
|
||||
(lambda ()
|
||||
(display "#lang r7rs")
|
||||
(newline)
|
||||
(display "(import (except (scheme base) let let-values let*-values string-copy string-copy! string-for-each string-map string-fill! string->list))")
|
||||
(newline)
|
||||
(display "(include \"")
|
||||
(display (path->filename input-file))
|
||||
(display "\")")
|
||||
(newline)))))
|
||||
(apply string-append
|
||||
`("racket "
|
||||
,(util-getenv "COMPILE_R7RS_RACKET")
|
||||
" "
|
||||
;"-I " ,(if r6rs? "r6rs " "r7rs ")
|
||||
,@(map (lambda (item)
|
||||
(string-append "-S " item " "))
|
||||
(append prepend-directories
|
||||
append-directories))
|
||||
,(if r6rs?
|
||||
""
|
||||
,(if r6rs? input-file rkt-input-file)))))))
|
||||
(string-append (string #\newline) "#lang r7rs"))))))))
|
||||
(sagittarius
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
|
|
@ -480,15 +459,20 @@
|
|||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append " -A " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(skint
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("skint"
|
||||
" "
|
||||
`("sh"
|
||||
,(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")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
|
|
@ -497,26 +481,17 @@
|
|||
,@(map (lambda (item)
|
||||
(string-append "-A " item "/ "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
(stak
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("stak"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_STAK")
|
||||
" "
|
||||
;,@(map (lambda (item) (string-append "-I " item " ")) prepend-directories)
|
||||
;,@(map (lambda (item) (string-append "-A " item " ")) append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
" --program=\"${tmpfile}\" \"$@\""
|
||||
,(string #\newline)
|
||||
"rm -rf \"${tmpfile}\""
|
||||
,(string #\newline)
|
||||
"exit"
|
||||
,(string #\newline))))))
|
||||
(stklos
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("stklos "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_STKLOS")
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
|
|
@ -524,9 +499,7 @@
|
|||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "-A " item " "))
|
||||
append-directories)
|
||||
" "
|
||||
,input-file)))))
|
||||
append-directories))))))
|
||||
(tr7
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
|
|
@ -538,12 +511,8 @@
|
|||
,@(map (lambda (item)
|
||||
(string-append item ":"))
|
||||
append-directories)
|
||||
" "
|
||||
" tr7i "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_TR7")
|
||||
" "
|
||||
,input-file)))))
|
||||
,(util-getenv "COMPILE_R7RS_TR7"))))))
|
||||
(vicare
|
||||
(type . compiler)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
|
|
@ -560,29 +529,20 @@
|
|||
append-directories)
|
||||
" "
|
||||
"--compile-program"
|
||||
" "
|
||||
,input-file)))))
|
||||
(ypsilon
|
||||
(type . interpreter)
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append
|
||||
`("ypsilon "
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_YPSILON")
|
||||
" "
|
||||
,(if r6rs? " --r6rs " " --r7rs ")
|
||||
" "
|
||||
" --mute"
|
||||
" "
|
||||
" --quiet "
|
||||
" "
|
||||
,@(map (lambda (item)
|
||||
(string-append "--sitelib=" item " "))
|
||||
prepend-directories)
|
||||
,@(map (lambda (item)
|
||||
(string-append "--sitelib=" item " "))
|
||||
append-directories)
|
||||
" "
|
||||
"--top-level-program"
|
||||
" "
|
||||
,input-file)))))))))
|
||||
" --top-level-program")))))))))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
#!r6rs
|
||||
(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display "Test successfull "))))
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!r6rs
|
||||
(import (rnrs)
|
||||
(rnrs programs)
|
||||
(foo bar))
|
||||
(baz)
|
||||
(write (list-tail (command-line) 1))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define baz (lambda () (display "Test successfull ")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define-library (foo bar) (import (scheme base) (scheme write) (hello world)) (export baz) (include "bar.scm"))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define hello-world (lambda () (+ 1 1)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define-library (hello world) (import (scheme base) (scheme write)) (export hello-world) (include "world.scm"))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define over-9000 (lambda () (+ 1 1)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(define-library (other hellolib) (import (scheme base) (scheme write)) (export over-9000) (include "hellolib.scm"))
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
(import (scheme base)
|
||||
(scheme write)
|
||||
(scheme process-context)
|
||||
(foo bar)
|
||||
(hello world)
|
||||
(other hellolib))
|
||||
(baz)
|
||||
(hello-world)
|
||||
|
||||
(define l (list "1" "2" "3"))
|
||||
(cond-expand
|
||||
;; Meevax gives too much args
|
||||
;; For this test for now this is okay
|
||||
(meevax (when (> (length (command-line)) 3) (write l)))
|
||||
;; mit-scheme gives too much args
|
||||
;; For this test for now this is okay
|
||||
(mit (when (> (length (command-line)) 3) (write l)))
|
||||
;; tr7 gives too much args
|
||||
;; For this test for now this is okay
|
||||
(tr7 (when (> (length (command-line)) 3) (write l)))
|
||||
(else (write (list-tail (command-line) 1))))
|
||||
|
||||
(over-9000)
|
||||
Loading…
Reference in New Issue