unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54021] [PATCH] Add rhino javascript package
@ 2022-02-16  1:58 Frank Pursel
  2022-02-16 17:00 ` Maxime Devos
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: Frank Pursel @ 2022-02-16  1:58 UTC (permalink / raw)
  To: 54021

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@gmail.com>
From: Frank Pursel <frank.pursel@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@nicolasgoaziou.fr>
 ;;; Copyright © 2021 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Frank Pursel <frank.pursel@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





^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-03-01 21:27 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
2022-02-16 17:00 ` Maxime Devos
2022-02-16 17:02 ` Maxime Devos
2022-02-16 17:08   ` Julien Lepiller
2022-02-16 17:08 ` Maxime Devos
2022-02-16 17:09 ` Maxime Devos
2022-02-16 17:21 ` Maxime Devos
2022-02-16 18:36   ` Frank Pursel
2022-02-16 18:43     ` Maxime Devos
2022-02-17  5:22 ` [bug#54021] [PATCH] Adding rhino package, revised patch Frank Pursel
2022-02-21 16:28   ` Maxime Devos
2022-02-18 20:42 ` [bug#54021] [PATCH] if, at first, you don't succeed Frank Pursel
2022-02-21 13:19   ` Efraim Flashner
2022-02-21 15:54 ` [bug#54021] [PATCH] Better rhino Frank Pursel
2022-02-21 18:45 ` [bug#54021] [PATCH] Removing all bundled jars prior to build Frank Pursel
2022-02-26 21:07   ` Julien Lepiller
2022-02-28 19:38 ` [bug#54021] [PATCH] package for rhino Frank Pursel
2022-02-28 20:45   ` Julien Lepiller
2022-02-28 21:45 ` [bug#54021] [PATCH] question -> answers Frank Pursel
2022-03-01 21:26   ` bug#54021: [PATCH] Add rhino javascript package Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).