Moving to running on chibi

This commit is contained in:
retropikzel 2025-07-12 08:50:20 +03:00
parent 339ad3c408
commit 047c83c90c
3 changed files with 13 additions and 14 deletions

View File

@ -1,11 +1,12 @@
PREFIX=/usr/local
SCHEME=chibi
all: build
build:
markdown README.md > README.html
echo "#!/bin/sh" > compile-r7rs
echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/main.scm" >> compile-r7rs
echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/main.scm \$$@" >> compile-r7rs
install:
mkdir -p ${PREFIX}/lib/compile-r7rs
@ -24,13 +25,13 @@ test-r6rs:
mkdir -p test/snow/foo
printf "#!r6rs\n(library (foo bar) (export baz) (import (rnrs)) (define baz (lambda () (display \"Test successfull\") (newline))))" > test/snow/foo/bar.sls
printf "#!r6rs\n(import (rnrs) (foo bar)) (baz)" > test/main.sps
cd test && COMPILE_R7RS=${COMPILE_R7RS} compile-r7rs -I ./snow -o main main.sps
cd test && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.sps
-cd test && ./main > /tmp/compile-r7rs-test-result.txt 2>&1
@grep "Test successfull" /tmp/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat /tmp/compile-r7rs-test-result.txt && exit 1)
test-r6rs-docker:
docker build --build-arg COMPILE_R7RS=${COMPILE_R7RS} --tag=compile-r7rs-test-${COMPILE_R7RS} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${COMPILE_R7RS} sh -c "make && make install && make clean-test COMPILE_R7RS=${COMPILE_R7RS} test-r6rs"
docker build --build-arg COMPILE_R7RS=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make clean-test COMPILE_R7RS=${SCHEME} test-r6rs"
test-r7rs:
rm -rf /tmp/compile-r7rs-test-result.txt
@ -40,13 +41,13 @@ test-r7rs:
echo "(import (scheme base) (foo bar)) (baz)" > test/main.scm
echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > test/snow/foo/bar.scm
echo "(define-library (foo bar) (import (scheme base) (scheme write)) (export baz) (include \"bar.scm\"))" > test/snow/foo/bar.sld
cd test && COMPILE_R7RS=${COMPILE_R7RS} compile-r7rs -I ./snow -o main main.scm
cd test && COMPILE_R7RS=${SCHEME} compile-r7rs -I ./snow -o main main.scm
-cd test && ./main > /tmp/compile-r7rs-test-result.txt 2>&1
@grep "Test successfull" /tmp/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat /tmp/compile-r7rs-test-result.txt && exit 1)
test-r7rs-docker:
docker build --build-arg COMPILE_R7RS=${COMPILE_R7RS} --tag=compile-r7rs-test-${COMPILE_R7RS} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${COMPILE_R7RS} sh -c "make && make install && make clean-test COMPILE_R7RS=${COMPILE_R7RS} test-r7rs"
docker build --build-arg COMPILE_R7RS=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make clean-test COMPILE_R7RS=${SCHEME} test-r7rs"
clean-test:
rm -rf test

View File

@ -1,7 +1,6 @@
(import (scheme base)
(scheme file)
(scheme read)
(scheme write)
(scheme process-context)
(foreign c)
(libs util)
@ -142,12 +141,10 @@
(newline)
(exit 0))
(cond-expand
(windows (define-c-library c-stdlib '("stdlib.h") "ucrtbase"))
(else (define-c-library c-stdlib
'("stdlib.h")
"c"
'((additional-versions ("6"))))))
(define-c-library c-stdlib
'("stdlib.h")
libc-name
'((additional-versions ("6"))))
(define-c-procedure c-system c-stdlib 'system 'int '(pointer))

View File

@ -1,6 +1,7 @@
(define-library
(libs util)
(import (scheme base)
(scheme write)
(scheme file)
(scheme process-context)
(foreign c))