~whereiseveryone/guixrus

guixrus/guixrus/packages/hare.scm -rw-r--r-- 5.2 KiB
beb74e80(unmatched-parenthesis [urgent fix] turns out patch location doesn't work out of the box in non-`guix` channels... 8 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
;;;
;;; This file is not 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 (guixrus packages hare)
  #:use-module (gnu packages base)
  #:use-module (gnu packages man)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system trivial)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (guixrus packages qbe))

(define-public harec
  (let ((commit "e5fb5176ba629e98ace5fcb3aa427b2c25d8fdf0")
        (revision "1"))
    (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)))
       (sha256
        (base32 "0pvv60047adfca00k52zkans8fsr6n1l3xczr3lkmbqsmfmpgaxj"))))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags ,#~(list (string-append "PREFIX=" #$output))
        #:phases
        ,#~(modify-phases %standard-phases
             (add-after 'unpack 'set-cc
               (lambda _
                 (setenv "AR" #$(ar-for-target))
                 (setenv "CC" #$(cc-for-target))
                 (setenv "LD" #$(ld-for-target)))))))
     (inputs (list qbe))
     (supported-systems (list "x86_64-linux" "aarch64-linux" "riscv64-linux"))
     (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))))

(define-public hare
  (let ((commit "9c7dd2e0f89bc31a1dd028b566dee3c231f4a992")
        (revision "1"))
     (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)))
        (sha256
         (base32 "0zjhfrnflvy21r879hjn7l94ws4yc17p5c6r6cngc2z4vbhryhin"))))
      (build-system gnu-build-system)
      (arguments
       `(#:phases
         (modify-phases %standard-phases
           (add-before 'configure 'set-cache
             (lambda _
               (setenv "HARECACHE" ".cache")))
           (replace 'configure
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (rename-file "config.example.mk" "config.mk")
                 (substitute* "config.mk"
                   (("PREFIX = /usr") (string-append "PREFIX=" out))
                   (("LOCALSRCDIR = /usr/local/src/hare")
                    (string-append "LOCALSRCDIR=" out "/src/hare")))))))))
      (inputs (list harec qbe))
      (native-inputs (list scdoc))
      (native-search-paths
       (list (search-path-specification
              (variable "HAREPATH")
              (files '("src/hare/stdlib" "src/hare/third-party")))))
      (home-page "https://harelang.org")
      (synopsis "Simple, powerful systems programming language")
      (description "Hare is a work-in-progress 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
Users should prefer @code{hare-toolchain} over this package to allow it to work out of the box.")
      (license (list license:gpl3 ;; compiler and build driver
                     license:mpl2.0 ;; standard library
                     )))))

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