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.
Message #41 received at 54021 <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: Frank Pursel <frank.pursel <at> gmail.com> Cc: 54021 <at> debbugs.gnu.org Subject: Re: [bug#54021] [PATCH] if, at first, you don't succeed... Date: Mon, 21 Feb 2022 15:19:00 +0200
[Message part 1 (text/plain, inline)]
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 <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 | 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 <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,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 <at> 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
[signature.asc (application/pgp-signature, inline)]
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.