Compare commits
5 Commits
main
...
retropikze
Author | SHA1 | Date |
---|---|---|
|
1a66611949 | |
|
468b50f90a | |
|
e946c3408f | |
|
958dcdd8a1 | |
|
d07356cd86 |
25
Dockerfile
25
Dockerfile
|
@ -1,23 +1,12 @@
|
|||
FROM schemers/chibi:head AS build
|
||||
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||
FROM schemers/chibi:head
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
git \
|
||||
make \
|
||||
libffi-dev \
|
||||
pandoc \
|
||||
chicken-bin
|
||||
RUN mkdir -p /opt/compile-r7rs
|
||||
RUN mkdir -p /opt/compile-r7rs/bin
|
||||
RUN mkdir -p /opt/compile-r7rs/lib
|
||||
RUN chicken-install r7rs
|
||||
build-essential ca-certificates git make libffi-dev
|
||||
RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 \
|
||||
&& cd chibi-scheme && make -j 16 && make -j 16 install
|
||||
WORKDIR /builddir
|
||||
COPY Makefile .
|
||||
COPY compile-r7rs.scm .
|
||||
COPY libs/ libs/
|
||||
RUN make PREFIX=/opt/compile-r7rs build-chicken-static && make PREFIX=/opt/compile-r7rs install
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
COPY --from=build /opt/compile-r7rs /opt/compile-r7rs
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}
|
||||
RUN make && make install
|
||||
WORKDIR /workdir
|
||||
RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
ARG SCHEME=chibi
|
||||
ARG IMAGE=chibi:head
|
||||
FROM schemers/${IMAGE}
|
||||
FROM schemers/${SCHEME}:head
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
make \
|
||||
|
|
28
Makefile
28
Makefile
|
@ -2,10 +2,6 @@ PREFIX=/usr/local
|
|||
SCHEME=chibi
|
||||
R6RSTMP=tmp/${SCHEME}-r6rs
|
||||
R7RSTMP=tmp/${SCHEME}-r7rs
|
||||
DOCKERIMG=${SCHEME}
|
||||
ifeq "${SCHEME}" "chicken"
|
||||
DOCKERIMG="chicken:5"
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
|
@ -16,26 +12,6 @@ build: deps
|
|||
echo "#!/bin/sh" > compile-r7rs
|
||||
echo "chibi-scheme -A ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/main.scm \"\$$@\"" >> compile-r7rs
|
||||
|
||||
build-chicken-static: deps
|
||||
csc -R r7rs -X r7rs -I snow/foreign/c -static -c -J -unit foreign.c -o foreign.c.o deps/foreign-c/foreign/c.sld
|
||||
ar rcs foreign.c.a foreign.c.o
|
||||
csc -R r7rs -X r7rs -static -c -J -unit srfi-170 -o srfi-170.o deps/foreign-c-srfi-170/srfi/170.sld
|
||||
ar rcs srfi-170.a srfi-170.o
|
||||
csc -R r7rs -X r7rs -static -c -J -unit libs.util -o libs.util.o libs/util.sld
|
||||
ar rcs libs.util.a libs.util.o
|
||||
csc -R r7rs -X r7rs -static -c -J -unit libs.library-util -o libs.library-util.o libs/library-util.sld
|
||||
ar rcs libs.library-util.a libs.library-util.o
|
||||
csc -R r7rs -X r7rs -static -c -J -unit libs.data -o libs.data.o libs/data.sld
|
||||
ar rcs libs.data.a libs.data.o
|
||||
csc -R r7rs -X r7rs -static \
|
||||
-o compile-r7rs \
|
||||
-uses libs.util \
|
||||
-uses libs.library-util \
|
||||
-uses libs.data \
|
||||
-uses foreign.c \
|
||||
-uses srfi-170 \
|
||||
compile-r7rs.scm
|
||||
|
||||
deps:
|
||||
mkdir -p deps
|
||||
git clone https://git.sr.ht/~retropikzel/foreign-c deps/foreign-c --depth=1
|
||||
|
@ -65,7 +41,7 @@ test-r6rs:
|
|||
@grep "Test successfull" ${R6RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R6RSTMP}/compile-r7rs-test-result.txt && exit 1)
|
||||
|
||||
test-r6rs-docker:
|
||||
docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r6rs"
|
||||
|
||||
test-r7rs:
|
||||
|
@ -87,7 +63,7 @@ test-r7rs:
|
|||
@grep "Test successfull" ${R7RSTMP}/compile-r7rs-test-result.txt || (echo "Test failed, output: " && cat ${R7RSTMP}/compile-r7rs-test-result.txt && exit 1)
|
||||
|
||||
test-r7rs-docker:
|
||||
docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker build -f Dockerfile.test --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c "make && make install && make SCHEME=${SCHEME} test-r7rs"
|
||||
|
||||
clean:
|
||||
|
|
26
README.md
26
README.md
|
@ -294,25 +294,21 @@ tried to compile them in wrong order you would run:
|
|||
## Usage with Docker
|
||||
<a name="#usage-with-docker"></a>
|
||||
|
||||
The project has
|
||||
[docker image](https://hub.docker.com/repository/docker/retropikzel1/compile-r7rs/general).
|
||||
Here is a sample Dockerfile to get you started.
|
||||
|
||||
It is statically built with Chicken scheme and installed under /opt/compile-r7rs,
|
||||
so it can be copied in your Dockerfile.
|
||||
|
||||
Here is a sample Dockerfile to get you started:
|
||||
|
||||
ARG SCHEME=chibi
|
||||
FROM schemers/${SCHEME}
|
||||
COPY --from=retropikzel1/compile-r7rs /opt/compile-r7rs /opt/compile-r7rs
|
||||
ENV PATH=/opt/compile-r7rs/bin:${PATH}
|
||||
ENV COMPILE_R7RS=${SCHEME}
|
||||
ARG COMPILE_R7RS=chibi
|
||||
FROM schemers/${COMPILE_R7RS}
|
||||
RUN apt-get update && apt-get install -y make git chicken-bin
|
||||
RUN chicken-install r7rs
|
||||
ARG COMPILE_R7RS=chibi
|
||||
ENV COMPILE_R7RS=${COMPILE_R7RS}
|
||||
RUN git clone https://git.sr.ht/~retropikzel/compile-r7rs && cd compile-r7rs && make && make install
|
||||
|
||||
To use this run:
|
||||
|
||||
docker build --build-arg SCHEME=${SCHEME} --tag=sometag .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t sometag sh -c "compile-r7rs -I . -o main ./snow main.scm"
|
||||
|
||||
export COMPILE_R7RS=<your scheme>
|
||||
docker build --build-arg COMPILE_R7RS=${COMPILE_R7RS} --tag=compile-r7rs-${COMPILE_R7RS} .
|
||||
docker run -v "${PWD}":/workdir -w /workdir -t compile-r7rs-${COMPILE_R7RS} sh -c "compile-r7rs -I -o main ./snow main.scm"
|
||||
|
||||
## Usual RnRS projects
|
||||
<a name="#usual-rnrs-projects"></a>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
(scheme read)
|
||||
(scheme write)
|
||||
(scheme process-context)
|
||||
(scheme cxr)
|
||||
(foreign c)
|
||||
(libs util)
|
||||
(libs data)
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
(string-replace (string-cut-from-end library-file 4) #\/ #\-)
|
||||
(string-replace (string-cut-from-end library-file 4) #\/ #\.))
|
||||
".a")))
|
||||
(apply string-append `("csc -R r7rs -X r7rs"
|
||||
(apply string-append `("csc"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
" -static -c -J -o "
|
||||
|
@ -83,7 +83,7 @@
|
|||
" "
|
||||
,out)))))
|
||||
(command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?)
|
||||
(apply string-append `("csc -R r7rs -X r7rs"
|
||||
(apply string-append `("csc"
|
||||
" "
|
||||
,(util-getenv "COMPILE_R7RS_CHICKEN")
|
||||
" "
|
||||
|
|
|
@ -13,14 +13,15 @@
|
|||
(if (null? dependencies)
|
||||
result
|
||||
(flatten-dependencies (append result
|
||||
(list
|
||||
(if (or (equal? (car (car dependencies)) 'only)
|
||||
(equal? (car (car dependencies)) 'except)
|
||||
(equal? (car (car dependencies)) 'prefix)
|
||||
(equal? (car (car dependencies)) 'rename))
|
||||
(car (cdr (car dependencies)))
|
||||
(car dependencies))))
|
||||
(cdr dependencies)))))
|
||||
(list
|
||||
(if (or (equal? (car (car dependencies)) 'only)
|
||||
(equal? (car (car dependencies)) 'except)
|
||||
(equal? (car (car dependencies)) 'prefix)
|
||||
(equal? (car (car dependencies)) 'rename))
|
||||
(car (cdr (car dependencies)))
|
||||
(car dependencies))))
|
||||
(cdr dependencies)))))
|
||||
|
||||
|
||||
(define library-name->path
|
||||
(lambda (name)
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
(scheme read)
|
||||
(scheme write)
|
||||
(scheme file)
|
||||
(scheme cxr)
|
||||
(scheme process-context)
|
||||
(libs util))
|
||||
(export library-dependencies)
|
||||
(include "library-util.scm"))
|
||||
|
|
Loading…
Reference in New Issue