;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Steve Sprang <scs@stevesprang.com>
-;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016, 2017 Pjotr Prins <pjotr.guix@thebird.nl>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Nikita <nikita@n0.is>
;;;
;;; This file is part of GNU Guix.
;;;
(define-module (gnu packages erlang)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system emacs)
#: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 autotools)
#:use-module (gnu packages fontutils)
(define-public erlang
(package
(name "erlang")
- (version "20.0")
+ (version "21.3.8.13")
(source (origin
- (method url-fetch)
+ (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 (string-append "https://github.com/erlang/otp/archive/OTP-"
- version ".tar.gz"))
- (file-name (string-append name "-" version ".tar.gz"))
+ (uri (git-reference
+ (url "https://github.com/erlang/otp")
+ (commit (string-append "OTP-" version))))
+ (file-name (git-file-name name version))
(sha256
(base32
- "1azjjyb743i6vjq7rnh5qnslsqg0x60a9zrlhg9n3dpm13z1b22l"))
+ "1dj37vk712dx76y25g13na24wbpn7a5ddmlpf4n51gm10sib54wj"))
(patches (search-patches "erlang-man-path.patch"))))
(build-system gnu-build-system)
(native-inputs
,(origin
(method url-fetch)
(uri (string-append "http://erlang.org/download/otp_doc_man_"
- version ".tar.gz"))
+ (version-major+minor version) ".tar.gz"))
(sha256
(base32
- "1k25p37w1l1j20qd8rga4j4q7s7r0rbsi02x3xwzhw51jhm59wdp"))))))
+ "0wm1dg1psv1n3gpiwyms06yhsryrnr28p455fp0l1ak8hdf4nipm"))))))
(inputs
`(("ncurses" ,ncurses)
("openssl" ,openssl)
(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"))))))
+ (time-utc->date
+ (make-time time-utc 0 (string->number
+ (getenv "SOURCE_DATE_EPOCH"))))))
(substitute* "lib/reltool/src/reltool_target.erl"
(("Date = date\\(\\),")
(string-append "Date = "
(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})")))
+ source-date-epoch
+ "tuple_to_list({~Y,~m,~d}), tuple_to_list({~H,~M,~S})")))
(substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
(("\\{Y,Mo,D\\} = date\\(\\),")
(date->string source-date-epoch
(substitute* "lib/snmp/src/compile/snmpc_mib_to_hrl.erl"
(("\\{H,Mi,S\\} = time\\(\\),")
(date->string source-date-epoch
- "{H,Mi,S} = {~H,~M,~S},"))))))
+ "{H,Mi,S} = {~H,~M,~S},")))
+ #t)))
+ (add-after 'unpack 'patch-/bin/sh
+ (lambda _
+ (substitute* "erts/etc/unix/run_erl.c"
+ (("sh = \"/bin/sh\";")
+ (string-append "sh = \""
+ (which "sh")
+ "\";")))
+
+ (substitute* "erts/emulator/sys/unix/sys_drivers.c"
+ (("SHELL \"/bin/sh\"")
+ (string-append "SHELL \""
+ (which "sh")
+ "\"")))
+ (substitute* "erts/emulator/sys/unix/erl_child_setup.c"
+ (("SHELL \"/bin/sh\"")
+ (string-append "SHELL \""
+ (which "sh")
+ "\"")))
+
+ (substitute* "lib/kernel/src/os.erl"
+ (("/bin/sh") (which "sh")))
+
+ #t))
(add-after 'patch-source-shebangs 'patch-source-env
(lambda _
(let ((escripts
"make/verify_runtime_dependencies"
"make/emd2exml.in"))))
(substitute* escripts
- (("/usr/bin/env") (which "env"))))))
+ (("/usr/bin/env") (which "env")))
+ #t)))
(add-before 'configure 'set-erl-top
(lambda _
- (setenv "ERL_TOP" (getcwd))))
- (add-before 'configure 'autoconf
- (lambda _ (zero? (system* "./otp_build" "autoconf"))))
+ (setenv "ERL_TOP" (getcwd))
+ #t))
+ (add-after 'patch-source-env 'autoconf
+ (lambda _
+ (invoke "./otp_build" "autoconf")
+ #t))
(add-after 'install 'patch-erl
;; This only works after install.
- (lambda _
- (substitute* (string-append (assoc-ref %outputs "out") "/bin/erl")
- (("sed") (which "sed")))))
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (substitute* (string-append out "/bin/erl")
+ (("sed") (which "sed")))
+ #t)))
(add-after 'install 'install-doc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(manpages (assoc-ref inputs "erlang-manpages"))
(share (string-append out "/share/")))
- (mkdir-p share)
- (mkdir-p (string-append share "/misc/erlang"))
- (with-directory-excursion share
- (and
- (zero? (system* "tar" "xvf" manpages))
+ (mkdir-p share)
+ (mkdir-p (string-append share "/misc/erlang"))
+ (with-directory-excursion share
+ (invoke "tar" "xvf" manpages)
(rename-file "COPYRIGHT"
(string-append share "/misc/erlang/COPYRIGHT"))
;; Delete superfluous file.
- (delete-file "PR.template")))))))))
- (home-page "http://erlang.org/")
+ (delete-file "PR.template"))
+ #t))))))
+ (home-page "https://www.erlang.org/")
(synopsis "The Erlang programming language")
(description
"Erlang is a programming language used to build massively
;; have other licenses. See 'system/COPYRIGHT' in the source distribution.
(license (list license:asl2.0 license:bsd-2 license:bsd-3 license:expat
license:lgpl2.0+ license:tcl/tk license:zlib))))
+
+(define-public emacs-erlang
+ (package
+ (name "emacs-erlang")
+ (version (package-version erlang))
+ (source (package-source erlang))
+ (build-system emacs-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'add-source-to-load-path 'change-working-directory
+ (lambda _ (chdir "lib/tools/emacs") #t)))))
+ (home-page "https://www.erlang.org/")
+ (synopsis "Erlang major mode for Emacs")
+ (description
+ "This package provides an Emacs major mode for editing Erlang source
+files.")
+ (license license:asl2.0)))