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

* [bug#54021] [PATCH] Add rhino javascript package
  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
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 17:00 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +                        (if tests?
> +                            (setenv "ANT_OPTS" "-Doffline=true")
> +                            (invoke "ant" "junit")) #t))

This does 'setenv' when tests?, and runs "ant junit" when (not tests?),
which doesn't seem useful.

Did you mean

  (when tests?
    (setenv ...)
    (invoke ...))

instead?  Also, you can drop the trailing #t, while they used to be
necessary, they don't have a meaning anymore and are gradually removed
from existing packages.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  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
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 17:02 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +      (inputs (list java-junit java-hamcrest-core
> +                    `(,icedtea "jdk")))

'java-junit' is for testing and icedtea:jdk is for building Java source
code to Jaa bytecode, so these seem 'native-inputs' to me.  The
distinction between 'inputs' and 'native-inputs' is cross-compiling.

I'm not familiar enough with rhino and java-hamcrest-core to tell if
'java-hamcrest-core' would be an input or a native-input.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  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 ` Maxime Devos
  2022-02-16 17:09 ` Maxime Devos
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 17:08 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +      (synopsis "Javascript implemented in java")

AFAICT, the standard spelling of JavaScript is JavaScript,
and the spelling of Java is Java, not java.

> +      (description
> +       "The Rhino engine, created primarily by Norris
> +Boyd (also at Netscape)

The author information is not important for people searching for
packages (using "guix search" or the like) satisfying their criteria.

>  is a JavaScript implementation written in
> +Java. Rhino is ECMA-262 Edition 5 compliant.")

The last sentence almost implies that rhino has been certified for
compliance or something.  Instead, I would write something like

‘Rhino implements ECMAScript, also known as JavaScript, as specified
in  the fifth edition of ECMA-262.’

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  2022-02-16 17:02 ` Maxime Devos
@ 2022-02-16 17:08   ` Julien Lepiller
  0 siblings, 0 replies; 20+ messages in thread
From: Julien Lepiller @ 2022-02-16 17:08 UTC (permalink / raw)
  To: 54021, maximedevos, frank.pursel

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

Hi!

Very cool work on rhino! It's a dependency I needed to work on kotlin's bootstrap :)

hamcrest-core is used by junit, so it should be a native-input too. Icedtea is useless here, because it's already an implicit input of the ant-build-system.

On February 16, 2022 6:02:38 PM GMT+01:00, Maxime Devos <maximedevos@telenet.be> wrote:
>Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
>> +      (inputs (list java-junit java-hamcrest-core
>> +                    `(,icedtea "jdk")))
>
>'java-junit' is for testing and icedtea:jdk is for building Java source
>code to Jaa bytecode, so these seem 'native-inputs' to me.  The
>distinction between 'inputs' and 'native-inputs' is cross-compiling.
>
>I'm not familiar enough with rhino and java-hamcrest-core to tell if
>'java-hamcrest-core' would be an input or a native-input.
>
>Greetings,
>Maxime.

[-- Attachment #2: Type: text/html, Size: 1403 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (2 preceding siblings ...)
  2022-02-16 17:08 ` Maxime Devos
@ 2022-02-16 17:09 ` Maxime Devos
  2022-02-16 17:21 ` Maxime Devos
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 17:09 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +                                      (which "java")

'which' looks in the native-inputs, which is incorrect here when cross-
compiling.   I suggest using '(search-input-file inputs "/bin/java")'
instead.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (3 preceding siblings ...)
  2022-02-16 17:09 ` Maxime Devos
@ 2022-02-16 17:21 ` Maxime Devos
  2022-02-16 18:36   ` Frank Pursel
  2022-02-17  5:22 ` [bug#54021] [PATCH] Adding rhino package, revised patch Frank Pursel
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 17:21 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 4853 bytes --]

Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> +(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"))

This is quite a bit more complicated than necessary ...

 * 'rel-git-tag' is unused.
 * Conventionally, a let-bound commit string has as name 'commit', not
   'git-commitv'.  (guix upstream) expects 'commit', not 'git-commitv',
   and will fail at auto-updating if a different name is used.
 * (see later)

> +    (package
> +      (name "rhino")
> +      (version git-short-commit)

'git-short-commit' is a (shortened) commit string, not a version
number.  This needs to be (version "1.7.7.2") instead.

> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/mozilla/rhino.git")
> +                      (commit git-short-commit)))

There is no need to shorten the commit string, you can use the full
"git-commitv" here.

> +                (file-name (git-file-name name git-short-commit))

We have a version number, so you can do (git-file-name name version)
here.

> +                (sha256
> +                 (base32
> +                  hash))))

The hash is only used in one place, so you can write it here directly.
This has as benefit that (guix packages) can do some checks on the hash
at compile time.

[...]

> +      (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))

Cleaning the source code of binaries, making sure that the source code
actually consists of source code, seems more something for origin
snippets.  It's not really explicitly mentioned anywhere I think,
but the following from ‘(guix)Snipepts versus Phases’ seems close:

The boundary between using an origin snippet versus a build phase to
modify the sources of a package can be elusive.  Origin snippets are
typically used to remove unwanted files such as bundled libraries,
nonfree sources, or to apply simple substitutions.  [...]

> +                    (replace 'install
> +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> +                        (let* ((out (assoc-ref outputs "out"))
> +                               (pkg+ver (string-append ,name ,rel-ver))

You can refer to the 'version' field of the package here:

  (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")

'bash-minimal' is missing from 'inputs'.  Not including it only works
when compiling natively.

> +                                      (which "java")
> +                                      (string-append out "/share/java/js.jar"))))


'format' has a port argument, so you could do

(call-with-output-file rhino
  (lambda (port)
    (format port "#!~a ~a -jar -a $@"
            (search-input-file [...]) [...])))

Also, what's this "$@"?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  2022-02-16 17:21 ` Maxime Devos
@ 2022-02-16 18:36   ` Frank Pursel
  2022-02-16 18:43     ` Maxime Devos
  0 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-16 18:36 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54021

[-- Attachment #1: Type: text/plain, Size: 4926 bytes --]

Thanks for the careful review.  The $@ was intended to allow the
introduction of additional command line arguments but since it starts a
repl and might be a source of nefariousness I've just removed it.  I did
not understand the bash-minimal comment.  Are you saying that
(search-input-file inputs "/bin/bash") will not work in the way I
intended?  I've changed all the inputs to native-inputs now.

I'll get back to you after I do some more testing.

Thank you for your helpful/thoughtful comments.

Regards,
Frank

On Wed, Feb 16, 2022 at 5:21 PM Maxime Devos <maximedevos@telenet.be> wrote:

> Frank Pursel schreef op di 15-02-2022 om 17:58 [-0800]:
> > +(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"))
>
> This is quite a bit more complicated than necessary ...
>
>  * 'rel-git-tag' is unused.
>  * Conventionally, a let-bound commit string has as name 'commit', not
>    'git-commitv'.  (guix upstream) expects 'commit', not 'git-commitv',
>    and will fail at auto-updating if a different name is used.
>  * (see later)
>
> > +    (package
> > +      (name "rhino")
> > +      (version git-short-commit)
>
> 'git-short-commit' is a (shortened) commit string, not a version
> number.  This needs to be (version "1.7.7.2") instead.
>
> > +      (source (origin
> > +                (method git-fetch)
> > +                (uri (git-reference
> > +                      (url "https://github.com/mozilla/rhino.git")
> > +                      (commit git-short-commit)))
>
> There is no need to shorten the commit string, you can use the full
> "git-commitv" here.
>
> > +                (file-name (git-file-name name git-short-commit))
>
> We have a version number, so you can do (git-file-name name version)
> here.
>
> > +                (sha256
> > +                 (base32
> > +                  hash))))
>
> The hash is only used in one place, so you can write it here directly.
> This has as benefit that (guix packages) can do some checks on the hash
> at compile time.
>
> [...]
>
> > +      (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))
>
> Cleaning the source code of binaries, making sure that the source code
> actually consists of source code, seems more something for origin
> snippets.  It's not really explicitly mentioned anywhere I think,
> but the following from ‘(guix)Snipepts versus Phases’ seems close:
>
> The boundary between using an origin snippet versus a build phase to
> modify the sources of a package can be elusive.  Origin snippets are
> typically used to remove unwanted files such as bundled libraries,
> nonfree sources, or to apply simple substitutions.  [...]
>
> > +                    (replace 'install
> > +                      (lambda* (#:key inputs outputs #:allow-other-keys)
> > +                        (let* ((out (assoc-ref outputs "out"))
> > +                               (pkg+ver (string-append ,name ,rel-ver))
>
> You can refer to the 'version' field of the package here:
>
>   (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")
>
> 'bash-minimal' is missing from 'inputs'.  Not including it only works
> when compiling natively.
>
> > +                                      (which "java")
> > +                                      (string-append out
> "/share/java/js.jar"))))
>
>
> 'format' has a port argument, so you could do
>
> (call-with-output-file rhino
>   (lambda (port)
>     (format port "#!~a ~a -jar -a $@"
>             (search-input-file [...]) [...])))
>
> Also, what's this "$@"?
>
> Greetings,
> Maxime.
>

[-- Attachment #2: Type: text/html, Size: 6963 bytes --]

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

* [bug#54021] [PATCH] Add rhino javascript package
  2022-02-16 18:36   ` Frank Pursel
@ 2022-02-16 18:43     ` Maxime Devos
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Devos @ 2022-02-16 18:43 UTC (permalink / raw)
  To: Frank Pursel; +Cc: 54021

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

Frank Pursel schreef op wo 16-02-2022 om 18:36 [+0000]:
> I did not understand the bash-minimal comment.  Are you saying that
> (search-input-file inputs "/bin/bash") will not work in the way I
> intended

'bash-minimal' (*) is an implicit native-input of ant-build-system.
When compiling natively, inputs and native-inputs are merged together
into 'inputs'.  As such, bash-minimal (and hence "/bin/bash") is
contained in 'inputs' when compiling natively.  So if you compiled
natively (most likely), then using (search-input-file inputs
"/bin/bash") this succeeds.

However, if cross-compiling with "guix build --target=aarch64-linux-
gnu" or the like (**), then the native-inputs and inputs are kept
separate, so 'inputs' would not contain bash, (search-input-file ...)
would fail by raising a &search-error exception and the build would
therefore fail.

This can be resolved by adding the 'bash-minimal' package to 'inputs'.

(*) Actually a variant of 'bash-minimal' but that does not matter here.
(**) This won't work _yet_ because 'ant-build-system' does not support
cross-compilation yet.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Adding rhino package, revised patch
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (4 preceding siblings ...)
  2022-02-16 17:21 ` Maxime Devos
@ 2022-02-17  5:22 ` 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
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-17  5:22 UTC (permalink / raw)
  To: 54021

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 <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 | 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 <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,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"
+                                (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"lib/emma.jar\"/>" all)
+                                 (string-append "<!-- " all " -->"))
+                                (("<pathelement path=\"lib/junit.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" junit-lib
+                                                "\" includes=\"**/*.jar\"/>"))
+                                (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" hamcrest-lib
+                                                "\" includes=\"**/*.jar\"/>"))
+                                (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                                 (string-append "<fileset dir=\"" snakeyaml-lib
+                                                "\" includes=\"**/*.jar\"/>"))))
+                            ;; 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))))
+
-- 
2.34.0







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

* [bug#54021] [PATCH] if, at first, you don't succeed...
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (5 preceding siblings ...)
  2022-02-17  5:22 ` [bug#54021] [PATCH] Adding rhino package, revised patch Frank Pursel
@ 2022-02-18 20:42 ` Frank Pursel
  2022-02-21 13:19   ` Efraim Flashner
  2022-02-21 15:54 ` [bug#54021] [PATCH] Better rhino Frank Pursel
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-18 20:42 UTC (permalink / raw)
  To: 54021

Hi,

I think this addresses all the identified issues and, best of all, does it
with a now, meaningful check phase.

Regards,
Frank

From e45fd6a53579327667067ca0642e97d0cb373d5c Mon Sep 17 00:00:00 2001
Message-Id: <e45fd6a53579327667067ca0642e97d0cb373d5c.1645216890.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 | 106 +++++++++++++++++++++++++++++++++++-
 1 file changed, 105 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index c453ac432a..158abaded7 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,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,101 @@ (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
+                            ;; Remove benchmark testing
+                            (with-directory-excursion
+                                "testsrc"
+                              (delete-file-recursively "benchmarks"))
+                            (with-directory-excursion
+                             "testsrc/org/mozilla/javascript"
+                             (delete-file-recursively "benchmarks"))
+                            ;; Identify bundled jars
+                            (format #t "~%~a~%" "Sourced jars")
+                            (for-each (lambda (f)
+                                        (format #t "~/~a~%" f))
+                                      (find-files "." ".*\\.jar$"))))))
+      (build-system ant-build-system)
+      (inputs (list bash-minimal))
+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
+      (arguments
+       `(#: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"
+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
+                        (string-append
+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                        (string-append "<fileset dir=\"" hamcrest-lib
+                                       "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                        (string-append "<fileset dir=\"" snakeyaml-lib
+                         "\" includes=\"**/*.jar\"/>"))
+                       ;; Disabling instrumentation.
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
+                        (string-append pre "\">"))))
+                   (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"))
+                               (man (string-append out "/share/man/man1")))
+                          (mkdir-p bin)
+                          (with-directory-excursion "man"
+                            (install-file "rhino.1" man))
+                          (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))))
+
-- 
2.34.0





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

* [bug#54021] [PATCH] if, at first, you don't succeed...
  2022-02-18 20:42 ` [bug#54021] [PATCH] if, at first, you don't succeed Frank Pursel
@ 2022-02-21 13:19   ` Efraim Flashner
  0 siblings, 0 replies; 20+ messages in thread
From: Efraim Flashner @ 2022-02-21 13:19 UTC (permalink / raw)
  To: Frank Pursel; +Cc: 54021

[-- Attachment #1: Type: text/plain, Size: 8496 bytes --]

On Fri, Feb 18, 2022 at 12:42:16PM -0800, Frank Pursel wrote:
> Hi,
> 
> I think this addresses all the identified issues and, best of all, does it
> with a now, meaningful check phase.

Very nice!

> Regards,
> Frank
> 
> From e45fd6a53579327667067ca0642e97d0cb373d5c Mon Sep 17 00:00:00 2001
> Message-Id: <e45fd6a53579327667067ca0642e97d0cb373d5c.1645216890.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 | 106 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 105 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
> index c453ac432a..158abaded7 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,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)

Please sort the (gnu packages ...) alphabetically :)

>    #: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,101 @@ (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"))

rel-ver and commit can actually go in version and commit respectively,
they don't need to be separated out at the top.

> +    (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
> +                            ;; Remove benchmark testing
> +                            (with-directory-excursion
> +                                "testsrc"
> +                              (delete-file-recursively "benchmarks"))

This can be (delete-file-recursively "testsrc/benchmarks"). Similar with
the one below it.

> +                            (with-directory-excursion
> +                             "testsrc/org/mozilla/javascript"
> +                             (delete-file-recursively "benchmarks"))
> +                            ;; Identify bundled jars
> +                            (format #t "~%~a~%" "Sourced jars")
> +                            (for-each (lambda (f)
> +                                        (format #t "~/~a~%" f))
> +                                      (find-files "." ".*\\.jar$"))))))

This one is small, in find-files you don't need the leading '.*' before
\\.jar$

> +      (build-system ant-build-system)
> +      (inputs (list bash-minimal))
> +      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
> +      (arguments
> +       `(#: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"
> +                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"lib/emma.jar\"/>" all)
> +                        (string-append "<!-- " all " -->"))
> +                       (("<pathelement path=\"lib/junit.jar\" ?/>")
> +                        (string-append
> +                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
> +                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
> +                        (string-append "<fileset dir=\"" hamcrest-lib
> +                                       "\" includes=\"**/*.jar\"/>"))
> +                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
> +                        (string-append "<fileset dir=\"" snakeyaml-lib
> +                         "\" includes=\"**/*.jar\"/>"))
> +                       ;; Disabling instrumentation.
> +                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
> +                        (string-append pre "\">"))))
> +                   (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"))
> +                               (man (string-append out "/share/man/man1")))
> +                          (mkdir-p bin)
> +                          (with-directory-excursion "man"
> +                            (install-file "rhino.1" man))

This one can just be (install-file "man/rhino.1" man)

> +                          (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")

Needs a period at the end of the description.

> +      (license license:mpl2.0))))
> +
> -- 
> 2.34.0
> 
> 
> 
> 

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [bug#54021] [PATCH] Better rhino
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (6 preceding siblings ...)
  2022-02-18 20:42 ` [bug#54021] [PATCH] if, at first, you don't succeed Frank Pursel
@ 2022-02-21 15:54 ` Frank Pursel
  2022-02-21 18:45 ` [bug#54021] [PATCH] Removing all bundled jars prior to build Frank Pursel
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Frank Pursel @ 2022-02-21 15:54 UTC (permalink / raw)
  To: 54021

Efraim,

Thank you for your comments.  I always wonder what is preferred here --
a clean single patch or the diff of changes.  Here I'm providing the
diff; if you would like me to create a single patch I'm happy to provide
it.

Regards,
Frank

From 135ea5541a9a5e4e009b9ee90eae36bec2b74dce Mon Sep 17 00:00:00 2001
Message-Id: <135ea5541a9a5e4e009b9ee90eae36bec2b74dce.1645458837.git.frank.pursel@gmail.com>
From: Frank Pursel <frank.pursel@gmail.com>
Date: Mon, 21 Feb 2022 07:48:07 -0800
Subject: [PATCH] Additional refinements.

---
 gnu/packages/javascript.scm | 44 ++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 158abaded7..d8ebee3c3f 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -27,24 +27,22 @@ (define-module (gnu packages javascript)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages node)
   #: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)
-  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system trivial)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system minify)
-  #:use-module (guix build-system ant)
-  #:use-module (guix utils)
-  #:use-module (guix gexp))
+  #:use-module (guix build-system trivial)
+  #:use-module (guix utils))
 
 (define-public cjson
   (package
@@ -796,16 +794,14 @@ (define-public duktape
     (license license:expat)))
 
 (define-public rhino
-  (let* ((rel-ver "1.7.7.2")
-         (commit "935942527ff434b205e797df4185518e5369466e"))
     (package
       (name "rhino")
-      (version rel-ver)
+      (version "1.7.7.2")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
                       (url "https://github.com/mozilla/rhino.git")
-                      (commit commit)))
+                      (commit "935942527ff434b205e797df4185518e5369466e")))
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
@@ -813,17 +809,14 @@ (define-public rhino
                 (modules '((guix build utils)))
                 (snippet '(begin
                             ;; Remove benchmark testing
-                            (with-directory-excursion
-                                "testsrc"
-                              (delete-file-recursively "benchmarks"))
-                            (with-directory-excursion
-                             "testsrc/org/mozilla/javascript"
-                             (delete-file-recursively "benchmarks"))
+                            (delete-file-recursively "testsrc/benchmarks")
+                            (delete-file-recursively
+                             "testsrc/org/mozilla/javascript/benchmarks")
                             ;; Identify bundled jars
                             (format #t "~%~a~%" "Sourced jars")
                             (for-each (lambda (f)
                                         (format #t "~/~a~%" f))
-                                      (find-files "." ".*\\.jar$"))))))
+                                      (find-files "." "\\.jar$"))))))
       (build-system ant-build-system)
       (inputs (list bash-minimal))
       (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
@@ -848,7 +841,8 @@ (define-public rhino
                         (string-append "<!-- " all " -->"))
                        (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
                         (string-append "<!-- " all " -->"))
-                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>" all)
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
+                         all)
                         (string-append "<!-- " all " -->"))
                        (("<pathelement path=\"lib/emma.jar\"/>" all)
                         (string-append "<!-- " all " -->"))
@@ -862,7 +856,8 @@ (define-public rhino
                         (string-append "<fileset dir=\"" snakeyaml-lib
                          "\" includes=\"**/*.jar\"/>"))
                        ;; Disabling instrumentation.
-                       (("(<target name=\"junit\" depends=\"junit-compile),.*" all pre)
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
+                         all pre)
                         (string-append pre "\">"))))
                    (invoke "ant" "junit")))))
            (replace 'install
@@ -873,8 +868,7 @@ (define-public rhino
                                (rhino (string-append bin "/rhino"))
                                (man (string-append out "/share/man/man1")))
                           (mkdir-p bin)
-                          (with-directory-excursion "man"
-                            (install-file "rhino.1" man))
+                          (install-file "man/rhino.1" man)
                           (install-file (string-append "build/" pkg+ver
                                                        "/js.jar")
                                         (string-append out "/share/java"))
@@ -889,6 +883,6 @@ (define-public 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))))
+specified in the fifth edition of ECMA-262.")
+      (license license:mpl2.0)))
 
-- 
2.34.0






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

* [bug#54021] [PATCH] Adding rhino package, revised patch
  2022-02-17  5:22 ` [bug#54021] [PATCH] Adding rhino package, revised patch Frank Pursel
@ 2022-02-21 16:28   ` Maxime Devos
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Devos @ 2022-02-21 16:28 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

Frank Pursel schreef op wo 16-02-2022 om 21:22 [-0800]:
> +                    ;; Identify bundled jars to maintain build purity
> +                    ;; remove bundled jars but those for testing

Jars for testing need to be removed too, they could influence the build
by modifying source files etc. when run.

Also, some licenses (e.g. GPL) require you to to publish the source
code whenever binaries are published.  I don't know if this is the
case for the bundled jars, rhino or dependents of rhino, but it's
simplest to just remove the binaries.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54021] [PATCH] Removing all bundled jars prior to build.
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (7 preceding siblings ...)
  2022-02-21 15:54 ` [bug#54021] [PATCH] Better rhino Frank Pursel
@ 2022-02-21 18:45 ` 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 21:45 ` [bug#54021] [PATCH] question -> answers Frank Pursel
  10 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-21 18:45 UTC (permalink / raw)
  To: 54021

Maxime,

Bundled jars removed.

Regards,
Frank

From 7aaefc20bfdbe85dd65fff4ed3d0683cab994b98 Mon Sep 17 00:00:00 2001
Message-Id: <7aaefc20bfdbe85dd65fff4ed3d0683cab994b98.1645469136.git.frank.pursel@gmail.com>
From: Frank Pursel <frank.pursel@gmail.com>
Date: Mon, 21 Feb 2022 10:43:07 -0800
Subject: [PATCH] Removed all pre-bundled jars.

---
 gnu/packages/javascript.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index d8ebee3c3f..bdeeb03a58 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -815,7 +815,8 @@ (define-public rhino
                             ;; Identify bundled jars
                             (format #t "~%~a~%" "Sourced jars")
                             (for-each (lambda (f)
-                                        (format #t "~/~a~%" f))
+                                        (format #t "~/Deleting: ~a~%" f)
+                                        (delete-file f))
                                       (find-files "." "\\.jar$"))))))
       (build-system ant-build-system)
       (inputs (list bash-minimal))
-- 
2.34.0





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

* [bug#54021] [PATCH] Removing all bundled jars prior to build.
  2022-02-21 18:45 ` [bug#54021] [PATCH] Removing all bundled jars prior to build Frank Pursel
@ 2022-02-26 21:07   ` Julien Lepiller
  0 siblings, 0 replies; 20+ messages in thread
From: Julien Lepiller @ 2022-02-26 21:07 UTC (permalink / raw)
  To: Frank Pursel; +Cc: 54021

Hi Frank,

could you send the complete patch? This would be easier to then test
and apply/comment.

Thanks!

Le Mon, 21 Feb 2022 10:45:59 -0800,
Frank Pursel <frank.pursel@gmail.com> a écrit :

> Maxime,
> 
> Bundled jars removed.
> 
> Regards,
> Frank
> 
> From 7aaefc20bfdbe85dd65fff4ed3d0683cab994b98 Mon Sep 17 00:00:00 2001
> Message-Id:
> <7aaefc20bfdbe85dd65fff4ed3d0683cab994b98.1645469136.git.frank.pursel@gmail.com>
> From: Frank Pursel <frank.pursel@gmail.com> Date: Mon, 21 Feb 2022
> 10:43:07 -0800 Subject: [PATCH] Removed all pre-bundled jars.
> 
> ---
>  gnu/packages/javascript.scm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
> index d8ebee3c3f..bdeeb03a58 100644
> --- a/gnu/packages/javascript.scm
> +++ b/gnu/packages/javascript.scm
> @@ -815,7 +815,8 @@ (define-public rhino
>                              ;; Identify bundled jars
>                              (format #t "~%~a~%" "Sourced jars")
>                              (for-each (lambda (f)
> -                                        (format #t "~/~a~%" f))
> +                                        (format #t "~/Deleting:
> ~a~%" f)
> +                                        (delete-file f))
>                                        (find-files "." "\\.jar$"))))))
>        (build-system ant-build-system)
>        (inputs (list bash-minimal))





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

* [bug#54021] [PATCH] package for rhino
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (8 preceding siblings ...)
  2022-02-21 18:45 ` [bug#54021] [PATCH] Removing all bundled jars prior to build Frank Pursel
@ 2022-02-28 19:38 ` Frank Pursel
  2022-02-28 20:45   ` Julien Lepiller
  2022-02-28 21:45 ` [bug#54021] [PATCH] question -> answers Frank Pursel
  10 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-28 19:38 UTC (permalink / raw)
  To: 54021

Julien,

A single patch, to rule them all, as requested. :) This patch should add
the rhino package to the existing javascript.scm file.  I think all the
issues have been addressed.  Thank you for your patience.

Regards,
Frank

From a422095cf0ac8778936661952d375abd35293253 Mon Sep 17 00:00:00 2001
Message-Id: <a422095cf0ac8778936661952d375abd35293253.1646075744.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 | 103 +++++++++++++++++++++++++++++++++++-
 1 file changed, 101 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 779ffcb7b8..68d338de8d 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.
 ;;;
@@ -26,7 +27,9 @@ (define-module (gnu packages javascript)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages node)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages uglifyjs)
@@ -34,10 +37,11 @@ (define-module (gnu packages javascript)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system trivial)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system minify)
+  #:use-module (guix build-system trivial)
   #:use-module (guix utils))
 
 (define-public cjson
@@ -791,3 +795,98 @@ (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
+    (package
+      (name "rhino")
+      (version "1.7.7.2")
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mozilla/rhino.git")
+                      (commit "935942527ff434b205e797df4185518e5369466e")))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
+                (modules '((guix build utils)))
+                (snippet '(begin
+                            ;; Remove benchmark testing
+                            (delete-file-recursively "testsrc/benchmarks")
+                            (delete-file-recursively
+                             "testsrc/org/mozilla/javascript/benchmarks")
+                            ;; Identify bundled jars
+                            (format #t "~%~a~%" "Sourced jars")
+                            (for-each (lambda (f)
+                                        (format #t "~/Deleting: ~a~%" f)
+                                        (delete-file f))
+                                      (find-files "." "\\.jar$"))))))
+      (build-system ant-build-system)
+      (inputs (list bash-minimal))
+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
+      (arguments
+       `(#: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"
+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
+                         all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
+                        (string-append "<!-- " all " -->"))
+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
+                        (string-append
+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
+                        (string-append "<fileset dir=\"" hamcrest-lib
+                                       "\" includes=\"**/*.jar\"/>"))
+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
+                        (string-append "<fileset dir=\"" snakeyaml-lib
+                         "\" includes=\"**/*.jar\"/>"))
+                       ;; Disabling instrumentation.
+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
+                         all pre)
+                        (string-append pre "\">"))))
+                   (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"))
+                               (man (string-append out "/share/man/man1")))
+                          (mkdir-p bin)
+                          (install-file "man/rhino.1" man)
+                          (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)))
+
-- 
2.34.0





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

* [bug#54021] [PATCH] package for rhino
  2022-02-28 19:38 ` [bug#54021] [PATCH] package for rhino Frank Pursel
@ 2022-02-28 20:45   ` Julien Lepiller
  0 siblings, 0 replies; 20+ messages in thread
From: Julien Lepiller @ 2022-02-28 20:45 UTC (permalink / raw)
  To: Frank Pursel, 54021

[-- Attachment #1: Type: text/plain, Size: 8203 bytes --]

Thanks!

I guess my only question remaining is why package this version instead of the latest, 1.7.15?

Also the commit message should be:

gnu: Add rhino.

* gnu/packages/javascript.scm (rhino): New variable

You didn't change the synopsis to spell JavaScript properly. Other than that, it's fine with me. We can take care of that, no need to resend a patch, unless Maxime has other comments :)

On February 28, 2022 8:38:39 PM GMT+01:00, Frank Pursel <frank.pursel@gmail.com> wrote:
>Julien,
>
>A single patch, to rule them all, as requested. :) This patch should add
>the rhino package to the existing javascript.scm file.  I think all the
>issues have been addressed.  Thank you for your patience.
>
>Regards,
>Frank
>
>From a422095cf0ac8778936661952d375abd35293253 Mon Sep 17 00:00:00 2001
>Message-Id: <a422095cf0ac8778936661952d375abd35293253.1646075744.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 | 103 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 101 insertions(+), 2 deletions(-)
>
>diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
>index 779ffcb7b8..68d338de8d 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.
> ;;;
>@@ -26,7 +27,9 @@ (define-module (gnu packages javascript)
>   #:use-module ((guix licenses) #:prefix license:)
>   #:use-module (gnu packages)
>   #:use-module (gnu packages base)
>+  #:use-module (gnu packages bash)
>   #:use-module (gnu packages compression)
>+  #:use-module (gnu packages java)
>   #:use-module (gnu packages node)
>   #:use-module (gnu packages readline)
>   #:use-module (gnu packages uglifyjs)
>@@ -34,10 +37,11 @@ (define-module (gnu packages javascript)
>   #:use-module (guix packages)
>   #:use-module (guix download)
>   #:use-module (guix git-download)
>-  #:use-module (guix build-system gnu)
>+  #:use-module (guix build-system ant)
>   #:use-module (guix build-system cmake)
>-  #:use-module (guix build-system trivial)
>+  #:use-module (guix build-system gnu)
>   #:use-module (guix build-system minify)
>+  #:use-module (guix build-system trivial)
>   #:use-module (guix utils))
> 
> (define-public cjson
>@@ -791,3 +795,98 @@ (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
>+    (package
>+      (name "rhino")
>+      (version "1.7.7.2")
>+      (source (origin
>+                (method git-fetch)
>+                (uri (git-reference
>+                      (url "https://github.com/mozilla/rhino.git")
>+                      (commit "935942527ff434b205e797df4185518e5369466e")))
>+                (file-name (git-file-name name version))
>+                (sha256
>+                 (base32
>+                  "09i4yr98hs6855fs7fhgmrpiwpr90lhxdv2bvfj97nn4rv1d7wl8"))
>+                (modules '((guix build utils)))
>+                (snippet '(begin
>+                            ;; Remove benchmark testing
>+                            (delete-file-recursively "testsrc/benchmarks")
>+                            (delete-file-recursively
>+                             "testsrc/org/mozilla/javascript/benchmarks")
>+                            ;; Identify bundled jars
>+                            (format #t "~%~a~%" "Sourced jars")
>+                            (for-each (lambda (f)
>+                                        (format #t "~/Deleting: ~a~%" f)
>+                                        (delete-file f))
>+                                      (find-files "." "\\.jar$"))))))
>+      (build-system ant-build-system)
>+      (inputs (list bash-minimal))
>+      (native-inputs (list java-junit java-hamcrest-core java-snakeyaml))
>+      (arguments
>+       `(#: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"
>+                       (("<pathelement location=\"\\$\\{xbean.jar\\}\" */>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement location=\"\\$\\{jsr173.jar\\}\" */>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"\\$\\{coverage.classes.dir\\}\" */>"
>+                         all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"lib/emma.jar\"/>" all)
>+                        (string-append "<!-- " all " -->"))
>+                       (("<pathelement path=\"lib/junit.jar\" ?/>")
>+                        (string-append
>+                         "<fileset dir=\"" junit-lib "\" includes=\"**/*.jar\"/>"))
>+                       (("<pathelement path=\"lib/hamcrest.jar\" ?/>")
>+                        (string-append "<fileset dir=\"" hamcrest-lib
>+                                       "\" includes=\"**/*.jar\"/>"))
>+                       (("<pathelement path=\"lib/snakeyaml.jar\" ?/>")
>+                        (string-append "<fileset dir=\"" snakeyaml-lib
>+                         "\" includes=\"**/*.jar\"/>"))
>+                       ;; Disabling instrumentation.
>+                       (("(<target name=\"junit\" depends=\"junit-compile),.*"
>+                         all pre)
>+                        (string-append pre "\">"))))
>+                   (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"))
>+                               (man (string-append out "/share/man/man1")))
>+                          (mkdir-p bin)
>+                          (install-file "man/rhino.1" man)
>+                          (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)))
>+
>-- 
>2.34.0
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 8798 bytes --]

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

* [bug#54021] [PATCH] question -> answers
  2022-02-16  1:58 [bug#54021] [PATCH] Add rhino javascript package Frank Pursel
                   ` (9 preceding siblings ...)
  2022-02-28 19:38 ` [bug#54021] [PATCH] package for rhino Frank Pursel
@ 2022-02-28 21:45 ` Frank Pursel
  2022-03-01 21:26   ` bug#54021: [PATCH] Add rhino javascript package Julien Lepiller
  10 siblings, 1 reply; 20+ messages in thread
From: Frank Pursel @ 2022-02-28 21:45 UTC (permalink / raw)
  To: 54021

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






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

* bug#54021: [PATCH] Add rhino javascript package
  2022-02-28 21:45 ` [bug#54021] [PATCH] question -> answers Frank Pursel
@ 2022-03-01 21:26   ` Julien Lepiller
  0 siblings, 0 replies; 20+ messages in thread
From: Julien Lepiller @ 2022-03-01 21:26 UTC (permalink / raw)
  To: Frank Pursel; +Cc: 54021-done

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@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
> 
> 
> 
> 
> 





^ permalink raw reply	[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).