From 4921229e8d681ddbc7e9387fe5996fba17734507 Mon Sep 17 00:00:00 2001 From: Bruno Verachten Date: Fri, 6 Feb 2026 21:12:40 +0100 Subject: [PATCH] Add RISC-V 64-bit (riscv64) support for trixie builds and AppImage. Add linux/riscv64 to the trixie Docker image platform list (hooks and build-images.sh). Bookworm and older builds are left unchanged. Add riscv64 AppImage build infrastructure based on the arm64v8 template, using Ubuntu 24.04 (Noble) as base since it is the first Ubuntu release with official riscv64 support. Uses distro-provided CGAL packages instead of OBS repositories. Update build-appimage.sh and docker-build-release.sh with riscv64 entries. Update README to document riscv64 support. --- README.md | 4 +- appimage/appimage-riscv64-base/Dockerfile | 70 +++++++++++++++++++ appimage/appimage-riscv64-openscad/Dockerfile | 54 ++++++++++++++ openscad/trixie/hooks/build | 2 +- openscad/trixie/hooks/pre_build | 2 +- scripts/build-appimage.sh | 3 + scripts/build-images.sh | 5 +- scripts/docker-build-release.sh | 5 ++ 8 files changed, 140 insertions(+), 5 deletions(-) create mode 100644 appimage/appimage-riscv64-base/Dockerfile create mode 100644 appimage/appimage-riscv64-openscad/Dockerfile diff --git a/README.md b/README.md index 421a550..18e06dd 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,12 @@ docker stop openscad-gui && docker rm openscad-gui ## CI support, for internal use -* `openscad/appimage-*` +* `openscad/appimage-*` (x86\_64, arm64v8, riscv64) * `openscad/mxe-*` * `openscad/src-*` +The trixie-based Docker images and AppImage builds support linux/amd64, linux/arm64, and linux/riscv64. + All docker images can be viewed with a [Docker Hub search for `openscad/`](https://hub.docker.com/search?q=openscad%2F&image_filter=open_source&type=image). ## Debug Builds diff --git a/appimage/appimage-riscv64-base/Dockerfile b/appimage/appimage-riscv64-base/Dockerfile new file mode 100644 index 0000000..e8a2f7e --- /dev/null +++ b/appimage/appimage-riscv64-base/Dockerfile @@ -0,0 +1,70 @@ +# +# Build: docker build -t openscad/appimage-riscv64-base . +# Use: docker run --rm -it -v openscad/appimage-riscv64-base +# +FROM riscv64/ubuntu:24.04 + +ARG GITHUB_USER=openscad +ARG GITHUB_REPO=openscad +ARG BRANCH=master +ARG JOBS=2 + +ENV DEBIAN_FRONTEND noninteractive + +RUN \ + apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y --no-install-recommends \ + apt-utils apt-transport-https ca-certificates git wget \ + patchelf gnupg ccache appstream xxd desktop-file-utils \ + libjpeg-dev cimg-dev libcairo-dev libfuse-dev libssl-dev \ + libgpgme-dev libgcrypt20-dev clang ninja-build \ + itstool cmake \ + && \ + apt-get clean + +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends libcgal-dev && \ + apt-get clean + +WORKDIR /openscad + +# Invalidate docker cache if the branch changes +ADD https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/git/refs/heads/${BRANCH} version.json + +RUN \ + cat version.json && rm -f version.json && \ + git clone "https://github.com/${GITHUB_USER}/${GITHUB_REPO}" . && \ + git checkout "${BRANCH}" && \ + git rev-parse --abbrev-ref HEAD && \ + git log -n8 --pretty=tformat:"%h %ai (%aN) %s" && \ + bash ./scripts/uni-get-dependencies.sh && \ + bash ./scripts/check-dependencies.sh && \ + (apt-get install -y lib3mf-dev || /bin/true) && \ + cd / && apt-get clean && rm -rf /openscad + +WORKDIR /appimage + +RUN \ + git clone --single-branch --recursive https://github.com/linuxdeploy/linuxdeploy.git && \ + git clone --single-branch --recursive https://github.com/linuxdeploy/linuxdeploy-plugin-qt.git && \ + git clone --single-branch --recursive https://github.com/linuxdeploy/linuxdeploy-plugin-appimage.git && \ + git clone --single-branch --recursive https://github.com/AppImage/AppImageKit.git + +RUN \ + cd /appimage/linuxdeploy/ && mkdir build && cd build/ && cmake -DCMAKE_INSTALL_PREFIX=/appimage/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make -j"$JOBS" && make install && \ + cd /appimage && mkdir -p usr/bin/ && cp linuxdeploy/build/bin/linuxdeploy usr/bin/ + +RUN \ + cd /appimage/linuxdeploy-plugin-qt/ && mkdir build && cd build/ && cmake -DCMAKE_INSTALL_PREFIX=/appimage/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make -j"$JOBS" && make install + +RUN \ + cd /appimage/linuxdeploy-plugin-appimage && mkdir build && cd build/ && cmake -DCMAKE_INSTALL_PREFIX=/appimage/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make -j"$JOBS" && make install + +RUN \ + cd /appimage/AppImageKit && mkdir build && cd build/ && cmake -DCMAKE_INSTALL_PREFIX=/appimage/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DAPPIMAGEKIT_PACKAGE_DEBS=OFF .. && make -j"$JOBS" && make install + +RUN \ + rm -rf linuxdeploy linuxdeploy-plugin-qt linuxdeploy-plugin-appimage AppImageKit && \ + find /appimage diff --git a/appimage/appimage-riscv64-openscad/Dockerfile b/appimage/appimage-riscv64-openscad/Dockerfile new file mode 100644 index 0000000..4a2412e --- /dev/null +++ b/appimage/appimage-riscv64-openscad/Dockerfile @@ -0,0 +1,54 @@ +# +# Build: docker build -t openscad/appimage-riscv64-openscad . +# Use: docker run --rm -it -v openscad/appimage-riscv64-openscad +# +FROM openscad/appimage-riscv64-base:latest + +ARG GITHUB_USER=openscad +ARG GITHUB_REPO=openscad +ARG BRANCH=master +ARG REFS=heads +ARG OPENSCAD_VERSION= +ARG BUILD_TYPE=Release +ARG SNAPSHOT=ON +ARG JOBS=2 +ARG COMMIT=true + +WORKDIR /openscad + +# Invalidate docker cache if the branch changes +ADD https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/git/refs/${REFS}/${BRANCH} version.json + +RUN \ + cat version.json && rm -f version.json && \ + git clone --recursive --single-branch --branch "${BRANCH}" --shallow-submodules "https://github.com/${GITHUB_USER}/${GITHUB_REPO}" . && \ + git rev-parse --abbrev-ref HEAD && \ + git log -n8 --pretty=tformat:"%h %ai (%aN) %s" + +RUN \ + export OPENSCAD_COMMIT=$(/bin/"$COMMIT" && git log -1 --pretty=format:%h || echo "") && \ + mkdir build && \ + cd build && \ + cmake .. \ + -GNinja \ + -DENABLE_TESTS=OFF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DOpenGL_GL_PREFERENCE=LEGACY \ + -DEXPERIMENTAL=${SNAPSHOT} \ + -DSNAPSHOT=${SNAPSHOT} \ + -DOPENSCAD_VERSION="$OPENSCAD_VERSION" \ + -DOPENSCAD_COMMIT="$OPENSCAD_COMMIT" \ + && \ + cmake --build . "-j$JOBS" -v + +RUN \ + cmake --install build --prefix=AppDir/usr -v + +RUN \ + export PATH=/appimage/usr/bin:"$PATH" && \ + VERSION="${OPENSCAD_VERSION:-$(date +%Y.%m.%d).ai}" linuxdeploy --plugin qt --output appimage --appdir AppDir && \ + mkdir -p out && \ + cp -iv OpenSCAD*.AppImage out/ + +ENTRYPOINT tar --create -C /openscad/out . diff --git a/openscad/trixie/hooks/build b/openscad/trixie/hooks/build index 1e2b9c8..fc01d68 100755 --- a/openscad/trixie/hooks/build +++ b/openscad/trixie/hooks/build @@ -12,7 +12,7 @@ dmidecode -t system || /bin/true docker buildx build \ --push \ --progress plain \ - --platform linux/amd64,linux/arm64 \ + --platform linux/amd64,linux/arm64,linux/riscv64 \ --build-arg REFS="heads" \ --build-arg BRANCH="master" \ --build-arg OPENSCAD_VERSION="$VERSION" \ diff --git a/openscad/trixie/hooks/pre_build b/openscad/trixie/hooks/pre_build index 0921029..a8d9118 100755 --- a/openscad/trixie/hooks/pre_build +++ b/openscad/trixie/hooks/pre_build @@ -5,6 +5,6 @@ export DOCKER_BUILDKIT=1 docker buildx create \ --name builder \ --driver docker-container \ - --platform linux/amd64,linux/arm64 \ + --platform linux/amd64,linux/arm64,linux/riscv64 \ --use docker buildx inspect --bootstrap diff --git a/scripts/build-appimage.sh b/scripts/build-appimage.sh index 1b73512..2afa243 100755 --- a/scripts/build-appimage.sh +++ b/scripts/build-appimage.sh @@ -14,4 +14,7 @@ build appimage openscad/appimage-x86_64-openscad build appimage openscad/appimage-arm64v8-base build appimage openscad/appimage-arm64v8-openscad +build appimage openscad/appimage-riscv64-base +build appimage openscad/appimage-riscv64-openscad + list 'openscad/appimage-*' diff --git a/scripts/build-images.sh b/scripts/build-images.sh index f2ce3d4..5895e4f 100755 --- a/scripts/build-images.sh +++ b/scripts/build-images.sh @@ -11,6 +11,7 @@ build () { DIR="$6" FILE="$7" FILTER="$8" + PLATFORM="${9:-linux/amd64,linux/arm64}" if [ -z "$FILTER" ] then @@ -45,7 +46,7 @@ build () { docker buildx build \ --push \ --progress=plain \ - --platform linux/amd64,linux/arm64 \ + --platform $PLATFORM \ --build-arg=REFS="$REF" \ --build-arg=BRANCH="$BRANCH" \ --build-arg OPENSCAD_VERSION="$VERSION" \ @@ -67,6 +68,6 @@ build tags openscad-2021.01 2021.01 latest "" openscad/buster Dockerfile "${1- build heads master bookworm "" "$V" openscad/bookworm Dockerfile "${1-}" build heads master bookworm-egl egl "$V" openscad/bookworm Dockerfile.egl "${1-}" -build heads master trixie dev "$V" openscad/trixie Dockerfile "${1-}" +build heads master trixie dev "$V" openscad/trixie Dockerfile "${1-}" linux/amd64,linux/arm64,linux/riscv64 docker image list -f 'reference=openscad/openscad' diff --git a/scripts/docker-build-release.sh b/scripts/docker-build-release.sh index 7a40c99..ed0ab8b 100755 --- a/scripts/docker-build-release.sh +++ b/scripts/docker-build-release.sh @@ -50,6 +50,7 @@ main () { echo "2) MXE 64-bit" echo "3) AppImage x86 64-bit" echo "4) AppImage ARM 64-bit" + echo "5) AppImage RISC-V 64-bit" echo "" echo "9) Sources" echo "" @@ -75,6 +76,10 @@ main () { build openscad/appimage-arm64v8-openscad appimage/appimage-arm64v8-openscad/ --build-arg SNAPSHOT=- run openscad/appimage-arm64v8-openscad ;; + 5) + build openscad/appimage-riscv64-openscad appimage/appimage-riscv64-openscad/ --build-arg SNAPSHOT=- + run openscad/appimage-riscv64-openscad + ;; 9) build openscad/src-openscad src/src-openscad --build-arg TAG="${BRANCH}" run openscad/src-openscad