gnu: kdenlive: Add missing dependencies.
[jackhill/guix/guix.git] / gnu / packages / elixir.scm
index e154a2b..1b88186 100644 (file)
@@ -3,8 +3,8 @@
 ;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 nee <nee.git@cock.li>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Nikita <nikita@n0.is>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 (define-module (gnu packages elixir)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
-  #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (gnu packages)
-  #:use-module (gnu packages erlang)
-  #:use-module (gnu packages version-control))
+  #:use-module (gnu packages erlang))
 
 (define-public elixir
   (package
     (name "elixir")
-    (version "1.6.6")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/elixir-lang/elixir"
-                                  "/archive/v" version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0c9qz5hasa59a9x1iwpcqpqj6wdbzpijfxqfmzimwj5z8q37nl3l"))))
+    (version "1.10.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/elixir-lang/elixir")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "16j4rmm3ix088fvxhvyjqf1hnfg7wiwa87gml3b2mrwirdycbinv"))
+       (patches (search-patches "elixir-path-length.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
                                          (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'replace-paths
+         (add-after 'unpack 'make-git-checkout-writable
+           (lambda _
+             (for-each make-file-writable (find-files "."))
+             #t))
+         (add-after 'make-git-checkout-writable 'replace-paths
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                (substitute* '("lib/elixir/lib/system.ex"
                               "lib/mix/lib/mix/scm/git.ex")
                  (("(cmd\\(['\"])git" _ prefix)
                   (string-append prefix (which "git"))))
+               (substitute* '("lib/mix/lib/mix/release.ex"
+                              "lib/mix/lib/mix/tasks/release.init.ex")
+                 (("#!/bin/sh")
+                  (string-append "#!" (which "sh"))))
                (substitute* "bin/elixir"
-                 (("ERL_EXEC=\"erl\"")
-                  (string-append "ERL_EXEC=" (which "erl"))))
+                 (("ERTS_BIN=")
+                  (string-append
+                    "ERTS_BIN="
+                    ;; Elixir Releases will prepend to ERTS_BIN the path of a copy of erl.
+                    ;; We detect if a release is being generated by checking the initial ERTS_BIN
+                    ;; value: if it's empty, we are not in release mode and can point to the actual
+                    ;; erl binary in Guix store.
+                    "\nif [ -z \"$ERTS_BIN\" ]; then ERTS_BIN="
+                    (string-drop-right (which "erl") 3)
+                    "; fi")))
                (substitute* "bin/mix"
                  (("#!/usr/bin/env elixir")
                   (string-append "#!" out "/bin/elixir"))))
@@ -82,9 +99,8 @@
              #t))
          (delete 'configure))))
     (inputs
-     `(("erlang" ,erlang)
-       ("git" ,git)))
-    (home-page "http://elixir-lang.org/")
+     `(("erlang" ,erlang)))
+    (home-page "https://elixir-lang.org/")
     (synopsis "Elixir programming language")
     (description "Elixir is a dynamic, functional language used to build
 scalable and maintainable applications.  Elixir leverages the Erlang VM, known