Working towards snow-fort release

This commit is contained in:
retropikzel 2025-06-27 16:27:50 +03:00
parent 6850991604
commit fde1349ff8
10 changed files with 72 additions and 23 deletions

2
Jenkinsfile vendored
View File

@ -26,7 +26,7 @@ pipeline {
stage("${implementation} snow-chibi install test") { stage("${implementation} snow-chibi install test") {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh "docker build --build-arg COMPILE_R7RS=${implementation} --tag=r7rs-pffi-test-${implementation} -f dockerfiles/Dockerfile.snow-chibi-install-test ." sh "docker build --build-arg COMPILE_R7RS=${implementation} --tag=r7rs-pffi-test-${implementation} -f dockerfiles/Dockerfile.snow-chibi-install-test ."
sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t r7rs-pffi-test-${implementation} sh -c \"make clean-package package && snow-chibi install --impls=${implementation} foreign-c-0.10.0.tgz && cp tests/hello.scm /tmp/ && cd /tmp && COMPILE_R7RS=${implementation} compile-r7rs -o hello hello.scm && ./hello\"" sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t r7rs-pffi-test-${implementation} sh -c \"make snow-chibi-install COMPILE_R7RS=${implementation} && cp tests/hello.scm /tmp/ && cd /tmp && COMPILE_R7RS=${implementation} compile-r7rs -o hello hello.scm && ./hello\""
} }
} }
} }

View File

