From 047c83c90cd51d83b8e4ceb2908c189c8bb85d25 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Sat, 12 Jul 2025 08:50:20 +0300 Subject: [PATCH] Moving to running on chibi --- Makefile | 15 ++++++++------- compile-r7rs.scm | 11 ++++------- libs/util.sld | 1 + 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5cb8008..6c80659 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/compile-r7rs.scm b/compile-r7rs.scm index e3b550c..c8761f0 100644 --- a/compile-r7rs.scm +++ b/compile-r7rs.scm @@ -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)) diff --git a/libs/util.sld b/libs/util.sld index 432522a..e9c86a6 100644 --- a/libs/util.sld +++ b/libs/util.sld @@ -1,6 +1,7 @@ (define-library (libs util) (import (scheme base) + (scheme write) (scheme file) (scheme process-context) (foreign c))