From patchwork Thu Feb 17 05:22:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Pursel X-Patchwork-Id: 37288 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7236927BBEA; Thu, 17 Feb 2022 05:23:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D014927BBE9 for ; Thu, 17 Feb 2022 05:23:27 +0000 (GMT) Received: from localhost ([::1]:53852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKZGJ-0007xt-0e for patchwork@mira.cbaines.net; Thu, 17 Feb 2022 00:23:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKZG2-0007xf-S5 for guix-patches@gnu.org; Thu, 17 Feb 2022 00:23:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKZFu-0000AU-FO for guix-patches@gnu.org; Thu, 17 Feb 2022 00:23:10 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKZFu-0003bO-98 for guix-patches@gnu.org; Thu, 17 Feb 2022 00:23:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54021] [PATCH] Adding rhino package, revised patch References: <87pmnnr2qq.fsf@gmail.com> In-Reply-To: <87pmnnr2qq.fsf@gmail.com> Resent-From: Frank Pursel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Feb 2022 05:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54021 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54021@debbugs.gnu.org Received: via spool by 54021-submit@debbugs.gnu.org id=B54021.164507537013812 (code B ref 54021); Thu, 17 Feb 2022 05:23:02 +0000 Received: (at 54021) by debbugs.gnu.org; 17 Feb 2022 05:22:50 +0000 Received: from localhost ([127.0.0.1]:49838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKZFi-0003ah-6r for submit@debbugs.gnu.org; Thu, 17 Feb 2022 00:22:50 -0500 Received: from mail-pl1-f182.google.com ([209.85.214.182]:41487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKZFg-0003aU-8n for 54021@debbugs.gnu.org; Thu, 17 Feb 2022 00:22:48 -0500 Received: by mail-pl1-f182.google.com with SMTP id j4so3728505plj.8 for <54021@debbugs.gnu.org>; Wed, 16 Feb 2022 21:22:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=d2XuMP99wP9Aiii5Oog+yEd2WaH9UeHIJdthK/k5Wu4=; b=O0xBcp0wfX+qiGpEN8aYazhvriRgd5fT2IfxZcEWBtlmD4GUHyKTFCTH/mfasCXqX8 qIVRzf37uMRejpj9HqgINh8b+jBuSf4ihB4Zg0/PRE/taGuVUQipEw+G+QBUgsx/TEoe KTrnMN9/nBBakR9fohs2vz/uSnF8LfoUcjBY33RjnBrgxwqg+Ks8KoucXwxIP9Cprann C569iU1n8nFv7vkhEiPFLo6FURrldwOj8qlPHy8OnOg755lXNRhSbDGtvavJfJORDCeh vGhOSvPyA0IcHmUMxjPJHei4kBxnmgxeMOMwmPyjIVb6S+rx+8rYS2YBS+f03Q4iA3Wa hrBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=d2XuMP99wP9Aiii5Oog+yEd2WaH9UeHIJdthK/k5Wu4=; b=L6XhifZiSbzNZ7iuANY+o7QtqBML1Nt5OlnqzWCBA5+/mpau1GXwq7SmGF9EDQwCD2 4mQ4bSt5ZiLa0bf+2OfR9Jf1L9un87fah97t7DjajvP9pqY164sE57vKQGTDH2CuPB49 ZRXI8LMZ2cqkbiW2vI26GQDpaj34QmK/BnsRvKOy9Bc4GwGy6DbHIkcLZnA055E8dwHL by7PQTCYZpOsq/FMWbYWHlX74FgJb8R0kp3RqDh9y2GtPAOUykLf627XtDmkY/p/Gt2G 2eQjGWCX0vXgckOjzGMzCKJbMYrAdarFo79RZ4BUMBZ0knUmrjySF3yvGrkLpJh16elj uNtA== X-Gm-Message-State: AOAM5324ZRCbOFqjyjTDHYELjPTxvjo9vh7msedlA7POXGUK7NTOmUjE W27sI/140LTe69eyX/2z62c= X-Google-Smtp-Source: ABdhPJxjlxJa4lMxtLuEKS/ZPPaO7tKEH0PXoFEDjLk75Qz01raCHi//XFDSaPVnojCTz6SBL++ryw== X-Received: by 2002:a17:902:b112:b0:14d:b42c:d4bd with SMTP id q18-20020a170902b11200b0014db42cd4bdmr1274312plr.160.1645075362044; Wed, 16 Feb 2022 21:22:42 -0800 (PST) Received: from Ginko.local ([66.170.190.211]) by smtp.gmail.com with ESMTPSA id h14sm51133082pfh.95.2022.02.16.21.22.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 21:22:41 -0800 (PST) From: Frank Pursel Date: Wed, 16 Feb 2022 21:22:39 -0800 Message-ID: <87mtiqqd7k.fsf@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi, I've incorporated the feedback I've receive so far and worked to get the check phase to complete successfully but this effort is complicated by the default use of benchmarking and instrumentation. I don't think this additional instrumentation is appropriate to the check phase of this package. I can get testing to naively succeed using an alternate target but because this version of the software has had longterm and widespread experience I recommend that we simply be honest and set tests? to #f. That is what I've done here. Comments in the source describe choices I made that you might decide are undesirable. Let me know what you think. Regards, Frank From 84848769a9c40e770d7a29edf200292a04bdcb2e Mon Sep 17 00:00:00 2001 Message-Id: <84848769a9c40e770d7a29edf200292a04bdcb2e.1645075292.git.frank.pursel@gmail.com> From: Frank Pursel Date: Tue, 15 Feb 2022 14:07:28 -0800 Subject: [PATCH] Adding rhino javascript guix package. * guix/gnu/package/javascript.scm (rhino): Added package. --- gnu/packages/javascript.scm | 105 +++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm index c453ac432a..3068ce8197 100644 --- a/gnu/packages/javascript.scm +++ b/gnu/packages/javascript.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2018 Nicolas Goaziou ;;; Copyright © 2021 Pierre Neidhardt ;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2022 Frank Pursel ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,9 @@ (define-module (gnu packages javascript) #:use-module (gnu packages readline) #:use-module (gnu packages uglifyjs) #:use-module (gnu packages web) + #:use-module (gnu packages java) + #:use-module (gnu packages bash) + #:use-module (gnu packages perl) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) @@ -38,7 +42,9 @@ (define-module (gnu packages javascript) #:use-module (guix build-system cmake) #:use-module (guix build-system trivial) #:use-module (guix build-system minify) - #:use-module (guix utils)) + #:use-module (guix build-system ant) + #:use-module (guix utils) + #:use-module (guix gexp)) (define-public cjson (package @@ -788,3 +794,100 @@ (define-public duktape your build, and use the Duktape API to call ECMAScript functions from C code and vice versa.") (license license:expat))) + +(define-public rhino + (let* ((rel-ver "1.7.7.2") + (commit "935942527ff434b205e797df4185518e5369466e")) + (package + (name "rhino") + (version rel-ver) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/mozilla/rhino.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Identify bundled jars to maintain build purity + ;; remove bundled jars but those for testing + ;; all appear to be for testing or unused build system + ;; + ;; source/rhino [env]$ find . -name '*.jar' + ;; ./testsrc/org/mozilla/javascript/tests/commonjs/module/modules.jar + ;; ./testsrc/tests/src/jstests.jar + ;; ./gradle/wrapper/gradle-wrapper.jar + (format #t "~%~a~%" "Sourced jars") + (for-each + (lambda (f) (format #t "~/~a~%" f)) + (find-files "." ".*\\.jar$")) + #t)))) + (build-system ant-build-system) + (inputs (list bash-minimal)) + (native-inputs (list java-junit + java-hamcrest-core + java-snakeyaml ;Required for tests. + perl ;Required for 'jsdriver' check target. + )) + (arguments + `(#:tests? #f + ;; tests? currently fail + ;; the 'junit' target defaults to impure instrumentation and benchmarking. + ;; there is another target 'jsdriver' of unknown scope which succeeds + ;; As this pkg+ver has seen longstanding use, tests? are disabled. + #:phases (modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? inputs native-inputs #:allow-other-keys) + (when tests? + (setenv "ANT_OPTS" "-Doffline=true") + (let ((junit-lib (assoc-ref inputs "java-junit")) + (hamcrest-lib (assoc-ref inputs "java-hamcrest-core")) + (snakeyaml-lib (assoc-ref inputs "java-snakeyaml"))) + (with-directory-excursion "testsrc" + (substitute* "build.xml" + (("" all) + (string-append "")) + (("" all) + (string-append "")) + (("" all) + (string-append "")) + (("" all) + (string-append "")) + (("") + (string-append "")) + (("") + (string-append "")) + (("") + (string-append "")))) + ;; Check could alternatively invoke the jsdriver target here. + (invoke "ant" "junit"))))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (pkg+ver (string-append ,name ,version)) + (bin (string-append out "/bin")) + (rhino (string-append bin "/rhino"))) + (mkdir-p bin) + (install-file (string-append "build/" pkg+ver + "/js.jar") + (string-append out "/share/java")) + (with-output-to-file rhino + (lambda _ + (format #t "#!~a~%~a -jar ~a~%" + (search-input-file inputs "/bin/bash") + (search-input-file inputs "/bin/java") + (string-append out "/share/java/js.jar")))) + (chmod rhino #o755))))))) + (home-page "https://mozilla.github.io/rhino") + (synopsis "Javascript implemented in Java") + (description + "Rhino implements ECMAScript, also known as JavaScript, in Java as +specified in the fifth edition of ECMA-262") + (license license:mpl2.0)))) +