gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / elixir.scm
CommitLineData
0a4ebe01
PP
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
151960e4 3;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
0a4ebe01 4;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
6de3d176 5;;; Copyright © 2017 nee <nee.git@cock.li>
c2265e02 6;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
3c986a7d 7;;; Copyright © 2018 Nikita <nikita@n0.is>
d485ef5c 8;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
0a4ebe01
PP
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages elixir)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix build-system gnu)
cadf846b 28 #:use-module (guix git-download)
0a4ebe01
PP
29 #:use-module (guix packages)
30 #:use-module (gnu packages)
a3e26863
JL
31 #:use-module (gnu packages erlang)
32 #:use-module (gnu packages version-control))
0a4ebe01
PP
33
34(define-public elixir
35 (package
36 (name "elixir")
c2265e02 37 (version "1.11.4")
cadf846b
TGR
38 (source
39 (origin
40 (method git-fetch)
41 (uri (git-reference
b0e7b699 42 (url "https://github.com/elixir-lang/elixir")
cadf846b
TGR
43 (commit (string-append "v" version))))
44 (file-name (git-file-name name version))
45 (sha256
c2265e02 46 (base32 "1y8fbhli29agf84ja0fwz6gf22a46738b50nwy26yvcl2n2zl9d8"))
cadf846b 47 (patches (search-patches "elixir-path-length.patch"))))
0a4ebe01
PP
48 (build-system gnu-build-system)
49 (arguments
50 `(#:test-target "test"
e345274a 51 #:parallel-tests? #f ;see <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32171#23>
0a4ebe01
PP
52 #:make-flags (list (string-append "PREFIX="
53 (assoc-ref %outputs "out")))
54 #:phases
55 (modify-phases %standard-phases
cadf846b
TGR
56 (add-after 'unpack 'make-git-checkout-writable
57 (lambda _
58 (for-each make-file-writable (find-files "."))
59 #t))
60 (add-after 'make-git-checkout-writable 'replace-paths
6de3d176 61 (lambda* (#:key inputs outputs #:allow-other-keys)
62 (let ((out (assoc-ref outputs "out")))
63 (substitute* '("lib/elixir/lib/system.ex"
64 "lib/mix/lib/mix/scm/git.ex")
65 (("(cmd\\(['\"])git" _ prefix)
66 (string-append prefix (which "git"))))
2148e68d
OK
67 (substitute* '("lib/mix/lib/mix/release.ex"
68 "lib/mix/lib/mix/tasks/release.init.ex")
69 (("#!/bin/sh")
70 (string-append "#!" (which "sh"))))
6de3d176 71 (substitute* "bin/elixir"
2148e68d
OK
72 (("ERTS_BIN=")
73 (string-append
74 "ERTS_BIN="
75 ;; Elixir Releases will prepend to ERTS_BIN the path of a copy of erl.
76 ;; We detect if a release is being generated by checking the initial ERTS_BIN
77 ;; value: if it's empty, we are not in release mode and can point to the actual
78 ;; erl binary in Guix store.
79 "\nif [ -z \"$ERTS_BIN\" ]; then ERTS_BIN="
80 (string-drop-right (which "erl") 3)
81 "; fi")))
6de3d176 82 (substitute* "bin/mix"
83 (("#!/usr/bin/env elixir")
84 (string-append "#!" out "/bin/elixir"))))
0a4ebe01 85 #t))
0a4ebe01
PP
86 (add-before 'build 'make-current
87 ;; The Elixir compiler checks whether or not to compile files by
88 ;; inspecting their timestamps. When the timestamp is equal to the
89 ;; epoch no compilation will be performed. Some tests fail when
90 ;; files are older than Jan 1, 2000.
91 (lambda _
92 (for-each (lambda (file)
93 (let ((recent 1400000000))
94 (utime file recent recent 0 0)))
95 (find-files "." ".*"))
96 #t))
e7a25d2a
CB
97 (add-before 'check 'set-home
98 (lambda* (#:key inputs #:allow-other-keys)
99 ;; Some tests require access to a home directory.
100 (setenv "HOME" "/tmp")
101 #t))
0a4ebe01
PP
102 (delete 'configure))))
103 (inputs
a3e26863
JL
104 `(("erlang" ,erlang)
105 ("git" ,git)))
2f87048d 106 (home-page "https://elixir-lang.org/")
0a4ebe01
PP
107 (synopsis "Elixir programming language")
108 (description "Elixir is a dynamic, functional language used to build
109scalable and maintainable applications. Elixir leverages the Erlang VM, known
110for running low-latency, distributed and fault-tolerant systems, while also
111being successfully used in web development and the embedded software domain.")
112 (license license:asl2.0)))