unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#55605] [PATCH 1/2] gnu: Add qbe.
@ 2022-05-24  1:21 Antero Mejr via Guix-patches via
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-05-24  1:21 UTC (permalink / raw)
  To: 55605; +Cc: Antero Mejr

* gnu/packages/c.scm (qbe): New variable.
---
Hare + QBE builds, tested running a Hello World program using the stdlib.

 gnu/packages/c.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e14e56ad71..01fd2e9a96 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2021 David Dashyan <mail@davie.li>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1096,3 +1097,37 @@ (define-public utf8-h
 C and C++.  The functions it provides are like those from the C header
 string.h, but with a utf8* prefix instead of the str* prefix.")
       (license license:unlicense))))
+
+(define-public qbe
+  (let ((commit "9a3e131cf713f8619705f906caf28c5809708ad0") (revision "0"))
+    (package
+      (name "qbe")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "git://c9x.me/qbe.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04dhdm2j84h9hlqj934wh9v456v3kzh0ayxs1gncyh4inv3b41cf"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ;no test suite
+         #:make-flags
+         (list (string-append "CC="
+                              ,(cc-for-target))
+               (string-append "DESTDIR="
+                              (assoc-ref %outputs "out"))
+               "PREFIX=")
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)))) ;no configure script
+      (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
+      (home-page "https://c9x.me/compile/")
+      (synopsis "Compiler backend written in C")
+      (description
+       "QBE aims to be a pure C embeddable backend that provides 70% of the
+performance of advanced compilers in 10% of the code.")
+      (license license:expat))))
-- 
2.36.1





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-05-24  1:21 [bug#55605] [PATCH 1/2] gnu: Add qbe Antero Mejr via Guix-patches via
@ 2022-05-24  1:21 ` Antero Mejr via Guix-patches via
  2022-05-24 17:01   ` Maxime Devos
                     ` (7 more replies)
  2022-05-24 16:56 ` [bug#55605] [PATCH 1/2] gnu: Add qbe Maxime Devos
  2022-05-24 21:06 ` Maxime Devos
  2 siblings, 8 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-05-24  1:21 UTC (permalink / raw)
  To: 55606; +Cc: Antero Mejr

* gnu/packages/hare.scm (hare): New variable.
---
Guix style was indenting badly when applied to the hare package, putting the
text far past 80 characters. Corrected it by hand.

 gnu/packages/hare.scm | 136 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)
 create mode 100644 gnu/packages/hare.scm

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
new file mode 100644
index 0000000000..5936056fda
--- /dev/null
+++ b/gnu/packages/hare.scm
@@ -0,0 +1,136 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages hare)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (guix utils)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
+  #:use-module (gnu packages man)
+  #:use-module (gnu platform))
+
+(define-public harec
+  (let ((commit "43b34048dd83bde5d4d2a7d93d37a593a9c12fda") (revision "0"))
+    (package
+      (name "harec")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/harec")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0502xw96za7bvnqvh6jhfjwrw4ddqwppr4ihcn9f5jvjpgw95284"))))
+      (native-inputs (list qbe))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ;no test suite
+         #:make-flags
+         (list (string-append "CC="
+                              ,(cc-for-target))
+               (string-append "DESTDIR="
+                              (assoc-ref %outputs "out")) "PREFIX=")
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key configure-flags #:allow-other-keys)
+               (setenv "QBE"
+                       (string-append (assoc-ref %build-inputs "qbe")
+                                      "/bin/qbe"))
+               ;; configure rejects unrecognized options
+               (apply invoke "./configure" configure-flags))))))
+      (home-page "https://harelang.org")
+      (synopsis "Hare bootstrap compiler")
+      (description "Hare compiler written in C11 for POSIX-compatible
+systems.")
+      (license license:gpl3+))))
+
+(define-public hare
+  (let ((commit "5af4fbd5f2f552da47af0f8f765050e49b0ae73f") (revision "0"))
+    (package
+      (name "hare")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/hare")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1gj2v5p73f8y5gpglm6mmfdadc6ih2bnd80nyax1xipsfy0f82di"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:make-flags
+         (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
+               "BINDIR=/bin"
+               "MANDIR=/share/man"
+               "SRCDIR=/src"
+               "LOCALSRCDIR=/src/hare"
+               (string-append "HAREPATH="
+                              (assoc-ref %outputs "out")
+                              "/src/hare/stdlib:"
+                              (assoc-ref %outputs "out")
+                              "/src/hare/third-party")
+               (string-append "PLATFORM=" "linux")
+               (string-append "ARCH="
+                              ,(platform-linux-architecture
+                                (lookup-platform-by-target-or-system
+                                 (or (%current-target-system)
+                                     (%current-system)))))
+               (string-append "HAREC="
+                              (string-append (assoc-ref %build-inputs "harec")
+                                             "/bin/harec"))
+               "HAREFLAGS="
+               (string-append "QBE="
+                              (string-append (assoc-ref %build-inputs "qbe")
+                                             "/bin/qbe"))
+               (string-append "AS="
+                              (string-append (assoc-ref %build-inputs "binutils")
+                                             "/bin/as"))
+               (string-append "LD="
+                              (string-append (assoc-ref %build-inputs "binutils")
+                                             "/bin/ld"))
+               (string-append "AR="
+                              (string-append (assoc-ref %build-inputs "binutils")
+                                             "/bin/ar"))
+               (string-append "SCDOC="
+                              (string-append (assoc-ref %build-inputs "scdoc")
+                                             "/bin/scdoc"))
+               "HARECACHE=.cache")
+         #:phases
+         (modify-phases %standard-phases
+                        (delete 'configure) ;No configuration script.
+           ;; Use own make-flags instead of `config.mk`.
+           (add-before 'build 'dont-include-config-mk
+             (lambda _
+               (substitute* "Makefile"
+                 (("include config.mk") "")) #t)))))
+      (native-inputs (list scdoc))
+      (propagated-inputs (list harec qbe binutils))
+      (home-page "https://harelang.org")
+      (synopsis "Compiler for the Hare programming language")
+      (description "Hare is a systems programming language.")
+      (license (list license:gpl3+ license:mpl2.0)))))
-- 
2.36.1





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

* [bug#55605] [PATCH 1/2] gnu: Add qbe.
  2022-05-24  1:21 [bug#55605] [PATCH 1/2] gnu: Add qbe Antero Mejr via Guix-patches via
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
@ 2022-05-24 16:56 ` Maxime Devos
  2022-05-24 21:06 ` Maxime Devos
  2 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-05-24 16:56 UTC (permalink / raw)
  To: Antero Mejr, 55605

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

Antero Mejr via Guix-patches via schreef op ma 23-05-2022 om 21:21 [-
0400]:
> +      (arguments
> +       `(#:tests? #f ;no test suite
> +         #:make-flags
> +         (list (string-append "CC="
> +                              ,(cc-for-target))
> +               (string-append "DESTDIR="
> +                              (assoc-ref %outputs "out"))
> +               "PREFIX=")

Guix doesn't use this kind of staging, "PREFIX=" (assoc-ref %outputs
"out") should be sufficient, no need for DESTDIR.  And the somewhat
obscure 'assoc-ref' can be eliminated and the strata made more explicit
with gexps:

   (arguments
     (list #:tests? #f ;...
           #:make-flags
           #~(list (string-append "CC=" #$(cc-for-target))
                   (string-append "PREFIX=" #$output))))

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
@ 2022-05-24 17:01   ` Maxime Devos
  2022-05-24 17:07   ` Maxime Devos
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-05-24 17:01 UTC (permalink / raw)
  To: Antero Mejr, 55606

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

Antero Mejr via Guix-patches via schreef op ma 23-05-2022 om 21:21 [-
0400]:
> +      (arguments
> +       `(#:tests? #f ;no test suite
> +         #:make-flags
> +         (list (string-append "CC="
> +                              ,(cc-for-target))
> +               (string-append "DESTDIR="
> +                              (assoc-ref %outputs "out")) "PREFIX=")
> +         #:phases
> +         (modify-phases %standard-phases
> +           (replace 'configure
> +             (lambda* (#:key configure-flags #:allow-other-keys)
> +               (setenv "QBE"
> +                       (string-append (assoc-ref %build-inputs "qbe")
> +                                      "/bin/qbe"))
> +               ;; configure rejects unrecognized options
> +               (apply invoke "./configure" configure-flags))))))

input labels can be eliminated (see
<https://guix.gnu.org/en/blog/2021/the-big-change/>):

  (arguments
    (list ...
          #:phases
          #~(modify-phases ...
               (setenv "QBE" (which "qbe"))
               (apply invoke ...))))

Also, 'qbe' looks like a non-native input input, IIUC that 'harec'
invokes 'qbe' under the hood.  (in that case, use (search-input-file
inputs "/bin/qbe") instead). As a test, you can do "guix build harec"
and "guix gc --refences /gnu/store/HAS-harec-VERSION" to see if it ends
up in the references.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  2022-05-24 17:01   ` Maxime Devos
@ 2022-05-24 17:07   ` Maxime Devos
  2022-05-24 17:09   ` Maxime Devos
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-05-24 17:07 UTC (permalink / raw)
  To: Antero Mejr, 55606

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

Antero Mejr via Guix-patches via schreef op ma 23-05-2022 om 21:21 [-
0400]:
> +       `(#:make-flags
> +         (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
> +               "BINDIR=/bin"
> +               "MANDIR=/share/man"
> +               "SRCDIR=/src"
> +               "LOCALSRCDIR=/src/hare"

See previous message about G-exp and DESTDIR.

+               (string-append "HAREPATH="
+                              (assoc-ref %outputs "out")
+                              "/src/hare/stdlib:"
+                              (assoc-ref %outputs "out")

Likewise, (assoc-ref ... "out") -> #$output


+               (string-append "HAREC="
+                              (string-append (assoc-ref %build-inputs
"harec")
+                                             "/bin/harec"))

Likewise about input labels, though in this case search-input-file.
Or (file-append #$(this-package-input "harec") "/bin/harec").

+               (string-append "AS="
+                              (string-append (assoc-ref %build-inputs
"binutils")

IIRC %build-inputs does not exist when cross-compiling, try "guix build
--target=aarch64-linux-gnu hare".  Also, it is ambigious if you meant
inputs or native-inptus here.  You might need %build-target-input or
one of those instead.  They are undocumented though, so maybe better
use this-package-{native,}-input.  Those don't support implicit inputs
though, so you may need to add the gcc manually (maybe look at (guix
build-system gnu) for how).

> +               "HARECACHE=.cache")

Is this used for building the hare compiler itself or for building hare
libraries and applications?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  2022-05-24 17:01   ` Maxime Devos
  2022-05-24 17:07   ` Maxime Devos
@ 2022-05-24 17:09   ` Maxime Devos
  2022-05-24 17:10   ` Tobias Geerinckx-Rice via Guix-patches via
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-05-24 17:09 UTC (permalink / raw)
  To: Antero Mejr, 55606

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

Antero Mejr via Guix-patches via schreef op ma 23-05-2022 om 21:21 [-
0400]:
> +               (string-append "LD="
> +                              (string-append (assoc-ref %build-inputs "binutils")

Looking at the makefile, I think all you need is "LD=ld".  Or maybe
"LD=TARGET-ld".

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                     ` (2 preceding siblings ...)
  2022-05-24 17:09   ` Maxime Devos
@ 2022-05-24 17:10   ` Tobias Geerinckx-Rice via Guix-patches via
  2022-05-29  0:54   ` [bug#55606] [PATCH] " Antero Mejr via Guix-patches via
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 38+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2022-05-24 17:10 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 55606

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

Antero Mejr via Guix-patches via 写道:
> Guix style was indenting badly when applied to the hare package, 
> putting the
> text far past 80 characters. Corrected it by hand.

This caught my attention; I didn't review anything.

Guix style just follows the same rules we should follow.  Don't 
‘fix’ the result unless there's a real bug in ‘guix style’.

Instead, work with it, in this case by adding newlines.  This:

  (proc "foo"
   "bar")

reads *wrong* to humans.

Worse, it's forever a pain to maintain, because nobody can ever 
auto-indent any changes they make to your hand-tweaked code.  They 
have to work around it.

Instead, when necessary, write:

  (proc
   "foo"
   "bar")

> +         (list (string-append "DESTDIR=" (assoc-ref %outputs 
> "out"))

In this case you'd a newline after the above ‘string-append’.

> +               (string-append "HAREC="
> +                              (string-append (assoc-ref 
> %build-inputs "harec")
> +                                             "/bin/harec"))

This is easy to fix: theres no need for the inner string-appends 
in this section.

  (string-append "HAREC="
                 (assoc-ref %build-inputs "harec")
                 "/bin/harec")

is 100% equivalent.  If the line is still too long, add newlines 
where it keeps the code the clearest.

With such changes, you can run ‘guix style’ (or let your editor 
indent the code) without worries or manual fix-ups.

Kind regards,

T G-R

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

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

* [bug#55605] [PATCH 1/2] gnu: Add qbe.
  2022-05-24  1:21 [bug#55605] [PATCH 1/2] gnu: Add qbe Antero Mejr via Guix-patches via
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  2022-05-24 16:56 ` [bug#55605] [PATCH 1/2] gnu: Add qbe Maxime Devos
@ 2022-05-24 21:06 ` Maxime Devos
  2 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-05-24 21:06 UTC (permalink / raw)
  To: Antero Mejr, 55605

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

Antero Mejr via Guix-patches via schreef op ma 23-05-2022 om 21:21 [-
0400]:
> * gnu/packages/c.scm (qbe): New variable.

Looks like someone wrote a patch for this previously (+ applied):
<https://issues.guix.gnu.org/53833>.  The 'hare' part hasn't been done
yet though.

For future reference, you can use
https://issues.guix.gnu.org/search?query=qbe
to look if a patch already exists for the package.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH] gnu: Add hare.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                     ` (3 preceding siblings ...)
  2022-05-24 17:10   ` Tobias Geerinckx-Rice via Guix-patches via
@ 2022-05-29  0:54   ` Antero Mejr via Guix-patches via
  2022-06-03 17:54   ` [bug#55606] Antero Mejr via Guix-patches via
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-05-29  0:54 UTC (permalink / raw)
  To: 55606; +Cc: Antero Mejr

* gnu/packages/hare.scm (hare): New variable.
---
 gnu/packages/hare.scm | 145 ++++++++++++++++++++++++++++++++++++++++++
 guix/utils.scm        |   6 ++
 2 files changed, 151 insertions(+)
 create mode 100644 gnu/packages/hare.scm

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
new file mode 100644
index 0000000000..b36bb3d475
--- /dev/null
+++ b/gnu/packages/hare.scm
@@ -0,0 +1,145 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages hare)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (guix utils)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
+  #:use-module (gnu packages man)
+  #:use-module (gnu platform))
+
+(define-public harec
+  (let ((commit "78989a15dfcc301ac2eca07afb1f906e172bd48b") (revision "0"))
+    (package
+      (name "harec")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/harec")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1cv71vmrcf31rk7cjrmhb6ivwdfwzick7fyiglwh4ky6bf0r6cgx"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:configure-flags
+             #~(list (string-append "--prefix="
+                                    #$output))
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-before 'configure 'setenv
+                   (lambda _
+                     (setenv "QBE"
+                             (string-append #$qbe "/bin/qbe"))
+                     (setenv "CC"
+                             #$(cc-for-target))))
+                 (replace 'configure
+                   (lambda* (#:key outputs
+                             (configure-flags '()) #:allow-other-keys)
+                     (apply invoke "./configure" configure-flags))))))
+      (inputs (list qbe))
+      (home-page "https://harelang.org")
+      (synopsis "Hare bootstrap compiler")
+      (description "Hare compiler written in C11 for POSIX-compatible
+systems.")
+      (license license:gpl3+))))
+
+(define-public hare
+  (let ((commit "19e380ccb7dfe2bcab5f94e6bd03004e3e2c6005") (revision "0"))
+    (package
+      (name "hare")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/hare")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04fk3akj3410f8fxw2ixp6l6f9x54pnnk00c0hx0297p7hdzzzq4"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:make-flags
+             #~(list (string-append "BINDIR="
+                                    #$output "/bin")
+                     (string-append "MANDIR="
+                                    #$output "/share/man")
+                     (string-append "SRCDIR="
+                                    #$output "/src")
+                     (string-append "LOCALSRCDIR=" "/usr/local/src/hare")
+                     (string-append "HAREPATH="
+                                    "/usr/local/src/hare/stdlib:"
+                                    "/usr/local/src/hare/third-party:"
+                                    #$output
+                                    "/src/hare/stdlib:"
+                                    #$output
+                                    "/src/hare/third-party")
+                     (string-append "PLATFORM=" "linux")
+                     (string-append "HAREC="
+                                    #$harec "/bin/harec")
+                     "HAREFLAGS="
+                     (string-append "QBE="
+                                    #$qbe "/bin/qbe")
+                     (string-append "AS="
+                                    #$(as-for-target))
+                     (string-append "LD="
+                                    #$(ld-for-target))
+                     (string-append "AR="
+                                    #$(ar-for-target))
+                     (string-append "SCDOC="
+                                    #$scdoc "/bin/scdoc")
+                     "HARECACHE=.cache")
+             #:phases
+             #~(modify-phases %standard-phases
+                 (delete 'configure)
+                 (add-before 'build 'set-arch-env
+                   (lambda _
+                     (let ((arch #$(platform-linux-architecture
+                                    (lookup-platform-by-target-or-system
+                                     (or (%current-target-system)
+                                         (%current-system))))))
+                       (setenv "ARCH" arch)) #t))
+                 (add-before 'build 'edit-files
+                   (lambda _
+                     (substitute* "Makefile"
+                       (("include config.mk") "")
+                       (("\\$\\(LOCALSRCDIR\\)") ""))
+                     (substitute* "math/complex/+test.ha"
+                       (("return realalike && imagalike;")
+                        "return true;")) #t)))))
+      (native-inputs (list scdoc))
+      (inputs (list tzdata))
+      (propagated-inputs (list harec qbe))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "HAREPATH")
+              (files '("src/hare/stdlib"
+                       "src/hare/third-party")))))
+      (home-page "https://harelang.org")
+      (synopsis "Compiler for the Hare programming language")
+      (description "Hare is a systems programming language.")
+      (license (list license:gpl3+ license:mpl2.0)))))
diff --git a/guix/utils.scm b/guix/utils.scm
index 44c46cb4a9..2cf5fb1db7 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -100,6 +100,7 @@ (define-module (guix utils)
             target-riscv64?
             target-64bit?
             ar-for-target
+            as-for-target
             cc-for-target
             cxx-for-target
             ld-for-target
@@ -722,6 +723,11 @@ (define* (ar-for-target #:optional (target (%current-target-system)))
       (string-append target "-ar")
       "ar"))
 
+(define* (as-for-target #:optional (target (%current-target-system)))
+  (if target
+      (string-append target "-as")
+      "as"))
+
 (define* (cc-for-target #:optional (target (%current-target-system)))
   (if target
       (string-append target "-gcc")
-- 
2.36.1





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

* [bug#55606]
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                     ` (4 preceding siblings ...)
  2022-05-29  0:54   ` [bug#55606] [PATCH] " Antero Mejr via Guix-patches via
@ 2022-06-03 17:54   ` Antero Mejr via Guix-patches via
  2022-06-25 16:54     ` [bug#55606] [PATCH 2/2] gnu: Add hare Liliana Marie Prikler
  2022-06-26  4:39   ` [bug#55606] [PATCH 1/2] gnu: Add harec Antero Mejr via Guix-patches via
  2022-06-26 13:59   ` Antero Mejr via Guix-patches via
  7 siblings, 1 reply; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-03 17:54 UTC (permalink / raw)
  To: 55606@debbugs.gnu.org

Thanks for the suggestions Maxime and Tobias, the patch above uses the new gexps and has better styling. The new patch was tested by building the hare programs 'hautils', which compiled and ran successfully.

Maxime, the HARECACHE directory is a temporary build directory for the compiler itself, yes.

Please let me know if there are any futher issues.




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-03 17:54   ` [bug#55606] Antero Mejr via Guix-patches via
@ 2022-06-25 16:54     ` Liliana Marie Prikler
  2022-06-25 17:53       ` ( via Guix-patches via
                         ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Liliana Marie Prikler @ 2022-06-25 16:54 UTC (permalink / raw)
  To: Antero Mejr, 55606@debbugs.gnu.org; +Cc: Tobias Geerinckx-Rice, Maxime Devos

Am Freitag, dem 03.06.2022 um 13:54 -0400 schrieb Antero Mejr:
> Please let me know if there are any futher issues.
For what it's worth, the patch should probably be split in three (one
for as-for-target, one for harec, one for hare).

Maxime, Tobias, what else is missing?




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-25 16:54     ` [bug#55606] [PATCH 2/2] gnu: Add hare Liliana Marie Prikler
@ 2022-06-25 17:53       ` ( via Guix-patches via
  2022-06-26  4:56         ` Antero Mejr via Guix-patches via
  2022-06-25 17:59       ` ( via Guix-patches via
  2022-06-25 21:32       ` Antero Mejr via Guix-patches via
  2 siblings, 1 reply; 38+ messages in thread
From: ( via Guix-patches via @ 2022-06-25 17:53 UTC (permalink / raw)
  To: Liliana Marie Prikler, Antero Mejr, 55606@debbugs.gnu.org
  Cc: Tobias Geerinckx-Rice, Maxime Devos

FYI, I added Hare packages and libraries to Guix 'R Us a while ago, but
was waiting for 1.0 to send it here:

https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/hare.scm
https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/common/hare.scm

    -- (




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-25 16:54     ` [bug#55606] [PATCH 2/2] gnu: Add hare Liliana Marie Prikler
  2022-06-25 17:53       ` ( via Guix-patches via
@ 2022-06-25 17:59       ` ( via Guix-patches via
  2022-06-26  4:40         ` Antero Mejr via Guix-patches via
  2022-06-25 21:32       ` Antero Mejr via Guix-patches via
  2 siblings, 1 reply; 38+ messages in thread
From: ( via Guix-patches via @ 2022-06-25 17:59 UTC (permalink / raw)
  To: Liliana Marie Prikler, Antero Mejr, 55606@debbugs.gnu.org
  Cc: Tobias Geerinckx-Rice, Maxime Devos

Some notes:

+ `hare` is not a compiler for Hare, it's a build tool. (It's going to
  include a self-hosted compiler eventually though :))
+ I think the way this patch handles config.mk from `hare` is better.
+ The Guix 'R Us version works with cross-compilation; I don't think this
  one does?
+ harec and qbe probably shouldn't be propagated; their paths should be
  patched into the source code.

    -- (




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-25 16:54     ` [bug#55606] [PATCH 2/2] gnu: Add hare Liliana Marie Prikler
  2022-06-25 17:53       ` ( via Guix-patches via
  2022-06-25 17:59       ` ( via Guix-patches via
@ 2022-06-25 21:32       ` Antero Mejr via Guix-patches via
  2 siblings, 0 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-25 21:32 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> For what it's worth, the patch should probably be split in three (one
> for as-for-target, one for harec, one for hare).

I split out as-for-target into a new patch/issue #56224, since it does
not directly involve hare:
https://issues.guix.gnu.org/56224




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

* [bug#55606] [PATCH 1/2] gnu: Add harec.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                     ` (5 preceding siblings ...)
  2022-06-03 17:54   ` [bug#55606] Antero Mejr via Guix-patches via
@ 2022-06-26  4:39   ` Antero Mejr via Guix-patches via
  2022-06-26  4:39     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  2022-06-26  6:50     ` [bug#55606] [PATCH 1/2] gnu: Add harec Liliana Marie Prikler
  2022-06-26 13:59   ` Antero Mejr via Guix-patches via
  7 siblings, 2 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26  4:39 UTC (permalink / raw)
  To: 55606

* gnu/packages/hare.scm (harec): New variable.
---
 gnu/packages/hare.scm | 66 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 gnu/packages/hare.scm

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
new file mode 100644
index 0000000000..a1149499d5
--- /dev/null
+++ b/gnu/packages/hare.scm
@@ -0,0 +1,66 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
+;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages hare)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
+  #:use-module (gnu packages man)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (guix platform)
+  #:use-module (guix utils))
+
+(define-public harec
+  (let ((commit "bbabe09bddf74bd699f8ad2224fdd6e2eefbd35e") (revision "0"))
+    (package
+      (name "harec")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/harec")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0sa8rjj5w01n55svql8drv761ks6i1bl9q4gj1yzr31dixaf6xvr"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:configure-flags #~(list (string-append "--prefix=" #$output))
+             #:phases #~(modify-phases %standard-phases
+                          (replace 'configure
+                            (lambda* (#:key outputs
+                                      (configure-flags '()) #:allow-other-keys)
+                              (setenv "AR" #$(ar-for-target))
+                              (setenv "AS" #$(as-for-target))
+                              (setenv "CC" #$(cc-for-target))
+                              (setenv "LD" #$(ld-for-target))
+                              (setenv "QBE" (string-append #$qbe "/bin/qbe"))
+                              (apply invoke "./configure" configure-flags))))))
+      (inputs (list qbe))
+      (home-page "https://harelang.org")
+      (synopsis "Hare bootstrap compiler in C")
+      (description "This package provides @code{harec}, the Hare language's
+bootstrap written in C.  Currently, the self-hosting @code{harec} rewrite is
+incomplete, so this is used as the default compiler in the build driver.")
+      (license license:gpl3))))
-- 
2.36.1





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  4:39   ` [bug#55606] [PATCH 1/2] gnu: Add harec Antero Mejr via Guix-patches via
@ 2022-06-26  4:39     ` Antero Mejr via Guix-patches via
  2022-06-26  7:18       ` Liliana Marie Prikler
  2022-06-26  6:50     ` [bug#55606] [PATCH 1/2] gnu: Add harec Liliana Marie Prikler
  1 sibling, 1 reply; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26  4:39 UTC (permalink / raw)
  To: 55606

* gnu/packages/hare.scm (hare): New variable.
---
 gnu/packages/hare.scm | 73 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
index a1149499d5..16c7d8e2dd 100644
--- a/gnu/packages/hare.scm
+++ b/gnu/packages/hare.scm
@@ -64,3 +64,76 @@ (define-public harec
 bootstrap written in C.  Currently, the self-hosting @code{harec} rewrite is
 incomplete, so this is used as the default compiler in the build driver.")
       (license license:gpl3))))
+
+(define-public hare
+  (let ((commit "19e380ccb7dfe2bcab5f94e6bd03004e3e2c6005") (revision "0"))
+    (package
+      (name "hare")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/hare")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04fk3akj3410f8fxw2ixp6l6f9x54pnnk00c0hx0297p7hdzzzq4"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:make-flags
+             #~(list (string-append "BINDIR=" #$output "/bin")
+                     (string-append "MANDIR=" #$output "/share/man")
+                     (string-append "SRCDIR=" #$output "/src")
+                     (string-append "LOCALSRCDIR=" #$output "/src/hare")
+                     (string-append "HAREC=" #$harec "/bin/harec")
+                     (string-append "PLATFORM=" "linux")
+                     (string-append "HAREPATH="
+                                    #$output "/src/hare/stdlib:"
+                                    #$output "/src/hare/third-party")
+                     (string-append "ARCH="
+                                    #$(platform-linux-architecture
+                                       (lookup-platform-by-target-or-system
+                                        (or (%current-target-system)
+                                            (%current-system)))))
+                     (string-append "AR=" #$(ar-for-target))
+                     (string-append "AS=" #$(as-for-target))
+                     (string-append "LD=" #$(ld-for-target))
+                     (string-append "QBE=" #$qbe "/bin/qbe")
+                     (string-append "SCDOC=" #$scdoc "/bin/scdoc")
+                     "HARECACHE=.cache"
+                     "BINOUT=.bin")
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'patch-failing-tests
+                   (lambda _
+                     ;; These tests fail due to a NaN-related bug in QBE when
+                     ;; used on glibc.
+                     (substitute* "math/complex/+test.ha"
+                       (("@test (fn (cos|cosh|exp)\\(\\) void =)" _ func)
+                        func))))
+                 (add-after 'unpack 'patch-makefile
+                   (lambda _
+                     (substitute* "Makefile"
+                       (("include config.mk") ""))))
+                 (delete 'configure))))
+      (native-inputs (list scdoc))
+      (inputs (list tzdata))
+      (propagated-inputs (list binutils harec qbe))
+      (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "HAREPATH")
+              (files '("src/hare/stdlib" "src/hare/third-party")))))
+      (home-page "https://harelang.org")
+      (synopsis "Systems programming language")
+      (description "Hare is a systems programming language that aims to improve
+on C while retaining its core philosophy. Its principles are:
+@itemize
+@item Trust the programmer.
+@item Provide tools the programmer may use when they don't trust themselves.
+@item Prefer explicit behavior over implicit behavior.
+@item A good program must be both correct and simple.
+@end itemize")
+      (license (list license:gpl3 ;compiler and build driver
+                     license:mpl2.0))))) ;standard library
-- 
2.36.1





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-25 17:59       ` ( via Guix-patches via
@ 2022-06-26  4:40         ` Antero Mejr via Guix-patches via
  2022-06-26  7:30           ` Maxime Devos
                             ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26  4:40 UTC (permalink / raw)
  To: (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos,
	Liliana Marie Prikler

Hi (,

"(" <paren@disroot.org> writes:
> Some notes:
>
> + `hare` is not a compiler for Hare, it's a build tool. (It's going to
>   include a self-hosted compiler eventually though :))

The above 2 patches are a combination of your guixrus patches and mine.
The descriptions are replaced with your better ones, and you are
credited at the top.

> + I think the way this patch handles config.mk from `hare` is better.

I kept that part in the new patches.

> + The Guix 'R Us version works with cross-compilation; I don't think this
>   one does?
You mean cross-compilation of hare code? When I try to use hare build -t
(the target flag) it gives me a not implemented error, so I don't think
hare cross-compilation is possible right now.

As for cross-compilation of the guix hare build, I think the
platform-linux-architecture bit should take care of it, right?

> + harec and qbe probably shouldn't be propagated; their paths should be
>   patched into the source code.
>
>     -- (

I'm unsure about this one - maybe the user would want to use harec or
qbe by themselves to debug a build step?
I wanted to give the user a full hare build environment when
they run `guix install hare`, but I understand your logic for wanting to
patch the paths in.

Thanks,
Antero




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-25 17:53       ` ( via Guix-patches via
@ 2022-06-26  4:56         ` Antero Mejr via Guix-patches via
  0 siblings, 0 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26  4:56 UTC (permalink / raw)
  To: (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos,
	Liliana Marie Prikler


"(" <paren@disroot.org> writes:

> FYI, I added Hare packages and libraries to Guix 'R Us a while ago, but
> was waiting for 1.0 to send it here:
>

Hare is already in Nixpkgs and AUR, so I think it would be good to make
the language available in Guix. I haven't seen a release plan, so
1.0.0 could still be far off.




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

* [bug#55606] [PATCH 1/2] gnu: Add harec.
  2022-06-26  4:39   ` [bug#55606] [PATCH 1/2] gnu: Add harec Antero Mejr via Guix-patches via
  2022-06-26  4:39     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
@ 2022-06-26  6:50     ` Liliana Marie Prikler
  1 sibling, 0 replies; 38+ messages in thread
From: Liliana Marie Prikler @ 2022-06-26  6:50 UTC (permalink / raw)
  To: Antero Mejr, 55606; +Cc: (, Tobias Geerinckx-Rice, Maxime Devos

Hi,

added the others back to CC; don't forget to set those when using guix
send-email.

Am Sonntag, dem 26.06.2022 um 00:39 -0400 schrieb Antero Mejr:
> * gnu/packages/hare.scm (harec): New variable.
> ---
>  gnu/packages/hare.scm | 66
> +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 gnu/packages/hare.scm
> 
> diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
> new file mode 100644
> index 0000000000..a1149499d5
> --- /dev/null
> +++ b/gnu/packages/hare.scm
> @@ -0,0 +1,66 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
> +;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages hare)
> +  #:use-module (gnu packages base)
> +  #:use-module (gnu packages c)
> +  #:use-module (gnu packages man)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (guix download)
> +  #:use-module ((guix licenses) #:prefix license:)
> +  #:use-module (guix gexp)
> +  #:use-module (guix git-download)
> +  #:use-module (guix packages)
> +  #:use-module (guix platform)
> +  #:use-module (guix utils))
> +
> +(define-public harec
> +  (let ((commit "bbabe09bddf74bd699f8ad2224fdd6e2eefbd35e")
> (revision "0"))
Despite what (guix style) may tell you, revision goes to an extra line.
> +    (package
> +      (name "harec")
> +      (version (git-version "0.0.0" revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://git.sr.ht/~sircmpwn/harec")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                 
> "0sa8rjj5w01n55svql8drv761ks6i1bl9q4gj1yzr31dixaf6xvr"))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       (list #:configure-flags #~(list (string-append "--prefix="
> #$output))
> +             #:phases #~(modify-phases %standard-phases
> +                          (replace 'configure
> +                            (lambda* (#:key outputs
> +                                      (configure-flags '()) #:allow-
> other-keys)
> +                              (setenv "AR" #$(ar-for-target))
> +                              (setenv "AS" #$(as-for-target))
> +                              (setenv "CC" #$(cc-for-target))
> +                              (setenv "LD" #$(ld-for-target))
> +                              (setenv "QBE" (string-append #$qbe
> "/bin/qbe"))
Should be (which "qbe"), or some elaborate search-input-file.  Also qbe
should be a native input.

I do wonder if some of those get embedded into the compiler or how
they're supposed to be used (outside of build time); if you find a
place where harec invokes qbe, you'd need to patch that in the source.
> +                              (apply invoke "./configure" configure-
> flags))))))
> +      (inputs (list qbe))
> +      (home-page "https://harelang.org")
> +      (synopsis "Hare bootstrap compiler in C")
> +      (description "This package provides @code{harec}, the Hare
> language's
> +bootstrap written in C.  Currently, the self-hosting @code{harec}
> rewrite is
> +incomplete, so this is used as the default compiler in the build
> driver.")
I don't see why it's necessary to state that harec can't self-host yet.
We would need to bootstrap it from C anyways, so having this
architecture in place actually makes things simpler.
> +      (license license:gpl3))))

Cheers




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  4:39     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
@ 2022-06-26  7:18       ` Liliana Marie Prikler
  2022-06-26 11:05         ` ( via Guix-patches via
  2022-06-26 14:00         ` Antero Mejr via Guix-patches via
  0 siblings, 2 replies; 38+ messages in thread
From: Liliana Marie Prikler @ 2022-06-26  7:18 UTC (permalink / raw)
  To: Antero Mejr, 55606; +Cc: (, Tobias Geerinckx-Rice, Maxime Devos

Hi,

Am Sonntag, dem 26.06.2022 um 00:39 -0400 schrieb Antero Mejr:
> * gnu/packages/hare.scm (hare): New variable.
> ---
>  gnu/packages/hare.scm | 73
> +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 73 insertions(+)
> 
> diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
> index a1149499d5..16c7d8e2dd 100644
> --- a/gnu/packages/hare.scm
> +++ b/gnu/packages/hare.scm
> @@ -64,3 +64,76 @@ (define-public harec
>  bootstrap written in C.  Currently, the self-hosting @code{harec}
> rewrite is
>  incomplete, so this is used as the default compiler in the build
> driver.")
>        (license license:gpl3))))
> +
> +(define-public hare
> +  (let ((commit "19e380ccb7dfe2bcab5f94e6bd03004e3e2c6005")
> (revision "0"))
As with harec.
> +    (package
> +      (name "hare")
> +      (version (git-version "0.0.0" revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://git.sr.ht/~sircmpwn/hare")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                 
> "04fk3akj3410f8fxw2ixp6l6f9x54pnnk00c0hx0297p7hdzzzq4"))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       (list #:make-flags
> +             #~(list (string-append "BINDIR=" #$output "/bin")
> +                     (string-append "MANDIR=" #$output "/share/man")
> +                     (string-append "SRCDIR=" #$output "/src")
> +                     (string-append "LOCALSRCDIR=" #$output
> "/src/hare")
> +                     (string-append "HAREC=" #$harec "/bin/harec")
Should have a (this-package-input) or (this-package-native-input) for
harec.  If it's the latter, (which "harec") might also be acceptable.
> +                     (string-append "PLATFORM=" "linux")
> +                     (string-append "HAREPATH="
> +                                    #$output "/src/hare/stdlib:"
> +                                    #$output "/src/hare/third-
> party")
> +                     (string-append "ARCH="
> +                                    #$(platform-linux-architecture
> +                                       (lookup-platform-by-target-
> or-system
> +                                        (or (%current-target-system)
> +                                            (%current-system)))))
> +                     (string-append "AR=" #$(ar-for-target))
> +                     (string-append "AS=" #$(as-for-target))
> +                     (string-append "LD=" #$(ld-for-target))
> +                     (string-append "QBE=" #$qbe "/bin/qbe")
As with harec.
> +                     (string-append "SCDOC=" #$scdoc "/bin/scdoc")
As with harec.
> +                     "HARECACHE=.cache"
> +                     "BINOUT=.bin")
I suppose neither of those ought to be installed?
> +             #:phases
> +             #~(modify-phases %standard-phases
> +                 (add-after 'unpack 'patch-failing-tests
> +                   (lambda _
> +                     ;; These tests fail due to a NaN-related bug in
> QBE when
> +                     ;; used on glibc.
> +                     (substitute* "math/complex/+test.ha"
> +                       (("@test (fn (cos|cosh|exp)\\(\\) void =)" _
> func)
> +                        func))))
> +                 (add-after 'unpack 'patch-makefile
> +                   (lambda _
> +                     (substitute* "Makefile"
> +                       (("include config.mk") ""))))
> +                 (delete 'configure))))
Why delete configure here, but not in harec?  I'm pretty sure we can
use the same hack for both packages.

> +      (native-inputs (list scdoc))
> +      (inputs (list tzdata))
> +      (propagated-inputs (list binutils harec qbe))
> +      (supported-systems (list "x86_64-linux" "aarch64-linux"
> "riscv64-linux"))
> +      (native-search-paths
> +       (list (search-path-specification
> +              (variable "HAREPATH")
> +              (files '("src/hare/stdlib" "src/hare/third-party")))))
Is there a need to split HAREPATH like that?  From a functionality
perspective, a singular "include/hare" or similar ought to be enough. 
I'd specifically avoid "src" since it exists "only for reference
purposes" in the FHS.  Other distros mandate that the linux kernel
source code be put there.
> +      (home-page "https://harelang.org")
> +      (synopsis "Systems programming language")
> +      (description "Hare is a systems programming language that aims
> to improve
> +on C while retaining its core philosophy. Its principles are:
> +@itemize
> +@item Trust the programmer.
> +@item Provide tools the programmer may use when they don't trust
> themselves.
> +@item Prefer explicit behavior over implicit behavior.
> +@item A good program must be both correct and simple.
> +@end itemize")
> +      (license (list license:gpl3 ;compiler and build driver
> +                     license:mpl2.0))))) ;standard library

Cheers





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  4:40         ` Antero Mejr via Guix-patches via
@ 2022-06-26  7:30           ` Maxime Devos
  2022-06-26  7:34           ` Maxime Devos
  2022-06-26 10:58           ` ( via Guix-patches via
  2 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-06-26  7:30 UTC (permalink / raw)
  To: Antero Mejr, (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice,
	Liliana Marie Prikler

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

Antero Mejr schreef op zo 26-06-2022 om 00:40 [-0400]:
> > + The Guix 'R Us version works with cross-compilation; I don't
> > think this
> >    one does?
> You mean cross-compilation of hare code? When I try to use hare build
> -t (the target flag) it gives me a not implemented error, so I don't
> think hare cross-compilation is possible right now.

IIRC, it was for cross-compiling the compiler itself, not using harec
as a cross-compiler.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  4:40         ` Antero Mejr via Guix-patches via
  2022-06-26  7:30           ` Maxime Devos
@ 2022-06-26  7:34           ` Maxime Devos
  2022-06-26 10:58           ` ( via Guix-patches via
  2 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-06-26  7:34 UTC (permalink / raw)
  To: Antero Mejr, (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice,
	Liliana Marie Prikler

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

Antero Mejr schreef op zo 26-06-2022 om 00:40 [-0400]:
> > + harec and qbe probably shouldn't be propagated; their paths
> > should be
> >    patched into the source code.
> > 
> >      -- (
> 
> I'm unsure about this one - maybe the user would want to use harec or
> qbe by themselves to debug a build step?

FWIW, they can use "guix install harec qbe" for that.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  4:40         ` Antero Mejr via Guix-patches via
  2022-06-26  7:30           ` Maxime Devos
  2022-06-26  7:34           ` Maxime Devos
@ 2022-06-26 10:58           ` ( via Guix-patches via
  2022-06-26 14:07             ` Antero Mejr via Guix-patches via
  2 siblings, 1 reply; 38+ messages in thread
From: ( via Guix-patches via @ 2022-06-26 10:58 UTC (permalink / raw)
  To: Antero Mejr
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos,
	Liliana Marie Prikler

On Sun Jun 26, 2022 at 5:40 AM BST, Antero Mejr wrote:
> As for cross-compilation of the guix hare build, I think the
> platform-linux-architecture bit should take care of it, right?

My mistake, I realized that it would work shortly after sending that.

> I'm unsure about this one - maybe the user would want to use harec or
> qbe by themselves to debug a build step?
> I wanted to give the user a full hare build environment when
> they run `guix install hare`, but I understand your logic for wanting to
> patch the paths in.

There are a few compilers where intermediate build programs aren't
included in propagated-inputs:

+ neither ldc nor zig include ld or as (nor the llvm equivalents)
+ neither nim nor ghc include gcc

I think it should be fine.

    -- (




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  7:18       ` Liliana Marie Prikler
@ 2022-06-26 11:05         ` ( via Guix-patches via
  2022-06-26 14:00         ` Antero Mejr via Guix-patches via
  1 sibling, 0 replies; 38+ messages in thread
From: ( via Guix-patches via @ 2022-06-26 11:05 UTC (permalink / raw)
  To: Liliana Marie Prikler, Antero Mejr, 55606
  Cc: Tobias Geerinckx-Rice, Maxime Devos

On Sun Jun 26, 2022 at 8:18 AM BST, Liliana Marie Prikler wrote:
> Is there a need to split HAREPATH like that?

Yes. The standard library modules and third-party modules are stored in
different directories. (Don't ask... :P)

> From a functionality
> perspective, a singular "include/hare" or similar ought to be enough. 
> I'd specifically avoid "src" since it exists "only for reference
> purposes" in the FHS.  Other distros mandate that the linux kernel
> source code be put there.

Well, it contains source code, and Hare makefiles install into /usr/src
by default, so using src makes sense.

    -- (




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

* [bug#55606] [PATCH 1/2] gnu: Add harec.
  2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
                     ` (6 preceding siblings ...)
  2022-06-26  4:39   ` [bug#55606] [PATCH 1/2] gnu: Add harec Antero Mejr via Guix-patches via
@ 2022-06-26 13:59   ` Antero Mejr via Guix-patches via
  2022-06-26 13:59     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  7 siblings, 1 reply; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 13:59 UTC (permalink / raw)
  To: 55606; +Cc: paren, me, maximedevos, liliana.prikler

Resolving the issues mentioned above.

* gnu/packages/hare.scm (harec): New variable.
---
 gnu/packages/hare.scm | 67 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 gnu/packages/hare.scm

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
new file mode 100644
index 0000000000..abded91007
--- /dev/null
+++ b/gnu/packages/hare.scm
@@ -0,0 +1,67 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
+;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages hare)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
+  #:use-module (gnu packages man)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (guix platform)
+  #:use-module (guix utils))
+
+(define-public harec
+  (let ((commit "bbabe09bddf74bd699f8ad2224fdd6e2eefbd35e")
+        (revision "0"))
+    (package
+      (name "harec")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/harec")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0sa8rjj5w01n55svql8drv761ks6i1bl9q4gj1yzr31dixaf6xvr"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:configure-flags #~(list (string-append "--prefix=" #$output))
+             #:phases #~(modify-phases %standard-phases
+                          (replace 'configure
+                            (lambda* (#:key outputs
+                                      (configure-flags '()) #:allow-other-keys)
+                              (setenv "AR" #$(ar-for-target))
+                              (setenv "AS" #$(as-for-target))
+                              (setenv "CC" #$(cc-for-target))
+                              (setenv "LD" #$(ld-for-target))
+                              (setenv "QBE" (which "qbe"))
+                              (apply invoke "./configure" configure-flags))))))
+      (native-inputs (list qbe))
+      (home-page "https://harelang.org")
+      (synopsis "Hare bootstrap compiler in C")
+      (description "This package provides @code{harec}, the Hare language's
+bootstrap written in C.  Currently, @code{harec} is used as the default
+compiler in the @code{hare} build driver.")
+      (license license:gpl3))))
-- 
2.36.1





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 13:59   ` Antero Mejr via Guix-patches via
@ 2022-06-26 13:59     ` Antero Mejr via Guix-patches via
  2022-06-26 14:20       ` Maxime Devos
  2022-06-26 14:22       ` Maxime Devos
  0 siblings, 2 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 13:59 UTC (permalink / raw)
  To: 55606; +Cc: paren, me, maximedevos, liliana.prikler

* gnu/packages/hare.scm (hare): New variable.
---
 gnu/packages/hare.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/gnu/packages/hare.scm b/gnu/packages/hare.scm
index abded91007..5e51ace67f 100644
--- a/gnu/packages/hare.scm
+++ b/gnu/packages/hare.scm
@@ -65,3 +65,77 @@ (define-public harec
 bootstrap written in C.  Currently, @code{harec} is used as the default
 compiler in the @code{hare} build driver.")
       (license license:gpl3))))
+
+(define-public hare
+  (let ((commit "19e380ccb7dfe2bcab5f94e6bd03004e3e2c6005")
+        (revision "0"))
+    (package
+      (name "hare")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://git.sr.ht/~sircmpwn/hare")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04fk3akj3410f8fxw2ixp6l6f9x54pnnk00c0hx0297p7hdzzzq4"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'patch-failing-tests
+                   (lambda _
+                     ;; These tests fail due to a NaN-related bug in QBE when
+                     ;; used on glibc.
+                     (substitute* "math/complex/+test.ha"
+                       (("@test (fn (cos|cosh|exp)\\(\\) void =)" _ func)
+                        func))))
+                 (add-after 'unpack 'patch-makefile
+                   (lambda _
+                     (substitute* "Makefile"
+                       (("include config.mk") ""))))
+                 (add-before 'build 'set-env
+                   (lambda _
+                     (setenv "BINDIR" (string-append #$output "/bin"))
+                     (setenv "MANDIR" (string-append #$output "/share/man"))
+                     (setenv "SRCDIR" (string-append #$output "/src"))
+                     (setenv "LOCALSRCDIR" (string-append #$output "/src/hare"))
+                     (setenv "HAREC" (which "harec"))
+                     (setenv "PLATFORM" "linux")
+                     (setenv "HAREPATH" (string-append
+                                         #$output "/src/hare/stdlib:"
+                                         #$output "/src/hare/third-party"))
+                     (setenv "ARCH"
+                             #$(platform-linux-architecture
+                                (lookup-platform-by-target-or-system
+                                 (or (%current-target-system)
+                                     (%current-system)))))
+                     (setenv "AR" #$(ar-for-target))
+                     (setenv "AS" #$(as-for-target))
+                     (setenv "LD" #$(ld-for-target))
+                     (setenv "QBE" (which "qbe"))
+                     (setenv "SCDOC" (which "scdoc"))
+                     (setenv "HARECACHE" ".cache")
+                     (setenv "BINOUT" ".bin")))
+                 (delete 'configure))))
+      (native-inputs (list harec qbe scdoc))
+      (inputs (list tzdata))
+      (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "HAREPATH")
+              (files '("src/hare/stdlib" "src/hare/third-party")))))
+      (home-page "https://harelang.org")
+      (synopsis "Systems programming language")
+      (description "Hare is a systems programming language that aims to improve
+on C while retaining its core philosophy. Its principles are:
+@itemize
+@item Trust the programmer.
+@item Provide tools the programmer may use when they don't trust themselves.
+@item Prefer explicit behavior over implicit behavior.
+@item A good program must be both correct and simple.
+@end itemize")
+      (license (list license:gpl3 ;compiler and build driver
+                     license:mpl2.0))))) ;standard library
-- 
2.36.1





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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26  7:18       ` Liliana Marie Prikler
  2022-06-26 11:05         ` ( via Guix-patches via
@ 2022-06-26 14:00         ` Antero Mejr via Guix-patches via
  1 sibling, 0 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 14:00 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 55606, Tobias Geerinckx-Rice, Maxime Devos, (


Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

>> +                     (string-append "HAREC=" #$harec "/bin/harec")
> Should have a (this-package-input) or (this-package-native-input) for
> harec.  If it's the latter, (which "harec") might also be acceptable.

Done.

>> +                     (string-append "QBE=" #$qbe "/bin/qbe")
> As with harec.

Done.

>> +                     (string-append "SCDOC=" #$scdoc "/bin/scdoc")
> As with harec.

Done.

>> +                     "HARECACHE=.cache"
>> +                     "BINOUT=.bin")
> I suppose neither of those ought to be installed?

Right, they're temp dirs. I checked the build output and made sure they
are not included.

>> +                 (delete 'configure))))
> Why delete configure here, but not in harec?  I'm pretty sure we can
> use the same hack for both packages.

hare doesn't have a configure, so we have to set the flags for the
build manually. harec does have a configure that correctly sets many
of the build flags, so I used it.

Thanks,
Antero

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 10:58           ` ( via Guix-patches via
@ 2022-06-26 14:07             ` Antero Mejr via Guix-patches via
  2022-06-26 14:27               ` Maxime Devos
  2022-07-24 16:10               ` ( via Guix-patches via
  0 siblings, 2 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 14:07 UTC (permalink / raw)
  To: (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos,
	Liliana Marie Prikler


"(" <paren@disroot.org> writes:

> There are a few compilers where intermediate build programs aren't
> included in propagated-inputs:
>
> + neither ldc nor zig include ld or as (nor the llvm equivalents)
> + neither nim nor ghc include gcc
>
> I think it should be fine.

If harec/qbe are not installed, hare raises an error saying that it
cannot find the program, so users will know to install it. So yes it
should be fine, I moved those programs into native-inputs.

If we moved qbe/harec to inputs, we could patch os::tryenv in
schedule.ha to resolve to the guix path. That way the user gets a
working toolchain by default, but they could still swap in different
versions of qbe/harec using the QBE/HAREC environment variables.
Let me know if that would be preferred over leaving qbe/harec in
native-inputs.

Thanks,
Antero




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 13:59     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
@ 2022-06-26 14:20       ` Maxime Devos
  2022-06-26 14:30         ` Antero Mejr via Guix-patches via
  2022-06-26 14:22       ` Maxime Devos
  1 sibling, 1 reply; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:20 UTC (permalink / raw)
  To: Antero Mejr, 55606; +Cc: paren, me, liliana.prikler

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

Antero Mejr schreef op zo 26-06-2022 om 09:59 [-0400]:
> +      (inputs (list tzdata))

What's this input for?  Packages shouldn't have tzdata in their inputs,
because it's a bunch of facts about the external world.  When doing
this, running hare's equivalent of `date` from an old profile would
give a bogus result because of out-of-date time zone info.

Also, the rebuilding problem, from (gnu packages base):

;;; A "fixed" version of tzdata, which is used in the test suites of glib and R
;;; and a few other places. We can update this whenever we are able to rebuild
;;; thousands of packages (for example, in a core-updates rebuild). This package
;;; will typically be obsolete and should never be referred to by a built
;;; package.
;;;
;;; Please make this a hidden-package if it is different from the primary tzdata
;;; package.
(define-public tzdata-for-tests tzdata)

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 13:59     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
  2022-06-26 14:20       ` Maxime Devos
@ 2022-06-26 14:22       ` Maxime Devos
  2022-06-26 14:33         ` Antero Mejr via Guix-patches via
  1 sibling, 1 reply; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:22 UTC (permalink / raw)
  To: Antero Mejr, 55606; +Cc: paren, me, liliana.prikler

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

Antero Mejr schreef op zo 26-06-2022 om 09:59 [-0400]:
> +      (synopsis "Systems programming language")

You can't package the language itself.  DYM: ‘The Hare compiler’, or
maybe: ‘The Hare standard library’, or both?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:07             ` Antero Mejr via Guix-patches via
@ 2022-06-26 14:27               ` Maxime Devos
  2022-06-26 14:39                 ` Antero Mejr via Guix-patches via
  2022-07-24 16:10               ` ( via Guix-patches via
  1 sibling, 1 reply; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:27 UTC (permalink / raw)
  To: Antero Mejr, (
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice,
	Liliana Marie Prikler

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

Antero Mejr schreef op zo 26-06-2022 om 10:07 [-0400]:
> If harec/qbe are not installed, hare raises an error saying that it
> cannot find the program, so users will know to install it. So yes it
> should be fine,
> 

TBC: what is this package packaging?

  * the compiler
  * some wrapper around the compiler
  * the standard library and the compiler
  * both

If it packages the compiler, this is not fine.  Guix is a package
manager and distribution, the point of which is to automatically sort
out dependencies.  Leaving it up to the user to sort out the
dependencies then partially defeats the point.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:20       ` Maxime Devos
@ 2022-06-26 14:30         ` Antero Mejr via Guix-patches via
  2022-06-26 14:39           ` Maxime Devos
  0 siblings, 1 reply; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 14:30 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 55606, me, liliana.prikler, paren


Maxime Devos <maximedevos@telenet.be> writes:

>> +      (inputs (list tzdata))
>
> What's this input for?  Packages shouldn't have tzdata in their inputs,
> because it's a bunch of facts about the external world.  When doing
> this, running hare's equivalent of `date` from an old profile would
> give a bogus result because of out-of-date time zone info.

I forgot to patch the path in leapsec.ha to use for Guix's leapseconds
file. Should I do that, or leave out tzdata?

From the hare mailing list:

"Notably, Hare requires the installation of the leap-seconds.list file in
the tzdata package in order to handle leap seconds properly.

Hare will work in the absence of this file, or of tzdata as a whole, but
users will encounter bugs in timekeeping logic."

https://lists.sr.ht/~sircmpwn/hare-distributions/%3CCKB9HRGYXORK.A6V2HBE01VD5%40taiga%3E




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:22       ` Maxime Devos
@ 2022-06-26 14:33         ` Antero Mejr via Guix-patches via
  2022-06-26 14:44           ` Maxime Devos
  0 siblings, 1 reply; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 14:33 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 55606, me, liliana.prikler, paren


Maxime Devos <maximedevos@telenet.be> writes:

>> +      (synopsis "Systems programming language")
>
> You can't package the language itself.  DYM: ‘The Hare compiler’, or
> maybe: ‘The Hare standard library’, or both?

I was going to use
"Hare programming language build driver and standard library"
in the next patch.




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:30         ` Antero Mejr via Guix-patches via
@ 2022-06-26 14:39           ` Maxime Devos
  0 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:39 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 55606, me, liliana.prikler, paren

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

Antero Mejr schreef op zo 26-06-2022 om 10:30 [-0400]:
> I forgot to patch the path in leapsec.ha to use for Guix's leapseconds
> file. Should I do that, or leave out tzdata?

Looking at <https://harelang.org/distributions/>, harec expects it to
be located in /usr/share/zoneinfo/leap-seconds.list by default (not
/gnu/store/.../share/tzdata), so adding tzdata as input doesn't
accomplish anything here.

So to have time zone things working on Guix System, it seems like hare
needs to be patched to support the $TZDIR environment variable (if it
doesn't support that already).

Also, I think there was some mail or message on #guix some time ago
about Guix not installing that particular file yet in the tzdata
package?  That would need to be fixed as well ...

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:27               ` Maxime Devos
@ 2022-06-26 14:39                 ` Antero Mejr via Guix-patches via
  0 siblings, 0 replies; 38+ messages in thread
From: Antero Mejr via Guix-patches via @ 2022-06-26 14:39 UTC (permalink / raw)
  To: Maxime Devos
  Cc: (, Tobias Geerinckx-Rice, Liliana Marie Prikler,
	55606@debbugs.gnu.org


Maxime Devos <maximedevos@telenet.be> writes:

> TBC: what is this package packaging?
>
>   * the compiler
>   * some wrapper around the compiler
>   * the standard library and the compiler
>   * both
>
> If it packages the compiler, this is not fine.  Guix is a package
> manager and distribution, the point of which is to automatically sort
> out dependencies.  Leaving it up to the user to sort out the
> dependencies then partially defeats the point.

My current understanding is:
The "hare" package is the standard library and a "build driver", which
orchestrates the program "harec" to compile hare programs into QBE IR,
and then hare calls qbe and binutils to compile the program to a
binary.

I think they refer to a "build driver" as "a program that calls other
programs to do a build". Kind of like Rust's cargo build system,
but without full package management.

However, in the future the plan is for hare to be a self-hosted
compiler and build system, dropping the harec dependency (will still
need it, but just for bootstrapping). Not sure if they will replace qbe
as well.

Our options are:
1. Provide the build driver "hare" standalone, then a "hare-toolchain"
package that propagates hare, harec, qbe, and binutils. This is how it
was done by ) on Guix'R'Us.
2. Add qbe and harec to propagated-inputs of hare. This is what the
earlier patch did.
3. Add qbe and harec to inputs, and patch the source code to direct
the build driver to the Guix paths.




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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:33         ` Antero Mejr via Guix-patches via
@ 2022-06-26 14:44           ` Maxime Devos
  2022-06-26 14:53             ` Maxime Devos
  0 siblings, 1 reply; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:44 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 55606, me, liliana.prikler, paren

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

Antero Mejr schreef op zo 26-06-2022 om 10:33 [-0400]:
> I was going to use
> "Hare programming language build driver and standard library"
> in the next patch.

I don't have a clue what a ‘build driver’ is (a kernel-style driver +
something about building -> a compiler inside the (Linux) kernel? 
Doesn't seem to apply here).  I'd use ‘compiler’ instead, which I
believe to be more widely understood (e.g., it has an entry on
Wikipedia).

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:44           ` Maxime Devos
@ 2022-06-26 14:53             ` Maxime Devos
  0 siblings, 0 replies; 38+ messages in thread
From: Maxime Devos @ 2022-06-26 14:53 UTC (permalink / raw)
  To: Antero Mejr; +Cc: 55606, me, liliana.prikler, paren

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

Maxime Devos schreef op zo 26-06-2022 om 16:44 [+0200]:
> Antero Mejr schreef op zo 26-06-2022 om 10:33 [-0400]:
> > I was going to use
> > "Hare programming language build driver and standard library"
> > in the next patch.
> 
> I don't have a clue what a ‘build driver’ is (a kernel-style driver +
> something about building -> a compiler inside the (Linux) kernel? 
> Doesn't seem to apply here).  I'd use ‘compiler’ instead, which I
> believe to be more widely understood (e.g., it has an entry on
> Wikipedia).
> 

Maybe nevermind.  From #guix:

14:47 < nckx> 'The build driver is responsible for collecting input files, 
              resolving their dependencies, and producing a plan for 
              compiling your program.' — 
              https://harelang.org/blog/2021-03-26-high-level-data-structures/
14:48 < nckx> Seemingly not synonymous.

although:

14:51 < maximed> (OTOH, technically 'gcc' isn't the compiler but 'cc1' is ...)

and yet we call 'gcc' a compiler and seems a bit of an implementation detail
to me, so I dunno.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#55606] [PATCH 2/2] gnu: Add hare.
  2022-06-26 14:07             ` Antero Mejr via Guix-patches via
  2022-06-26 14:27               ` Maxime Devos
@ 2022-07-24 16:10               ` ( via Guix-patches via
  1 sibling, 0 replies; 38+ messages in thread
From: ( via Guix-patches via @ 2022-07-24 16:10 UTC (permalink / raw)
  To: Antero Mejr
  Cc: 55606@debbugs.gnu.org, Tobias Geerinckx-Rice, Maxime Devos,
	Liliana Marie Prikler

On Sun Jun 26, 2022 at 3:07 PM BST, Antero Mejr wrote:
> If we moved qbe/harec to inputs, we could patch os::tryenv in
> schedule.ha to resolve to the guix path. That way the user gets a
> working toolchain by default, but they could still swap in different
> versions of qbe/harec using the QBE/HAREC environment variables.
Yes, that's what I meant. (Sorry for the late reply :))

    -- (




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

end of thread, other threads:[~2022-07-24 16:11 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24  1:21 [bug#55605] [PATCH 1/2] gnu: Add qbe Antero Mejr via Guix-patches via
2022-05-24  1:21 ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
2022-05-24 17:01   ` Maxime Devos
2022-05-24 17:07   ` Maxime Devos
2022-05-24 17:09   ` Maxime Devos
2022-05-24 17:10   ` Tobias Geerinckx-Rice via Guix-patches via
2022-05-29  0:54   ` [bug#55606] [PATCH] " Antero Mejr via Guix-patches via
2022-06-03 17:54   ` [bug#55606] Antero Mejr via Guix-patches via
2022-06-25 16:54     ` [bug#55606] [PATCH 2/2] gnu: Add hare Liliana Marie Prikler
2022-06-25 17:53       ` ( via Guix-patches via
2022-06-26  4:56         ` Antero Mejr via Guix-patches via
2022-06-25 17:59       ` ( via Guix-patches via
2022-06-26  4:40         ` Antero Mejr via Guix-patches via
2022-06-26  7:30           ` Maxime Devos
2022-06-26  7:34           ` Maxime Devos
2022-06-26 10:58           ` ( via Guix-patches via
2022-06-26 14:07             ` Antero Mejr via Guix-patches via
2022-06-26 14:27               ` Maxime Devos
2022-06-26 14:39                 ` Antero Mejr via Guix-patches via
2022-07-24 16:10               ` ( via Guix-patches via
2022-06-25 21:32       ` Antero Mejr via Guix-patches via
2022-06-26  4:39   ` [bug#55606] [PATCH 1/2] gnu: Add harec Antero Mejr via Guix-patches via
2022-06-26  4:39     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
2022-06-26  7:18       ` Liliana Marie Prikler
2022-06-26 11:05         ` ( via Guix-patches via
2022-06-26 14:00         ` Antero Mejr via Guix-patches via
2022-06-26  6:50     ` [bug#55606] [PATCH 1/2] gnu: Add harec Liliana Marie Prikler
2022-06-26 13:59   ` Antero Mejr via Guix-patches via
2022-06-26 13:59     ` [bug#55606] [PATCH 2/2] gnu: Add hare Antero Mejr via Guix-patches via
2022-06-26 14:20       ` Maxime Devos
2022-06-26 14:30         ` Antero Mejr via Guix-patches via
2022-06-26 14:39           ` Maxime Devos
2022-06-26 14:22       ` Maxime Devos
2022-06-26 14:33         ` Antero Mejr via Guix-patches via
2022-06-26 14:44           ` Maxime Devos
2022-06-26 14:53             ` Maxime Devos
2022-05-24 16:56 ` [bug#55605] [PATCH 1/2] gnu: Add qbe Maxime Devos
2022-05-24 21:06 ` Maxime Devos

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).