From bdfae1562b2bf94cf97cd0b837900a751d21e1fb Mon Sep 17 00:00:00 2001 From: Neil McPhail Date: Mon, 7 Jul 2025 12:39:49 +0000 Subject: [PATCH] Add dev containter for building --- .devcontainer/Dockerfile | 99 ++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 25 +++++++ .devcontainer/hooks/post_checkout | 3 + .vscode/launch.json | 106 ++++++++++++++++++++++++++++++ 4 files changed, 233 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/hooks/post_checkout create mode 100644 .vscode/launch.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..586357b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,99 @@ +# syntax=docker/dockerfile:1 + +FROM ubuntu:24.04 AS build +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + make \ + unzip \ + && rm -rf /var/lib/apt/lists/* + +ADD https://github.com/z00m128/sjasmplus.git#v1.21.0 /sjasmplus +RUN cd /sjasmplus && make -j8 && make install +ADD https://boarstone.mcphail.uk/mcphail/spectrum_remload.git /ttttt +RUN cd /ttttt && make ttttt +ADD https://github.com/einar-saukas/ZX0.git /zx0 +RUN cd /zx0/src/ \ + && gcc -O2 -o zx0 zx0.c optimize.c compress.c memory.c \ + && gcc -O2 -o dzx0 dzx0.c +ADD https://www.boriel.com/files/zxb/zxbasic-1.18.1-linux64.tar.gz . +RUN tar xf zxbasic* +ADD https://github.com/Mastodon-/inpaws.git /inpaws +RUN cd /inpaws/ \ + && make -j8 + +FROM build AS z88dk +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + bison \ + ca-certificates \ + ccache \ + cpanminus \ + curl \ + dos2unix \ + flex \ + gdb \ + git \ + libboost-all-dev \ + libcapture-tiny-perl \ + libclone-perl \ + libdata-hexdump-perl \ + libfile-slurp-perl \ + libgmp3-dev \ + liblocal-lib-perl \ + libmodern-perl-perl \ + libpath-tiny-perl \ + libregexp-common-perl \ + libtext-table-perl \ + libxml2-dev \ + libyaml-perl \ + m4 \ + perl \ + pkg-config \ + ragel \ + re2c \ + texi2html \ + texinfo \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* +ENV Z88DK_PATH="/opt/z88dk" +RUN cpanm -l $HOME/perl5 --no-wget local::lib Template::Plugin::YAML \ + && git clone --depth 1 --recursive https://github.com/z88dk/z88dk.git ${Z88DK_PATH} \ + && cd ${Z88DK_PATH} \ + && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)" \ + && chmod 777 build.sh \ + && sed -i -e "s/make/make -j8/g" build.sh \ + && BUILD_SDCC=1 BUILD_SDCC_HTTP=1 ./build.sh \ + && make install-clean bins-clean + +FROM ubuntu:24.04 +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + fuse-emulator-utils \ + git \ + make \ + openssh-client \ + pasmo \ + python3 \ + z80asm \ + z80dasm \ + zmakebas \ + && rm -rf /var/lib/apt/lists/* +COPY --from=build /usr/local/bin/sjasmplus /bin/sjasmplus +COPY --from=build /ttttt/ttttt /bin/ttttt +COPY --from=build /zx0/src/zx0 /bin/zx0 +COPY --from=build /zx0/src/dzx0 /bin/dzx0 +COPY --from=build /zxbasic/zxbasm.py /opt/zxbasic/zxbasm +COPY --from=build /zxbasic/zxbc.py /opt/zxbasic/zxbc +COPY --from=build /zxbasic/zxbpp.py /opt/zxbasic/zxbpp +COPY --from=build /zxbasic/src /opt/zxbasic/src +COPY --from=build /inpaws/inpaws /bin/inpaws +COPY --from=z88dk /opt/z88dk/bin /opt/z88dk/bin +COPY --from=z88dk /opt/z88dk/lib /opt/z88dk/lib +COPY --from=z88dk /opt/z88dk/include /opt/z88dk/include +ENV PATH="${PATH}:/opt/z88dk/bin:/opt/zxbasic" +ENV ZCCCFG="/opt/z88dk/lib/config" +USER ubuntu +RUN echo "PATH=$PATH:/opt/z88dk/bin:/opt/zxbasic" >> ~/.profile +RUN echo "export ZCCCFG=/opt/z88dk/lib/config/" >> ~/.profile \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..be348c2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "ZX Spectrum dev tools", + //"build": { "dockerfile": "Dockerfile" }, + // The Dockerfile takes an age to build due to z88dk, so pull from prebuilt: + "image": "boarstone.mcphail.uk/mcphail/speccydev:stable", + "remoteUser": "ubuntu", + "runArgs": [ + "--network=host" + ], + "customizations": { + "vscode": { + "extensions": [ + "maziac.dezog", + "maziac.asm-code-lens", + "maziac.z80-instruction-set", + "maziac.hex-hover-converter", + "maziac.sna-fileviewer", + "maziac.nex-fileviewer", + "ms-vscode.makefile-tools", + "jsjlogin.zxbasic", + "thenestruo.z80-asm-meter" + ] + } + } +} diff --git a/.devcontainer/hooks/post_checkout b/.devcontainer/hooks/post_checkout new file mode 100755 index 0000000..59044a2 --- /dev/null +++ b/.devcontainer/hooks/post_checkout @@ -0,0 +1,3 @@ +#! /bin/bash +# From https://stackoverflow.com/questions/54055666/docker-hub-and-git-submodules/59640438#59640438 +git submodule update --init diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..af3a73d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,106 @@ +{ + "configurations": [ + { + "type": "dezog", + "request": "launch", + "name": "Simulator - ZX81 56k RAM", + "remoteType": "zsim", + "zsim": { + "visualMemory": true, + "preset": "zx81", + "memoryModel": "ZX81-56K" + }, + "sjasmplus": [ + { + "path": "myprog.sld" + } + ], + "commandsAfterLaunch": [], + "history": { + "reverseDebugInstructionCount": 1000000, + "spotCount": 10, + "codeCoverageEnabled": true + }, + "startAutomatically": false, + "rootFolder": "${workspaceFolder}", + "load": "myprog.p" + }, + { + "type": "dezog", + "request": "launch", + "name": "Simulator - ZX128K Spectrum", + "remoteType": "zsim", + "zsim": { + "visualMemory": true, + "preset": "spectrum", + "memoryModel": "ZX128K" + }, + "sjasmplus": [ + { + "path": "myprog.sld" + } + ], + "commandsAfterLaunch": [], + "history": { + "reverseDebugInstructionCount": 1000000, + "spotCount": 10, + "codeCoverageEnabled": true + }, + "startAutomatically": false, + "rootFolder": "${workspaceFolder}", + "load": "myprog.sna", + "topOfStack": "0x5d58" + }, + { + "type": "dezog", + "request": "launch", + "name": "CSpect", + "remoteType": "cspect", + "sjasmplus": [ + { + "path": "myprog.sld" + } + ], + "commandsAfterLaunch": [], + "history": { + "reverseDebugInstructionCount": 1000000, + "spotCount": 10, + "codeCoverageEnabled": false + }, + "startAutomatically": false, + "rootFolder": "${workspaceFolder}", + "load": "myprog.sna", + "topOfStack": "0x5d58", + "cspect": { + // Change "host.docker.internal" to "localhost" if running on Linux + "hostname": "host.docker.internal" + } + }, + { + "type": "dezog", + "request": "launch", + "name": "Simulator - ZX48K Spectrum", + "remoteType": "zsim", + "zsim": { + "visualMemory": true, + "preset": "spectrum", + "memoryModel": "ZX48K" + }, + "sjasmplus": [ + { + "path": "myprog.sld" + } + ], + "commandsAfterLaunch": [], + "history": { + "reverseDebugInstructionCount": 1000000, + "spotCount": 10, + "codeCoverageEnabled": true + }, + "startAutomatically": false, + "rootFolder": "${workspaceFolder}", + "load": "myprog.sna", + "topOfStack": "0x5d58" + } + ] +}