gnu: libdvdcss: Update to 1.4.3.
[jackhill/guix/guix.git] / gnu / packages / elixir.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
3 ;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
4 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2017 nee <nee.git@cock.li>
6 ;;; Copyright © 2018, 2019, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Nikita <nikita@n0.is>
8 ;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
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)
28 #:use-module (guix git-download)
29 #:use-module (guix packages)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages erlang)
32 #:use-module (gnu packages version-control))
33
34 (define-public elixir
35 (package
36 (name "elixir")
37 (version "1.11.4")
38 (source
39 (origin
40 (method git-fetch)
41 (uri (git-reference
42 (url "https://github.com/elixir-lang/elixir")
43 (commit (string-append "v" version))))
44 (file-name (git-file-name name version))
45 (sha256
46 (base32 "1y8fbhli29agf84ja0fwz6gf22a46738b50nwy26yvcl2n2zl9d8"))
47 (patches (search-patches "elixir-path-length.patch"))))
48 (build-system gnu-build-system)
49 (arguments
50 `(#:test-target "test"
51 #:parallel-tests? #f ;see <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32171#23>
52 #:make-flags (list (string-append "PREFIX="
53 (assoc-ref %outputs "out")))
54 #:phases
55 (modify-phases %standard-phases
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
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"))))
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"))))
71 (substitute* "bin/elixir"
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")))
82 (substitute* "bin/mix"
83 (("#!/usr/bin/env elixir")
84 (string-append "#!" out "/bin/elixir"))))
85 #t))
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))
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))
102 (delete 'configure))))
103 (inputs
104 `(("erlang" ,erlang)
105 ("git" ,git)))
106 (home-page "https://elixir-lang.org/")
107 (synopsis "Elixir programming language")
108 (description "Elixir is a dynamic, functional language used to build
109 scalable and maintainable applications. Elixir leverages the Erlang VM, known
110 for running low-latency, distributed and fault-tolerant systems, while also
111 being successfully used in web development and the embedded software domain.")
112 (license license:asl2.0)))