From bcbd79dbe4b043e2956306868fbcea445c1d7750 Mon Sep 17 00:00:00 2001
From: Olivier Benz <olivier.benz@b-data.ch>
Date: Fri, 20 Sep 2024 12:20:58 +0200
Subject: [PATCH] Add linux/riscv64 images
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- for GHC versions ‚â• 9.10.1
- Close https://github.com/benz0li/ghc-musl/issues/9
---
 README.md         | 24 ++++++++++++++++--------
 SECURITY.md       |  9 ++++++---
 VERSION_MATRIX.md |  7 +++++++
 latest.Dockerfile | 13 +++++++++----
 4 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index d7a9f3e..78aecc5 100644
--- a/README.md
+++ b/README.md
@@ -13,18 +13,26 @@ The multi‚Äëarch (`linux/amd64`, `linux/arm64/v8`) docker image used to build th
 * [Stack](https://github.com/commercialhaskell/stack)
 * [Juvix](https://github.com/anoma/juvix)
 
-Credits to
+Credit to
 
-<!-- markdownlint-disable line-length -->
 * [@odidev](https://github.com/odidev) for
-  [ghc-bootstrap-aarch64](https://gitlab.alpinelinux.org/odidev/ghc-bootstrap-aarch64)  
-   and
+  [ghc-bootstrap-aarch64](https://gitlab.alpinelinux.org/odidev/ghc-bootstrap-aarch64)[^1]  
+  and
 * [@neosimsim](https://github.com/neosimsim) for
-  [docker-builder-images](https://gitlab.com/neosimsim/docker-builder-images)
-<!-- markdownlint-enable line-length -->
+  [neosimsim—Docker build images](https://gitlab.com/neosimsim/docker-builder-images)
+
+[^1]: Porting GHC to Linux/AArch64
 
 who laid the groundwork for [this](https://gitlab.com/benz0li/ghc-musl).
 
+Credit to
+
+* Celeste of Alpine for [GHC bootstrap riscv64](https://gitlab.b-data.ch/ghc/ghc-bootstrap-riscv64)[^2]
+
+who made it possible to add `linux/riscv64` images (GHC versions ‚â• 9.10.1).
+
+[^2]: Porting GHC to Linux/riscv64
+
 ## Table of Contents
 
 * [Prerequisites](#prerequisites)
@@ -125,11 +133,11 @@ For further information, see [Dev Containers](.devcontainer).
 What makes this project different:
 
 1. Multi‚Äëarch: `linux/amd64`, `linux/arm64/v8`
-1. Built using Hadrian[^1], from source, without docs
+1. Built using Hadrian[^3], from source, without docs
 1. Built using the LLVM backend
     * flavour: `perf+llvm+split_sections`
 
-[^1]: GHC versions ‚â• 9.2.8.
+[^3]: GHC versions ‚â• 9.2.8.
 
 ## Contributing
 
diff --git a/SECURITY.md b/SECURITY.md
index 7e797d5..8b164b5 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -1,11 +1,14 @@
 ## Supported Versions
 
-Only the docker image with the latest version of GHC is supported with security
-updates.
+Only the docker images with the latest version of GHC are supported with
+security updates.
+
+`linux/riscv64` docker images are currently built only once. Therefore,
+vulnerabilities for this `os/arch` will not be fixed.
 
 ## Reporting a Vulnerability
 
-To report a vulnerability in the latest docker image, email the maintainer
+To report a vulnerability in a latest docker image, email the maintainer
 <olivier.benz@b-data.ch>.
 
 ## Vulnerabilities in Prior Versions
diff --git a/VERSION_MATRIX.md b/VERSION_MATRIX.md
index d72c98f..1ba2af3 100644
--- a/VERSION_MATRIX.md
+++ b/VERSION_MATRIX.md
@@ -45,3 +45,10 @@ Topmost entry = Tag `latest`
 
 * Images based on Alpine 3.{17,18}: Package pkgconf downgraded to v1.8.1
   * Due to <https://github.com/haskell/cabal/issues/8923>
+
+## Experimental
+
+`linux/riscv64` images for GHC versions ‚â• 9.10.1, e.g.
+`quay.io/benz0li/ghc-musl:{latest,GHC_VERSION}-linux-riscv64`.  
+:information_source: Whenever a new version of GHC is released, the previous
+`linux/riscv64` image is added to the manifest.
diff --git a/latest.Dockerfile b/latest.Dockerfile
index be34253..d9db5de 100644
--- a/latest.Dockerfile
+++ b/latest.Dockerfile
@@ -82,10 +82,15 @@ RUN cabal update \
 
 FROM alpine:3.20 as ghc-base
 
-LABEL org.opencontainers.image.licenses="MIT" \
-      org.opencontainers.image.source="https://gitlab.b-data.ch/ghc/ghc-musl" \
-      org.opencontainers.image.vendor="Olivier Benz" \
-      org.opencontainers.image.authors="Olivier Benz <olivier.benz@b-data.ch>"
+ARG IMAGE_LICENSE="MIT"
+ARG IMAGE_SOURCE="https://gitlab.b-data.ch/ghc/ghc-musl"
+ARG IMAGE_VENDOR="Olivier Benz"
+ARG IMAGE_AUTHORS="Olivier Benz <olivier.benz@b-data.ch>"
+
+LABEL org.opencontainers.image.licenses="$IMAGE_LICENSE" \
+      org.opencontainers.image.source="$IMAGE_SOURCE" \
+      org.opencontainers.image.vendor="$IMAGE_VENDOR" \
+      org.opencontainers.image.authors="$IMAGE_AUTHORS"
 
 ARG GHC_VERSION_BUILD
 ARG CABAL_VERSION_BUILD
-- 
GitLab