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