From d6fa3ac7a8203173b125390aed596832565a3687 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Tue, 16 Aug 2022 10:28:31 +0200 Subject: [PATCH] gnu: mozjs: Update to 102.2.0. * gnu/packages/gnuzilla.scm (mozjs): Update to 102.2.0. (source)[uri]: Use new download location. [arguments]: Adjust configure phase for upstream changes. Remove adjust-tests-for-icu-68 phase, add adjust-tests phase. Don't delete tests in pre-check phase. [native-inputs]: Remove AUTOCONF-2.13 and PYTHON-3. Add AUTOCONF, M4, and PYTHON-WRAPPER. [inputs]: Replace ICU4C with ICU4C-71. (mozjs-78): New variable. * gnu/packages/games.scm (0ad)[inputs]: Change from MOZJS to MOZJS-78. * gnu/packages/polkit.scm (polkit-mozjs)[inputs]: Likewise. --- gnu/packages/games.scm | 2 +- gnu/packages/gnuzilla.scm | 214 ++++++++++++++++++++++++++------------ gnu/packages/polkit.scm | 2 +- 3 files changed, 149 insertions(+), 69 deletions(-) diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 5dc7298acb..aa2e4e04b0 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -6736,7 +6736,7 @@ (define-public 0ad libxcursor libxml2 miniupnpc - mozjs + mozjs-78 openal sdl2 wxwidgets diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index ad955649cc..3fc0355e60 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm @@ -14,7 +14,7 @@ ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2019, 2020 Adrian Malacoda ;;; Copyright © 2020, 2021, 2022 Jonathan Brielmaier -;;; Copyright © 2020 Marius Bakke +;;; Copyright © 2020, 2022 Marius Bakke ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 Maxime Devos ;;; Copyright © 2021, 2022 Maxim Cournoyer @@ -96,16 +96,16 @@ (define-module (gnu packages gnuzilla) (define-public mozjs (package (name "mozjs") - (version "78.15.0") + (version "102.2.0") (source (origin (method url-fetch) ;; TODO: Switch to IceCat source once available on ftp.gnu.org. - (uri (string-append "https://archive.mozilla.org/pub/firefox" + (uri (string-append "https://ftp.mozilla.org/pub/firefox" "/releases/" version "esr/source/firefox-" version "esr.source.tar.xz")) (sha256 (base32 - "0l91cxdc5v9fps79ckb1kid4gw6v5qng1jd9zvaacwaiv628shx4")))) + "1zwpgis7py1bf8p88pz3mpai6a02qrdb8ww2fa9kxxdl9b8r2k81")))) (build-system gnu-build-system) (arguments (list @@ -147,7 +147,7 @@ (define-public mozjs (for-each generate-all-checksums '("js" "third_party/rust"))))) (replace 'configure - (lambda* (#:key inputs configure-flags #:allow-other-keys) + (lambda* (#:key configure-flags #:allow-other-keys) ;; The configure script does not accept environment variables as ;; arguments. It also must be run from a different directory, ;; but not the root directory either. @@ -156,43 +156,11 @@ (define-public mozjs (setenv "SHELL" (which "sh")) (setenv "CONFIG_SHELL" (which "sh")) (setenv "AUTOCONF" (which "autoconf")) - (apply invoke "../js/src/configure" - (cons (string-append "--prefix=" #$output) - configure-flags)))) - (add-after 'unpack 'adjust-for-icu-68 - (lambda _ - (with-directory-excursion "js/src/tests" - ;; The test suite expects a lightly patched ICU 67. Since - ;; Guix is about to switch to ICU 68, massage the tests to - ;; work with that instead of patching ICU. Try removing this - ;; phase for newer versions of mozjs. - - ;; These tests look up locale names and expects to get - ;; "GB" instead of "UK". - (substitute* "non262/Intl/DisplayNames/language.js" - (("Traditionell, GB") - "Traditionell, UK")) - (substitute* "non262/Intl/DisplayNames/region.js" - (("\"GB\": \"GB\"") - "\"GB\": \"UK\"")) - - ;; XXX: Some localized time formats have changed, and - ;; substitution fails for accented characters, even though - ;; it works in the REPL(?). Just delete these for now. - (delete-file "non262/Intl/Date/toLocaleString_timeZone.js") - (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js") - - ;; Similarly, these get an unexpected "A" suffix when looking - ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is - ;; tricky to substitute. - (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js") - (delete-file "non262/Intl/DateTimeFormat/format.js") - - ;; This file compares a generated list of ICU locale names - ;; with actual lookups. Some have changed slightly, i.e. - ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity. - (delete-file "non262/Intl/Locale/likely-subtags-generated.js")))) - (add-before 'check 'pre-check + (apply invoke "python" "../configure.py" + "--enable-project=js" + (string-append "--prefix=" #$output) + configure-flags))) + (add-before 'check 'adjust-tests (lambda _ (with-directory-excursion "../js/src/tests" (substitute* "shell/os.js" @@ -200,23 +168,143 @@ (define-public mozjs ((".*killed process should not have exitStatus.*") "")) - ;; XXX: Delete all tests that test time zone functionality, - ;; because the test suite uses /etc/localtime to figure out - ;; the offset from the hardware clock, which does not work - ;; in the build container. See . - (delete-file-recursively "non262/Date") - (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js") + ;; The test suite expects a lightly patched ICU. Disable tests + ;; that do not work with the system version. See + ;; "intl/icu-patches" for clues. - (setenv "JSTESTS_EXTRA_ARGS" - (string-join - (list - ;; Do not run tests marked as "random". - "--exclude-random" - ;; Exclude web platform tests. - "--wpt=disabled" - ;; Respect the daemons configured number of jobs. - (string-append "--worker-count=" - (number->string (parallel-job-count)))))))))))) + ;; See and + ;; and + ;; related patch for why this is failing. + (delete-file "non262/Intl/DateTimeFormat/\ +fractional-second-digits-append-item.js") + ;; FIXME: got "0 \u251CAM/PM: noon\u2524", expected "0 (AM/PM: noon)" + (delete-file "non262/Intl/DateTimeFormat/day-period-hour-cycle.js") + ;; FIXME: got "en-US-posix", expected "en-US-POSIX". + (delete-file "non262/Intl/available-locales-supported.js") + ;; FIXME: got "en-US", expected "en-US-POSIX" + (delete-file "non262/Intl/available-locales-resolved.js")))) + (add-before 'check 'pre-check + (lambda _ + (setenv "JSTESTS_EXTRA_ARGS" + (string-join + (list + ;; Do not run tests marked as "random". + "--exclude-random" + ;; Exclude web platform tests. + "--wpt=disabled" + ;; Respect the daemons configured number of jobs. + (string-append "--worker-count=" + (number->string (parallel-job-count))))))))))) + (native-inputs + (list autoconf + llvm ;for llvm-objdump + m4 + perl + pkg-config + python-wrapper + rust + `(,rust "cargo"))) + (inputs + (list icu4c-71 readline zlib)) + (propagated-inputs + (list nspr)) ; in the Requires.private field of mozjs-*.pc + (home-page + "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey") + (synopsis "Mozilla javascript engine") + (description "SpiderMonkey is Mozilla's JavaScript engine written +in C/C++.") + (license license:mpl2.0))) ; and others for some files + +(define-public mozjs-78 + (package + (inherit mozjs) + (name "mozjs") + (version "78.15.0") + (source (origin + (method url-fetch) + (uri (string-append "https://archive.mozilla.org/pub/firefox" + "/releases/" version "esr/source/firefox-" + version "esr.source.tar.xz")) + (sha256 + (base32 + "0l91cxdc5v9fps79ckb1kid4gw6v5qng1jd9zvaacwaiv628shx4")))) + (build-system gnu-build-system) + (arguments + (substitute-keyword-arguments (package-arguments mozjs) + ((#:phases phases) + #~(modify-phases #$phases + (replace 'configure + (lambda* (#:key configure-flags #:allow-other-keys) + ;; The configure script does not accept environment variables as + ;; arguments. It also must be run from a different directory, + ;; but not the root directory either. + (mkdir "run-configure-from-here") + (chdir "run-configure-from-here") + (setenv "SHELL" (which "sh")) + (setenv "CONFIG_SHELL" (which "sh")) + (setenv "AUTOCONF" (which "autoconf")) + (apply invoke "../js/src/configure" + (cons (string-append "--prefix=" #$output) + configure-flags)))) + (replace 'adjust-tests + (lambda _ + (with-directory-excursion "../js/src/tests" + ;; The test suite expects a lightly patched ICU 67. Since + ;; Guix is about to switch to ICU 68, massage the tests to + ;; work with that instead of patching ICU. Try removing this + ;; phase for newer versions of mozjs. + + ;; These tests look up locale names and expects to get + ;; "GB" instead of "UK". + (substitute* "non262/Intl/DisplayNames/language.js" + (("Traditionell, GB") + "Traditionell, UK")) + (substitute* "non262/Intl/DisplayNames/region.js" + (("\"GB\": \"GB\"") + "\"GB\": \"UK\"")) + + ;; XXX: Some localized time formats have changed, and + ;; substitution fails for accented characters, even though + ;; it works in the REPL(?). Just delete these for now. + (delete-file "non262/Intl/Date/toLocaleString_timeZone.js") + (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js") + + ;; Similarly, these get an unexpected "A" suffix when looking + ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is + ;; tricky to substitute. + (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js") + (delete-file "non262/Intl/DateTimeFormat/format.js") + + ;; This file compares a generated list of ICU locale names + ;; with actual lookups. Some have changed slightly, i.e. + ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity. + (delete-file "non262/Intl/Locale/likely-subtags-generated.js")))) + (replace 'pre-check + (lambda _ + (with-directory-excursion "../js/src/tests" + (substitute* "shell/os.js" + ;; FIXME: Why does the killed process have an exit status? + ((".*killed process should not have exitStatus.*") + "")) + + ;; XXX: Delete all tests that test time zone functionality, + ;; because the test suite uses /etc/localtime to figure out + ;; the offset from the hardware clock, which does not work + ;; in the build container. See . + (delete-file-recursively "non262/Date") + (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js") + + (setenv "JSTESTS_EXTRA_ARGS" + (string-join + (list + ;; Do not run tests marked as "random". + "--exclude-random" + ;; Exclude web platform tests. + "--wpt=disabled" + ;; Respect the daemons configured number of jobs. + (string-append "--worker-count=" + (number->string + (parallel-job-count))))))))))))) (native-inputs (list autoconf-2.13 automake @@ -227,15 +315,7 @@ (define-public mozjs rust `(,rust "cargo"))) (inputs - (list icu4c readline zlib)) - (propagated-inputs - (list nspr)) ; in the Requires.private field of mozjs-*.pc - (home-page - "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey") - (synopsis "Mozilla javascript engine") - (description "SpiderMonkey is Mozilla's JavaScript engine written -in C/C++.") - (license license:mpl2.0))) ; and others for some files + (list icu4c readline zlib)))) (define mozilla-compare-locales (origin diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index 9a3703b196..38e7f36c2a 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -90,7 +90,7 @@ (define-public polkit-mozjs "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) (build-system gnu-build-system) (inputs - (list expat linux-pam elogind mozjs nspr)) + (list expat linux-pam elogind mozjs-78 nspr)) (propagated-inputs (list glib)) ; required by polkit-gobject-1.pc (native-inputs