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") {
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 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 )
TESTNAME=primitives
package: docs
package: documentation
snow-chibi package \
--version=${VERSION} \
--authors="Retropikzel" \
@ -14,6 +14,9 @@ package: docs
--description="Portable foreign function interface for R7RS Schemes" \
foreign/c.sld
snow-chibi-install: clean-package package
snow-chibi --impls=${COMPILE_R7RS} install foreign-c-${VERSION}.tgz
clean-package:
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/c-include/libtest.h 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 -I . -o ${TESTNAME} ${TESTNAME}.scm
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:
cp -r foreign 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:
# apt-get install pandoc weasyprint
docs:
documentation: README.md
mkdir -p documentation
pandoc --standalone \
--template templates/documentation.html README.md \

View File

@ -144,17 +144,31 @@ Required versions:
## 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
[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.
Example assuming libraries in directory _snow_:
git clone https://git.sr.ht/~retropikzel/foreign-c --branch LATEST_VERSION
cd foreign-c
make SCHEME_IMPLEMENTATION_NAME
cd ..
mkdir -p 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
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>
</table>
<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
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
<em>foreign</em> directory to your library directory.</p>
or git clone, tag, and copy the <em>foreign</em> directory to
your library directory.</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
cd foreign-c
make SCHEME_IMPLEMENTATION_NAME
cd ..
mkdir -p snow
cp -r foreign-c/foreign snow/
make -C snow/foreign/c SCHEME_IMPLEMENTATION_NAME</code></pre>
cp -r foreign-c/foreign snow/</code></pre>
<p>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.”</p>

Binary file not shown.

View File

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

View File

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

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))
(cond-expand
(gambit

View File

@ -2,6 +2,11 @@
(scheme write)
(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))
(c-puts (string->c-utf8 "Hello from C!"))

View File

@ -5,6 +5,16 @@
(scheme process-context)
(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
(define header-count 1)