unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Adding GNAT/GCC-Ada to Guix
@ 2023-07-16  8:47 Fernando Oleo Blanco
  2023-07-16 14:36 ` Denis 'GNUtoo' Carikli
  0 siblings, 1 reply; 5+ messages in thread
From: Fernando Oleo Blanco @ 2023-07-16  8:47 UTC (permalink / raw)
  To: Guix Devel

Dear Guix community,

I would like to bring once again [1] the discussion regarding the 
addition of a modern Ada compiler to Guix. In this case, GCC-Ada, aka GNAT.

TL;DR: GCC-Ada/GNAT cannot be bootstrapped. I would like to package a 
binary up until a bootstrap path is available; which is already under 
discussion.

As far as I know, GCC-Ada has not been added to Guix for two major 
reasons. The first one is the lack of bootstrappability and the second 
one is that no one has given it a thorough try. This emails hopes to 
shed some light on both of these topics.

1. Bootstrapping Ada

GCC-Ada (originally known as GNAT) has always required a previous GNAT 
version to compile newer releases. Ada was made an official language of 
the GCC stack with the GCC 3.1 release. Before this release, GNAT was 
distributed as a set of patches that had to be applied to GCC's src and 
it required a previous GNAT compiler to be available. I could not find 
"the original binary", but I have found ancient GNAT patch sets. The 
first (non-public) binaries were created using an Ada 83 compiler, 
potentially with Ada-Ed, an Ada 83 interpreter written in C (already 
available in Guix). However, the first publicly available patches dating 
from (GCC 2) already used Ada 95 features and required the Ada 95 
compiler based on GCC. What does this wall of text mean?

There was never a publicly available GNAT/GCC-Ada compiler that could be 
bootstrapped. The bootstrapping path was never made available and has 
been lost to history.

Why did I tell all of this?
Because I would like to add GCC-Ada to Guix and I am fully aware of the 
work that the Guix and the #bootstrappable people are doing towards a 
fully transparent compilation history. Opaque binaries are not allowed 
for that purpose. Sadly that is not currently possible with Ada. 
Therefore, I would like to get permission to add GCC-Ada as a binary up 
until there is a bootstrapping path available. I am aware that some 
languages/tools have received this treatment before.

2. A path towards bootstrapping GCC-Ada

As I said, some of us are aware of the issue mentioned above. We have 
already talked about a solution. I will not explain it here. Please, 
read the forum posts available in [2]. However, a bootstrapping compiler 
is years into the future.

3. What can Ada provide to Guix?

Apart from being an official language of the GCC toolsuite, it is also 
used in some important and unique places. For example, the graphics 
stack of Coreboot/Libreboot among other drivers are written in Ada [3] 
(you can find more by running `find . -type f -name "*.ad*"` on 
Coreboot's root folder). It is also the base programming language of 
SPARK [4], a verifiable, GPLv3 licensed, programming language, used for 
the ARIANE rockets and the Rosetta space probe for example. And of 
course, there are plenty of libraries, tools and programs written in 
Ada! Without a compiler, none of this can be packaged in Guix...

4. The dreaded binaries

As I said, I would like to package GCC-Ada, but it would initially be a 
binary blob (a semi-trusted one, maybe one from the Alire [5,6] project 
or Debian [7]). Are the Guix maintainers okay with this? Would you 
accept such a commit?

4.5 Some technical data about the proposed binaries

The Debian binary is just the GNAT/GCC-Ada compiler, meaning it has as 
dependencies gcc-12, libc6, libgmp10, libgnat-12 (Ada STL), etc. The 
compressed size of the package is ~18 MB, uncompressed it weighs ~91 MB. 
This indicates that it is not a high entropy package. However, as I said 
before, this is a very barebones Ada installation and it may make the 
package creation quite complex as other binaries may be required.

The Alire installation [6] weighs 296 MB compressed. Uncompressed it 
becomes a 837 MB folder. The reason for the much larger weight (but 
still relatively low entropy) is that the Alire binary comes with the 
entire compilation suit. It has a C/C++ compiler, Ada, binutils, GDB, 
some runtime environments, etc. It is a full, self-contained 
installation that is designed to be a drop-in deployment to get started 
compiling Ada. The compilation of this package is done using this python 
script [8], so the process is transparent.

5. Closing up

I personally would like the Alire installation media to be allowed as a 
binary if this proposal is accepted. This is because it is much easier 
to package (as the package would not need to link to other compilers or 
libraries) and it is the standard tooling used in the Alire project 
(think of Rust's Cargo but for Ada), which makes it fairly standard 
within the community.

What do you think? Is this a good idea? Should Guix accept this? Should 
Guix not provide an Ada compiler unless it can be bootstrapped, which 
will take years?
Of course, I would like to see this accepted, but I believe an initial 
discussion is required.

[1] https://lists.gnu.org/archive/html/guix-devel/2017-01/msg01568.html
[2] https://fossil.irvise.xyz/gnat-bootstrap/forum
[3] 
https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/drivers/intel/gma/
[4] https://github.com/AdaCore/spark2014
[5] https://alire.ada.dev/
[6] 
https://github.com/alire-project/GNAT-FSF-builds/releases/tag/gnat-12.2.0-1
[7] https://packages.debian.org/bookworm/gnat-12
[8] https://github.com/alire-project/GNAT-FSF-builds

Best regards and thank you for your time,
Fer



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding GNAT/GCC-Ada to Guix
  2023-07-16  8:47 Adding GNAT/GCC-Ada to Guix Fernando Oleo Blanco
@ 2023-07-16 14:36 ` Denis 'GNUtoo' Carikli
  2023-07-17  7:44   ` Ricardo Wurmus
  0 siblings, 1 reply; 5+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2023-07-16 14:36 UTC (permalink / raw)
  To: Fernando Oleo Blanco; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 3385 bytes --]

On Sun, 16 Jul 2023 08:47:41 +0000
Fernando Oleo Blanco <irvise_ml@irvise.xyz> wrote:

> Dear Guix community,
Hi,

> Why did I tell all of this?
> Because I would like to add GCC-Ada to Guix and I am fully aware of
> the work that the Guix and the #bootstrappable people are doing
> towards a fully transparent compilation history. Opaque binaries are
> not allowed for that purpose. Sadly that is not currently possible
> with Ada. Therefore, I would like to get permission to add GCC-Ada as
> a binary up until there is a bootstrapping path available. I am aware
> that some languages/tools have received this treatment before.
I don't know well the exact policies with that regard (I'm not a Guix
maintainer, just an occasional contributor) but I found the following
compilers in Guix source code:

- The haskell is not and was never bootstrapped from source. Though
  the binaries used to bootstrap it changed over time.

- There are also other compilers like vala and nim that convert vala
  and nim source code to C. The issue is that they are written in vala
  and nim, and Guix uses generated "source code" (generated C that is
  very hard to read) to build the compilers. People usually don't
  modify nor audit that kind of generated source unless it is for
  debugging purposes.

> 3. What can Ada provide to Guix?
> 
> Apart from being an official language of the GCC toolsuite, it is
> also used in some important and unique places. For example, the
> graphics stack of Coreboot/Libreboot among other drivers are written
> in Ada [3] (you can find more by running `find . -type f -name
> "*.ad*"` on Coreboot's root folder).
Nowadays Libreboot includes nonfree software in its releases, so
because of that me and Adrien 'Neox' Bourmault started working to
continue the original spirit of the old Libreboot that didn't contain
any nonfree software.

And while we don't have a release yet, in the longer run we're
interested in using Guix for building it because Guix is FSDG compliant
and it can be installed on top of most GNU/Linux distributions.

It would also make the maintenance easier and shared with other users of
Guix, enable to easily rebuild older releases, have faster build
times, etc.

Since it's also possible to inherit packages, in the long run it
would probably makes sense for us to move most of our work in Guix.

So having some ways to build software written in Ada with Guix would
make a big difference here as without that we would probably only be
able to use Guix only for some parts (like for building GRUB, SeaBIOS
etc for Coreboot).

Without that, Guix users would also need to use another distribution
with Guix inside to be able to build it.

> It is also the base programming
> language of SPARK [4], a verifiable, GPLv3 licensed, programming
> language, used for the ARIANE rockets and the Rosetta space probe for
> example. And of course, there are plenty of libraries, tools and
> programs written in Ada! Without a compiler, none of this can be
> packaged in Guix...
At the last FOSDEM, I was also shown at the ADA table that it was
also possible to build software for micro-controllers with it.

Though I've no idea if there are interesting free software firmwares
written in Ada worth packaging in Guix.

Anyway, Thanks a lot for all your work on this.

Denis.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding GNAT/GCC-Ada to Guix
  2023-07-16 14:36 ` Denis 'GNUtoo' Carikli
