Commit | Line | Data |
---|---|---|
3c6e42b3 SS |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 Steve Sprang <scs@stevesprang.com> | |
35e86e36 | 3 | ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name> |
5c4ea872 | 4 | ;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl> |
629c1947 | 5 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
3c6e42b3 SS |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu packages erlang) | |
23 | #:use-module ((guix licenses) #:prefix license:) | |
24 | #:use-module (guix build-system gnu) | |
25 | #:use-module (guix download) | |
26 | #:use-module (guix packages) | |
35e86e36 | 27 | #:use-module (guix utils) |
a4078acf | 28 | #:use-module (gnu packages) |
3c6e42b3 SS |
29 | #:use-module (gnu packages autotools) |
30 | #:use-module (gnu packages fontutils) | |
31 | #:use-module (gnu packages gl) | |
32 | #:use-module (gnu packages ncurses) | |
33 | #:use-module (gnu packages perl) | |
34 | #:use-module (gnu packages tls) | |
35 | #:use-module (gnu packages wxwidgets)) | |
36 | ||
37 | (define-public erlang | |
38 | (package | |
39 | (name "erlang") | |
629c1947 | 40 | (version "20.2.3") |
3c6e42b3 SS |
41 | (source (origin |
42 | (method url-fetch) | |
43 | ;; The tarball from http://erlang.org/download contains many | |
44 | ;; pre-compiled files, so we use this snapshot of the source | |
45 | ;; repository. | |
46 | (uri (string-append "https://github.com/erlang/otp/archive/OTP-" | |
47 | version ".tar.gz")) | |
48 | (file-name (string-append name "-" version ".tar.gz")) | |
49 | (sha256 | |
50 | (base32 | |
629c1947 | 51 | "0s9g4ijdbqq21k4cqggz074d3fiimah942qisv2kgizhlivpw2nm")) |
a4078acf | 52 | (patches (search-patches "erlang-man-path.patch")))) |
3c6e42b3 SS |
53 | (build-system gnu-build-system) |
54 | (native-inputs | |
55 | `(("perl" ,perl) | |
56 | ("autoconf" ,autoconf) | |
57 | ("automake" ,automake) | |
58 | ||
59 | ;; Erlang's documentation is distributed in a separate tarball. | |
60 | ("erlang-manpages" | |
61 | ,(origin | |
62 | (method url-fetch) | |
63 | (uri (string-append "http://erlang.org/download/otp_doc_man_" | |
35e86e36 | 64 | (version-major+minor version) ".tar.gz")) |
3c6e42b3 SS |
65 | (sha256 |
66 | (base32 | |
629c1947 | 67 | "1pyb8wbk7znsyni8d1k4dj1m01lr191dcrrzisli1z27ks7hh3lm")))))) |
3c6e42b3 SS |
68 | (inputs |
69 | `(("ncurses" ,ncurses) | |
70 | ("openssl" ,openssl) | |
71 | ("wxwidgets" ,wxwidgets))) | |
72 | (propagated-inputs | |
73 | `(("fontconfig" ,fontconfig) | |
74 | ("glu" ,glu) | |
75 | ("mesa" ,mesa))) | |
76 | (arguments | |
77 | `(#:test-target "release_tests" | |
78 | #:configure-flags | |
79 | (list "--disable-saved-compile-time" | |
80 | "--enable-dynamic-ssl-lib" | |
81 | "--enable-native-libs" | |
82 | "--enable-shared-zlib" | |
83 | "--enable-smp-support" | |
84 | "--enable-threads" | |
85 | "--enable-wx" | |
86 | (string-append "--with-ssl=" (assoc-ref %build-inputs "openssl"))) | |
87 | #:modules ((srfi srfi-19) ; make-time, et cetera. | |
88 | (guix build utils) | |
89 | (guix build gnu-build-system)) | |
90 | #:phases | |
91 | (modify-phases %standard-phases | |
92 | ;; The are several code fragments that embed timestamps into the | |
93 | ;; output. Here, we alter those fragments to use the value of | |
94 | ;; SOURCE_DATE_EPOCH instead. | |
95 | (add-after 'unpack 'remove-timestamps | |
96 | (lambda _ | |
97 | (let ((source-date-epoch | |
98 | (time-utc->date | |
99 | (make-time time-utc 0 (string->number | |
100 | (getenv "SOURCE_DATE_EPOCH")))))) | |
101 | (substitute* "lib/reltool/src/reltool_target.erl" | |
102 | (("Date = date\\(\\),") | |
103 | (string-append "Date = " | |
104 | (date->string source-date-epoch | |
105 | "'{~Y,~m,~d}',")))) | |
106 | (substitute* "lib/reltool/src/reltool_target.erl" | |
107 | (("Time = time\\(\\),") | |
108 | (string-append "Time = " | |
109 | (date->string source-date-epoch | |
110 | "'{~H,~M,~S}',")))) | |
111 | (substitute* '("lib/reltool/src/reltool_target.erl" | |
112 | "lib/sasl/src/systools_make.erl") | |
113 | (("date\\(\\), time\\(\\),") | |
114 | (date->string source-date-epoch | |
115 | "{~Y,~m,~d}, {~H,~M,~S},"))) | |
ee217402 | 116 | (substitute* "lib/dialyzer/test/small_SUITE_data/src/gs_make.erl" |
3c6e42b3 SS |
117 | (("tuple_to_list\\(date\\(\\)\\),tuple_to_list\\(time\\(\\)\\)") |
118 | (date->string | |
119 | source-date-epoch | |
120 | "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})"))) | |
121 | (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl" | |
122 | (("\\{Y,Mo,D\\} = date\\(\\),") | |
123 | (date->string source-date-epoch | |
124 | "{Y,Mo,D} = {~Y,~m,~d},"))) | |
125 | (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl" | |
126 | (("\\{H,Mi,S\\} = time\\(\\),") | |
127 | (date->string source-date-epoch | |
128 | "{H,Mi,S} = {~H,~M,~S},")))))) | |
129 | (add-after 'patch-source-shebangs 'patch-source-env | |
130 | (lambda _ | |
131 | (let ((escripts | |
132 | (append | |
133 | (find-files "." "\\.escript") | |
134 | (find-files "lib/stdlib/test/escript_SUITE_data/") | |
135 | '("erts/lib_src/utils/make_atomics_api" | |
136 | "erts/preloaded/src/add_abstract_code" | |
137 | "lib/diameter/bin/diameterc" | |
138 | "lib/reltool/examples/display_args" | |
139 | "lib/reltool/examples/mnesia_core_dump_viewer" | |
140 | "lib/snmp/src/compile/snmpc.src" | |
141 | "make/verify_runtime_dependencies" | |
142 | "make/emd2exml.in")))) | |
143 | (substitute* escripts | |
144 | (("/usr/bin/env") (which "env")))))) | |
145 | (add-before 'configure 'set-erl-top | |
146 | (lambda _ | |
147 | (setenv "ERL_TOP" (getcwd)))) | |
d10092b8 | 148 | (add-after 'patch-source-env 'autoconf |
3c6e42b3 SS |
149 | (lambda _ (zero? (system* "./otp_build" "autoconf")))) |
150 | (add-after 'install 'patch-erl | |
151 | ;; This only works after install. | |
152 | (lambda _ | |
153 | (substitute* (string-append (assoc-ref %outputs "out") "/bin/erl") | |
154 | (("sed") (which "sed"))))) | |
155 | (add-after 'install 'install-doc | |
156 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
157 | (let* ((out (assoc-ref outputs "out")) | |
158 | (manpages (assoc-ref inputs "erlang-manpages")) | |
159 | (share (string-append out "/share/"))) | |
160 | (mkdir-p share) | |
161 | (mkdir-p (string-append share "/misc/erlang")) | |
162 | (with-directory-excursion share | |
163 | (and | |
164 | (zero? (system* "tar" "xvf" manpages)) | |
165 | (rename-file "COPYRIGHT" | |
166 | (string-append share "/misc/erlang/COPYRIGHT")) | |
5c4ea872 PP |
167 | ;; Delete superfluous file. |
168 | (delete-file "PR.template"))))))))) | |
3c6e42b3 SS |
169 | (home-page "http://erlang.org/") |
170 | (synopsis "The Erlang programming language") | |
171 | (description | |
172 | "Erlang is a programming language used to build massively | |
173 | scalable soft real-time systems with requirements on high | |
174 | availability. Some of its uses are in telecoms, banking, e-commerce, | |
175 | computer telephony and instant messaging. Erlang's runtime system has | |
176 | built-in support for concurrency, distribution and fault tolerance.") | |
177 | ;; Erlang is distributed under the Apache License 2.0, but some components | |
178 | ;; have other licenses. See 'system/COPYRIGHT' in the source distribution. | |
179 | (license (list license:asl2.0 license:bsd-2 license:bsd-3 license:expat | |
180 | license:lgpl2.0+ license:tcl/tk license:zlib)))) |