Subject: [bug#78470] [PATCH] gnu: Add gm2-toolchain.

From: Danny Milosavljevic <[email-masked]>
Date: Sat, 17 May 2025 12:29:52 +0200

* gnu/packages/commencement.scm (gm2-toolchain): New variable.
* gnu/packages/gcc.scm (gm2): New variable.

Change-Id: I0f416b53497daeec60dcefc3916591ea8a152dae
---
 gnu/packages/commencement.scm |  7 +++++++
 gnu/packages/gcc.scm          | 12 ++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 60ade637e1..24382d5437 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3744,5 +3744,12 @@ (define-public gfortran-toolchain
 gfortran, as well as libc (headers and binaries, plus debugging symbols
 in the @code{debug} output), and binutils.")))
 
+(define-public gm2-toolchain
+  (package (inherit (make-gcc-toolchain gm2))
+    (synopsis "Complete GCC tool chain for Modula-2 development")
+    (description "This package provides a complete GCC tool chain for
+Modula-2 development to be installed in user profiles.  This includes
+modula2, as well as libc (headers and binaries, plus debugging symbols
+in the @code{debug} output), and binutils.")))
 
 ;;; commencement.scm ends here
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 2486448893..d1fb67cd72 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -48,6 +48,7 @@ (define-module (gnu packages gcc)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages elf)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -1247,6 +1248,17 @@ (define-public gdc
    (custom-gcc gcc "gdc" '("d")
                %generic-search-paths)))
 
+(define-public gm2
+  (hidden-package
+   (let ((base (custom-gcc gcc-14
+               "gm2" '("m2")
+               %generic-search-paths)))
+     (package
+       (inherit base)
+       (native-inputs
+        `(("flex" ,flex)
+          ,@(package-native-inputs base)))))))
+
 (define-public (make-libgccjit gcc)
   (package
     (inherit gcc)

base-commit: efac01f19b65d7d77a98bbfd57fe2073fb13064a
-- 
2.49.0