summaryrefslogtreecommitdiff
path: root/hare.scm
diff options
context:
space:
mode:
Diffstat (limited to 'hare.scm')
-rw-r--r--hare.scm59
1 files changed, 37 insertions, 22 deletions
diff --git a/hare.scm b/hare.scm
index a51da1a..4616b26 100644
--- a/hare.scm
+++ b/hare.scm
@@ -6,12 +6,17 @@
#:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages c)
#:use-module (gnu packages man)
#:use-module (ice-9 match))
+
+;; Partially obtained from:
+;; https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/hare.scm
+
(define tzdata-list
(package
(inherit tzdata)
@@ -107,6 +112,9 @@
(modify-phases %standard-phases
(add-before 'configure 'setenv
(lambda _
+ (setenv "AR" ,(ar-for-target))
+ (setenv "AS" ,(as-for-target))
+ (setenv "LD" ,(ld-for-target))
(setenv "CC" ,(cc-for-target))))
(add-after 'configure 'configure-better
(lambda* (#:key outputs #:allow-other-keys)
@@ -115,12 +123,9 @@
(delete 'configure))))
(inputs (list qbe-master scdoc))
(synopsis "Bootstrapping compiler for Hare")
- (description "Hare is a systems programming language designed to be
-simple, stable, and robust. Hare uses a static type system, manual memory
-management, and a minimal runtime. It is well-suited to writing operating
-systems, system tools, compilers, networking software, and other low-level,
-high performance tasks. If you want to code in Hare, you probably prefer to
-install @code{hare}")
+ (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."
(home-page "https://git.sr.ht/~sircmpwn/harec")
(license license:gpl3))))
@@ -147,6 +152,7 @@ install @code{hare}")
#:make-flags #~(list "HARECACHE=./cache" (string-append "PREFIX=" #$output))
#:phases
#~(modify-phases %standard-phases
+ (delete 'configure)
(add-before 'configure 'configure-make
(lambda _
(substitute*
@@ -156,33 +162,26 @@ install @code{hare}")
(("/usr/share/zoneinfo/")
(string-append #$tzdata-list "/share/zoneinfo/")))
(copy-file "config.example.mk" "config.mk")
- (substitute*
+ ;; We don't need to do this if we are using the toolchain
+ ;; below...
+ #;(substitute*
"config.mk"
(("AS = as")
- (string-append "AS = "
- #$binutils "/bin/" #$(as-for-target)))
+ (string-append "AS = "#$(as-for-target)))
(("LD = ld")
- (string-append "LD = "
- #$binutils "/bin/" #$(ld-for-target)))
+ (string-append "LD = "#$(ld-for-target)))
(("QBE = qbe")
- (string-append "QBE = "
- #$qbe-master "/bin/qbe"))
+ (string-append "QBE = " #$qbe-master "/bin/qbe"))
(("SCDOC = scdoc")
- (string-append "SD ="
- #$scdoc "/bin/scdoc"))
+ (string-append "SD =" #$scdoc "/bin/scdoc"))
(("HAREC = harec")
(string-append "HAREC =" #$harec "/bin/harec")))
- (substitute*
+ #;(substitute*
"cmd/hare/build.ha"
(("\"qbe\"")
(string-append "\"" #$qbe-master "/bin/qbe" "\""))
(("\"harec\"")
- (string-append "\"" #$harec "/bin/harec" "\""))
- (("arch.as_cmd")
- (string-append "\"" #$binutils "/bin/" #$(as-for-target) "\""))
- (("arch.ld_cmd")
- (string-append "\"" #$binutils "/bin/" #$(ld-for-target) "\"")))))
- (delete 'configure))))
+ (string-append "\"" #$harec "/bin/harec" "\""))))))))
(synopsis "Hare build driver")
(description "Hare is a systems programming language designed to be
simple, stable, and robust. Hare uses a static type system, manual memory
@@ -191,3 +190,19 @@ systems, system tools, compilers, networking software, and other low-level,
high performance tasks.")
(home-page "https://git.sr.ht/~sircmpwn/hare")
(license license:gpl3))))
+
+(define-public hare-toolchain
+ (package
+ (name "hare-toolchain")
+ (version (package-version hare))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments `(#:builder (begin (mkdir %output))))
+ (propagated-inputs (list binutils hare harec qbe-master))
+ (native-search-paths (package-native-search-paths hare))
+ (home-page (package-home-page hare))
+ (synopsis "Complete @code{hare} toolchain for Hare development")
+ (description "This package provides a toolchain for the Hare language. It
+allows you to conveniently install all the required packages (such as
+@code{binutils} and @code{qbe}) into your profile.")
+ (license (package-license hare))))