diff --git a/Dockerfile b/Dockerfile index f842281..1829b41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,17 @@ -FROM docker.io/debian:trixie-slim AS build +FROM schemers/chicken:5 AS build RUN mkdir -p ${HOME}/.snow && echo "()" > ${HOME}/.snow/config.scm RUN apt-get update && apt-get install -y \ - build-essential \ - ca-certificates \ - git \ - make \ - libffi-dev \ - pandoc \ - chicken-bin \ - libc-dev -RUN chicken-install r7rs + gcc wget ca-certificates xz-utils make git libffi-dev unzip lbzip2 cmake \ + g++ python3 locate zlib1g-dev WORKDIR /build +ENV PATH=${PATH}:/opt/compile-r7rs/bin RUN git clone https://github.com/ashinn/chibi-scheme.git --depth=1 -RUN cd chibi-scheme && make -j 32 && make -j 32 install +RUN cd chibi-scheme && make DESTDIR=/opt/compile-r7rs/chibi all +RUN cd chibi-scheme && make DESTDIR=/opt/compile-r7rs/chibi install +RUN mkdir -p /opt/compile-r7rs/bin +RUN echo "#!/bin/sh" > /opt/compile-r7rs/bin/snow-chibi +RUN echo "PATH=${PATH}:/opt/compile-r7rs/chibi/usr/local/bin CHIBI_MODULE_PATH=/opt/compile-r7rs/chibi/usr/local/share/chibi:/opt/compile-r7rs/chibi/usr/local/lib/chibi LD_LIBRARY_PATH=/opt/compile-r7rs/chibi/usr/local/lib exec chibi-scheme -mchibi.snow.commands -mchibi.snow.interface -mchibi.snow.package -mchibi.snow.utils /opt/compile-r7rs/chibi/usr/local/bin/snow-chibi.scm \"\$@\"" >> /opt/compile-r7rs/bin/snow-chibi +RUN chmod +x /opt/compile-r7rs/bin/snow-chibi ENV SCHEME=chicken RUN snow-chibi --impls=${SCHEME} --always-yes install "(foreign c)" RUN snow-chibi --impls=${SCHEME} --always-yes install "(srfi 170)" @@ -22,6 +21,7 @@ COPY libs libs RUN make PREFIX=/opt/compile-r7rs build-static RUN make PREFIX=/opt/compile-r7rs install -FROM docker.io/debian:trixie-slim +FROM debian:trixie-slim COPY --from=build /opt/compile-r7rs /opt/compile-r7rs -ENV PATH=/opt/compile-r7rs/bin:${PATH} +ENV PATH=${PATH}:/opt/compile-r7rs/bin +ENV LD_LIBRARY_PATH=/opt/compile-r7rs/lib diff --git a/Dockerfile.test b/Dockerfile.test index 5a0b7cf..3fd5918 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -1,14 +1,21 @@ ARG SCHEME=chibi ARG IMAGE=chibi:head -FROM docker.io/schemers/${IMAGE} +FROM debian:trixie AS build RUN apt-get update && apt-get install -y \ + --download-only \ + --no-install-recommends \ + --no-install-suggests \ build-essential \ make \ libffi-dev \ ca-certificates \ git \ - pandoc + cmark + ARG SCHEME=chibi ENV COMPILE_R7RS=${SCHEME} +FROM schemers/${IMAGE} +COPY --from=build /var/cache/apt/archives /debs +RUN dpkg -i /debs/*.deb COPY --from=local-build-compile-r7rs /opt/compile-r7rs /opt/compile-r7rs -ENV PATH=/opt/compile-r7rs:${PATH} +ENV PATH=${PATH}:/opt/compile-r7rs/bin diff --git a/Jenkinsfile b/Jenkinsfile index 56f8115..c80d5ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,14 +17,20 @@ pipeline { stages { stage('Build') { steps { - sh "podman build -f Dockerfile --tag=local-build-compile-r7rs ." + sh "docker build -f Dockerfile --tag=local-build-compile-r7rs ." + } + } + + stage('Warm up cache') { + steps { + sh "docker build -f Dockerfile.test --build-arg IMAGE=chibi:head --build-arg SCHEME=chibi --tag=compile-r7rs-test-chibi ." } } stage('Test R6RS implementations') { steps { script { - def r6rs_implementations = sh(script: 'podman run docker.io/retropikzel1/compile-r7rs bash -c "compile-r7rs --list-r6rs-schemes"', returnStdout: true).split() + def r6rs_implementations = sh(script: 'docker run retropikzel1/compile-r7rs bash -c "compile-r7rs --list-r6rs-schemes"', returnStdout: true).split() parallel r6rs_implementations.collectEntries { SCHEME -> [(SCHEME): { stage("${SCHEME} R6RS") { @@ -33,8 +39,8 @@ pipeline { if("${SCHEME}" == "chicken") { DOCKERIMG="chicken:5" } - sh "podman build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} ." - sh "podman run -v ${WORKSPACE}:/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c \"make && make install && make SCHEME=${SCHEME} test-r6rs\"" + sh "docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} ." + sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c \"make && make install && make SCHEME=${SCHEME} test-r6rs\"" } } } @@ -47,7 +53,7 @@ pipeline { stage('Test R7RS implementations') { steps { script { - def r7rs_implementations = sh(script: 'podman run retropikzel1/compile-r7rs bash -c "compile-r7rs --list-r7rs-schemes"', returnStdout: true).split() + def r7rs_implementations = sh(script: 'docker run retropikzel1/compile-r7rs bash -c "compile-r7rs --list-r7rs-schemes"', returnStdout: true).split() parallel r7rs_implementations.collectEntries { SCHEME -> [(SCHEME): { stage("${SCHEME} R7RS") { @@ -56,8 +62,8 @@ pipeline { if("${SCHEME}" == "chicken") { DOCKERIMG="chicken:5" } - sh "podman build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} ." - sh "podman run -v ${WORKSPACE}:/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c \"make && make install && make SCHEME=${SCHEME} test-r7rs\"" + sh "docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --build-arg SCHEME=${SCHEME} --tag=compile-r7rs-test-${SCHEME} ." + sh "docker run -v ${WORKSPACE}:/workdir -w /workdir -t compile-r7rs-test-${SCHEME} sh -c \"make && make install && make SCHEME=${SCHEME} test-r7rs\"" } } } diff --git a/Makefile b/Makefile index 8fff371..1f52bb8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PREFIX=/usr/local SCHEME=chibi R6RSTMP=tmp/${SCHEME}-r6rs R7RSTMP=tmp/${SCHEME}-r7rs -DOCKERIMG=docker.io/${SCHEME}:head +DOCKERIMG=${SCHEME}:head ifeq "${SCHEME}" "chicken" DOCKERIMG="chicken:5" endif @@ -51,8 +51,10 @@ test-r6rs: -cd ${R6RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1 @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 --tag=local-compile-r7rs . +build-local-docker: + docker build -f Dockerfile --tag=local-build-compile-r7rs . + +test-r6rs-docker: build-local-docker docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --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" @@ -74,8 +76,7 @@ test-r7rs: -cd ${R7RSTMP} && ./main > compile-r7rs-test-result.txt 2>&1 @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 --tag=local-compile-r7rs . +test-r7rs-docker: build-local-docker docker build -f Dockerfile.test --build-arg IMAGE=${DOCKERIMG} --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" diff --git a/libs/data.sld b/libs/data.sld index f59d859..910362d 100644 --- a/libs/data.sld +++ b/libs/data.sld @@ -472,12 +472,9 @@ (type . interpreter) (command . ,(lambda (input-file output-file prepend-directories append-directories library-files r6rs?) (apply string-append - `("sash" - " " + `("sash " ,(util-getenv "COMPILE_R7RS_SAGITTARIUS") - " " - ,(if r6rs? "-r6" "-r7") - " " + ,(if r6rs? " -r6 " " -r7 ") ,@(map (lambda (item) (string-append "-L " item " ")) prepend-directories)