Subject: [bug#44926] [PATCH v2 04/15] gnu: Add dart-2.0.0-dev.20.0.

From: nixo <[email-masked]>
Date: Sun, 29 Nov 2020 18:34:03 +0100

* gnu/packages/dart.scm (dart-2.0.0-dev.20.0): New variable.
---
 gnu/packages/dart.scm | 61 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/gnu/packages/dart.scm b/gnu/packages/dart.scm
index 07e3dcee21..c2463a676c 100644
--- a/gnu/packages/dart.scm
+++ b/gnu/packages/dart.scm
@@ -426,3 +426,64 @@
 @item Supported both on desktop and on mobile
 @end")
     (license license:bsd-3)))
+
+(define-public dart-2.0.0-dev.20.0
+  (package
+    (inherit dart-2.0.0-dev.8.0)
+    (name "dart")
+    (version "2.0.0-dev.20.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/dart-lang/sdk")
+             (commit version)))
+       (file-name (string-append name "-" version))
+       (sha256
+        (base32
+         "1k2zc27r3b7ha5bvlhaqr75xiyf6rg7nwk3r0qrjl7dk9k50iyix"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments dart-2.0.0-dev.8.0)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-before 'configure 'set-dart-path
+             (lambda* (#:key inputs propagated-inputs #:allow-other-keys)
+               (substitute* "runtime/observatory/BUILD.gn"
+                 (("\"--sdk=True\" \\]")
+                  (string-append
+                   "\"--sdk=True\", "
+                   "\"--dart-executable\","
+                   "\"" (assoc-ref inputs "dart") "/bin/dart\","
+                   "\"--pub-executable\","
+                   "\"" (assoc-ref inputs "dart") "/bin/pub\" ]")))
+               (substitute* "tools/utils.py"
+                 (("os.path.join\\(CheckedInSdkPath\\(\\), 'bin', name)")
+                  (string-append "os.path.join(\""
+                                 (assoc-ref %build-inputs "dart")
+                                 "/bin/\", name)")))
+               (substitute* "build/prebuilt_dart_sdk.gni"
+                 (("\\$_dart_root/tools/sdks/\\$host_os/dart-sdk/bin/")
+                  (string-append (assoc-ref %build-inputs "dart") "/bin/")))))
+           (add-before 'configure 'disable-Werror
+             (lambda _
+               (substitute* "runtime/BUILD.gn"
+                 (("\"-Werror\"") "# -Werror")
+                 (("\"-Wall\"") "# -Wall")
+                 (("\"-Wextra\"") "# -Wextra"))
+               (substitute* "build/config/compiler/BUILD.gn"
+                 (("\"-Wl,--icf=all\"") "")
+                 (("\"-Wall") "# \"-Wall")
+                 (("\"-Wextra") "# \"-Wextra")
+                 (("\"-Werror") "# \"-Werror"))))
+           (add-before 'configure 'fix-get-timestamp
+             (lambda _
+               (substitute* "tools/make_version.py"
+                 (("utils.GetGitTimestamp") "\"0\" # "))))
+           (add-before 'configure 'fix-zlib-build
+             (lambda _
+               (substitute* "third_party/zlib/BUILD.gn"
+                 (("direct_dependent_configs") "# direct_dependent_configs")
+                 (("\"//base\",") ""))))))))
+    (native-inputs
+     (cons `("dart" ,dart-2.0.0-dev.8.0)
+           (package-native-inputs dart-2.0.0-dev.8.0)))))
-- 
2.29.2