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> |
47956fa0 | 6 | ;;; Copyright © 2018 ng0 <ng0@n0.is> |
3c6e42b3 SS |
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 erlang) | |
24 | #:use-module ((guix licenses) #:prefix license:) | |
25 | #:use-module (guix build-system gnu) | |
d6449c36 | 26 | #:use-module (guix build-system emacs) |
3c6e42b3 | 27 | #:use-module (guix download) |
ed672882 | 28 | #:use-module (guix git-download) |
3c6e42b3 | 29 | #:use-module (guix packages) |
35e86e36 | 30 | #:use-module (guix utils) |
a4078acf | 31 | #:use-module (gnu packages) |
3c6e42b3 SS |
32 | #:use-module (gnu packages autotools) |
33 | #:use-module (gnu packages fontutils) | |
34 | #:use-module (gnu packages gl) | |
35 | #:use-module (gnu packages ncurses) | |
36 | #:use-module (gnu packages perl) | |
37 | #:use-module (gnu packages tls) | |
38 | #:use-module (gnu packages wxwidgets)) | |
39 | ||
40 | (define-public erlang | |
41 | (package | |
42 | (name "erlang") | |
666da84f | 43 | (version "21.0.5") |
3c6e42b3 | 44 | (source (origin |
ed672882 | 45 | (method git-fetch) |
3c6e42b3 SS |
46 | ;; The tarball from http://erlang.org/download contains many |
47 | ;; pre-compiled files, so we use this snapshot of the source | |
48 | ;; repository. | |
ed672882 TGR |
49 | (uri (git-reference |
50 | (url "https://github.com/erlang/otp.git") | |
51 | (commit (string-append "OTP-" version)))) | |
52 | (file-name (git-file-name name version)) | |
3c6e42b3 SS |
53 | (sha256 |
54 | (base32 | |
666da84f | 55 | "0gv83i5ybj1z3ykbbldjzf7dbfjszp84c0yzrpshj611b9wp0176")) |
a4078acf | 56 | (patches (search-patches "erlang-man-path.patch")))) |
3c6e42b3 SS |
57 | (build-system gnu-build-system) |
58 | (native-inputs | |
59 | `(("perl" ,perl) | |
60 | ("autoconf" ,autoconf) | |
61 | ("automake" ,automake) | |
62 | ||
63 | ;; Erlang's documentation is distributed in a separate tarball. | |
64 | ("erlang-manpages" | |
65 | ,(origin | |
66 | (method url-fetch) | |
67 | (uri (string-append "http://erlang.org/download/otp_doc_man_" | |
35e86e36 | 68 | (version-major+minor version) ".tar.gz")) |
3c6e42b3 SS |
69 | (sha256 |
70 | (base32 | |
39eec988 | 71 | "0cgv23q0215f6lvmhj4w9skx5m29khjs9mb890635s3yp520xgqh")))))) |
3c6e42b3 SS |
72 | (inputs |
73 | `(("ncurses" ,ncurses) | |
74 | ("openssl" ,openssl) | |
75 | ("wxwidgets" ,wxwidgets))) | |
76 | (propagated-inputs | |
77 | `(("fontconfig" ,fontconfig) | |
78 | ("glu" ,glu) | |
79 | ("mesa" ,mesa))) | |
80 | (arguments | |
81 | `(#:test-target "release_tests" | |
82 | #:configure-flags | |
83 | (list "--disable-saved-compile-time" | |
84 | "--enable-dynamic-ssl-lib" | |
85 | "--enable-native-libs" | |
86 | "--enable-shared-zlib" | |
87 | "--enable-smp-support" | |
88 | "--enable-threads" | |
89 | "--enable-wx" | |
90 | (string-append "--with-ssl=" (assoc-ref %build-inputs "openssl"))) | |
91 | #:modules ((srfi srfi-19) ; make-time, et cetera. | |
92 | (guix build utils) | |
93 | (guix build gnu-build-system)) | |
94 | #:phases | |
95 | (modify-phases %standard-phases | |
9b25e1d1 | 96 | (delete 'bootstrap) |
3c6e42b3 SS |
97 | ;; The are several code fragments that embed timestamps into the |
98 | ;; output. Here, we alter those fragments to use the value of | |
99 | ;; SOURCE_DATE_EPOCH instead. | |
100 | (add-after 'unpack 'remove-timestamps | |
101 | (lambda _ | |
102 | (let ((source-date-epoch | |
1b0ce451 TGR |
103 | (time-utc->date |
104 | (make-time time-utc 0 (string->number | |
105 | (getenv "SOURCE_DATE_EPOCH")))))) | |
3c6e42b3 SS |
106 | (substitute* "lib/reltool/src/reltool_target.erl" |
107 | (("Date = date\\(\\),") | |
108 | (string-append "Date = " | |
109 | (date->string source-date-epoch | |
110 | "'{~Y,~m,~d}',")))) | |
111 | (substitute* "lib/reltool/src/reltool_target.erl" | |
112 | (("Time = time\\(\\),") | |
113 | (string-append "Time = " | |
114 | (date->string source-date-epoch | |
115 | "'{~H,~M,~S}',")))) | |
116 | (substitute* '("lib/reltool/src/reltool_target.erl" | |
117 | "lib/sasl/src/systools_make.erl") | |
118 | (("date\\(\\), time\\(\\),") | |
119 | (date->string source-date-epoch | |
120 | "{~Y,~m,~d}, {~H,~M,~S},"))) | |
ee217402 | 121 | (substitute* "lib/dialyzer/test/small_SUITE_data/src/gs_make.erl" |
3c6e42b3 SS |
122 | (("tuple_to_list\\(date\\(\\)\\),tuple_to_list\\(time\\(\\)\\)") |
123 | (date->string | |
1b0ce451 TGR |
124 | source-date-epoch |
125 | "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})"))) | |
3c6e42b3 SS |
126 | (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl" |
127 | (("\\{Y,Mo,D\\} = date\\(\\),") | |
128 | (date->string source-date-epoch | |
129 | "{Y,Mo,D} = {~Y,~m,~d},"))) | |
130 | (substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl" | |
131 | (("\\{H,Mi,S\\} = time\\(\\),") | |
132 | (date->string source-date-epoch | |
1b0ce451 TGR |
133 | "{H,Mi,S} = {~H,~M,~S},"))) |
134 | #t))) | |
b5453aa7 CB |
135 | (add-after 'unpack 'patch-/bin/sh |
136 | (lambda _ | |
137 | (substitute* "erts/etc/unix/run_erl.c" | |
138 | (("sh = \"/bin/sh\";") | |
139 | (string-append "sh = \"" | |
140 | (which "sh") | |
141 | "\";"))) | |
142 | ||
143 | (substitute* "erts/emulator/sys/unix/sys_drivers.c" | |
144 | (("SHELL \"/bin/sh\"") | |
145 | (string-append "SHELL \"" | |
146 | (which "sh") | |
147 | "\""))) | |
148 | (substitute* "erts/emulator/sys/unix/erl_child_setup.c" | |
149 | (("SHELL \"/bin/sh\"") | |
150 | (string-append "SHELL \"" | |
151 | (which "sh") | |
152 | "\""))) | |
153 | ||
154 | (substitute* "lib/kernel/src/os.erl" | |
155 | (("/bin/sh") (which "sh"))) | |
156 | ||
157 | #t)) | |
3c6e42b3 SS |
158 | (add-after 'patch-source-shebangs 'patch-source-env |
159 | (lambda _ | |
160 | (let ((escripts | |
161 | (append | |
162 | (find-files "." "\\.escript") | |
163 | (find-files "lib/stdlib/test/escript_SUITE_data/") | |
164 | '("erts/lib_src/utils/make_atomics_api" | |
165 | "erts/preloaded/src/add_abstract_code" | |
166 | "lib/diameter/bin/diameterc" | |
167 | "lib/reltool/examples/display_args" | |
168 | "lib/reltool/examples/mnesia_core_dump_viewer" | |
169 | "lib/snmp/src/compile/snmpc.src" | |
170 | "make/verify_runtime_dependencies" | |
171 | "make/emd2exml.in")))) | |
172 | (substitute* escripts | |
1b0ce451 TGR |
173 | (("/usr/bin/env") (which "env"))) |
174 | #t))) | |
3c6e42b3 SS |
175 | (add-before 'configure 'set-erl-top |
176 | (lambda _ | |
1b0ce451 TGR |
177 | (setenv "ERL_TOP" (getcwd)) |
178 | #t)) | |
d10092b8 | 179 | (add-after 'patch-source-env 'autoconf |
1b0ce451 TGR |
180 | (lambda _ |
181 | (invoke "./otp_build" "autoconf") | |
182 | #t)) | |
3c6e42b3 SS |
183 | (add-after 'install 'patch-erl |
184 | ;; This only works after install. | |
1b0ce451 TGR |
185 | (lambda* (#:key outputs #:allow-other-keys) |
186 | (let* ((out (assoc-ref outputs "out"))) | |
187 | (substitute* (string-append out "/bin/erl") | |
188 | (("sed") (which "sed"))) | |
189 | #t))) | |
3c6e42b3 SS |
190 | (add-after 'install 'install-doc |
191 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
192 | (let* ((out (assoc-ref outputs "out")) | |
193 | (manpages (assoc-ref inputs "erlang-manpages")) | |
194 | (share (string-append out "/share/"))) | |
1b0ce451 TGR |
195 | (mkdir-p share) |
196 | (mkdir-p (string-append share "/misc/erlang")) | |
197 | (with-directory-excursion share | |
198 | (invoke "tar" "xvf" manpages) | |
3c6e42b3 SS |
199 | (rename-file "COPYRIGHT" |
200 | (string-append share "/misc/erlang/COPYRIGHT")) | |
5c4ea872 | 201 | ;; Delete superfluous file. |
1b0ce451 TGR |
202 | (delete-file "PR.template")) |
203 | #t)))))) | |
eae7ece1 | 204 | (home-page "https://www.erlang.org/") |
3c6e42b3 SS |
205 | (synopsis "The Erlang programming language") |
206 | (description | |
207 | "Erlang is a programming language used to build massively | |
208 | scalable soft real-time systems with requirements on high | |
209 | availability. Some of its uses are in telecoms, banking, e-commerce, | |
210 | computer telephony and instant messaging. Erlang's runtime system has | |
211 | built-in support for concurrency, distribution and fault tolerance.") | |
212 | ;; Erlang is distributed under the Apache License 2.0, but some components | |
213 | ;; have other licenses. See 'system/COPYRIGHT' in the source distribution. | |
214 | (license (list license:asl2.0 license:bsd-2 license:bsd-3 license:expat | |
215 | license:lgpl2.0+ license:tcl/tk license:zlib)))) | |
d6449c36 CZ |
216 | |
217 | (define-public emacs-erlang | |
218 | (package | |
219 | (name "emacs-erlang") | |
220 | (version (package-version erlang)) | |
221 | (source (package-source erlang)) | |
222 | (build-system emacs-build-system) | |
223 | (arguments | |
224 | `(#:phases | |
225 | (modify-phases %standard-phases | |
226 | (add-before 'set-emacs-load-path 'change-working-directory | |
227 | (lambda _ (chdir "lib/tools/emacs") #t))))) | |
228 | (home-page "https://www.erlang.org/") | |
229 | (synopsis "Erlang major mode for Emacs") | |
230 | (description | |
231 | "This package provides an Emacs major mode for editing Erlang source | |
232 | files.") | |
233 | (license license:asl2.0))) |