@ 2023-07-17  7:44   ` Ricardo Wurmus
  2023-07-20 18:13     ` Fernando Oleo Blanco
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Wurmus @ 2023-07-17  7:44 UTC (permalink / raw)
  To: Denis 'GNUtoo' Carikli; +Cc: Fernando Oleo Blanco, guix-devel


Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> writes:

> - The haskell is not and was never bootstrapped from source. Though
>   the binaries used to bootstrap it changed over time.

We do, however, build GHC 4 from source; there is only a small amount of
*generated* C files that we currently can’t avoid.  We build up from GHC
4 to version 7.

Someone needs to close the link between that build output and the
more recent GHCs we still hold.

-- 
Ricardo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding GNAT/GCC-Ada to Guix
  2023-07-17  7:44   ` Ricardo Wurmus
@ 2023-07-20 18:13     ` Fernando Oleo Blanco
  2023-07-27  1:35       ` Timothy Sample
  0 siblings, 1 reply; 5+ messages in thread
From: Fernando Oleo Blanco @ 2023-07-20 18:13 UTC (permalink / raw)
  To: Ricardo Wurmus, Denis 'GNUtoo' Carikli; +Cc: guix-devel

Thank you Denis and Ricardo for your input.

Denis, regarding the existence of low-level Ada libraries for hardware 
development, we do have quite a few! And I would be interested in 
packaging a couple of them. One would be the very well-known BareBones 
Runtimes [1] and also SweetAda [2]. Having SPARK also built fully from 
scratch and fully reproducibly would be extremely nice too.

I have talked with some people over at IRC and they recommended the use 
of the smaller GCC-Ada/GNAT binaries from Debian (even from older 
releases) and try to build an up-to-date Ada compiler toolchain with it.

However, that would be a lot of work to get going and it may require a 
lot of trial and error for it to fully work. I was thinking that maybe 
it would be best to start with the Alire binary that, while larger and 
against the Guix philosophy, will initially provide an up-to-date Ada 
toolchain easily and it would allow Ada programs to be added to Guix 
quite easily and quickly. Then, as time passes, we can try to get rid of 
it with the use of Debian binaries. That way we can test and ensure that 
the path towards smaller binaries still works and compiles software 
correctly. Hopefully I expressed myself correctly and hopefully this 
proposal gets accepted. I would like to put emphasis on the "temporary" 
part of this solution. The goal is to not have any binaries whatsoever, 
but we can start with a large and easy to work with binary and slowly 
work our way to having none of it. What do you all think?

[1] https://github.com/AdaCore/bb-runtimes
[2] https://github.com/gabriele-galeotti/SweetAda

Best regards,
Fer



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Adding GNAT/GCC-Ada to Guix
  2023-07-20 18:13     ` Fernando Oleo Blanco
