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 PREFIX=/usr/local
SCHEME=chibi
all: build all: build
build: build:
markdown README.md > README.html markdown README.md > README.html
echo "#!/bin/sh" > compile-r7rs 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: install:
mkdir -p ${PREFIX}/lib/compile-r7rs mkdir -p ${PREFIX}/lib/compile-r7rs
@ -24,13 +25,13 @@ test-r6rs:
mkdir -p test/snow/foo 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(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 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 -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) @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: test-r6rs-docker:
docker build --build-arg COMPILE_R7RS=${COMPILE_R7RS} --tag=compile-r7rs-test-${COMPILE_R7RS} . docker build --build-arg COMPILE_R7RS=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
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 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: test-r7rs:
rm -rf /tmp/compile-r7rs-test-result.txt 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 "(import (scheme base) (foo bar)) (baz)" > test/main.scm
echo "(define baz (lambda () (display \"Test successfull\") (newline)))" > test/snow/foo/bar.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 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 -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) @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: test-r7rs-docker:
docker build --build-arg COMPILE_R7RS=${COMPILE_R7RS} --tag=compile-r7rs-test-${COMPILE_R7RS} . docker build --build-arg COMPILE_R7RS=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
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 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: clean-test:
rm -rf test rm -rf test

View File

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

View File

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