diff options
| author | Ashvith Shetty <ashvithshetty0010@zohomail.in> | 2025-03-14 18:28:59 +0530 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-04-02 20:50:14 +0200 |
| commit | c71a243d99841a94c234cd07390fde4a0d7ed805 (patch) | |
| tree | 1bd1e08790d219b45c058c97e192a68b26fdfb41 /gnu/packages/javascript.scm | |
| parent | 02f4666e9a39ad3a6029aa14564906aa9041999d (diff) | |
gnu: Add quickjs-ng.
* gnu/packages/javascript.scm (quickjs-ng): New variable.
Change-Id: Ib0dba8aa24e2dafe98b8688fbde1c0ce0a31a4e2
Diffstat (limited to 'gnu/packages/javascript.scm')
| -rw-r--r-- | gnu/packages/javascript.scm | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm index b48acf47dc9..21222f00279 100644 --- a/gnu/packages/javascript.scm +++ b/gnu/packages/javascript.scm | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> | 8 | ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 9 | ;;; Copyright © 2022 Frank Pursel <frank.pursel@gmail.com> | 9 | ;;; Copyright © 2022 Frank Pursel <frank.pursel@gmail.com> |
| 10 | ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> | 10 | ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> |
| 11 | ;;; Copyright © 2025 Ashvith Shetty <ashvithshetty0010@zohomail.in> | ||
| 11 | ;;; | 12 | ;;; |
| 12 | ;;; This file is part of GNU Guix. | 13 | ;;; This file is part of GNU Guix. |
| 13 | ;;; | 14 | ;;; |
| @@ -29,6 +30,7 @@ | |||
| 29 | #:use-module (gnu packages) | 30 | #:use-module (gnu packages) |
| 30 | #:use-module (gnu packages base) | 31 | #:use-module (gnu packages base) |
| 31 | #:use-module (gnu packages bash) | 32 | #:use-module (gnu packages bash) |
| 33 | #:use-module (gnu packages c) | ||
| 32 | #:use-module (gnu packages compression) | 34 | #:use-module (gnu packages compression) |
| 33 | #:use-module (gnu packages java) | 35 | #:use-module (gnu packages java) |
| 34 | #:use-module (gnu packages node) | 36 | #:use-module (gnu packages node) |
| @@ -865,6 +867,93 @@ implemented in Javascript and a small built-in standard library with C library | |||
| 865 | wrappers.") | 867 | wrappers.") |
| 866 | (license license:expat))) | 868 | (license license:expat))) |
| 867 | 869 | ||
| 870 | (define-public test262-source | ||
| 871 | (origin | ||
| 872 | (method git-fetch) | ||
| 873 | (uri (git-reference (url "https://github.com/tc39/test262") | ||
| 874 | (commit "e7a84b0a090ca86cc05f2e90116115c8c2a7c059"))) | ||
| 875 | (file-name "test262") | ||
| 876 | (sha256 (base32 "0y1w6ypjpam6dal75cwvwwmrrhh7glx9pp812yxvy8rc8w9sfwyw")) | ||
| 877 | (modules '((guix build utils))) | ||
| 878 | (snippet #~(begin | ||
| 879 | (for-each delete-file | ||
| 880 | (list "ECMA TR-104.pdf" "docs/coverage.html" | ||
| 881 | "docs/ES3_ES5_Changes.xlsx")))))) | ||
| 882 | |||
| 883 | (define-public quickjs-ng | ||
| 884 | (package | ||
| 885 | (name "quickjs-ng") | ||
| 886 | (version "0.9.0") | ||
| 887 | (source | ||
| 888 | (origin | ||
| 889 | (method git-fetch) | ||
| 890 | (uri (git-reference | ||
| 891 | (url "https://github.com/quickjs-ng/quickjs") | ||
| 892 | (commit (string-append "v" version)))) | ||
| 893 | (file-name (git-file-name name version)) | ||
| 894 | (sha256 | ||
| 895 | (base32 "0lbjayp6x5784dxa7ll67isjjiqajg4hx3ls6fyzzfk6hd44jkzw")))) | ||
| 896 | (arguments | ||
| 897 | (list | ||
| 898 | ;; Data model is ILP32 in 32bit, LP64 in 64bit | ||
| 899 | ;; https://docs.oracle.com/cd/E19620-01/805-3024/lp64-1/index.html | ||
| 900 | #:tests? (and (not (%current-target-system)) | ||
| 901 | (target-64bit?)) | ||
| 902 | #:configure-flags | ||
| 903 | #~(list "-DBUILD_SHARED_LIBS:BOOL=TRUE" | ||
| 904 | "-DQJS_BUILD_EXAMPLES:BOOL=FALSE" | ||
| 905 | "-DQJS_BUILD_CLI_WITH_MIMALLOC:BOOL=TRUE" | ||
| 906 | "-DQJS_ENABLE_ASAN:BOOL=FALSE" | ||
| 907 | "-DQJS_ENABLE_UBSAN:BOOL=FALSE" | ||
| 908 | "-DQJS_ENABLE_MSAN:BOOL=FALSE" | ||
| 909 | "-DQJS_ENABLE_TSAN:BOOL=FALSE" | ||
| 910 | ;; Only works with static build | ||
| 911 | "-DQJS_BUILD_LIBC:BOOL=FALSE" | ||
| 912 | #$@(if (or (target-riscv64?) | ||
| 913 | (target-ppc32?)) | ||
| 914 | #~("-DCMAKE_EXE_LINKER_FLAGS=-latomic") | ||
| 915 | #~())) | ||
| 916 | #:phases | ||
| 917 | #~(modify-phases %standard-phases | ||
| 918 | (add-before 'configure 'prepare-tests | ||
| 919 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 920 | (substitute* '("test262.conf" "test262-fast.conf" | ||
| 921 | "test262_errors.txt") | ||
| 922 | (("test262/") | ||
| 923 | (string-append (assoc-ref inputs "test262") "/"))) | ||
| 924 | (substitute* "tests/test_std.js" | ||
| 925 | (("/bin/sh") | ||
| 926 | (which "sh"))) | ||
| 927 | (substitute* "Makefile" | ||
| 928 | ((" \\$\\(QJS\\)") | ||
| 929 | "") | ||
| 930 | (("BUILD_DIR=build") | ||
| 931 | "BUILD_DIR=../build")))) | ||
| 932 | (replace 'check | ||
| 933 | (lambda* (#:key tests? #:allow-other-keys) | ||
| 934 | (when tests? | ||
| 935 | (with-directory-excursion "../source" | ||
| 936 | (invoke "make" "test") | ||
| 937 | (invoke "make" "test262-fast") | ||
| 938 | (invoke "make" "microbench") | ||
| 939 | (invoke "../build/qjs" "-c" "examples/hello.js" "-o" "hello") | ||
| 940 | (invoke "./hello") | ||
| 941 | (invoke "../build/api-test")))))))) | ||
| 942 | (build-system cmake-build-system) | ||
| 943 | (native-inputs (list test262-source)) | ||
| 944 | (inputs (list mimalloc)) | ||
| 945 | (home-page "https://quickjs-ng.github.io/quickjs/") | ||
| 946 | (synopsis "Small embeddable Javascript engine") | ||
| 947 | (description | ||
| 948 | "@code{quickjs-ng} supports the ES2023 specification including modules, | ||
| 949 | asynchronous generators, proxies, BigInt, BigDecimal, BigFloat and operator | ||
| 950 | overloading. It can compile Javascript sources to executables with no external | ||
| 951 | dependency. It includes a command line interpreter with contextual colorization | ||
| 952 | implemented in Javascript and a small built-in standard library with C library | ||
| 953 | wrappers.") | ||
| 954 | ;; 3-clause BSD license for test262 | ||
| 955 | (license (list license:expat license:bsd-3)))) | ||
| 956 | |||
| 868 | (define-public duktape | 957 | (define-public duktape |
| 869 | (package | 958 | (package |
| 870 | (name "duktape") | 959 | (name "duktape") |
