| 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 Tobias Geerinckx-Rice <me@tobias.gr> |
| 7 | ;;; |
| 8 | ;;; This file is part of GNU Guix. |
| 9 | ;;; |
| 10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 11 | ;;; under the terms of the GNU General Public License as published by |
| 12 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 13 | ;;; your option) any later version. |
| 14 | ;;; |
| 15 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | ;;; GNU General Public License for more details. |
| 19 | ;;; |
| 20 | ;;; You should have received a copy of the GNU General Public License |
| 21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 22 | |
| 23 | (define-module (gnu packages elixir) |
| 24 | #:use-module ((guix licenses) #:prefix license:) |
| 25 | #:use-module (guix build-system gnu) |
| 26 | #:use-module (guix download) |
| 27 | #:use-module (guix packages) |
| 28 | #:use-module (gnu packages) |
| 29 | #:use-module (gnu packages erlang) |
| 30 | #:use-module (gnu packages version-control)) |
| 31 | |
| 32 | (define-public elixir |
| 33 | (package |
| 34 | (name "elixir") |
| 35 | (version "1.5.3") |
| 36 | (source (origin |
| 37 | (method url-fetch) |
| 38 | (uri (string-append "https://github.com/elixir-lang/elixir" |
| 39 | "/archive/v" version ".tar.gz")) |
| 40 | (file-name (string-append name "-" version ".tar.gz")) |
| 41 | (sha256 |
| 42 | (base32 |
| 43 | "0acnxfwvkx1m1d0h5z051mz95n35zm468hcvc3wpmn17c15h5ihg")) |
| 44 | ;; FIXME: 27 tests (out of 4K) had to be disabled as |
| 45 | ;; they fail in the build environment. Common failures |
| 46 | ;; are: |
| 47 | ;; - Mix.Shell.cmd() fails with error 130 |
| 48 | ;; - The git_repo fixture cannot be found |
| 49 | ;; - Communication with spawned processes fails with EPIPE |
| 50 | ;; - Failure to copy files |
| 51 | (patches (search-patches "elixir-disable-failing-tests.patch")))) |
| 52 | (build-system gnu-build-system) |
| 53 | (arguments |
| 54 | `(#:test-target "test" |
| 55 | #:make-flags (list (string-append "PREFIX=" |
| 56 | (assoc-ref %outputs "out"))) |
| 57 | #:phases |
| 58 | (modify-phases %standard-phases |
| 59 | (add-after 'unpack 'replace-paths |
| 60 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 61 | (let ((out (assoc-ref outputs "out"))) |
| 62 | (substitute* '("lib/elixir/lib/system.ex" |
| 63 | "lib/mix/lib/mix/scm/git.ex") |
| 64 | (("(cmd\\(['\"])git" _ prefix) |
| 65 | (string-append prefix (which "git")))) |
| 66 | (substitute* "bin/elixir" |
| 67 | (("ERL_EXEC=\"erl\"") |
| 68 | (string-append "ERL_EXEC=" (which "erl")))) |
| 69 | (substitute* "bin/mix" |
| 70 | (("#!/usr/bin/env elixir") |
| 71 | (string-append "#!" out "/bin/elixir")))) |
| 72 | #t)) |
| 73 | (add-after 'unpack 'fix-or-disable-tests |
| 74 | (lambda* (#:key inputs #:allow-other-keys) |
| 75 | ;; Some tests require access to a home directory. |
| 76 | (setenv "HOME" "/tmp") |
| 77 | |
| 78 | ;; FIXME: These tests fail because the "git_repo" fixture does |
| 79 | ;; not exist or cannot be found. |
| 80 | (delete-file "lib/mix/test/mix/tasks/deps.git_test.exs") |
| 81 | |
| 82 | ;; FIXME: Mix.Shell.cmd() always fails with error code 130. |
| 83 | (delete-file "lib/mix/test/mix/shell_test.exs") |
| 84 | |
| 85 | ;; FIXME: |
| 86 | ;; disabled failing impure tests to make it build again. |
| 87 | ;; related discussion: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28034#14 |
| 88 | (delete-file "lib/elixir/test/elixir/kernel/cli_test.exs") |
| 89 | (delete-file "lib/elixir/test/elixir/kernel/dialyzer_test.exs") |
| 90 | (delete-file "lib/iex/test/iex/helpers_test.exs") |
| 91 | (delete-file "lib/ex_unit/test/ex_unit/capture_io_test.exs") |
| 92 | |
| 93 | #t)) |
| 94 | (add-before 'build 'make-current |
| 95 | ;; The Elixir compiler checks whether or not to compile files by |
| 96 | ;; inspecting their timestamps. When the timestamp is equal to the |
| 97 | ;; epoch no compilation will be performed. Some tests fail when |
| 98 | ;; files are older than Jan 1, 2000. |
| 99 | (lambda _ |
| 100 | (for-each (lambda (file) |
| 101 | (let ((recent 1400000000)) |
| 102 | (utime file recent recent 0 0))) |
| 103 | (find-files "." ".*")) |
| 104 | #t)) |
| 105 | (delete 'configure)))) |
| 106 | (inputs |
| 107 | `(("erlang" ,erlang) |
| 108 | ("git" ,git))) |
| 109 | (home-page "http://elixir-lang.org/") |
| 110 | (synopsis "Elixir programming language") |
| 111 | (description "Elixir is a dynamic, functional language used to build |
| 112 | scalable and maintainable applications. Elixir leverages the Erlang VM, known |
| 113 | for running low-latency, distributed and fault-tolerant systems, while also |
| 114 | being successfully used in web development and the embedded software domain.") |
| 115 | (license license:asl2.0))) |