GNU bug report logs - #54021
[PATCH] Add rhino javascript package

Previous Next

Package: guix-patches;

Reported by: Frank Pursel <frank.pursel <at> gmail.com>

Date: Wed, 16 Feb 2022 02:00:02 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Frank Pursel <frank.pursel <at> gmail.com>
Subject: bug#54021: closed (Re: [bug#54021] [PATCH] Add rhino javascript
 package)
Date: Tue, 01 Mar 2022 21:27:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#54021: [PATCH] Add rhino javascript package

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 54021 <at> debbugs.gnu.org.

-- 
54021: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54021
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Julien Lepiller <julien <at> lepiller.eu>
To: Frank Pursel <frank.pursel <at> gmail.com>
Cc: 54021-done <at> debbugs.gnu.org
Subject: Re: [bug#54021] [PATCH] Add rhino javascript package
Date: Tue, 1 Mar 2022 22:26:01 +0100
Thanks for the answer (I didn't spot your message immediately because
you renamed the subject). I suppose this is good for now, especially
since I need a version of rhino for kotlin, which I need for gradle,
which we would need for future versions of rhino :)

Pushed to master as 22525731fdbfeebfc51d17dc6674a92d75383213, thanks!

Le Mon, 28 Feb 2022 13:45:58 -0800,
Frank Pursel <frank.pursel <at> gmail.com> a écrit :

> Julien,
> 
> I missed the JavaScript in the synopsis, my fault; I did get the one
> in the description.
> 
> Why the older version?  A couple of reasons.  First, is that I'm
> trying to address the problems that have been pointed out with my
> earlier patches for a ditaa package.  'ditaa' has a sequence of
> dependencies that lead to the version of rhino I've packaged.  I
> looked at the latest version too (because that would certainly be a
> good thing) but newer releases of rhino have transitioned to the
> gradle build system.  I have experience with ant that I can use but
> none, yet, with gradle.  Plus, and this may be naive, I thought it
> might be a good experiment (perhaps even better for guix) to see if a
> guix transformation based on this ant build could build one of the
> later rhino versions that otherwise would require gradle.  I may
> pursue such experiments later after I achieve my first goal, which is
> to package ditaa.  I also think there is a risk that the latest
> version of rhino will not work with ditaa as the one we are packaging
> does.
> 
> If I can suceed with rhino and my more recent submission of xalan
> then I will have a clean build of batik that will allow ditaa to be
> built properly using only guix quality, built-from-source, libraries.
>  That is my current small guix ambition.    
> 
> Regards,
> Frank
> 
> 
> 
> 
> 


[Message part 3 (message/rfc822, inline)]
From: Frank Pursel <frank.pursel <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] Add rhino javascript package
Date: Tue, 15 Feb 2022 17:58:53 -0800
Hi,

Rhino javascript has been around a long time.  It has also been built
upon by many others.  I needed to build this version for another package
and wanted to send it on as it might be useful.

Regards,
Frank


From c386b47786fc318cdfa0b1157a22590ebc279460 Mon Sep 17 00:00:00 2001
Message-Id: <c386b47786fc318cdfa0b1157a22590ebc279460.1644976508.git.frank.pursel <at> gmail.com>
From: Frank Pursel <frank.pursel <at> gmail.com>
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 | 65 +++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index c453ac432a..e9db0d2ce6 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail <at> ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (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 (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -38,6 +40,7 @@ (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 build-system ant)
   #:use-module (guix utils))
 
 (define-public cjson
@@ -788,3 +791,65 @@ (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") (rel-git-tag "Rhino1_7_7_2_Release")
+         (git-commitv "935942527ff434b205e797df4185518e5369466e")
+         (git-short-commit (substring git-commitv 0 6))
+         (hash "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+    (package
+      (name "rhino")
+      (version git-short-commit)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit git-short-commit)))
+                (file-name (git-file-name name git-short-commit))
+                (sha256
+                 (base32
+                  hash))))
+      (build-system ant-build-system)
+      (inputs (list java-junit java-hamcrest-core
+                    `(,icedtea "jdk")))
+      (arguments
+       `(#:phases (modify-phases %standard-phases
+                    (add-after 'unpack 'clean-jars
+                      (lambda _
+                        (for-each (lambda (jarf)
+                                    (delete-file jarf)
+                                    (format #t "Deleted: ~s
+" jarf))
+                                  (find-files "." ".*\\.jar$")) #t))
+                    (replace 'check
+                      (lambda* (#:key tests? #:allow-other-keys)
+                        (if tests?
+                            (setenv "ANT_OPTS" "-Doffline=true")
+                            (invoke "ant" "junit")) #t))
+                    (replace 'install
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (pkg+ver (string-append ,name ,rel-ver))
+                               (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")
+                                      (which "java")
+                                      (string-append out "/share/java/js.jar"))))
+                          (chmod rhino #o755) #t))))))
+      (home-page "https://mozilla.github.io/rhino")
+      (synopsis "Javascript implemented in java")
+      (description
+       "The Rhino engine, created primarily by Norris
+Boyd (also at Netscape) is a JavaScript implementation written in
+Java. Rhino is ECMA-262 Edition 5 compliant.")
+      (license license:mpl2.0))))
+
-- 
2.34.0




This bug report was last modified 3 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.