@ -5,7 +5,7 @@ DOCKER_INIT=cd /workdir && make clean &&
VERSION=$(shell awk '/version:/{ print $$2 }' README.md ) VERSION=$(shell awk '/version:/{ print $$2 }' README.md )
TESTNAME=primitives TESTNAME=primitives
package: docs package: documentation
snow-chibi package \ snow-chibi package \
--version=${VERSION} \ --version=${VERSION} \
--authors="Retropikzel" \ --authors="Retropikzel" \
@ -14,6 +14,9 @@ package: docs
--description="Portable foreign function interface for R7RS Schemes" \ --description="Portable foreign function interface for R7RS Schemes" \
foreign/c.sld foreign/c.sld
snow-chibi-install: clean-package package
snow-chibi --impls=${COMPILE_R7RS} install foreign-c-${VERSION}.tgz
clean-package: clean-package:
rm -rf *.tgz rm -rf *.tgz
@ -32,11 +35,17 @@ test-compile-r7rs: tmp/test/libtest.o tmp/test/libtest.so tmp/test/libtest.a
cp tests/*.scm tmp/test/ cp tests/*.scm tmp/test/
cp tests/c-include/libtest.h tmp/test/ cp tests/c-include/libtest.h tmp/test/
cd tmp/test && \ cd tmp/test && \
COMPILE_R7RS_GAMBIT="-cc-options \"-ltest -I. -L\" -ld-options \"-L.\"" \
COMPILE_R7RS_CHICKEN="-L -static -L -ltest -I. -L." \ COMPILE_R7RS_CHICKEN="-L -static -L -ltest -I. -L." \
compile-r7rs -I . -o ${TESTNAME} ${TESTNAME}.scm compile-r7rs -I . -o ${TESTNAME} ${TESTNAME}.scm
cd tmp/test && ./${TESTNAME} cd tmp/test && ./${TESTNAME}
test-compile-r7rs-snow: tmp/test/libtest.o tmp/test/libtest.so tmp/test/libtest.a
cp tests/*.scm tmp/test/
cp tests/c-include/libtest.h tmp/test/
cd tmp/test && \
compile-r7rs -o hello hello.scm
cd tmp/test && ./hello
test-compile-r7rs-wine: test-compile-r7rs-wine:
cp -r foreign tmp/test/ cp -r foreign tmp/test/
cp tests/*.scm tmp/test/ cp tests/*.scm tmp/test/
@ -65,7 +74,7 @@ tmp/test/libtest.a: tmp/test/libtest.o tests/c-src/libtest.c
documentation/foreign-c.html: documentation/foreign-c.html:
# apt-get install pandoc weasyprint # apt-get install pandoc weasyprint
docs: documentation: README.md
mkdir -p documentation mkdir -p documentation
pandoc --standalone \ pandoc --standalone \
--template templates/documentation.html README.md \ --template templates/documentation.html README.md \

View File

@ -144,17 +144,31 @@ Required versions:
## Installation ## Installation
### Snow-fort
[https://snow-fort.org/](https://snow-fort.org/)
Installable with snow-chibi for following implementations.
- Chibi
- Kawa
- STklos
### Manul
Either download the latest release from Either download the latest release from
[https://git.sr.ht/~retropikzel/foreign-c/refs](https://git.sr.ht/~retropikzel/foreign-c/refs) [https://git.sr.ht/~retropikzel/foreign-c/refs](https://git.sr.ht/~retropikzel/foreign-c/refs)
or git clone, preferably with a tag, and copy the _foreign_ directory to your or git clone, tag, and copy the _foreign_ directory to your
library directory. library directory.
Example assuming libraries in directory _snow_: Example assuming libraries in directory _snow_:
git clone https://git.sr.ht/~retropikzel/foreign-c --branch LATEST_VERSION git clone https://git.sr.ht/~retropikzel/foreign-c --branch LATEST_VERSION
cd foreign-c
make SCHEME_IMPLEMENTATION_NAME
cd ..
mkdir -p snow mkdir -p snow
cp -r foreign-c/foreign snow/ cp -r foreign-c/foreign snow/
make -C snow/foreign/c SCHEME_IMPLEMENTATION_NAME
With most implementations the make command does not compile anything. When that With most implementations the make command does not compile anything. When that
is the case it will say "Nothing to build on SCHEME\_IMPLEMENTATION\_NAME." is the case it will say "Nothing to build on SCHEME\_IMPLEMENTATION\_NAME."

View File

@ -366,15 +366,28 @@ Schemes - 0.10.0</title>
</tbody> </tbody>
</table> </table>
<h2 id="installation">Installation</h2> <h2 id="installation">Installation</h2>
<h3 id="snow-fort">Snow-fort</h3>
<p><a
href="https://snow-fort.org/">https://snow-fort.org/</a></p>
<p>Installable with snow-chibi for following
implementations.</p>
<ul>
<li>Chibi</li>
<li>Kawa</li>
<li>STklos</li>
</ul>
<h3 id="manul">Manul</h3>
<p>Either download the latest release from <a <p>Either download the latest release from <a
href="https://git.sr.ht/~retropikzel/foreign-c/refs">https://git.sr.ht/~retropikzel/foreign-c/refs</a> href="https://git.sr.ht/~retropikzel/foreign-c/refs">https://git.sr.ht/~retropikzel/foreign-c/refs</a>
or git clone, preferably with a tag, and copy the or git clone, tag, and copy the <em>foreign</em> directory to
<em>foreign</em> directory to your library directory.</p> your library directory.</p>
<p>Example assuming libraries in directory <em>snow</em>:</p> <p>Example assuming libraries in directory <em>snow</em>:</p>
<pre><code>git clone https://git.sr.ht/~retropikzel/foreign-c --branch LATEST_VERSION <pre><code>git clone https://git.sr.ht/~retropikzel/foreign-c --branch LATEST_VERSION
cd foreign-c
make SCHEME_IMPLEMENTATION_NAME
cd ..
mkdir -p snow mkdir -p snow
cp -r foreign-c/foreign snow/ cp -r foreign-c/foreign snow/</code></pre>
make -C snow/foreign/c SCHEME_IMPLEMENTATION_NAME</code></pre>
<p>With most implementations the make command does not compile <p>With most implementations the make command does not compile
anything. When that is the case it will say “Nothing to build on anything. When that is the case it will say “Nothing to build on
SCHEME_IMPLEMENTATION_NAME.”</p> SCHEME_IMPLEMENTATION_NAME.”</p>

Binary file not shown.

View File

@ -201,7 +201,7 @@
c-bytevector->bytevector c-bytevector->bytevector
;;;; Utilities ;;;; Utilities
libc libc-name
;; TODO endianness ;; TODO endianness
native-endianness native-endianness
@ -314,7 +314,7 @@
(gambit (include "c/primitives/gambit.scm")) (gambit (include "c/primitives/gambit.scm"))
(gauche (include "c/primitives/gauche/define-c-procedure.scm")) (gauche (include "c/primitives/gauche/define-c-procedure.scm"))
;(gerbil (include "c/primitives/gerbil.scm")) ;(gerbil (include "c/primitives/gerbil.scm"))
(guile (include "c/primitives/guile.scm")) (guile (include "./c/primitives/guile.scm"))
(kawa (include "c/primitives/kawa.scm")) (kawa (include "c/primitives/kawa.scm"))
(mit-scheme (include "c/primitives/mit-scheme.scm")) (mit-scheme (include "c/primitives/mit-scheme.scm"))
;(larceny (include "c/primitives/larceny.scm")) ;(larceny (include "c/primitives/larceny.scm"))

View File

@ -1,14 +1,7 @@
(cond-expand (cond-expand
(windows (windows
(define-c-library libc (define libc-name "ucrtbase"))
'("stdlib.h" "stdio.h" "string.h")
"ucrtbase"
'()))
(else (else
(define c-library "c") (define libc-name
(when (get-environment-variable "BE_HOST_CPU") (cond ((get-environment-variable "BE_HOST_CPU") "root") ; Haiku
(set! c-library "root")) (else "c")))))
(define-c-library libc
'("stdlib.h" "stdio.h" "string.h")
"c"
'((additional-versions ("0" "6"))))))

View File

@ -1,3 +1,8 @@
(define-c-library libc
'("stdlib.h" "stdio.h" "string.h")
libc-name
'((additional-versions ("0" "6"))))
(define-c-procedure c-calloc libc 'calloc 'pointer '(int int)) (define-c-procedure c-calloc libc 'calloc 'pointer '(int int))
(cond-expand (cond-expand
(gambit (gambit

View File

@ -2,6 +2,11 @@
(scheme write) (scheme write)
(foreign c)) (foreign c))
(define-c-library libc
'("stdlib.h" "stdio.h" "string.h")
libc-name
'((additional-versions ("0" "6"))))
(define-c-procedure c-puts libc 'puts 'int '(pointer)) (define-c-procedure c-puts libc 'puts 'int '(pointer))
(c-puts (string->c-utf8 "Hello from C!")) (c-puts (string->c-utf8 "Hello from C!"))

View File

@ -5,6 +5,16 @@
(scheme process-context) (scheme process-context)
(foreign c)) (foreign c))
(display "libc-name:" )
(display libc-name)
(newline)
(define-c-library libc
'("stdlib.h" "stdio.h" "string.h")
libc-name
'((additional-versions ("0" "6"))))
;; util ;; util
(define header-count 1) (define header-count 1)