nongnu: Make leiningen self-contained.

* nongnu/packages/clojure.scm (leiningen-jar): New variable.
 (leiningen): Use downloaded jar-file.
This commit is contained in:
Jelle Licht 2020-01-14 15:31:00 +01:00
parent 95340b45c8
commit b2c39bd8e7
No known key found for this signature in database
GPG key ID: DA4597F947B41025

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz> ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2020 Jelle Licht <jlicht@fsfe.org>
;;; ;;;
;;; This file is not part of GNU Guix. ;;; This file is not part of GNU Guix.
;;; ;;;
@ -18,39 +19,75 @@
(define-module (nongnu packages clojure) (define-module (nongnu packages clojure)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix build-system ant) #:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)) #:use-module ((guix licenses) #:prefix license:))
;; This is a hidden package, as it does not really serve a purpose on its own.
(define leiningen-jar
(package
(name "leiningen-jar")
(version "2.9.1")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/technomancy/leiningen/releases/download/"
version "/leiningen-2.9.1-standalone.zip"))
(file-name "leiningen-standalone.jar")
(sha256
(base32
"1y2mva5s2w2szzn1b9rhz0dvkffls4ravii677ybcf2w9wd86z7a"))))
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder (begin
(use-modules (guix build utils))
(let ((source (assoc-ref %build-inputs "source"))
(jar-dir (string-append %output "/share/")))
(mkdir-p jar-dir)
(copy-file source
(string-append jar-dir "leiningen-standalone.jar"))))))
(home-page "https://leiningen.org")
(synopsis "Automate Clojure projects without setting your hair on fire")
(description "Leiningen is a Clojure tool with a focus on project
automation and declarative configuration. It gets out of your way and
lets you focus on your code.")
(license license:epl1.0)))
(define-public leiningen (define-public leiningen
(package (package
(inherit leiningen-jar)
(name "leiningen") (name "leiningen")
(version "2.9.1") (version "2.9.1")
(source (origin (source (origin
(method url-fetch/tarbomb) (method git-fetch)
(uri (string-append (uri (git-reference
"https://github.com/technomancy/leiningen/archive/" (url "https://github.com/technomancy/leiningen.git")
version ".tar.gz")) (commit version)))
(file-name (string-append name "-" version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"0acbmgs9sq6rc24b0ly2345pvyfky03s3gzmzvi98vsp0ys3khm4")))) "0qv9vp6ypdilwv818fpwknr9sj40sz2vdcqxbd42m1l0ljjggiy1"))))
(build-system ant-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:phases `(#:tests? #f
(modify-phases %standard-phases #:phases (modify-phases %standard-phases
(delete 'configure) (delete 'configure)
(delete 'build) (delete 'build)
(delete 'check)
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda _
(install-file (string-append (let* ((lein-pkg (string-append (assoc-ref %build-inputs "source") "/bin/lein-pkg"))
"leiningen-" ,version "/bin/lein") (lein-jar (string-append (assoc-ref %build-inputs "leiningen-jar")
(string-append "/share/leiningen-standalone.jar"))
(assoc-ref outputs "out") "/bin"))))))) (bin-dir (string-append %output "/bin"))
(home-page "https://leiningen.org") (lein (string-append bin-dir "/lein")))
(synopsis "Automating Clojure projects without setting your hair on fire") (mkdir-p bin-dir)
(description "Leiningen is an easy way to use Clojure. With a focus (copy-file lein-pkg lein)
on project automation and declarative configuration, it gets out of your way (patch-shebang lein)
and lets you focus on your code.") (chmod lein #o555)
(license license:epl1.0))) (substitute* lein
(("LEIN_JAR=.*") (string-append "LEIN_JAR=" lein-jar)))
#t))))))
(inputs
`(("leiningen-jar" ,leiningen-jar)))))