~jojo/Carth

ref: 8a0330bd1609859d4b03dd14eeb937150e06a8c7 Carth/guix.scm -rw-r--r-- 5.1 KiB
8a0330bdJoJo lower: Tail call opt for voidcalls. Also starting over a little 2 months 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
130
131
132
;; -*- eval: (guix-devel-mode) -*-

(use-modules (gnu)
             (guix packages)
             (guix build-system haskell)
             (guix build-system cargo)
             (guix download)
             ((guix licenses)
              #:prefix license:))

(use-package-modules haskell haskell-xyz haskell-check
                     llvm
                     crates-io
                     libsigsegv
                     tls
                     bdw-gc)

(define ghc-llvm-hs-pretty
  (package
    (name "ghc-llvm-hs-pretty")
    (version "0.9.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (hackage-uri "llvm-hs-pretty" version))
       (sha256
        (base32 "17kj713j38lg6743dwv1gd0wcls888zazzhlw3xvxzw2n8bjahyj"))))
    (build-system haskell-build-system)
    (inputs (list ghc-llvm-hs-pure ghc-prettyprinter))
    (native-inputs
     (list ghc-tasty
           ghc-tasty-hspec
           ghc-tasty-hunit
           ghc-tasty-golden
           ghc-llvm-hs))
    (home-page "https://github.com/llvm-hs/llvm-hs-pretty")
    (synopsis "A pretty printer for LLVM IR.")
    (description
     "This package provides a pretty printer for the LLVM AST types provided by
llvm-hs.")
    (license license:expat)))

(define carth-std-rs
  (package
    (name "carth-std-rs")
    (version "0.4.0")
    (source
     (file-union name
                 `(("Cargo.toml" ,(local-file "std-rs/Cargo.toml"))
                   ("src" ,(local-file "std-rs/src" #:recursive? #t)))))
    (build-system cargo-build-system)
    (inputs `(("libsigsegv" ,libsigsegv)
              ("openssl" ,openssl)
              ("libgc" ,libgc)))
    (arguments
     `(#:cargo-inputs
       (("rust-libc" ,rust-libc-0.2)
        ("rust-native-tls" ,rust-native-tls-0.2))
       #:phases
       (modify-phases %standard-phases
         (replace 'install
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (lib (string-append out "/lib")))
               (mkdir-p lib)
               ;; Both static and shared libraries are produced, and needed. The
               ;; shared is used in the JIT when doing `cart run`, and the static
               ;; is used when compiling with `carth compile`.
               (copy-file "target/release/libcarth_std_rs.a"
                          (string-append lib "/libcarth_std_rs.a"))
               (copy-file "target/release/libcarth_std_rs.so"
                          (string-append lib "/libcarth_std_rs.so"))))))))
    (home-page "https://github.com/bryal/carth")
    (synopsis "The Carth foreign core library")
    (description "The core and runtime library for Carth -- a purely functional
programming language with Scheme-like syntax. Work in progress.")
    (license license:agpl3+)))

(package
  (name "carth")
  (version "0.4.0")
  (source
   (file-union name
               `(("carth.cabal" ,(local-file "carth.cabal"))
                 ("README.md" ,(local-file "README.md"))
                 ("CHANGELOG.org" ,(local-file "CHANGELOG.org"))
                 ("LICENSE-AGPLv3" ,(local-file "LICENSE-AGPLv3"))
                 ("LICENSE-ACSL" ,(local-file "LICENSE-ACSL"))
                 ("Setup.hs" ,(local-file "Setup.hs"))
                 ("src" ,(local-file "src" #:recursive? #t))
                 ("app" ,(local-file "app" #:recursive? #t))
                 ("test" ,(local-file "test" #:recursive? #t)))))
  (build-system haskell-build-system)
  (arguments
   `(#:haddock?
     #f
     #:tests?
     #f
     ;; #:phases
     ;; (modify-phases %standard-phases
     ;;   (add-before 'configure 'patch-runtime-lib-paths
     ;;     (lambda* (#:key inputs outputs #:allow-other-keys)
     ;;       (let* ((sigsegv (assoc-ref inputs "libsigsegv"))
     ;;              (std-rs (assoc-ref inputs "carth-std-rs"))
     ;;              (sigsegv-a (string-append sigsegv "/lib/libsigsegv.a"))
     ;;              (sigsegv-so (string-append sigsegv "/lib/libsigsegv.so"))
     ;;              (foreign-a (string-append std-rs "/lib/libcarth_std_rs.a"))
     ;;              (foreign-so (string-append std-rs "/lib/libcarth_std_rs.so")))
     ;;         (invoke "ls" "-la" "src/Compile.hs")
     ;;         (invoke "cat" "/etc/passwd")
     ;;         (chmod "src/Compile.hs" #o755)
     ;;         (substitute* "src/Compile.hs"
     ;;           (("-l:libcarth_std_rs.a") (string-append "-l:" foreign-a))
     ;;           (("-lsigsegv") (string-append "-l:" sigsegv-a))
     ;;           (("libsigsegv.so") sigsegv-so)
     ;;           (("libcarth_std_rs.so") foreign-so))))))
     ))
  (inputs
   `(("ghc-megaparsec" ,ghc-megaparsec)
     ("ghc-microlens-platform" ,ghc-microlens-platform)
     ("ghc-llvm-hs-pretty" ,ghc-llvm-hs-pretty)
     ("ghc-llvm-hs-pure" ,ghc-llvm-hs-pure)
     ("ghc-llvm-hs" ,ghc-llvm-hs)
     ("ghc-utf8-string" ,ghc-utf8-string)))
  (propagated-inputs
   `(("carth-std-rs" ,carth-std-rs)
     ("libsigsegv" ,libsigsegv)))
  (home-page "https://github.com/bryal/carth")
  (synopsis "The Carth compiler")
  (description "The compiler for Carth -- a purely functional
programming language with Scheme-like syntax. Work in progress.")
  (license license:agpl3+))