;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Nicolò Balzarotti ;;; ;;; 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 . (define-module (gnu packages dart) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages build-tools) #:use-module (gnu packages gcc) #:use-module (gnu packages golang) #:use-module (gnu packages libunwind) #:use-module (gnu packages ninja) #:use-module (gnu packages nss) #:use-module (gnu packages perl) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz)) (define* (dart-pkg name tag hash #:optional (url (string-append "https://github.com/dart-lang/" (string-replace-substring name "-" "_")))) (origin (method git-fetch) (uri (git-reference (url url) (commit tag))) (file-name (git-file-name name (if (> (string-length tag) 9) (string-take tag 9) tag))) (sha256 (base32 hash)))) (define-public dart-2.0.0-dev.8.0 (package (name "dart") (version "2.0.0-dev.8.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 "17870yvi4flcraw3ihs694g4r0fmmmj2qmz9n4r311pizxzagjkk")) (modules '((guix build utils))) ;; Delete a folder containing a pre-build windows .dll (snippet '(delete-file-recursively "build/win")) (patches (search-patches "dart-2.0.0-dev.8-disable-analytics.patch")))) (arguments `(#:configure-flags ;; FIXME: Do not hardcode the target? Don't know if when fixed this ;; package will work on other targets (list "host_cpu=\"x64\"" "target_cpu=\"x64\"" "dart_target_arch=\"x64\"" "target_os=\"linux\"" "dart_runtime_mode=\"develop\"" "dart_debug=false" "is_debug=false" "is_release=true" "is_product=false" "is_clang=false" "use_goma=false" "goma_dir=\"None\"" "dart_use_tcmalloc=true" "dart_use_fallback_root_certificates=true" "dart_zlib_path = \"//runtime/bin/zlib\"" "dart_platform_sdk=false" "is_asan=false" "is_msan=false" "is_tsan=false" "dart_snapshot_kind=\"app-jit\"") #:phases (modify-phases %standard-phases ;; no check target. Tests are available, but I should check how to ;; run them (delete 'check) (add-before 'configure 'add-git-revision (lambda _ (with-output-to-file "tools/GIT_REVISION" (lambda () (display "0"))))) (add-before 'configure 'add-third-party-src ;; Copy some deps to third_party, as required by the build system ;; TODO: LINK THEM INSTEAD OF COPYING (lambda* (#:key inputs #:allow-other-keys) (use-modules (ice-9 regex) (ice-9 match)) ;; place pkg inputs in the right third_party folder ;; (either pkg or pkgtested) based on their input name (define (dart-copy-deps-to-third-party-dir pkgdep) (copy-recursively (assoc-ref inputs pkgdep) (let* ((out "third_party/") (text (if (string-match "pkgtested" pkgdep) (string-append out "pkg_tested/" (regexp-substitute #f (string-match "dart-pkgtested-" pkgdep) 'post)) (string-append out "pkg/" (regexp-substitute #f (string-match "dart-pkg-" pkgdep) 'post))))) (if (string-match "-" text) (regexp-substitute/global #f "-" text 'pre "_" 'post) text)))) (map (lambda (input) (let ((pkg (car input))) ;; Copy only dependencies starting with "dart-" (when (string-match "dart-" pkg) (dart-copy-deps-to-third-party-dir pkg)))) inputs) ;; Do the same for other required packages (copy-recursively (assoc-ref inputs "boringssl") "third_party/boringssl/src") (copy-recursively (assoc-ref inputs "gperftools") "third_party/tcmalloc/gperftools") (copy-recursively (assoc-ref inputs "root-certificates") "third_party/root_certificates") (copy-recursively (assoc-ref inputs "zlib") "third_party/zlib") (copy-recursively (assoc-ref inputs "observatory-pub-packages") "third_party/observatory_pub_packages"))) (add-after 'add-third-party-src 'generate-third-party-build-files (lambda* (#:key inputs #:allow-other-keys) (with-directory-excursion "third_party/boringssl" ;; go requires home to be set (setenv "HOME" "/tmp/") (invoke (string-append (assoc-ref inputs "python") "/bin/python2") "src/util/generate_build_files.py" "gn") (map (lambda (file) (copy-file (string-append (assoc-ref inputs "boringssl-gen") "/" file) file)) '("BUILD.gn" "BUILD.generated.gni"))))) (add-before 'configure 'enable-dtags ;; adds the RUNPATH (lambda* (#:key inputs propagated-inputs #:allow-other-keys) (substitute* "build/config/gcc/BUILD.gn" (("disable-new-dtags") "enable-new-dtags")))) (replace 'configure (lambda* (#:key configure-flags #:allow-other-keys) (let ((args (string-join configure-flags " "))) (mkdir "out") ;; Generate ninja build files. (invoke "gn" "gen" "out/Release" (string-append "--args=" args)) ;; Print the full list of supported arguments as well as ;; their current status for convenience. (format #t "Dumping configure flags...\n") (invoke "gn" "args" "out/Release" "--list")))) (replace 'build (lambda* (#:key configure-flags #:allow-other-keys) (invoke "ninja" "all" "-C" "out/Release"))) ;; no install phase (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) ;; This should depend on the architecture as before (copy-recursively "out/Release/dart-sdk/" out))))))) (inputs `(("zlib" ,(dart-pkg "zlib" "c3d0a6190f2f8c924a05ab6cc97b8f975bddd33f" "0fr3h9krramy0jclbacjnwbn0lzvjm6b809llhaz56mbd90i4yl4" "https://chromium.googlesource.com/chromium/src/third_party/zlib")) ("libunwind" ,libunwind) ("nspr" ,nspr) ("nss" ,nss) ("boringssl" ,(dart-pkg "boringssl" "d519bf6be0b447fb80fbc539d4bff4479b5482a2" "137q647ha8x770wv3jj2kgjv3lj9qjcv191m51vkp3a7zqhhaknv" "https://boringssl.googlesource.com/boringssl")) ("boringssl-gen" ,(dart-pkg "boringssl-gen" "d2b56d1b7657e52eb5a1f075968c773aa3e53614" "1pn2hn0i9fwd27i695q4av3bymm11pmydlbv4hcafslhggq0md19")) ("gperftools" ,(dart-pkg "gperftools" "02eeed29df112728564a5dde6417fa4622b57a06" "1j5yx7v1g8ljzv5hs2452q736gdf1xm5x9w5d1csm5bjlryxaykm" "https://github.com/gperftools/gperftools")) ("root-certificates" ,(dart-pkg "root-certificates" "16ef64be64c7dfdff2b9f4b910726e635ccc519e" "1kxadamhz03dlvm3j5xxqjgn0jasgskyjx11ysm3a431ma5j9182")) ("observatory-pub-packages" ,(dart-pkg "observatory-pub-packages" "4c282bb240b68f407c8c7779a65c68eeb0139dc6" "0p09r24q37i4hyz3n2j75lx9a252zr81jcynap61nfh415xlcv3z")) ("dart-pkg-args" ,(dart-pkg "args" "0.13.7" "0y3f1kaplxmanw5gqm84l9wqx2nl1vrk11m8kdqqwc7n73fc4kdl")) ("dart-pkg-async" ,(dart-pkg "async" "2.0.0" "1r0fqdh633426p2h9ynb126s58l30jj3mj0bzvjigbklam7vfjgc")) ("dart-pkg-barback" ,(dart-pkg "barback" "0.15.2+13" "0n532b2as62nkzq7w9jaxk6gkl78il1kq3q0s1xgcdazmbzx5fb1")) ("dart-pkg-bazel-worker" ,(dart-pkg "bazel-worker" "v0.1.4" "1cc4jvx9qba76ws2l7ijr8kvl8yydfak965gwrgb88f2r1qp2q46")) ("dart-pkg-charcode" ,(dart-pkg "charcode" "v1.1.1" "0907828insqsr0ffyz4n2xns4qc77brnm7zv0a6965b53b84pk8b")) ("dart-pkg-cli-util" ,(dart-pkg "cli-util" "0.1.2+1" "09nqdkyipnb0734ci554gxrl9cic528mlhfad9wibcg6kx7y6gra")) ("dart-pkg-collection" ,(dart-pkg "collection" "1.14.3" "1rdgvrj67vj27k2052h5k31xc6rays4p4j27a122c1ikxnb4i3bh")) ("dart-pkg-convert" ,(dart-pkg "convert" "2.0.1" "1v0b6vgzp6i37jja2d2aim6dmig8xfjhi8b553a1909n5pzqxp2g")) ("dart-pkg-crypto" ,(dart-pkg "crypto" "2.0.2+1" "12v5rw189vrk2n2ryxkf8qcbdx8hf3bf33i552439lzhz0czkvcq")) ("dart-pkg-csslib" ,(dart-pkg "csslib" "0.14.1" "0zlmbg6vwwc4cha8l2xv73klwzdqg6b43qmhlca0f62lr7k6014w")) ("dart-pkg-dart2js-info" ,(dart-pkg "dart2js_info" "0.5.5+1" "05rdp96n9rxkjyw7lmn3a9hlbsaxpdn8wp8qnsfjmqv3i8vcypvj")) ("dart-pkg-dartdoc" ,(dart-pkg "dartdoc" "v0.13.0+3" "1v85510bvjhllr00hgabvn737bh791x1m14qsv7zbxhqnsy2jafj")) ("dart-pkg-fixnum" ,(dart-pkg "fixnum" "0.10.5" "01j7sj4mnkaxam1bpmhvlxl817dcck92xzpk66m7qbccm58c0giw")) ("dart-pkg-func" ,(dart-pkg "func" "25eec48146a58967d75330075ab376b3838b18a8" "0xcfnca5sa5hc62g14xx11qqv9xjamsaqqn1cmldb917qnxb7lkk")) ("dart-pkg-glob" ,(dart-pkg "glob" "1.1.5" "1lbd7lkxvw0q5zvz2hxvc035mxakmzcq08lwwr25v56s9ybavh93")) ("dart-pkg-html" ,(dart-pkg "html" "0.13.2" "0w0gn8camhqhclmlf5g1mp03nssl2gyghqkmcz0zrvkicc1d5r1s")) ("dart-pkg-http" ,(dart-pkg "http" "0.11.3+14" "1a1k8m2gp8a02q9bw40bqj7ad9yx44ap0w4xr7s26lridi7isylc")) ("dart-pkg-http-multi-server" ,(dart-pkg "http_multi_server" "2.0.4" "09x4alr181p6s3zxqflgmhglglxr4aaaz6ys7pp0r715dq50qz4n")) ("dart-pkg-http-parser" ,(dart-pkg "http-parser" "3.1.1" "18p8cqanxbxsxk3wwvisgb1bxdy83vkh3l11h0cys7gxrz6z2g12")) ("dart-pkg-http-throttle" ,(dart-pkg "http-throttle" "1.0.1" "1q0pv1px5rd7zjd799pnq5zcr825ya1yqnxyvdr91rlga621hdbj")) ("dart-pkg-intl" ,(dart-pkg "intl" "0.15.2" "0vd0a3pqmfs03kf12mmg0rrpian0f35ja0x332mr7cx8h9d7pmqx")) ("dart-pkg-isolate" ,(dart-pkg "isolate" "1.1.0" "12m97zhm8qwpraf6nyvj1nawssygrwz0zka7843ayj3vxx6j34xr")) ("dart-pkg-json-rpc-2" ,(dart-pkg "json_rpc_2" "2.0.4" "1q2x6gy7l7agr930k4r6vncfzjcnp43chq9fwxfa0p0nyccnixz3")) ("dart-pkg-linter" ,(dart-pkg "linter" "0.1.39" "0wfd6bzfny5bis3r2ygj89kyd2gl618x7hk06qp4h9nvbpsvvz0n")) ("dart-pkg-logging" ,(dart-pkg "logging" "0.11.3+1" "180w376jz2wmfijcfg07ygfpc6i68i4zibw2421xvwcjhi0q07kv")) ("dart-pkg-markdown" ,(dart-pkg "markdown" "0.11.4" "009qw47k3lrl2fkdn378l41dga493alspywrk3z93yy1pqaf1j5n")) ("dart-pkg-matcher" ,(dart-pkg "matcher" "0.12.1+4" "1q0hbcc5ys5zpml7blsyj0d1f42w67vr6x19vxg34sra3bv0h2xx")) ("dart-pkg-mime" ,(dart-pkg "mime" "0.9.4" "1bh4xla0qlaz9cm1qgxqq57l76b2zh5qqk9pax7sc57s79zi1nmz")) ("dart-pkg-mockito" ,(dart-pkg "mockito" "2.0.2" "1q1zlv3fwfjbmwm141wj19vglx15s8xkqzdsqz9hhv6gg7h45gsl")) ("dart-pkg-mustache4dart" ,(dart-pkg "mustache4dart" "v2.1.0" "0wsmg2xvpp2h9rqcg65icymh2s9hifq6v700mni65ky33dah9ji1" "https://github.com/valotas/mustache4dart")) ("dart-pkg-oauth2" ,(dart-pkg "oauth2" "1.1.0" "1519799j61sdka6p1n6ba768v5a8q4q9w6y957dzqigwaf19p9v5")) ("dart-pkg-path" ,(dart-pkg "path" "1.4.2" "0ld39rpzla8wd4c2kx1kycdk66cwypklxki58nb18959j2749fbi")) ("dart-pkg-plugin" ,(dart-pkg "plugin" "0.2.0" "10sgglzpwr9hkdhr6r4d1kvazv49zdhc9cr2asxdk5531347kk9m")) ("dart-pkg-pool" ,(dart-pkg "pool" "1.3.3" "1cljnzsrbjgkif8rj1vxrzp5rz2xak265pasachdcg4yh2hl0y7d")) ("dart-pkg-protobuf" ,(dart-pkg "protobuf" "0.5.4" "1wjb8da0da0gda0f83dl2dvl5w4a6gvq5xcg1yrgg3xjs7gzy8dd")) ("dart-pkg-pub" ,(dart-pkg "pub" "cde958f157d3662bf968bcbed05580d5c0355e89" "1g1cw4c0811l3pvc80fvb7s04shzxvxrcb25195s7kjjfiivgqi4")) ("dart-pkg-pub-semver" ,(dart-pkg "pub-semver" "1.3.2" "15s6zn2qyyfc5lf8ip5h8j3sq5miz4vrzxbgbwi5vv91d53miia8")) ("dart-pkg-quiver" ,(dart-pkg "quiver" "0.25.0" "02wqrk266s0ias9lfy7l5dh9ni2r697n3z42h4sgzxy7qg4rip24" "https://github.com/google/quiver-dart")) ("dart-pkg-resource" ,(dart-pkg "resource" "af5a5bf65511943398146cf146e466e5f0b95cb9" "1jq4bmg65jrpyqxcvbp87d5qqpgmv5ylfz3w1djzimq5jhr9k4vn")) ("dart-pkg-scheduled-test" ,(dart-pkg "scheduled-test" "0.12.11+1" "1xk66f68m443yig5672p0dpack2c0kpkyk2d7f8iaq22q5zq7h1w")) ("dart-pkg-shelf" ,(dart-pkg "shelf" "0.6.8" "0vl4m47yhjvc1nynyzc42bks4mzv877vsy7fbcv9w2fjh05sxhb9")) ("dart-pkg-shelf-packages-handler" ,(dart-pkg "shelf-packages-handler" "1.0.3" "0iccfa713jyg7bb7fx144i5rl0afyfxvb3pi56igw2gdwklq4yck")) ("dart-pkg-shelf-static" ,(dart-pkg "shelf-static" "0.2.4" "1gfyjqvv13d3zpnaahv5fi601ag7mr8crm94xawlvgvpqgpl0hsh")) ("dart-pkg-shelf-web-socket" ,(dart-pkg "shelf-web-socket" "0.2.1" "18krh9bnbshwjjl47k15x9g3r7s5k0yichvn3gdsddjqjgp6vfp8")) ("dart-pkg-source-map-stack-trace" ,(dart-pkg "source-map-stack-trace" "1.1.4" "1cpyq1vdfc623k8cdx673v2kkv112hzsrsyaxd8dd82v23caglva")) ("dart-pkg-source-maps" ,(dart-pkg "source-maps" "0.10.4" "11dmncxgv8q40am73dxlxgzkfaanvgc9p3lds77m96mb1k27zbkf")) ("dart-pkg-source-span" ,(dart-pkg "source-span" "1.4.0" "0gpa15p5rcilgl0paqa7f9fkiks7kyalzl2r0sd37m4cry9cf0vz")) ("dart-pkg-stack-trace" ,(dart-pkg "stack-trace" "1.8.2" "0n21n2dv371bfcw6q83xwb8x26d1rd49cvx5qzm8mi0006h9frzs")) ("dart-pkg-stream-channel" ,(dart-pkg "stream-channel" "1.6.2" "02ixi6vsja2cc22jcflp89v5wsbj45fl23p0sgaayqaj6l1jcxm1")) ("dart-pkg-string-scanner" ,(dart-pkg "string-scanner" "1.0.2" "13hfnc704c9qipcvjinbv1hbq57hs5l2f68kyw282dlrcbbwwksy")) ("dart-pkg-term-glyph" ,(dart-pkg "term-glyph" "1.0.0" "1nxqg345k2zh0yn498mxxdi7v1q3651z5invv0llfvs17ly2h2pz")) ("dart-pkg-test" ,(dart-pkg "test" "0.12.24+6" "1xkmvwx30zm5ci1gn53hf6zrxymlq9cn9waa00k3ihxbd64mxg1k")) ("dart-pkg-test-reflective-loader" ,(dart-pkg "test-reflective-loader" "0.1.0" "1qmbayg6js96lcy9s6grly1y6rh9x5mbyqygnr58zsdypzvhr4hr")) ("dart-pkg-tuple" ,(dart-pkg "tuple" "v1.0.1" "0khkwq1blc90lgdcy4i8ng4nzppmhg31nziw4sc36axwbwdnpc86")) ("dart-pkg-typed-data" ,(dart-pkg "typed-data" "1.1.3" "1zr9la34lib0rdfdf0539hdai2j71kf3s4ynsal7hw4pqvkdwi72")) ("dart-pkg-unittest" ,(dart-pkg "test" "0.11.7" "1xbx2i2glmqlc3cz8x91anhf8d4hsr3bq9j53qliawz8j6q9anf8")) ("dart-pkg-usage" ,(dart-pkg "usage" "3.3.0" "0r8d0q4ij42c7axclwns61cyrxpmk1qpggqfiqfm5vbmh8gpfm3b")) ("dart-pkg-utf" ,(dart-pkg "utf" "0.9.0+3" "07jppjvg8bc8plzq910b8ld32l6x35i8qwy0mdqimydjjaslj78f")) ("dart-pkg-watcher" ,(dart-pkg "watcher" "0.9.7+4" "09jpk98qb5j5250sr9r9ic17gj741yjy1p2j50zzl47a9wydfjly")) ("dart-pkg-web-socket-channel" ,(dart-pkg "web-socket-channel" "1.0.6" "1phb2n3n6npzwl08nnp1aggcjmvwx516b816q4hsx8w190yr4f86")) ("dart-pkg-yaml" ,(dart-pkg "yaml" "2.1.12" "0m2xr36vd2v3yirv1jb5v3dncsczn8n34s9fmqcm2ld979b4vanm")) ("dart-pkgtested-dart-style" ,(dart-pkg "dart-style" "1.0.7" "0qym7z5n4w4jy75fnvcyza3hw0nrm8kli5mv65drr16f8pkr0lcg")) ("dart-pkgtested-package-config" ,(dart-pkg "package-config" "1.0.3" "03w67nb1dhi2yqb63z1301p88hjws1d8azmw8m5ap4zapqdbhzgn")) ("dart-pkgtested-package-resolver" ,(dart-pkg "package-resolver" "1.0.2+1" "0qs7zmxjwqqjkq6mqnz8b3rj142hyz1x0v1innh8n3bwmljgp3w9")))) (native-inputs `(("python" ,python-2) ("python2-gyp" ,python2-gyp) ("perl" ,perl) ("go" ,go) ("gn" ,gn-for-dart-bootstrap) ("ninja" ,ninja) ("gcc" ,gcc-6))) (build-system gnu-build-system) (home-page "https://dart.dev") (synopsis "The Dart SDK, including the VM, dart2js and core libraries") (description "Dart is a programming language which is: @enumerate @item Optimized for UI @item Supports hot reload @item Supported both on desktop and on mobile @end") (license license:bsd-3)))