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