[bug#55606,2/2] gnu: Add hare.
Commit Message
* gnu/packages/hare.scm (hare): New variable.
---
gnu/packages/hare.scm | 74 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
Comments
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.
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.
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
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.
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.
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.
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.
@@ -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