mailmap: Update entries for Nikita.
[jackhill/guix/guix.git] / gnu / packages / elixir.scm
index 2a1d994..0613acf 100644 (file)
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 nee <nee.git@cock.li>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 ng0 <ng0@n0.is>
+;;; Copyright © 2018 Nikita <nikita@n0.is>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +24,7 @@
 (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)
 (define-public elixir
   (package
     (name "elixir")
-    (version "1.8.2")
-    (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
-                "0ddqxw24zdqlg7glzk22m7qjal8f18divzp364a6gi1bv6rg16yg"))
-             (patches (search-patches "elixir-path-length.patch"))))
+    (version "1.10.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/elixir-lang/elixir.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18bqqqzvhr1zj491wc3d36a310mg1wcs12npp70zfmgqrc60q65a"))
+       (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"))))