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
| | ;;; GNU Guix --- Functional package management for GNU
;;; 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 dart)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix download)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (guix config)
#:use-module (guix build-system copy)
#:use-module ((gnu packages bootstrap) #:select (glibc-dynamic-linker))
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (gnu packages elf)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
(define-public dart-3.5
(package
(name "dart")
(version "3.5.4")
(source (origin
(method url-fetch)
(uri (string-append
"https://storage.googleapis.com/dart-archive/channels/stable/release/"
version "/sdk/dartsdk-"
(match (%current-system)
("x86_64-linux" "linux-x64")
("i686-linux" "linux-ia32")
("aarch64-linux" "linux-arm64")
(_ "unsupported"))
"-release.zip"))
(sha256
(base32 (match (%current-system)
("x86_64-linux" "0rv9rp8g5blhncqwciymhxh3z2832yp54lphxgsvkmm9y8s5w34d")
("i686-linux" "02kv119swcp7y4n3yb2i5a4dagjpf0zq3b3an1apahj5zn6ak41g")
("aarch64-linux" "1v437zpksk0jhib6vhpcbvv715mv32zmwby8b3p9qd3k67fn87d9")
(_ "0000000000000000000000000000000000000000000000000000"))))))
(build-system copy-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(patchelf (string-append (assoc-ref inputs "patchelf")
"/bin/patchelf"))
(ld-so (string-append (assoc-ref inputs "libc")
#$(glibc-dynamic-linker))))
(mkdir-p out)
(copy-recursively "." out)
(for-each
(lambda (file) (invoke patchelf "--set-interpreter" ld-so file))
(find-files bin (lambda (file stat) (and (executable-file? file)
(elf-file? file))))))))
(add-after 'install 'check
(lambda* (#:key tests? inputs outputs #:allow-other-keys)
(when tests?
(let* ((out (assoc-ref outputs "out"))
(coreutils (assoc-ref inputs "coreutils"))
(PATH (string-join
(list
(string-append out "/bin")
(string-append coreutils "/bin"))
":"))
(hello #$(plain-file
"hello.dart"
"void main() => print('hello, world!');")))
(setenv "PATH" PATH)
(invoke "dart" "create" "--no-pub" "dart_test_project")
(unless (directory-exists? "dart_test_project")
(error "'dart create' did not create expected directory"))
(unless (file-exists? "dart_test_project/bin/dart_test_project.dart")
(error "'dart create' did not create expected .dart file"))
(invoke "dart" "compile" "exe" hello "-o" "hello.exe")
(invoke "./hello.exe")))))
(delete 'strip))))
(inputs (list coreutils))
(native-inputs (list unzip coreutils patchelf))
(home-page "https://dart.dev/")
(synopsis "Approachable, portable, and productive language")
(description "Dart is a class-based, single inheritance, object-oriented
language with C-style syntax. It offers compilation to JavaScript, interfaces,
mixins, abstract classes, reified generics, and optional typing.")
(supported-systems '("x86_64-linux" "i686-linux" "aarch64-linux"))
(license license:bsd-3)))
|