From b2c39bd8e7f64e5173e2a5a786c67a310702f32d Mon Sep 17 00:00:00 2001 From: Jelle Licht Date: Tue, 14 Jan 2020 15:31:00 +0100 Subject: nongnu: Make leiningen self-contained. * nongnu/packages/clojure.scm (leiningen-jar): New variable. (leiningen): Use downloaded jar-file. --- nongnu/packages/clojure.scm | 87 ++++++++++++++++++++++++++++++++------------- 1 file changed, 62 insertions(+), 25 deletions(-) diff --git a/nongnu/packages/clojure.scm b/nongnu/packages/clojure.scm index 2b4c57c..dc770b0 100644 --- a/nongnu/packages/clojure.scm +++ b/nongnu/packages/clojure.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Pierre Neidhardt +;;; Copyright © 2020 Jelle Licht ;;; ;;; This file is not part of GNU Guix. ;;; @@ -18,39 +19,75 @@ (define-module (nongnu packages clojure) #: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 git-download) #:use-module ((guix licenses) #:prefix license:)) -(define-public leiningen +;; This is a hidden package, as it does not really serve a purpose on its own. +(define leiningen-jar (package - (name "leiningen") + (name "leiningen-jar") (version "2.9.1") (source (origin - (method url-fetch/tarbomb) - (uri (string-append - "https://github.com/technomancy/leiningen/archive/" - version ".tar.gz")) - (file-name (string-append name "-" version)) + (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 - "0acbmgs9sq6rc24b0ly2345pvyfky03s3gzmzvi98vsp0ys3khm4")))) - (build-system ant-build-system) + "1y2mva5s2w2szzn1b9rhz0dvkffls4ravii677ybcf2w9wd86z7a")))) + (build-system trivial-build-system) (arguments - `(#:phases - (modify-phases %standard-phases - (delete 'configure) - (delete 'build) - (delete 'check) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (install-file (string-append - "leiningen-" ,version "/bin/lein") - (string-append - (assoc-ref outputs "out") "/bin"))))))) + `(#: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 "Automating Clojure projects without setting your hair on fire") - (description "Leiningen is an easy way to use Clojure. With a focus -on project automation and declarative configuration, it gets out of your way -and lets you focus on your code.") + (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 + (package + (inherit leiningen-jar) + (name "leiningen") + (version "2.9.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/technomancy/leiningen.git") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0qv9vp6ypdilwv818fpwknr9sj40sz2vdcqxbd42m1l0ljjggiy1")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases (modify-phases %standard-phases + (delete 'configure) + (delete 'build) + (replace 'install + (lambda _ + (let* ((lein-pkg (string-append (assoc-ref %build-inputs "source") "/bin/lein-pkg")) + (lein-jar (string-append (assoc-ref %build-inputs "leiningen-jar") + "/share/leiningen-standalone.jar")) + (bin-dir (string-append %output "/bin")) + (lein (string-append bin-dir "/lein"))) + (mkdir-p bin-dir) + (copy-file lein-pkg lein) + (patch-shebang lein) + (chmod lein #o555) + (substitute* lein + (("LEIN_JAR=.*") (string-append "LEIN_JAR=" lein-jar))) + #t)))))) + (inputs + `(("leiningen-jar" ,leiningen-jar))))) -- cgit v1.2.3