;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Steve Sprang ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2016, 2017 Pjotr Prins ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Nikita ;;; Copyright © 2020-2022 Hartmut Goebel ;;; Copyright © 2021 Oskar Köök ;;; Copyright © 2021 Cees de Groot ;;; Copyright © 2022 jgart ;;; Copyright © 2023 wrobell ;;; Copyright © 2023 Tim Johann ;;; Copyright © 2024 Igor Goryachev ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages erlang) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix gexp) #:use-module (guix build-system gnu) #:use-module (guix build-system emacs) #:use-module (guix build-system rebar) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages fontutils) #:use-module (gnu packages gl) #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages version-control) #:use-module (gnu packages tls) #:use-module (gnu packages wxwidgets)) (define-public erlang (package (name "erlang") (version "27.2") (source (origin (method git-fetch) ;; The tarball from http://erlang.org/download contains many ;; pre-compiled files, so we use this snapshot of the source ;; repository. (uri (git-reference (url "https://github.com/erlang/otp") (commit (string-append "OTP-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0s9pw7vyjb53mvk4y0kj5zdv8nr30yklvnjs6va4gxn0xm4k7amb")) (patches (search-patches "erlang-man-path.patch")))) (build-system gnu-build-system) (native-inputs `(("perl" ,perl) ;; Erlang's documentation is distributed in a separate tarball. ("erlang-manpages" ,(origin (method url-fetch) (uri (string-append "https://github.com/erlang/otp/releases/download" "/OTP-" version "/otp_doc_man_" version ".tar.gz")) (sha256 (base32 "12biwwh6yzaf8j8w4qzk9mbzcw567ffmx6i8vx2ry8qd2758mvp6")))))) (inputs (list ncurses openssl wxwidgets)) (propagated-inputs (list fontconfig glu mesa)) (arguments `(#:test-target "release_tests" #:configure-flags (list "--disable-saved-compile-time" "--enable-deterministic-build" "--enable-dynamic-ssl-lib" "--enable-native-libs" "--enable-shared-zlib" "--enable-smp-support" "--enable-threads" "--enable-wx" (string-append "--with-ssl=" (assoc-ref %build-inputs "openssl"))) #:modules ((srfi srfi-19) ; make-time, et cetera. (guix build utils) (guix build gnu-build-system)) #:phases (modify-phases %standard-phases (delete 'bootstrap) ;; The are several code fragments that embed timestamps into the ;; output. Here, we alter those fragments to use the value of ;; SOURCE_DATE_EPOCH instead. (add-after 'unpack 'remove-timestamps (lambda _ (let ((source-date-epoch (time-utc->date (make-time time-utc 0 (string->number (getenv "SOURCE_DATE_EPOCH")))))) (substitute* "lib/dialyzer/test/small_SUITE_data/src/gs_make.erl" (("tuple_to_list\\(date\\(\\)\\),tuple_to_list\\(time\\(\\)\\)") (date->string source-date-epoch "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})")))))) ;; When compiling with 'deterministic' option the important meta ;; information is still needed for some Erlang's dependants, such as ;; Elixir. We make compiler to preserve it. ;; For more info see: https://github.com/erlang/otp/issues/8602 (add-after 'unpack 'preserve-source-meta (lambda _ (substitute* "lib/compiler/src/compile.erl" (("\\[\\{source,Source\\} \\| Info0\\];") "[{source,Source} | Info0]; [_|_] = Source when IsDeterministic -> [{source,Source} | Info0];")))) (add-after 'unpack 'patch-/bin/sh (lambda* (#:key inputs #:allow-other-keys) (let ((sh (search-input-file inputs "/bin/sh"))) (substitute* "erts/etc/unix/run_erl.c" (("sh = \"/bin/sh\";") (string-append "sh = \"" sh "\";"))) (substitute* "erts/emulator/sys/unix/sys_drivers.c" (("SHELL \"/bin/sh\"") (string-append "SHELL \"" sh "\""))) (substitute* "erts/emulator/sys/unix/erl_child_setup.c" (("SHELL \"/bin/sh\"") (string-append "SHELL \"" sh "\""))) (substitute* "lib/kernel/src/os.erl" (("/bin/sh") sh))))) (add-after 'patch-source-shebangs 'patch-source-env (lambda _ (let ((escripts