Improvements
This commit is contained in:
parent
c47420b706
commit
5ba6b6c0b4
35
Dockerfile
35
Dockerfile
|
|
@ -1,32 +1,15 @@
|
||||||
FROM debian:trixie-slim AS build
|
FROM debian:trixie-slim
|
||||||
RUN apt-get update && apt-get install -y gcc make git chicken-bin
|
RUN apt-get update && apt-get install -y gcc make git libffi-dev
|
||||||
RUN chicken-install r7rs
|
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 chibi
|
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 chibi
|
||||||
|
|
||||||
WORKDIR /build/chibi
|
WORKDIR /build/chibi
|
||||||
RUN make DESTDIR=/opt/compile-r7rs
|
RUN make
|
||||||
RUN make DESTDIR=/opt/compile-r7rs install
|
RUN make install
|
||||||
|
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||||
RUN mkdir -p /opt/compile-r7rs/bin
|
RUN snow-chibi install --impls=chibi --always-yes "(foreign c)"
|
||||||
RUN echo "#!/bin/sh" > /opt/compile-r7rs/bin/snow-chibi
|
RUN snow-chibi install --impls=chibi --always-yes "(srfi 170)"
|
||||||
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)"
|
|
||||||
COPY Makefile .
|
COPY Makefile .
|
||||||
COPY compile-r7rs.scm .
|
COPY compile-r7rs.scm .
|
||||||
COPY libs libs
|
COPY libs libs
|
||||||
RUN make build-chicken
|
RUN make build-chibi
|
||||||
RUN make PREFIX=/opt/compile-r7rs install
|
RUN make 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
|
|
||||||
|
|
|
||||||
|
|
@ -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 SCHEME=chibi
|
||||||
ARG IMAGE=chibi:head
|
ARG IMAGE=chibi:head
|
||||||
FROM debian:trixie AS build
|
FROM debian:bookworm AS cache
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y gcc make git
|
||||||
--download-only \
|
WORKDIR /cache
|
||||||
--no-install-recommends \
|
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1
|
||||||
--no-install-suggests \
|
WORKDIR /cache/chibi-scheme
|
||||||
build-essential \
|
RUN make
|
||||||
make \
|
|
||||||
libffi-dev \
|
|
||||||
ca-certificates \
|
|
||||||
git \
|
|
||||||
cmark
|
|
||||||
|
|
||||||
ARG SCHEME=chibi
|
ARG SCHEME=chibi
|
||||||
ENV COMPILE_R7RS=${SCHEME}
|
ARG IMAGE=chibi:head
|
||||||
FROM schemers/${IMAGE}
|
FROM schemers/${IMAGE}
|
||||||
COPY --from=build /var/cache/apt/archives /debs
|
RUN apt-get update && apt-get install -y make gcc libffi-dev unzip
|
||||||
RUN dpkg -i /debs/*.deb
|
COPY --from=cache /cache /cache
|
||||||
COPY --from=local-build-compile-r7rs /opt/compile-r7rs /opt/compile-r7rs
|
WORKDIR /cache/chibi-scheme
|
||||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}:/opt/compile-r7rs/snow-chibi/bin
|
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 {
|
pipeline {
|
||||||
|
|
||||||
agent {
|
agent {
|
||||||
label 'docker-x86_64'
|
docker {
|
||||||
|
label 'docker-x86_64'
|
||||||
|
image 'schemers/chibi:head'
|
||||||
|
args '--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options {
|
options {
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
|
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
|
||||||
timeout(time: 1, unit: 'HOURS')
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters {
|
|
||||||
booleanParam(name: 'DOCKER', defaultValue: false, description: 'Build and push docker image')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build and install') {
|
||||||
steps {
|
steps {
|
||||||
sh "docker build -f Dockerfile --tag=local-build-compile-r7rs ."
|
sh "apt-get install -y make"
|
||||||
}
|
sh "make build-chibi"
|
||||||
}
|
sh "make install"
|
||||||
|
|
||||||
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 ."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
stage('Test R6RS implementations') {
|
stage('Test R6RS implementations') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
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"
|
ifeq "${SCHEME}" "chicken"
|
||||||
DOCKERIMG="chicken:5"
|
DOCKERIMG="chicken:5"
|
||||||
endif
|
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:
|
||||||
|
echo "HERE!"
|
||||||
|
|
||||||
build-chibi:
|
build-chibi:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
echo "#!/bin/sh" > compile-r7rs
|
||||||
echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> 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:
|
build-chicken:
|
||||||
csc -R r7rs -X r7rs -static -c -J -unit libs.util -o libs.util.o libs/util.sld
|
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:
|
build-gauche:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
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
|
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:
|
build-guile:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
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
|
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:
|
build-kawa:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
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
|
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:
|
#build-racket:
|
||||||
#echo "#!/bin/sh" > compile-r7rs
|
#echo "#!/bin/sh" > compile-r7rs
|
||||||
|
|
@ -48,24 +54,12 @@ build-kawa:
|
||||||
build-sagittarius:
|
build-sagittarius:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
echo "#!/bin/sh" > compile-r7rs
|
||||||
echo "sash -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
echo "sash -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||||
|
chmod +x compile-r7rs
|
||||||
|
|
||||||
build-stklos:
|
build-stklos:
|
||||||
echo "#!/bin/sh" > compile-r7rs
|
echo "#!/bin/sh" > compile-r7rs
|
||||||
echo "stklos -I ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
echo "stklos -I ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs
|
||||||
|
chmod +x 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
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p ${PREFIX}/bin
|
mkdir -p ${PREFIX}/bin
|
||||||
|
|
@ -81,39 +75,26 @@ uninstall:
|
||||||
test-r6rs:
|
test-r6rs:
|
||||||
rm -rf ${R6RSTMP}
|
rm -rf ${R6RSTMP}
|
||||||
mkdir -p ${R6RSTMP}
|
mkdir -p ${R6RSTMP}
|
||||||
mkdir -p ${R6RSTMP}/libs
|
cp -r r6rs-testfiles/* ${R6RSTMP}/
|
||||||
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
|
|
||||||
cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.sps
|
cd ${R6RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.sps
|
||||||
-cd ${R6RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1
|
cd ${R6RSTMP} && ./main 1 2 3 > test-result.txt
|
||||||
@grep "Test successfull" ${R6RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/compile-r7rs-test-result.txt && exit 1)
|
@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 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:
|
test-r7rs:
|
||||||
rm -rf ${R7RSTMP}
|
rm -rf ${R7RSTMP}
|
||||||
mkdir -p ${R7RSTMP}
|
mkdir -p ${R7RSTMP}
|
||||||
mkdir -p ${R7RSTMP}/libs
|
cp -r r7rs-testfiles/* ${R7RSTMP}/
|
||||||
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
|
|
||||||
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.scm
|
cd ${R7RSTMP} && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./libs -o main main.scm
|
||||||
-cd ${R7RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1
|
-cd ${R7RSTMP} && ./main 1 2 3 > 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)
|
@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 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:
|
clean:
|
||||||
rm -rf test-r7rs
|
rm -rf test-r7rs
|
||||||
|
|
@ -125,6 +106,7 @@ clean:
|
||||||
find . -name "*.link" -delete
|
find . -name "*.link" -delete
|
||||||
find . -name "*.meta" -delete
|
find . -name "*.meta" -delete
|
||||||
find . -name "*.import.*" -delete
|
find . -name "*.import.*" -delete
|
||||||
|
rm -rf libs.library-util.c
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
rm -rf deps
|
rm -rf deps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,13 +151,13 @@
|
||||||
(define scheme-type (cdr (assoc 'type (cdr (assoc scheme data)))))
|
(define scheme-type (cdr (assoc 'type (cdr (assoc scheme data)))))
|
||||||
|
|
||||||
(define scheme-command
|
(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 "")
|
(list (if input-file input-file "")
|
||||||
(if output-file output-file "")
|
(if output-file output-file "")
|
||||||
prepend-directories
|
prepend-directories
|
||||||
append-directories
|
append-directories
|
||||||
library-files
|
library-files
|
||||||
r6rs?))))
|
r6rs?)))
|
||||||
|
|
||||||
(define scheme-library-command
|
(define scheme-library-command
|
||||||
(lambda (library-file)
|
(lambda (library-file)
|
||||||
|
|
@ -198,16 +198,18 @@
|
||||||
(display "Compiling library ")
|
(display "Compiling library ")
|
||||||
(display file)
|
(display file)
|
||||||
(newline)
|
(newline)
|
||||||
(display "With command ")
|
(for-each
|
||||||
(display library-command)
|
(lambda (command)
|
||||||
(newline)
|
(display "Running ")
|
||||||
(display "Exit code ")
|
(write command)
|
||||||
(let ((output (c-system (string->c-utf8 library-command))))
|
(newline)
|
||||||
(when (not (= output 0))
|
(display "Exit code ")
|
||||||
(error "Problem compiling libraries, exiting" output))
|
(let ((exit-code (c-system (string->c-utf8 command))))
|
||||||
(display output))
|
(display exit-code)
|
||||||
(newline)
|
(newline)
|
||||||
(newline)))
|
(when (not (= exit-code 0))
|
||||||
|
(exit exit-code))))
|
||||||
|
library-command)))
|
||||||
library-files))
|
library-files))
|
||||||
(else
|
(else
|
||||||
(display "Implementation has no library build command, skipping library compilation.")
|
(display "Implementation has no library build command, skipping library compilation.")
|
||||||
|
|
@ -217,32 +219,33 @@
|
||||||
(when (and (equal? scheme-type 'interpreter) input-file)
|
(when (and (equal? scheme-type 'interpreter) input-file)
|
||||||
(when (and output-file (file-exists? output-file))
|
(when (and output-file (file-exists? output-file))
|
||||||
(delete-file 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 "Creating startup script ")
|
||||||
(display output-file)
|
(display output-file)
|
||||||
(newline)
|
(newline)
|
||||||
(display "Containing command ")
|
(display "Starting with ")
|
||||||
(display scheme-command)
|
(display shebang-line)
|
||||||
(newline)
|
(newline)
|
||||||
(with-output-to-file
|
(with-output-to-file
|
||||||
(if (string=? compilation-target "windows")
|
(if (string=? compilation-target "windows")
|
||||||
(string-append output-file ".bat")
|
(string-append output-file ".bat")
|
||||||
output-file)
|
output-file)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(cond ((string=? compilation-target "unix")
|
(display shebang-line)
|
||||||
(display "#!/bin/sh")
|
(newline)
|
||||||
(newline))
|
(display scheme-program)
|
||||||
((string=? compilation-target "windows")
|
|
||||||
(display "@echo off")
|
|
||||||
(newline)
|
|
||||||
(display "start")))
|
|
||||||
(display scheme-command)
|
|
||||||
(cond ((string=? compilation-target "unix")
|
|
||||||
(display " \"")
|
|
||||||
(display "$@")
|
|
||||||
(display "\"")))
|
|
||||||
(newline)))
|
(newline)))
|
||||||
(cond ((string=? compilation-target "unix")
|
(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 (equal? scheme-type 'compiler) input-file)
|
||||||
(when (and output-file (file-exists? output-file))
|
(when (and output-file (file-exists? output-file))
|
||||||
|
|
@ -250,10 +253,17 @@
|
||||||
(display "Compiling file ")
|
(display "Compiling file ")
|
||||||
(display input-file)
|
(display input-file)
|
||||||
(newline)
|
(newline)
|
||||||
(display "With command ")
|
(for-each
|
||||||
(display scheme-command)
|
(lambda (command)
|
||||||
(newline)
|
(display "Running ")
|
||||||
(display "Exit code ")
|
(write command)
|
||||||
(display (c-system (string->c-utf8 scheme-command)))
|
(newline)
|
||||||
|
(display "Exit code ")
|
||||||
|
(let ((exit-code (c-system (string->c-utf8 command))))
|
||||||
|
(display exit-code)
|
||||||
|
(newline)
|
||||||
|
(when (not (= exit-code 0))
|
||||||
|
(exit exit-code))))
|
||||||
|
scheme-command)
|
||||||
(newline))
|
(newline))
|
||||||
|
|
||||||
|
|
|
||||||
1114
libs/data.sld
1114
libs/data.sld
File diff suppressed because it is too large
Load Diff
|
|
@ -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