| 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 | (define-module (gnu packages javascript)
|
| 29 | #:use-module ((guix licenses) #:prefix license:)
|
| 30 | #:use-module (gnu packages)
|
| 31 | #:use-module (gnu packages base)
|
| 32 | #:use-module (gnu packages bash)
|
| 33 | #:use-module (gnu packages c)
|
| 34 | #:use-module (gnu packages compression)
|
| 35 | #:use-module (gnu packages java)
|
| 36 | #:use-module (gnu packages node)
|
| 37 | #:use-module (gnu packages readline)
|
| 38 | #:use-module (gnu packages uglifyjs)
|
| 39 | #:use-module (gnu packages web)
|
| 40 | #:use-module (guix gexp)
|
| 41 | #:use-module (guix packages)
|
| 42 | #:use-module (guix download)
|
| 43 | #:use-module (guix git-download)
|
| 44 | #:use-module (guix build-system ant)
|
| 45 | #:use-module (guix build-system cmake)
|
| 46 | #:use-module (guix build-system gnu)
|
| 47 | #:use-module (guix build-system minify)
|
| 48 | #:use-module (guix build-system trivial)
|
| 49 | #:use-module (guix utils))
|
| 50 |
|
| 51 | (define-public cjson
|
| 52 | (package
|
| 53 | (name "cjson")
|
| 54 | (version "1.7.18")
|
| 55 | (source (origin
|
| 56 | (method git-fetch)
|
| 57 | (uri (git-reference
|
| 58 | (url "https://github.com/DaveGamble/cJSON")
|
| 59 | (commit (string-append "v" version))))
|
| 60 | (file-name (git-file-name name version))
|
| 61 | (sha256
|
| 62 | (base32 "08p37q4i3za3dgz7wynma1fh8y4rq7pyzyjzcda710nxrmsm1pyv"))))
|
| 63 | (build-system cmake-build-system)
|
| 64 | (arguments
|
| 65 | `(#:configure-flags '("-DENABLE_CJSON_UTILS=On")))
|
| 66 | (home-page "https://github.com/DaveGamble/cJSON")
|
| 67 | (synopsis "JSON parser written in ANSI C")
|
| 68 | (description "This library provides a portable embeddable JSON parser.")
|
| 69 | (license license:expat)))
|
| 70 |
|
| 71 | (define-public js-context-menu
|
| 72 | (package
|
| 73 | (name "js-context-menu")
|
| 74 | (version "0.6.1")
|
| 75 | (source
|
| 76 | (origin
|
| 77 | (method git-fetch)
|
| 78 | (uri (git-reference
|
| 79 | (url "https://github.com/zorkow/context-menu")
|
| 80 | (commit (string-append "v" version))))
|
| 81 | (file-name (git-file-name name version))
|
| 82 | (sha256
|
| 83 | (base32
|
| 84 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))
|
| 85 | (build-system trivial-build-system)
|
| 86 | (arguments
|
| 87 | `(#:modules ((guix build utils))
|
| 88 | #:builder
|
| 89 | (begin
|
| 90 | (use-modules (guix build utils))
|
| 91 | (chdir (assoc-ref %build-inputs "source"))
|
| 92 | (let ((target (string-append %output "/share/javascript/context-menu")))
|
| 93 | (apply invoke (search-input-file %build-inputs "/bin/esbuild")
|
| 94 | "--bundle"
|
| 95 | "--tsconfig=tsconfig.json"
|
| 96 | (string-append "--outdir=" target)
|
| 97 | (find-files "ts" "\\.ts$"))))))
|
| 98 | (native-inputs
|
| 99 | (list esbuild))
|
| 100 | (home-page "https://github.com/zorkow/context-menu")
|
| 101 | (synopsis "Generic context menu")
|
| 102 | (description "This package provides a reimplementation of the MathJax
|
| 103 | context menu in TypeScript.")
|
| 104 | (license license:asl2.0)))
|
| 105 |
|
| 106 | (define-public font-mathjax
|
| 107 | (package
|
| 108 | (name "font-mathjax")
|
| 109 | (version "2.7.2")
|
| 110 | (source
|
| 111 | (origin
|
| 112 | (method git-fetch)
|
| 113 | (uri (git-reference
|
| 114 | (url "https://github.com/mathjax/MathJax")
|
| 115 | (commit version)))
|
| 116 | (file-name (git-file-name name version))
|
| 117 | (sha256
|
| 118 | (base32
|
| 119 | "127j12g7v2hx6k7r00b8cp49s7nkrwhxy6l8p03pw34xpxbgbimm"))))
|
| 120 | (build-system trivial-build-system)
|
| 121 | (arguments
|
| 122 | `(#:modules ((guix build utils))
|
| 123 | #:builder
|
| 124 | (begin
|
| 125 | (use-modules (guix build utils)
|
| 126 | (ice-9 match))
|
| 127 | (let ((install-directory (string-append %output "/share/fonts/mathjax")))
|
| 128 | (mkdir-p install-directory)
|
| 129 | (copy-recursively (string-append (assoc-ref %build-inputs "source")
|
| 130 | "/fonts")
|
| 131 | install-directory)))))
|
| 132 | (home-page "https://www.mathjax.org/")
|
| 133 | (synopsis "Fonts for MathJax")
|
| 134 | (description "This package contains the fonts required for MathJax.")
|
| 135 | (license license:asl2.0)))
|
| 136 |
|
| 137 | (define-public js-mathjax
|
| 138 | (package
|
| 139 | (inherit font-mathjax)
|
| 140 | (name "js-mathjax")
|
| 141 | (arguments
|
| 142 | `(#:modules ((guix build utils))
|
| 143 | #:builder
|
| 144 | (begin
|
| 145 | (use-modules (guix build utils)
|
| 146 | (ice-9 match)
|
| 147 | (ice-9 popen)
|
| 148 | (ice-9 regex))
|
| 149 | (set-path-environment-variable
|
| 150 | "PATH" '("bin") (map (match-lambda
|
| 151 | ((_ . input)
|
| 152 | input))
|
| 153 | %build-inputs))
|
| 154 | (set-path-environment-variable
|
| 155 | "GUIX_LOCPATH" '("lib/locale")
|
| 156 | (list (assoc-ref %build-inputs "glibc-utf8-locales")))
|
| 157 | (setenv "LANG" "en_US.UTF-8")
|
| 158 | (let ((install-directory (string-append %output "/share/javascript/mathjax")))
|
| 159 | (copy-recursively (string-append (assoc-ref %build-inputs "source") "/unpacked")
|
| 160 | "MathJax-unpacked")
|
| 161 | (mkdir-p install-directory)
|
| 162 | (symlink (string-append (assoc-ref %build-inputs "font-mathjax")
|
| 163 | "/share/fonts/mathjax")
|
| 164 | (string-append install-directory "/fonts"))
|
| 165 |
|
| 166 | (for-each
|
| 167 | (lambda (file)
|
| 168 | (let ((installed (string-append install-directory
|
| 169 | |
| 170 | (string-drop file 18))))
|
| 171 | (format #t "~a -> ~a~%" file installed)
|
| 172 | (cond
|
| 173 | ((string-match "\\.js$" file)
|
| 174 | (mkdir-p (dirname installed))
|
| 175 | (let ((minified (open-pipe* OPEN_READ "uglifyjs" file)))
|
| 176 | (call-with-output-file installed
|
| 177 | (lambda (port)
|
| 178 | (dump-port minified port)))
|
| 179 |
|
| 180 | (let ((exit (close-pipe minified)))
|
| 181 | (unless (zero? exit)
|
| 182 | (error "dear, uglifyjs failed" exit)))))
|
| 183 | (else
|
| 184 | (install-file file (dirname installed))))))
|
| 185 | (find-files "."))
|
| 186 |
|
| 187 | #t))))
|
| 188 | (native-inputs
|
| 189 | `(("font-mathjax" ,font-mathjax)
|
| 190 | ("glibc-utf8-locales" ,(libc-utf8-locales-for-target))
|
| 191 | ("uglifyjs" ,node-uglify-js)
|
| 192 | ,@(package-native-inputs font-mathjax)))
|
| 193 | (synopsis "JavaScript display engine for LaTeX, MathML, and AsciiMath")
|
| 194 | (description "MathJax is a JavaScript display engine for LaTeX, MathML,
|
| 195 | and AsciiMath notation that works in all modern browsers. It requires no
|
| 196 | plugins or software to be installed on the browser. So the page author can
|
| 197 | write web documents that include mathematics and be confident that readers will
|
| 198 | be able to view it naturally and easily.")))
|
| 199 |
|
| 200 | (define-public js-mathjax-3
|
| 201 | (package
|
| 202 | (name "js-mathjax")
|
| 203 | (version "3.2.0")
|
| 204 | (source
|
| 205 | (origin
|
| 206 | (method git-fetch)
|
| 207 | (uri (git-reference
|
| 208 | (url "https://github.com/mathjax/MathJax-src")
|
| 209 | (commit version)))
|
| 210 | (file-name (git-file-name name version))
|
| 211 | (sha256
|
| 212 | (base32
|
| 213 | "05lm6nw7rzpcc5yz7xsjxi4id9369vvnrksx82nglxrqrpws97wx"))
|
| 214 | (patches (search-patches "mathjax-disable-webpack.patch"
|
| 215 | "mathjax-no-a11y.patch"))))
|
| 216 | (build-system gnu-build-system)
|
| 217 | (arguments
|
| 218 | `(#:phases
|
| 219 | (modify-phases %standard-phases
|
| 220 | (add-after 'unpack 'prepare-sources
|
| 221 | (lambda* (#:key inputs #:allow-other-keys)
|
| 222 | |
| 223 | |
| 224 | (delete-file-recursively "ts/a11y")
|
| 225 | (delete-file-recursively "components/src/a11y")
|
| 226 | (delete-file-recursively "components/src/sre")
|
| 227 | (delete-file-recursively "components/src/node-main")
|
| 228 |
|
| 229 | |
| 230 | (mkdir-p "node_modules")
|
| 231 | (with-directory-excursion "node_modules"
|
| 232 | (for-each
|
| 233 | (lambda (p)
|
| 234 | (copy-recursively (assoc-ref inputs (string-append "node-" p)) p))
|
| 235 | '("mj-context-menu" "mhchemparser")))
|
| 236 |
|
| 237 | |
| 238 | (symlink "ts" "js")
|
| 239 | (symlink "ts" "node_modules/mj-context-menu/js")))
|
| 240 | (delete 'configure)
|
| 241 | (replace 'build
|
| 242 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 243 | (let ((esbuild (string-append (assoc-ref inputs "esbuild")
|
| 244 | "/bin/esbuild"))
|
| 245 | (node (string-append (assoc-ref inputs "node")
|
| 246 | "/bin/node"))
|
| 247 | (target (string-append (assoc-ref outputs "out")
|
| 248 | "/share/javascript/mathjax/es5")))
|
| 249 | |
| 250 | (invoke node "components/bin/makeAll")
|
| 251 | |
| 252 | (apply
|
| 253 | invoke
|
| 254 | esbuild
|
| 255 | "--bundle"
|
| 256 | "--minify"
|
| 257 | |
| 258 | "--target=es6"
|
| 259 | (string-append "--outdir=" target)
|
| 260 | "--sourcemap"
|
| 261 | "--outbase=components/src"
|
| 262 | "--define:__dirname=\"/\""
|
| 263 | |
| 264 | |
| 265 | "--define:global=window"
|
| 266 | |
| 267 | |
| 268 | (filter
|
| 269 | (lambda (f)
|
| 270 | (string=?
|
| 271 | (basename (dirname f))
|
| 272 | (string-drop-right (basename f) 3)))
|
| 273 | (find-files "components/src" "\\.js$")))
|
| 274 | |
| 275 | |
| 276 | (for-each
|
| 277 | (lambda (f)
|
| 278 | (rename-file f (string-append (dirname (dirname f)) "/" (basename f))))
|
| 279 | (find-files target "\\.js(\\.map)?$"))
|
| 280 | |
| 281 | (copy-recursively
|
| 282 | "ts/output/chtml/fonts/tex-woff-v2"
|
| 283 | (string-append target "/output/chtml/fonts/woff-v2")))))
|
| 284 | (delete 'check)
|
| 285 | (delete 'install))))
|
| 286 | (native-inputs
|
| 287 | `(("esbuild" ,esbuild)
|
| 288 | ("node" ,node-lts)
|
| 289 | ("node-mj-context-menu"
|
| 290 | ,(let ((name "context-menu")
|
| 291 | (version "0.6.1"))
|
| 292 | (origin
|
| 293 | (method git-fetch)
|
| 294 | (uri (git-reference
|
| 295 | (url "https://github.com/zorkow/context-menu.git")
|
| 296 | (commit (string-append "v" version))))
|
| 297 | (file-name (git-file-name name version))
|
| 298 | (sha256
|
| 299 | (base32
|
| 300 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh")))))
|
| 301 | ("node-mhchemparser"
|
| 302 | ,(let ((name "mhchemparser")
|
| 303 | |
| 304 | (version "b1bd0670df7e9bbd5a724ac642aa2664d6e500b3"))
|
| 305 | (origin
|
| 306 | (method git-fetch)
|
| 307 | (uri (git-reference
|
| 308 | (url "https://github.com/mhchem/mhchemParser.git")
|
| 309 | (commit version)))
|
| 310 | (file-name (git-file-name name version))
|
| 311 | (sha256
|
| 312 | (base32
|
| 313 | "1g72kbxzf9f2igidpma3jwk28ln4bp3qhwspmhnm79baf3701dgv")))))))
|
| 314 | (home-page "https://www.mathjax.org/")
|
| 315 | (synopsis (package-synopsis js-mathjax))
|
| 316 | (description (package-description js-mathjax))
|
| 317 | (license license:asl2.0)))
|
| 318 |
|
| 319 | (define-public js-mathjax-for-r-mathjaxr
|
| 320 | (package
|
| 321 | (inherit js-mathjax-3)
|
| 322 | (name "js-mathjax")
|
| 323 | (version "3.1.2")
|
| 324 | (source
|
| 325 | (origin
|
| 326 | (method git-fetch)
|
| 327 | (uri (git-reference
|
| 328 | (url "https://github.com/mathjax/MathJax-src")
|
| 329 | (commit version)))
|
| 330 | (file-name (git-file-name name version))
|
| 331 | (sha256
|
| 332 | (base32
|
| 333 | "0kqcb6pl0zfs4hf8zqb4l50kkfq7isv35vpy05m0lg0yr9w0w4ai"))
|
| 334 | (patches (search-patches "mathjax-disable-webpack.patch"
|
| 335 | "mathjax-3.1.2-no-a11y.patch"))))
|
| 336 | (arguments
|
| 337 | (substitute-keyword-arguments (package-arguments js-mathjax-3)
|
| 338 | ((#:phases phases '%standard-phases)
|
| 339 | `(modify-phases ,phases
|
| 340 | (replace 'prepare-sources
|
| 341 | (lambda* (#:key inputs #:allow-other-keys)
|
| 342 | |
| 343 | |
| 344 | (delete-file-recursively "ts/a11y")
|
| 345 | (delete-file-recursively "components/src/a11y")
|
| 346 | (delete-file-recursively "components/src/sre")
|
| 347 | (delete-file-recursively "components/src/node-main")
|
| 348 |
|
| 349 | |
| 350 | (mkdir-p "node_modules")
|
| 351 | (with-directory-excursion "node_modules"
|
| 352 | (for-each
|
| 353 | (lambda (p)
|
| 354 | (copy-recursively (assoc-ref inputs (string-append "node-" p)) p))
|
| 355 | '("mj-context-menu")))
|
| 356 |
|
| 357 | |
| 358 | (symlink "ts" "js")
|
| 359 | (symlink "ts" "node_modules/mj-context-menu/js")))))))
|
| 360 | (native-inputs
|
| 361 | `(("esbuild" ,esbuild)
|
| 362 | ("node" ,node-lts)
|
| 363 | ("node-mj-context-menu"
|
| 364 | ,(let ((name "context-menu")
|
| 365 | (version "0.6.1"))
|
| 366 | (origin
|
| 367 | (method git-fetch)
|
| 368 | (uri (git-reference
|
| 369 | (url "https://github.com/zorkow/context-menu.git")
|
| 370 | (commit (string-append "v" version))))
|
| 371 | (file-name (git-file-name name version))
|
| 372 | (sha256
|
| 373 | (base32
|
| 374 | "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh")))))))))
|
| 375 |
|
| 376 | (define-public js-commander
|
| 377 | (package
|
| 378 | (name "js-commander")
|
| 379 | (version "6.2.1")
|
| 380 | (source
|
| 381 | (origin
|
| 382 | (method git-fetch)
|
| 383 | (uri (git-reference
|
| 384 | (url "https://github.com/tj/commander.js")
|
| 385 | (commit (string-append "v" version))))
|
| 386 | (file-name (git-file-name name version))
|
| 387 | (sha256
|
| 388 | (base32
|
| 389 | "126m25s6mxpxmdj4aw5awz06b47r8r798lcf1c5bnmmh39cik5i1"))))
|
| 390 | (build-system trivial-build-system)
|
| 391 | (arguments
|
| 392 | `(#:modules ((guix build utils))
|
| 393 | #:builder
|
| 394 | (begin
|
| 395 | (use-modules (guix build utils))
|
| 396 | (chdir (assoc-ref %build-inputs "source"))
|
| 397 | (let ((esbuild (search-input-file %build-inputs "/bin/esbuild"))
|
| 398 | (target (string-append %output "/share/javascript/commander")))
|
| 399 | (invoke esbuild
|
| 400 | "--bundle"
|
| 401 | "--minify"
|
| 402 | "--tsconfig=tsconfig.json"
|
| 403 | "--platform=node"
|
| 404 | (string-append "--outfile=" target "/index.min.js")
|
| 405 | "index.js")))))
|
| 406 | (native-inputs
|
| 407 | (list esbuild))
|
| 408 | (home-page "https://github.com/tj/commander.js")
|
| 409 | (synopsis "Library for node.js command-line interfaces")
|
| 410 | (description "Commander.js aims to be the complete solution for node.js
|
| 411 | command-line interfaces.")
|
| 412 | (license license:expat)))
|
| 413 |
|
| 414 | (define-public js-xmldom-sre
|
| 415 | |
| 416 | (let ((commit "3c79325bc2c9e5d27e3ba44b680fa8c5dd6a381d")
|
| 417 | (revision "1"))
|
| 418 | (package
|
| 419 | (name "js-xmldom-sre")
|
| 420 | (version "0.1.32")
|
| 421 | (source
|
| 422 | (origin
|
| 423 | (method git-fetch)
|
| 424 | (uri (git-reference
|
| 425 | (url "https://github.com/zorkow/xmldom/")
|
| 426 | (commit commit)))
|
| 427 | (file-name (git-file-name name version))
|
| 428 | (sha256
|
| 429 | (base32
|
| 430 | "0a88v0id3mjflpvjqhv8a28br0xvaaszxbf7alg6pxfbnkb69yyq"))))
|
| 431 | (build-system trivial-build-system)
|
| 432 | (arguments
|
| 433 | `(#:modules ((guix build utils))
|
| 434 | #:builder
|
| 435 | (begin
|
| 436 | (use-modules (guix build utils))
|
| 437 | (chdir (assoc-ref %build-inputs "source"))
|
| 438 | (let ((esbuild (search-input-file %build-inputs "/bin/esbuild"))
|
| 439 | (target (string-append %output "/share/javascript/xmldom-sre")))
|
| 440 | (invoke esbuild
|
| 441 | "--bundle"
|
| 442 | "--minify"
|
| 443 | "--platform=node"
|
| 444 | (string-append "--outfile=" target "/dom-parser.min.js")
|
| 445 | "dom-parser.js")))))
|
| 446 | (native-inputs
|
| 447 | (list esbuild))
|
| 448 | (home-page "https://github.com/zorkow/xmldom/")
|
| 449 | (synopsis "DOM parser and XML serializer")
|
| 450 | (description "This is a fork of the xmldom library. It allows the use
|
| 451 | of wicked-good-xpath together with xmldom.")
|
| 452 | |
| 453 | (license (list license:expat
|
| 454 | license:lgpl2.0)))))
|
| 455 |
|
| 456 | (define-public js-respond
|
| 457 | (package
|
| 458 | (name "js-respond")
|
| 459 | (version "1.4.2")
|
| 460 | (source (origin
|
| 461 | (method git-fetch)
|
| 462 | (uri (git-reference
|
| 463 | (url "https://github.com/scottjehl/Respond")
|
| 464 | (commit version)))
|
| 465 | (file-name (git-file-name name version))
|
| 466 | (sha256
|
| 467 | (base32
|
| 468 | "00xid731rirc7sdy1gc8qal3v9g0agr2qx15hm4x97l1lcbylyn2"))))
|
| 469 | (build-system minify-build-system)
|
| 470 | (arguments
|
| 471 | `(#:javascript-files '("src/matchmedia.addListener.js"
|
| 472 | "src/matchmedia.polyfill.js"
|
| 473 | "src/respond.js")))
|
| 474 | (home-page "https://github.com/scottjehl/Respond")
|
| 475 | (synopsis "Polyfill for min/max-width CSS3 Media Queries")
|
| 476 | (description "The goal of this script is to provide a fast and lightweight
|
| 477 | script to enable responsive web designs in browsers that don't support CSS3
|
| 478 | Media Queries.")
|
| 479 | (license license:expat)))
|
| 480 |
|
| 481 | (define-public js-html5shiv
|
| 482 | (package
|
| 483 | (name "js-html5shiv")
|
| 484 | (version "3.7.3")
|
| 485 | (source (origin
|
| 486 | (method git-fetch)
|
| 487 | (uri (git-reference
|
| 488 | (url "https://github.com/aFarkas/html5shiv")
|
| 489 | (commit version)))
|
| 490 | (file-name (git-file-name name version))
|
| 491 | (sha256
|
| 492 | (base32
|
| 493 | "0y1c5nyq0brl9fjdihhax33vks4s1ij9iv113879sg3zflmgqpd0"))))
|
| 494 | (build-system minify-build-system)
|
| 495 | (home-page "https://github.com/aFarkas/html5shiv")
|
| 496 | (synopsis "Enable HTML5 sectioning elements in legacy browsers")
|
| 497 | (description "The HTML5 Shiv enables use of HTML5 sectioning elements in
|
| 498 | legacy Internet Explorer and provides basic HTML5 styling for Internet
|
| 499 | Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.")
|
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | (license (list license:expat license:gpl2))))
|
| 506 |
|
| 507 | (define-public js-json2
|
| 508 | (let ((commit "031b1d9e6971bd4c433ca85e216cc853f5a867bd")
|
| 509 | (revision "1"))
|
| 510 | (package
|
| 511 | (name "js-json2")
|
| 512 | (version (string-append "2016-10-28." revision "-" (string-take commit 7)))
|
| 513 | (source (origin
|
| 514 | (method git-fetch)
|
| 515 | (uri (git-reference
|
| 516 | (url "https://github.com/douglascrockford/JSON-js")
|
| 517 | (commit commit)))
|
| 518 | (file-name (string-append name "-" version "-checkout"))
|
| 519 | (sha256
|
| 520 | (base32
|
| 521 | "1fvb6b2y5sd3sqdgcj683sdxcbxdii34q0ysc9wg0dq1sy81l11v"))))
|
| 522 | (build-system minify-build-system)
|
| 523 | (arguments
|
| 524 | `(#:javascript-files '("json2.js"
|
| 525 | "json_parse.js"
|
| 526 | "json_parse_state.js"
|
| 527 | "cycle.js")))
|
| 528 | (home-page "https://github.com/douglascrockford/JSON-js")
|
| 529 | (synopsis "JSON encoders and decoders")
|
| 530 | (description "The files in this collection implement JSON
|
| 531 | encoders/decoders in JavaScript.
|
| 532 |
|
| 533 | @code{json2.js}: This file creates a JSON property in the global object, if
|
| 534 | there isn't already one, setting its value to an object containing a stringify
|
| 535 | method and a parse method. The @code{parse} method uses the @code{eval}
|
| 536 | method to do the parsing, guarding it with several regular expressions to
|
| 537 | defend against accidental code execution hazards. On current browsers, this
|
| 538 | file does nothing, preferring the built-in JSON object.
|
| 539 |
|
| 540 | @code{json_parse.js}: This file contains an alternative JSON @code{parse}
|
| 541 | function that uses recursive descent instead of @code{eval}.
|
| 542 |
|
| 543 | @code{json_parse_state.js}: This files contains an alternative JSON
|
| 544 | @code{parse} function that uses a state machine instead of @code{eval}.
|
| 545 |
|
| 546 | @code{cycle.js}: This file contains two functions, @code{JSON.decycle} and
|
| 547 | @code{JSON.retrocycle}, which make it possible to encode cyclical structures
|
| 548 | and DAGs in JSON, and to then recover them. This is a capability that is not
|
| 549 | provided by ES5. @code{JSONPath} is used to represent the links.")
|
| 550 | (license license:public-domain))))
|
| 551 |
|
| 552 | (define (make-js-lunr-lang lang-name abbrev)
|
| 553 | (package
|
| 554 | (name (string-append "js-lunr-" abbrev))
|
| 555 | (version "1.13.0")
|
| 556 | (source
|
| 557 | (origin
|
| 558 | (method git-fetch)
|
| 559 | (uri (git-reference
|
| 560 | (url "https://github.com/MihaiValentin/lunr-languages")
|
| 561 | (commit version)))
|
| 562 | (file-name (git-file-name name version))
|
| 563 | (sha256
|
| 564 | (base32 "03q1awcg5plxdzxg89cd4x8lvnjfba541kbx59q2c6ly7dh4pyv6"))))
|
| 565 | (build-system minify-build-system)
|
| 566 | (arguments
|
| 567 | (list
|
| 568 | #:javascript-files
|
| 569 | #~(list #$(string-append "lunr." abbrev ".js"))
|
| 570 | #:phases
|
| 571 | #~(modify-phases %standard-phases
|
| 572 | (delete 'install-license-files))))
|
| 573 | (home-page "https://github.com/MihaiValentin/lunr-languages")
|
| 574 | (synopsis (string-append lang-name "stemmers and stopwords"))
|
| 575 | (description
|
| 576 | (format #f "This package provides ~a stemmers and stopwords for the Lunr \
|
| 577 | Javascript library."
|
| 578 | lang-name))
|
| 579 | (license license:expat)))
|
| 580 |
|
| 581 | (define-public js-lunr-ar (make-js-lunr-lang "Arabic" "ar"))
|
| 582 | (define-public js-lunr-da (make-js-lunr-lang "Danish" "da"))
|
| 583 | (define-public js-lunr-de (make-js-lunr-lang "German" "de"))
|
| 584 | (define-public js-lunr-el (make-js-lunr-lang "Greek" "el"))
|
| 585 | (define-public js-lunr-es (make-js-lunr-lang "Spanish" "es"))
|
| 586 | (define-public js-lunr-fi (make-js-lunr-lang "Finnish" "fi"))
|
| 587 | (define-public js-lunr-fr (make-js-lunr-lang "French" "fr"))
|
| 588 | (define-public js-lunr-he (make-js-lunr-lang "Hebrew" "he"))
|
| 589 | (define-public js-lunr-hi (make-js-lunr-lang "Hindi" "hi"))
|
| 590 | (define-public js-lunr-hu (make-js-lunr-lang "Hungarian" "hu"))
|
| 591 | (define-public js-lunr-hy (make-js-lunr-lang "Armenian" "hy"))
|
| 592 | (define-public js-lunr-it (make-js-lunr-lang "Italian" "it"))
|
| 593 | (define-public js-lunr-ja (make-js-lunr-lang "Japanese" "ja"))
|
| 594 | (define-public js-lunr-kn (make-js-lunr-lang "Kannada" "kn"))
|
| 595 | (define-public js-lunr-ko (make-js-lunr-lang "Korean" "ko"))
|
| 596 | (define-public js-lunr-nl (make-js-lunr-lang "Dutch" "nl"))
|
| 597 | (define-public js-lunr-no (make-js-lunr-lang "Norwegian" "no"))
|
| 598 | (define-public js-lunr-pt (make-js-lunr-lang "Portuguese" "pt"))
|
| 599 | (define-public js-lunr-ro (make-js-lunr-lang "Romanian" "ro"))
|
| 600 | (define-public js-lunr-ru (make-js-lunr-lang "Russian" "ru"))
|
| 601 | (define-public js-lunr-sa (make-js-lunr-lang "Sanskrit" "sa"))
|
| 602 | (define-public js-lunr-sv (make-js-lunr-lang "Swedish" "sv"))
|
| 603 | (define-public js-lunr-ta (make-js-lunr-lang "Tamil" "ta"))
|
| 604 | (define-public js-lunr-te (make-js-lunr-lang "Telugu" "te"))
|
| 605 | (define-public js-lunr-th (make-js-lunr-lang "Thai" "th"))
|
| 606 | (define-public js-lunr-tr (make-js-lunr-lang "Turkish" "tr"))
|
| 607 | (define-public js-lunr-vi (make-js-lunr-lang "Vietnamese" "vi"))
|
| 608 | (define-public js-lunr-zh (make-js-lunr-lang "Chinese" "zh"))
|
| 609 |
|
| 610 | (define-public js-lunr-multi (make-js-lunr-lang "Multilanguages" "multi"))
|
| 611 | (define-public js-lunr-stemmer-support
|
| 612 | (let ((pkg (make-js-lunr-lang "" "stemmer.support")))
|
| 613 | (package/inherit pkg
|
| 614 | (name "js-lunr-stemmer-support")
|
| 615 | (synopsis "Stemmer support for Lunr")
|
| 616 | (description
|
| 617 | "This package provides stemmer support for the Lunr Javascript
|
| 618 | library."))))
|
| 619 |
|
| 620 | (define-public js-strftime
|
| 621 | (package
|
| 622 | (name "js-strftime")
|
| 623 | (version "0.10.0")
|
| 624 | (source (origin
|
| 625 | (method git-fetch)
|
| 626 | (uri (git-reference
|
| 627 | (url"https://github.com/samsonjs/strftime")
|
| 628 | (commit (string-append "v" version))))
|
| 629 | (file-name (git-file-name name version))
|
| 630 | (sha256
|
| 631 | (base32
|
| 632 | "131nmlivazwxyba25kh9lda99749fq4xsyin6lzfalaaydviby4p"))))
|
| 633 | (build-system minify-build-system)
|
| 634 | (arguments
|
| 635 | `(#:javascript-files '("strftime.js")))
|
| 636 | (home-page "https://github.com/samsonjs/strftime")
|
| 637 | (synopsis "Implementation of strftime to JavaScript")
|
| 638 | (description "This is an implementation of the @code{strftime} procedure
|
| 639 | for JavaScript. It works in (at least) node.js and browsers. It supports
|
| 640 | localization and timezones. Most standard specifiers from C are supported as
|
| 641 | well as some other extensions from Ruby.")
|
| 642 | (license license:expat)))
|
| 643 |
|
| 644 | (define-public js-highlight
|
| 645 | (package
|
| 646 | (name "js-highlight")
|
| 647 | (version "9.12.0")
|
| 648 | (source (origin
|
| 649 | (method git-fetch)
|
| 650 | (uri (git-reference
|
| 651 | (url "https://github.com/isagalaev/highlight.js")
|
| 652 | (commit version)))
|
| 653 | (file-name (git-file-name name version))
|
| 654 | (sha256
|
| 655 | (base32
|
| 656 | "12qz22qjpd6svj58pwgcwg2x2rzhihfdrxg6lgj39nfpaln6dris"))))
|
| 657 | (build-system minify-build-system)
|
| 658 | (arguments
|
| 659 | `(#:javascript-files '("src/highlight.js")))
|
| 660 | (home-page "https://github.com/isagalaev/highlight.js")
|
| 661 | (synopsis "Syntax highlighting for JavaScript")
|
| 662 | (description "Highlight.js is a syntax highlighter written in JavaScript.
|
| 663 | It works in the browser as well as on the server. It works with pretty much
|
| 664 | any markup, doesn’t depend on any framework and has automatic language
|
| 665 | detection.")
|
| 666 | (license license:bsd-3)))
|
| 667 |
|
| 668 | (define-public js-datatables
|
| 669 | (package
|
| 670 | (name "js-datatables")
|
| 671 | (version "1.10.19")
|
| 672 | (source (origin
|
| 673 | (method url-fetch)
|
| 674 | (uri (string-append "https://datatables.net/releases/DataTables-"
|
| 675 | version ".zip"))
|
| 676 | (sha256
|
| 677 | (base32
|
| 678 | "0cff8a1g7pjwbjdqq0yzqd963ar7pfi4splmm6rwdzganr77rkhb"))))
|
| 679 | (build-system minify-build-system)
|
| 680 | (arguments
|
| 681 | `(#:javascript-files '("media/js/dataTables.bootstrap.js"
|
| 682 | "media/js/jquery.dataTables.js")))
|
| 683 | (native-inputs
|
| 684 | (list unzip))
|
| 685 | (home-page "https://datatables.net")
|
| 686 | (synopsis "DataTables plug-in for jQuery")
|
| 687 | (description "DataTables is a table enhancing plug-in for the jQuery
|
| 688 | Javascript library, adding sorting, paging and filtering abilities to plain
|
| 689 | HTML tables with minimal effort.")
|
| 690 | (license license:expat)))
|
| 691 |
|
| 692 | (define-public js-datatables-1.9
|
| 693 | (package
|
| 694 | (inherit js-datatables)
|
| 695 | (name "js-datatables")
|
| 696 | (version "1.9.4")
|
| 697 | (source (origin
|
| 698 | (method url-fetch)
|
| 699 | (uri (string-append "https://datatables.net/releases/DataTables-"
|
| 700 | version ".zip"))
|
| 701 | (sha256
|
| 702 | (base32
|
| 703 | "0yd6548cbpb4hlpwybjp93b9m084n5rba6v1x5n83y0dvlxcd06g"))))
|
| 704 | (arguments
|
| 705 | (list #:javascript-files '(list "media/js/jquery.dataTables.js")))))
|
| 706 |
|
| 707 | (define-public js-requirejs
|
| 708 | (package
|
| 709 | (name "js-requirejs")
|
| 710 | (version "2.3.6")
|
| 711 | (source (origin
|
| 712 | (method git-fetch)
|
| 713 | (uri (git-reference
|
| 714 | (url "https://github.com/requirejs/requirejs")
|
| 715 | (commit version)))
|
| 716 | (file-name (git-file-name name version))
|
| 717 | (sha256
|
| 718 | (base32
|
| 719 | "0cvd5y2mb3h6yil3niqn3gjqrzixdsxcz4rvc2f0hg4kzp5y0w86"))))
|
| 720 | (build-system minify-build-system)
|
| 721 | (arguments `(#:javascript-files '("require.js")))
|
| 722 | (home-page "https://github.com/requirejs/requirejs/")
|
| 723 | (synopsis "File and module loader for JavaScript")
|
| 724 | (description "RequireJS loads plain JavaScript files as well as more
|
| 725 | defined modules. It is optimized for in-browser use, including in a Web
|
| 726 | Worker, but it can be used in other JavaScript environments.")
|
| 727 | (license license:expat)))
|
| 728 |
|
| 729 | (define-public js-selectize
|
| 730 | (package
|
| 731 | (name "js-selectize")
|
| 732 | (version "0.12.6")
|
| 733 | (source (origin
|
| 734 | (method git-fetch)
|
| 735 | (uri (git-reference
|
| 736 | (url "https://github.com/selectize/selectize.js")
|
| 737 | (commit (string-append "v" version))))
|
| 738 | (file-name (git-file-name name version))
|
| 739 | (sha256
|
| 740 | (base32
|
| 741 | "15gichl8wi6yxag2ps723nxrgyan15976dzsnvw9h9py8sbyyzjn"))))
|
| 742 | (build-system minify-build-system)
|
| 743 | |
| 744 | |
| 745 | |
| 746 | (arguments `(#:javascript-files '("dist/js/standalone/selectize.js")))
|
| 747 | (home-page "https://selectize.github.io/selectize.js/")
|
| 748 | (synopsis "Hybrid widget between a textbox and <select> box")
|
| 749 | (description "Selectize is the hybrid of a textbox and @code{<select>}
|
| 750 | box. It's jQuery based and it has autocomplete and native-feeling keyboard
|
| 751 | navigation; it is useful for tagging, contact lists, etc.")
|
| 752 | (license license:asl2.0)))
|
| 753 |
|
| 754 | (define-public js-es5-shim
|
| 755 | (package
|
| 756 | (name "js-es5-shim")
|
| 757 | (version "4.5.13")
|
| 758 | (source (origin
|
| 759 | (method git-fetch)
|
| 760 | (uri (git-reference
|
| 761 | (url "https://github.com/es-shims/es5-shim")
|
| 762 | (commit (string-append "v" version))))
|
| 763 | (file-name (git-file-name name version))
|
| 764 | (sha256
|
| 765 | (base32
|
| 766 | "142w384fbyllq4yggv173g82lw3wix4jqcg6hkhx1ymq89vvnpmh"))))
|
| 767 | (build-system minify-build-system)
|
| 768 | (arguments `(#:javascript-files
|
| 769 | '("es5-sham.js"
|
| 770 | "es5-shim.js")))
|
| 771 | (home-page "https://github.com/es-shims/es5-shim")
|
| 772 | (synopsis "ECMAScript 5 compatibility shims for legacy JavaScript engines")
|
| 773 | (description "@code{es5-shim.js} patches a JavaScript context to contain
|
| 774 | all ECMAScript 5 methods that can be faithfully emulated with a legacy
|
| 775 | JavaScript engine. @code{es5-sham.js} patches other ES5 methods as closely as
|
| 776 | possible. Many of these shams are intended only to allow code to be written
|
| 777 | to ES5 without causing run-time errors in older engines. In many cases, this
|
| 778 | means that these shams cause many ES5 methods to silently fail.")
|
| 779 | (license license:expat)))
|
| 780 |
|
| 781 | (define-public js-filesaver
|
| 782 | (package
|
| 783 | (name "js-filesaver")
|
| 784 | (version "1.3.8")
|
| 785 | (source (origin
|
| 786 | (method git-fetch)
|
| 787 | (uri (git-reference
|
| 788 | (url "https://github.com/eligrey/FileSaver.js")
|
| 789 | (commit version)))
|
| 790 | (file-name (git-file-name name version))
|
| 791 | (sha256
|
| 792 | (base32
|
| 793 | "0gvqk0hnr8fig0n4da7vj7q6z31bcyv52916xz3rbmdj3pgpiv1d"))))
|
| 794 | (build-system minify-build-system)
|
| 795 | (arguments
|
| 796 | `(#:phases
|
| 797 | (modify-phases %standard-phases
|
| 798 | (add-after 'unpack 'fix-uglification
|
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | (lambda _
|
| 804 | (substitute* "src/FileSaver.js"
|
| 805 | (("export ") ""))
|
| 806 | #t))
|
| 807 | (add-after 'install 'install-unminified-version
|
| 808 | (lambda* (#:key outputs #:allow-other-keys)
|
| 809 | (install-file "src/FileSaver.js"
|
| 810 | (string-append (assoc-ref outputs "out")
|
| 811 | "/share/javascript"))
|
| 812 | #t)))))
|
| 813 | (home-page
|
| 814 | "https://eligrey.com/blog/saving-generated-files-on-the-client-side/")
|
| 815 | (synopsis "HTML5 saveAs() FileSaver implementation")
|
| 816 | (description "@file{FileSaver.js} implements the @code{saveAs()}
|
| 817 | FileSaver interface in browsers that do not natively support it.
|
| 818 |
|
| 819 | @file{FileSaver.js} is the solution to saving files on the
|
| 820 | client-side, and is perfect for webapps that need to generate files,
|
| 821 | or for saving sensitive information that shouldn't be sent to an
|
| 822 | external server.")
|
| 823 | (license license:expat)))
|
| 824 |
|
| 825 | (define-public js-scianimator
|
| 826 | (package
|
| 827 | (name "js-scianimator")
|
| 828 | (version "1.4")
|
| 829 | (source (origin
|
| 830 | (method git-fetch)
|
| 831 | (uri (git-reference
|
| 832 | (url "https://github.com/brentertz/scianimator.git")
|
| 833 | (commit version)))
|
| 834 | (file-name (git-file-name name version))
|
| 835 | (sha256
|
| 836 | (base32
|
| 837 | "0b4r6z85gnsjagdchvf1pvrhylfiaidh701hna8jrm0l4kbb735x"))))
|
| 838 | (build-system minify-build-system)
|
| 839 | (arguments
|
| 840 | '(#:javascript-files
|
| 841 | (list "assets/js/jquery.scianimator.js")))
|
| 842 | (home-page "https://github.com/brentertz/scianimator")
|
| 843 | (synopsis "Scientific image animator plugin for jQuery")
|
| 844 | (description "SciAnimator provides a simple yet powerful interface for
|
| 845 | animating a series of images.")
|
| 846 | (license license:expat)))
|
| 847 |
|
| 848 | (define-public mujs
|
| 849 | (package
|
| 850 | (name "mujs")
|
| 851 | (version "1.3.5")
|
| 852 | (source
|
| 853 | (origin
|
| 854 | (method git-fetch)
|
| 855 | (uri (git-reference
|
| 856 | (url "https://github.com/ccxvii/mujs")
|
| 857 | (commit version)))
|
| 858 | (file-name (git-file-name name version))
|
| 859 | (sha256
|
| 860 | (base32 "1p90cb830li6y38m748s4kz2pkimxarbcaym3bwrxnk3jaqcf69q"))
|
| 861 | (snippet
|
| 862 | #~(begin
|
| 863 | (use-modules (guix build utils))
|
| 864 | (for-each delete-file
|
| 865 | (list "astnames.h"
|
| 866 | "opnames.h"
|
| 867 | "one.c"))))))
|
| 868 | (build-system gnu-build-system)
|
| 869 | (arguments
|
| 870 | (list
|
| 871 | #:phases
|
| 872 | #~(modify-phases %standard-phases
|
| 873 | (delete 'configure) |
| 874 | (replace 'install
|
| 875 | (lambda* (#:key (make-flags '()) #:allow-other-keys)
|
| 876 | (apply invoke "make" "install-shared" make-flags))))
|
| 877 | #:make-flags
|
| 878 | #~(list (string-append "VERSION=" #$version)
|
| 879 | (string-append "CC=" #$(cc-for-target))
|
| 880 | (string-append "prefix=" #$output))
|
| 881 | #:tests? #f)) |
| 882 | (inputs
|
| 883 | (list readline))
|
| 884 | (home-page "https://mujs.com/")
|
| 885 | (synopsis "JavaScript interpreter written in C")
|
| 886 | (description "MuJS is a lightweight Javascript interpreter designed for
|
| 887 | embedding in other software to extend them with scripting capabilities. MuJS
|
| 888 | was designed with a focus on small size, correctness, and simplicity. It is
|
| 889 | written in portable C and implements ECMAScript as specified by ECMA-262. The
|
| 890 | interface for binding with native code is designed to be as simple as possible
|
| 891 | to use, and is very similar to Lua. There is no need to interact with byzantine
|
| 892 | C++ template mechanisms, or worry about marking and unmarking garbage collection
|
| 893 | roots, or wrestle with obscure build systems.")
|
| 894 | (license license:isc)))
|
| 895 |
|
| 896 | (define-public quickjs
|
| 897 | (package
|
| 898 | (name "quickjs")
|
| 899 | (version "2025-04-26")
|
| 900 | (source (origin
|
| 901 | (method url-fetch)
|
| 902 | (uri (string-append "https://bellard.org/quickjs/quickjs-"
|
| 903 | version ".tar.xz"))
|
| 904 | (sha256
|
| 905 | (base32
|
| 906 | "1gw39jazggpbrjmkkmkhsj2wn0mmaw6wb0gkh7vzcvhn4m60f81g"))
|
| 907 | (snippet
|
| 908 | #~(begin (use-modules (guix build utils))
|
| 909 | (for-each delete-file
|
| 910 | '("doc/quickjs.pdf"
|
| 911 | "doc/quickjs.html"))))))
|
| 912 | (build-system gnu-build-system)
|
| 913 | (arguments
|
| 914 | (list #:make-flags
|
| 915 | #~(list (string-append "PREFIX=" #$output)
|
| 916 | #$@(if (or (target-riscv64?)
|
| 917 | (target-ppc32?))
|
| 918 | '("LDFLAGS=-latomic")
|
| 919 | '()))
|
| 920 | #:phases #~(modify-phases %standard-phases
|
| 921 | (delete 'configure)
|
| 922 | (replace 'check
|
| 923 | (lambda* (#:key tests? #:allow-other-keys)
|
| 924 | (when tests?
|
| 925 | (invoke "make" "microbench")))))))
|
| 926 | (home-page "https://bellard.org/quickjs/")
|
| 927 | (synopsis "Small embeddable Javascript engine")
|
| 928 | (description "QuickJS supports the ES2023 specification including modules,
|
| 929 | asynchronous generators, proxies, BigInt, BigDecimal, BigFloat and operator
|
| 930 | overloading. It can compile Javascript sources to executables with no external
|
| 931 | dependency. It includes a command line interpreter with contextual colorization
|
| 932 | implemented in Javascript and a small built-in standard library with C library
|
| 933 | wrappers.")
|
| 934 | (license license:expat)))
|
| 935 |
|
| 936 | (define-public test262-source
|
| 937 | (origin
|
| 938 | (method git-fetch)
|
| 939 | (uri (git-reference (url "https://github.com/tc39/test262")
|
| 940 | (commit "e7a84b0a090ca86cc05f2e90116115c8c2a7c059")))
|
| 941 | (file-name "test262")
|
| 942 | (sha256 (base32 "0y1w6ypjpam6dal75cwvwwmrrhh7glx9pp812yxvy8rc8w9sfwyw"))
|
| 943 | (modules '((guix build utils)))
|
| 944 | (snippet #~(begin
|
| 945 | (for-each delete-file
|
| 946 | (list "ECMA TR-104.pdf" "docs/coverage.html"
|
| 947 | "docs/ES3_ES5_Changes.xlsx"))))))
|
| 948 |
|
| 949 | (define-public quickjs-ng
|
| 950 | (package
|
| 951 | (name "quickjs-ng")
|
| 952 | (version "0.9.0")
|
| 953 | (source
|
| 954 | (origin
|
| 955 | (method git-fetch)
|
| 956 | (uri (git-reference
|
| 957 | (url "https://github.com/quickjs-ng/quickjs")
|
| 958 | (commit (string-append "v" version))))
|
| 959 | (file-name (git-file-name name version))
|
| 960 | (sha256
|
| 961 | (base32 "0lbjayp6x5784dxa7ll67isjjiqajg4hx3ls6fyzzfk6hd44jkzw"))))
|
| 962 | (arguments
|
| 963 | (list
|
| 964 | |
| 965 | |
| 966 | #:tests? (and (not (%current-target-system))
|
| 967 | (target-64bit?))
|
| 968 | #:configure-flags
|
| 969 | #~(list "-DBUILD_SHARED_LIBS:BOOL=TRUE"
|
| 970 | "-DQJS_BUILD_EXAMPLES:BOOL=FALSE"
|
| 971 | "-DQJS_BUILD_CLI_WITH_MIMALLOC:BOOL=TRUE"
|
| 972 | "-DQJS_ENABLE_ASAN:BOOL=FALSE"
|
| 973 | "-DQJS_ENABLE_UBSAN:BOOL=FALSE"
|
| 974 | "-DQJS_ENABLE_MSAN:BOOL=FALSE"
|
| 975 | "-DQJS_ENABLE_TSAN:BOOL=FALSE"
|
| 976 | |
| 977 | "-DQJS_BUILD_LIBC:BOOL=FALSE"
|
| 978 | #$@(if (or (target-riscv64?)
|
| 979 | (target-ppc32?))
|
| 980 | #~("-DCMAKE_EXE_LINKER_FLAGS=-latomic")
|
| 981 | #~()))
|
| 982 | #:phases
|
| 983 | #~(modify-phases %standard-phases
|
| 984 | (add-before 'configure 'prepare-tests
|
| 985 | (lambda* (#:key inputs #:allow-other-keys)
|
| 986 | (substitute* '("test262.conf" "test262-fast.conf"
|
| 987 | "test262_errors.txt")
|
| 988 | (("test262/")
|
| 989 | (string-append (assoc-ref inputs "test262") "/")))
|
| 990 | (substitute* "tests/test_std.js"
|
| 991 | (("/bin/sh")
|
| 992 | (which "sh")))
|
| 993 | (substitute* "Makefile"
|
| 994 | ((" \\$\\(QJS\\)")
|
| 995 | "")
|
| 996 | (("BUILD_DIR=build")
|
| 997 | "BUILD_DIR=../build"))))
|
| 998 | (replace 'check
|
| 999 | (lambda* (#:key tests? #:allow-other-keys)
|
| 1000 | (when tests?
|
| 1001 | (with-directory-excursion "../source"
|
| 1002 | (invoke "make" "test")
|
| 1003 | (invoke "make" "test262-fast")
|
| 1004 | (invoke "make" "microbench")
|
| 1005 | (invoke "../build/qjs" "-c" "examples/hello.js" "-o" "hello")
|
| 1006 | (invoke "./hello")
|
| 1007 | (invoke "../build/api-test"))))))))
|
| 1008 | (build-system cmake-build-system)
|
| 1009 | (native-inputs (list test262-source))
|
| 1010 | (inputs (list mimalloc))
|
| 1011 | (home-page "https://quickjs-ng.github.io/quickjs/")
|
| 1012 | (synopsis "Small embeddable Javascript engine")
|
| 1013 | (description
|
| 1014 | "@code{quickjs-ng} supports the ES2023 specification including modules,
|
| 1015 | asynchronous generators, proxies, BigInt, BigDecimal, BigFloat and operator
|
| 1016 | overloading. It can compile Javascript sources to executables with no external
|
| 1017 | dependency. It includes a command line interpreter with contextual colorization
|
| 1018 | implemented in Javascript and a small built-in standard library with C library
|
| 1019 | wrappers.")
|
| 1020 | |
| 1021 | (license (list license:expat license:bsd-3))))
|
| 1022 |
|
| 1023 | (define-public duktape
|
| 1024 | (package
|
| 1025 | (name "duktape")
|
| 1026 | (version "2.6.0")
|
| 1027 | (source (origin
|
| 1028 | (method url-fetch)
|
| 1029 | (uri (string-append "https://duktape.org/duktape-"
|
| 1030 | version ".tar.xz"))
|
| 1031 | (sha256
|
| 1032 | (base32
|
| 1033 | "19szwxzvl2g65fw95ggvb8h0ma5bd9vvnnccn59hwnc4dida1x4n"))))
|
| 1034 | (build-system gnu-build-system)
|
| 1035 | (arguments
|
| 1036 | (list #:tests? #f |
| 1037 | #:make-flags
|
| 1038 | #~(list "-f" "Makefile.sharedlibrary"
|
| 1039 | (string-append "INSTALL_PREFIX="
|
| 1040 | |
| 1041 | #$(if (%current-target-system)
|
| 1042 | #~#$output
|
| 1043 | #~%output))
|
| 1044 | |
| 1045 | #$@(if (%current-target-system)
|
| 1046 | #~((string-append "CC=" #$(cc-for-target)))
|
| 1047 | #~()))
|
| 1048 | #:phases
|
| 1049 | #~(modify-phases %standard-phases
|
| 1050 | (delete 'configure)
|
| 1051 | |
| 1052 | |
| 1053 | (add-after 'install 'install-pkg-config
|
| 1054 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1055 | (let* ((out (assoc-ref outputs "out"))
|
| 1056 | (pkg-config-dir (string-append out "/lib/pkgconfig")))
|
| 1057 | (mkdir-p pkg-config-dir)
|
| 1058 | (with-output-to-file (string-append pkg-config-dir "/duktape.pc")
|
| 1059 | (lambda _
|
| 1060 | (format #t "prefix=~@*~a~@
|
| 1061 | libdir=${prefix}/lib~@
|
| 1062 | includedir=${prefix}/include~@
|
| 1063 |
|
| 1064 | Name: duktape~@
|
| 1065 | Description: Embeddable Javascript engine~@
|
| 1066 | Version: ~a~@
|
| 1067 | Libs: -L${libdir} -lduktape~@
|
| 1068 | Cflags: -I${includedir}~%"
|
| 1069 | out #$version)))))))))
|
| 1070 | (home-page "https://duktape.org/")
|
| 1071 | (synopsis "Small embeddable Javascript engine")
|
| 1072 | (description "Duktape is an embeddable Javascript engine, with a focus on
|
| 1073 | portability and compact footprint. Duktape is easy to integrate into a C/C++
|
| 1074 | project: add @file{duktape.c}, @file{duktape.h}, and @file{duk_config.h} to
|
| 1075 | your build, and use the Duktape API to call ECMAScript functions from C code
|
| 1076 | and vice versa.")
|
| 1077 | (license license:expat)))
|
| 1078 |
|
| 1079 | (define-public rhino
|
| 1080 | (package
|
| 1081 | (name "rhino")
|
| 1082 | (version "1.7.7.2")
|
| 1083 | (source (origin
|
| 1084 | (method git-fetch)
|
| 1085 | (uri (git-reference
|
| 1086 | (url "https://github.com/mozilla/rhino.git")
|
| 1087 | (commit "935942527ff434b205e797df4185518e5369466e")))
|
| 1088 | (file-name (git-file-name name version))
|
| 1089 | (sha256
|
| 1090 | (base32
|
| 1091 | "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
|
| 1092 | (modules '((guix build utils)))
|
| 1093 | (snippet '(begin
|
| 1094 | |
| 1095 | (delete-file-recursively "testsrc/benchmarks")
|
| 1096 | (delete-file-recursively
|
| 1097 | "testsrc/org/mozilla/javascript/benchmarks")
|
| 1098 | |
| 1099 | (format #t "~%~a~%" "Sourced jars")
|
| 1100 | (for-each (lambda (f)
|
| 1101 | (format #t "~/Deleting: ~a~%" f)
|
| 1102 | (delete-file f))
|
| 1103 | (find-files "." "\\.jar$"))))))
|
| 1104 | (build-system ant-build-system)
|
| 1105 | (inputs (list bash-minimal))
|
| 1106 | (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
|
| 1107 | (arguments
|
| 1108 | `(#:phases
|
| 1109 | (modify-phases
|
| 1110 | %standard-phases
|
| 1111 | (add-after 'unpack 'remove-build-dates
|
| 1112 | |
| 1113 | (lambda _
|
| 1114 | (substitute*
|
| 1115 | "build.properties"
|
| 1116 | (("..implementation.date.") ""))))
|
| 1117 | (replace 'check
|
| 1118 | (lambda* (#:key tests? inputs native-inputs
|
| 1119 | #:allow-other-keys)
|
| 1120 | (when tests?
|
| 1121 | (setenv "ANT_OPTS" "-Doffline=true")
|
| 1122 | (let ((junit-lib
|
| 1123 | (assoc-ref inputs "java-junit"))
|
| 1124 | (hamcrest-lib
|
| 1125 | (assoc-ref inputs "java-hamcrest-core"))
|
| 1126 | (snakeyaml-lib
|
| 1127 | (assoc-ref inputs "java-snakeyaml")))
|
| 1128 | (with-directory-excursion "testsrc"
|
| 1129 | (substitute* "build.xml"
|
| 1130 | (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
|
| 1131 | (string-append "<!-- " all " -->"))
|
| 1132 | (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
|
| 1133 | (string-append "<!-- " all " -->"))
|
| 1134 | (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
|
| 1135 | all)
|
| 1136 | (string-append "<!-- " all " -->"))
|
| 1137 | (("<pathelement path=\"lib/emma.jar\"/>" all)
|
| 1138 | (string-append "<!-- " all " -->"))
|
| 1139 | (("<pathelement path=\"lib/junit.jar\" ?/>")
|
| 1140 | (string-append
|
| 1141 | "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
|
| 1142 | (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
|
| 1143 | (string-append "<fileset dir=\"" hamcrest-lib
|
| 1144 | "\" includes=\"**/*.jar\"/>"))
|
| 1145 | (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
|
| 1146 | (string-append "<fileset dir=\"" snakeyaml-lib
|
| 1147 | "\" includes=\"**/*.jar\"/>"))
|
| 1148 | |
| 1149 | (("(<target name=\"junit\" depends=\"junit-compile),.*"
|
| 1150 | all pre)
|
| 1151 | (string-append pre "\">"))))
|
| 1152 | (invoke "ant" "junit")))))
|
| 1153 | (replace 'install
|
| 1154 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 1155 | (let* ((out (assoc-ref outputs "out"))
|
| 1156 | (pkg+ver (string-append ,name ,version))
|
| 1157 | (bin (string-append out "/bin"))
|
| 1158 | (rhino (string-append bin "/rhino"))
|
| 1159 | (man (string-append out "/share/man/man1")))
|
| 1160 | (mkdir-p bin)
|
| 1161 | (install-file "man/rhino.1" man)
|
| 1162 | (install-file (string-append "build/" pkg+ver
|
| 1163 | "/js.jar")
|
| 1164 | (string-append out "/share/java"))
|
| 1165 | (with-output-to-file rhino
|
| 1166 | (lambda _
|
| 1167 | (format #t "#!~a~%~a -jar ~a $@~%"
|
| 1168 | (search-input-file inputs "/bin/bash")
|
| 1169 | (search-input-file inputs "/bin/java")
|
| 1170 | (string-append out "/share/java/js.jar"))))
|
| 1171 | (chmod rhino #o755)))))))
|
| 1172 | (home-page "https://mozilla.github.io/rhino")
|
| 1173 | (synopsis "Javascript implemented in Java")
|
| 1174 | (description
|
| 1175 | "Rhino implements ECMAScript, also known as JavaScript, in Java as
|
| 1176 | specified in the fifth edition of ECMA-262.")
|
| 1177 | (license license:mpl2.0)))
|
| 1178 |
|