@ 2023-07-27  1:35       ` Timothy Sample
  0 siblings, 0 replies; 5+ messages in thread
From: Timothy Sample @ 2023-07-27  1:35 UTC (permalink / raw)
  To: Fernando Oleo Blanco
  Cc: Ricardo Wurmus, Denis 'GNUtoo' Carikli, guix-devel

[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]

Hi Fernando,

Fernando Oleo Blanco <irvise_ml@irvise.xyz> writes:

> I have talked with some people over at IRC and they recommended the use
> of the smaller GCC-Ada/GNAT binaries from Debian (even from older
> releases) and try to build an up-to-date Ada compiler toolchain with it.
>
> However, that would be a lot of work to get going and it may require a
> lot of trial and error for it to fully work. [...]

I did this five years ago!  Attached is a package that constructs a
working Ada compiler from Debian 8 (Jessie) binaries.  There are also
some packages that loosely follow the Guix commencement of GCC (as of
five years ago), but include GNAT.

Cf. https://logs.guix.gnu.org/guix/2018-09-04.log#165534

I just tested building ‘gnat-debian’ and ‘gnat-boot0’.  They still work!
The former is GCC 4 and the latter is (now) GCC 11.  I also built a
basic Ada program with ‘gnat-boot0’.  The rest of it may or may not
work.  The ‘gnat-5’ package is no longer appropriate, obviously.  :)

I hope that helps.  FWIW, I still think Debian is the best option here
for a bootstrapping binary.  Ada-Ed and old GNAT are the most likely
option for proper bootstrapping.  I found a yacc and lex grammar for Ada
95, too, but I can’t remember if it is freely licensed.  It could be
used to bridge the gap between Ada-Ed and old GNAT (maybe).


-- Tim


[-- Attachment #2: ada.scm --]
[-- Type: text/plain, Size: 11605 bytes --]

;;; Copyright © 2018 Timothy Sample <samplet@ngyro.com>
;;; SPDX-License-Identifier: GPL-3.0-or-later

(use-modules (gnu packages bootstrap)
             (gnu packages elf)
             (gnu packages guile)
             (gnu packages gcc)
             (gnu packages perl)
             (guix base16)
             (guix build-system gnu)
             (guix download)
             ((guix licenses) #:prefix license:)
             (guix packages)
             (guix utils)
             (ice-9 match))

\f
;;; Debian GNAT bootstrap binary

(define %debian-mirror "http://archive.debian.org/debian")

(define (debian-url source name version)
  (string-append %debian-mirror "/pool/main/" (substring source 0 1) "/"
                 source "/" name "_" version "_amd64.deb"))

(define %debian-gcc-packages
  '(("libasan1"
     "ea0c7defc2fbbb61f069a5d119a3e3e5c9740f7fafd5214bf3065aa8cb971097")
    ("libatomic1"
     "92d74070442f13a2e9403464862e1b0b1bb23992e5157e2ac83cc4ac9f17084a")
    ("libcilkrts5"
     "a0d57dd6273ef2366ba8b54669ac147226e24238e40c2c4a39a3e0e2a7eacb99")
    ("cpp-4.9"
     "f1b38be5b85df78265bba28dae8987b72904b7d36051703bc1f7e70c55136a91")
    ("gcc-4.9"
     "569a2ca8aed7eca54fbb9edae367064bbb0f7f773973e73c72e27fbfc703c3b0")
    ("libgomp1"
     "5e4425acbd597a4f091c69e787a9ea16f8bf4442c1dfd795d1ac8669912f2851")
    ("libitm1"
     "c005a4b836179ca9aa6ed28d9cb8785a3af6daa222cb55563fcc1edbca081eb4")
    ("libgcc-4.9-dev"
     "db89814eb484edf5d9c24a9def334ca1eac22afbfd3f8b23f12262e217ac80ff")
    ("libgcc1"
     "3101d5dc171fab3b4601bc3282bbc69f0fb9cfd1e1761389e1e6d2590e384623")
    ("libstdc++6"
     "a8f4ef6773b90bb39a8a8a0a5e3e20ca8501de6896204f665eb114d5b79f164f")
    ("liblsan0"
     "20caadf3fdd5905618f9933768bdbd79b9c16a26ece2774ad1b38d14329ecdf2")
    ("libquadmath0"
     "7e3779d41a42a88621f93c47a77874547b266b7c8166c80e254721e8347c3355")
    ("libtsan0"
     "5574f38d9b2f4987b90a70003ea7e60e0b5cab5c7a7c6ac9c2837eb1353e71bf")
    ("libubsan0"
     "49f00199613ff3d214c4137a2fe3b43bc3bbee79fa92ed9fb9cd0b0abaaf7c3e")))

(define %debian-gnat-packages
  '(("gnat-4.9"
     "0afb887980b819853f04e6c674f1a962836e3f691f14ad2b93af93c432db4bcb")
    ("libgnat-4.9"
     "9d6258a9dea4e78d4e6bd9996e00f673f1169df1aa00db713c716f22011b3638")
    ("libgnatprj4.9"
     "cadaf3f8d5f150589cbb286ecca07f1cd2f33b2f52675326398c9e1fb3b9aba5")
    ("libgnatvsn4.9"
     "227eaf2a40c24c9222e2f658d8b02e24e5f0d82f4c9003f994421c19c13f040d")))

(define %debian-gnat-closure
  `(("cloog" "libcloog-isl4" "0.18.2-1+b2"
     "8bb4ba985d65ededbfc24d76d3610af57a70787b635841407558d25a7f06ff49")
    ("gmp" "libgmp10" "6.0.0+dfsg-6"
     "155a31b0f716aa3dcd7ee68e9bd57e0b76a6b31f4e41fb2d953e986315437082")
    ("isl" "libisl10" "0.12.2-2"
     "5a091cf30221e183d319f4906a746043be7220061f3b742b2ad958ee79ac01f7")
    ("mpclib3" "libmpc3" "1.0.2-1"
     "0a252dcf89843ee8b402fd226c8fb552d69c82c7013a28e335ba36878468d959")
    ("mpfr4" "libmpfr4" "3.1.2-2"
     "1b6ef16024e7850c4f2d47dbe06cba1143ac36d5584db515f63d5fbd873e3eb2")
    ("zlib" "zlib1g" "1.2.8.dfsg-2+b1"
     "b75102f61ace79c14ea6f06fdd9509825ee2af694c6aa503253df4e6659d6772")
    ("gcc-defaults" "gcc" "4.9.2-2"
     "b7a60f9bc12d8ac0bbce99160390f28ee4a2d1d94753d123a7016d0443e46518")
    ("gcc-defaults" "cpp" "4.9.2-2"
     "e0d777817359da6dd7d003c164f12a55a8b889eb360ba2c945d5316ee7dbefd8")
    ,@(map (match-lambda
             ((name hash)
              `("gcc-4.9" ,name "4.9.2-10+deb8u1" ,hash)))
           %debian-gcc-packages)
    ,@(map (match-lambda
             ((name hash)
              `("gnat-4.9" ,name "4.9.2-1" ,hash)))
           %debian-gnat-packages)))

