[PATCH] gnu: clojure: Add wrapper.

  • Done
  • quality assurance status badge
Details
2 participants
  • Jesse Gibbons
  • Christopher Baines
Owner
unassigned
Submitted by
Jesse Gibbons
Severity
normal
J
J
Jesse Gibbons wrote on 22 Dec 2019 00:56
(name . guix-patches mailing list)(address . guix-patches@gnu.org)
0c8be989d029bb4e8590f579e0b550f4f6905a2a.camel@gmail.com
gnu/packages/clojure.scm: (clojure)[inputs]: Add icedtea.
[phases] {make-wrapper}: New phase.

---
gnu/packages/clojure.scm | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

Toggle diff (53 lines)
diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index a9cabfe008..85d8708eee 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Jesse Gibbons <jgibbons2357+guix@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
(define-module (gnu packages clojure)
#:use-module (gnu packages)
+ #:use-module (gnu packages java)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
@@ -77,6 +79,8 @@
(sha256
(base32
"1kcyv2836acs27vi75hvf3r773ahv2nlh9b3j9xa9m9sdanz1h83")))))
(build-system ant-build-system)
+ (inputs
+ `(("jre" ,icedtea)))
(arguments
`(#:imported-modules ((guix build clojure-utils)
(guix build guile-build-system)
@@ -113,7 +117,21 @@
(add-after 'install-license-files 'install-doc
(cut install-doc #:doc-dirs '("doc/clojure/") <...>))
(add-after 'install-doc 'install-javadoc
- (install-javadoc "target/javadoc/")))))
+ (install-javadoc "target/javadoc/"))
+ (add-after 'install 'make-wrapper
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (wrapper (string-append out "/bin/clojure")))
+ (mkdir-p (string-append out "/bin"))
+ (with-output-to-file wrapper
+ (lambda _
+ (display
+ (string-append
+ "#!/bin/sh\n\n"
+ (assoc-ref inputs "jre") "/bin/java -jar "
+ out "/share/java/clojure.jar \"$@\"\n"))))
+ (chmod wrapper #o555))
+ #t)))))
(native-inputs libraries)
(home-page "https://clojure.org/")
(synopsis "Lisp dialect running on the JVM")
C
C
Christopher Baines wrote on 20 Nov 2020 21:16
(name . Jesse Gibbons)(address . jgibbons2357@gmail.com)(address . 38704-done@debbugs.gnu.org)
87v9dzkcms.fsf@cbaines.net
Jesse Gibbons <jgibbons2357@gmail.com> writes:

Toggle quote (5 lines)
> gnu/packages/clojure.scm: (clojure)[inputs]: Add icedtea.
> [phases] {make-wrapper}: New phase.
>
> fixes: https://issues.guix.gnu.org/issue/32709

Hi Jesse,

Apologies for the long delay with this patch.

I tweaked the commit message, and the patch in one place and I've gone
ahead and pushed it to master as
d38903fab47fe333a99c68166e98e454d6e0e446.

Toggle quote (51 lines)
> ---
> gnu/packages/clojure.scm | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
> index a9cabfe008..85d8708eee 100644
> --- a/gnu/packages/clojure.scm
> +++ b/gnu/packages/clojure.scm
> @@ -2,6 +2,7 @@
> ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
> ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
> ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
> +;;; Copyright © 2019 Jesse Gibbons <jgibbons2357+guix@gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -20,6 +21,7 @@
>
> (define-module (gnu packages clojure)
> #:use-module (gnu packages)
> + #:use-module (gnu packages java)
> #:use-module ((guix licenses) #:prefix license:)
> #:use-module (guix packages)
> #:use-module (guix download)
> @@ -77,6 +79,8 @@
> (sha256
> (base32
> "1kcyv2836acs27vi75hvf3r773ahv2nlh9b3j9xa9m9sdanz1h83")))))
> (build-system ant-build-system)
> + (inputs
> + `(("jre" ,icedtea)))
> (arguments
> `(#:imported-modules ((guix build clojure-utils)
> (guix build guile-build-system)
> @@ -113,7 +117,21 @@
> (add-after 'install-license-files 'install-doc
> (cut install-doc #:doc-dirs '("doc/clojure/") <...>))
> (add-after 'install-doc 'install-javadoc
> - (install-javadoc "target/javadoc/")))))
> + (install-javadoc "target/javadoc/"))
> + (add-after 'install 'make-wrapper
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (wrapper (string-append out "/bin/clojure")))
> + (mkdir-p (string-append out "/bin"))
> + (with-output-to-file wrapper
> + (lambda _
> + (display
> + (string-append
> + "#!/bin/sh\n\n"

I used (which "sh") here rather than hardcoding /bin/sh, as then there's
no dependency on the changable /bin/sh.

Toggle quote (8 lines)
> + (assoc-ref inputs "jre") "/bin/java -jar "
> + out "/share/java/clojure.jar \"$@\"\n"))))
> + (chmod wrapper #o555))
> + #t)))))
> (native-inputs libraries)
> (home-page "https://clojure.org/")
> (synopsis "Lisp dialect running on the JVM")

Thanks again,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl+4JAtfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xf8Bg//SCMVPoDALDbo/45DZLkie8IN1wkIr0zN
AFOMithJ1AnEu8dY1fEGIv47y8cYRb6ftpyPLBwrA2XhLw2z9yIC7iI+R81TgroS
V0FOEskZrK/3loy7mbjCIvJEMBBYGoKxCrrdmqVgi9sSIKyqgXWOq4SAex9qY4SE
8CKM5VnmPNPqSLqG8llKlb/NBHuQFsjv8QZUS5WMfGsakMetKTtXOVmnpZdtUpP5
ZCriEODMr95Nzhe1PLJI0KkCyCpjIM0m2uE+on9dY1Uzx6hJY/JAmXS03KGKlS2z
7IQgHizFF5qzIIrDx1XVpp3ZJZx15LiTb9IxMTnn800qJuNmI2LmRyE5/Qls1R+U
fBpkmLsUXL+4RkH8kSKTzH7w+YRCmobsLeIewjGcdsyME8ThUUegcEwyQ9irsbbf
oDEpUebpMALigtr/WpcIYvBR80ruVESb6/oGVaVgef5tmeDshiFTl7C2lEUYAL/f
eQcebIMFgq96IJg8I9Vzil64Jcnzylwg/2bMMzWn13RNzjDDZVq5DDiNJaW6E5p4
MGkX6OQ29M7p01WbMGujDVGRK8z6VNBEOeSVPRAuBXWcy7IC82Vd7ATB5YGJ7b2h
XGDq8ZNdt2tPjxhhbEh80zpxc6EKAyrLWuWWzUzq6iWb/s6L81X9AqL+viFtu//C
ey3sw8WhjI8=
=oRhN
-----END PGP SIGNATURE-----

Closed
?