(define gnat-debian
  (package
    (name "gnat-debian")
    (version "4.9.2-1")
    (source #f)
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f
       #:strip-binaries? #f
       #:modules ((ice-9 match)
                  ,@%gnu-build-system-modules)
       #:phases
       (modify-phases %standard-phases
         ;; Instead of a single source archive, we have a bunch of
         ;; Debian package archives to unpack.
         (replace 'unpack
           (lambda* (#:key inputs #:allow-other-keys)
             (for-each (match-lambda
                         ((name . value)
                          (when (string-suffix? ".deb" name)
                            (invoke "ar" "x" value)
                            (invoke "tar" "xvf" "data.tar.xz"))))
                       inputs)
             ;; Most of the libraries are in "/usr/lib" but a few are in
             ;; "/lib".  They are easier to work with if consolidated.
             (copy-recursively "lib" "usr/lib")
             #t))
         ;; There is a symlink to "libgcc_s.so" that uses an absolute
         ;; path.  We need to make it relative.
         (add-after 'unpack 'fix-libgcc_s-link
           (lambda _
             (with-directory-excursion "usr//lib/gcc/x86_64-linux-gnu/4.9"
               (delete-file "libgcc_s.so")
               (symlink "../../../x86_64-linux-gnu/libgcc_s.so.1"
                        "libgcc_s.so"))
             #t))
         ;; This follows the Rust bootstrap binary packages.  We need to
         ;; patch the binaries so that they can find their shared
         ;; libraries and the dynamic linker.
         (add-after 'configure 'patch-elves
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (ld-so (string-append (assoc-ref inputs "libc")
                                          ,(glibc-dynamic-linker)))
                    (rpath (string-append out "/lib/x86_64-linux-gnu:"
                                          (dirname ld-so)))
                    (elves (find-files "."
                                       (lambda (file stat)
                                         (and (not (string-suffix? ".o" file))
                                              (elf-file? file))))))
               (for-each (lambda (elf)
                           (format #t "Setting RUNPATH for ~a~%" elf)
                           (invoke "patchelf" "--set-rpath" rpath elf)
                           (when (with-output-to-port (%make-void-port "w")
                                   (lambda ()
                                     (zero? (system* "patchelf"
                                                     "--print-interpreter"
                                                     elf))))
                             (format #t "Setting interpreter for ~a~%" elf)
                             (invoke "patchelf" "--set-interpreter" ld-so elf)))
                         elves)
               #t)))
         (delete 'configure)
         (delete 'build)
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (copy-recursively "usr" out)
               #t)))
         ;; Tthe easiest way to ensure that GNAT uses Guix's dynamic
         ;; linker is to wrap the "collect2" program and modify its
         ;; arguments.  Normally, one would use LDFLAGS to set it, but
         ;; this doesn't propagate through the GNAT tools (e.g.,
         ;; "gnatmake").
         (add-after 'install 'wrap-collect
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (string-append (assoc-ref outputs "out")))
                    (collect2 (string-append out "/lib/gcc/"
                                             "x86_64-linux-gnu/4.9/"
                                             "collect2"))
                    (ld-so (string-append (assoc-ref inputs "libc")
                                          ,(glibc-dynamic-linker)))
                    (guile (string-append (assoc-ref inputs "guile")
                                          "/bin/guile")))
               ;; Hide the real "collect2" program.
               (copy-file collect2 (string-append collect2 "-real"))
               ;; Write a small script to change the "-dynamic-linker"
               ;; argument before running the real "collect2".
               (with-output-to-file collect2
                 (lambda _
                   (display
                    (string-append "#!" guile " --no-auto-compile\n!#\n"))
                   (write
                    `(begin
                       (use-modules (ice-9 match))
                       (define (update-dynamic-linker args)
                         (let loop ((args args) (acc '()))
                           (match args
                             (() (reverse acc))
                             (("-dynamic-linker" _ . rest)
                              (loop rest (cons* ,ld-so "-dynamic-linker" acc)))
                             ((arg . rest)
                              (loop rest (cons arg acc))))))
                       (apply execl ,(string-append collect2 "-real")
                              (update-dynamic-linker (command-line)))))))
               #t))))))
    (inputs
     `(("guile" ,guile-2.2)))
    (native-inputs
     `(("patchelf" ,patchelf)
       ,@(map (match-lambda
                ((source name version hash)
                 `(,(string-append name ".deb")
                   ,(origin
                      (method url-fetch)
                      (uri (debian-url source name version))
                      (sha256 (base16-string->bytevector hash))))))
              %debian-gnat-closure)))
    (synopsis "GNU Ada compiler")
    (description "GNAT is a full-featured Ada 2012 compiler.")
    (home-page "https://gcc.gnu.org/")
    (license license:gpl3+)))

\f
;;; GNAT commencement

(define-public gnat-boot0
  (package
    (inherit gcc)
    (name "gnat-boot0")
    (arguments
     (substitute-keyword-arguments (package-arguments gcc)
       ((#:configure-flags flags)
        `(cons "--enable-languages=c,c++,ada"
               (filter (lambda (flag)
                         (not (string-prefix? "--enable-languages" flag)))
                       ,flags)))))
    (native-inputs
     `(("gcc" ,gnat-debian)
       ,@(package-native-inputs gcc)))))

(define gnat-final
  (package
    (inherit gnat-boot0)
    (name "gnat-final")
    (native-inputs
     `(("gcc" ,gnat-boot0)
       ,@(package-native-inputs gcc)))))

\f
;;; GNAT packages

;; XXX: These packages conflict with GCC.  Ideally, they would extend
;; GCC, but that may require modifying the GCC package, which is
;; something I would like to avoid (unless it could be merged
;; upstream).  It may be possible to wrap `gcc' and use its `-B' flag
;; to find the Ada compiler.  Another option could be to make a union
;; package.

(define (make-gnat gcc)
  (package
    (inherit gcc)
    (name "gnat")
    (arguments
     (substitute-keyword-arguments (package-arguments gcc)
       ((#:configure-flags flags)
        `(cons "--enable-languages=c,c++,ada"
               (filter (lambda (flag)
                         (not (string-prefix? "--enable-languages" flag)))
                       ,flags)))))
    (native-inputs
     (cons `("gcc" ,gnat-final)
           (package-native-inputs gcc)))))

(define-public gnat-5
  (make-gnat gcc-5))

(define-public gnat gnat-5)

(define-public gnat-toolchain
  (package
    (inherit ((@@ (gnu packages commencement) make-gcc-toolchain) gnat))
    (name "gnat-toolchain")))

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-27  1:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-16  8:47 Adding GNAT/GCC-Ada to Guix Fernando Oleo Blanco
2023-07-16 14:36 ` Denis 'GNUtoo' Carikli
2023-07-17  7:44   ` Ricardo Wurmus
2023-07-20 18:13     ` Fernando Oleo Blanco
2023-07-27  1:35       ` Timothy Sample

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).