gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / erlang.scm
index 1c18efe..7b5dc70 100644 (file)
@@ -3,6 +3,8 @@
 ;;; 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>
+;;; Copyright © 2021 Oskar Köök <oskar@maatriks.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,7 +24,9 @@
 (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)
 (define-public erlang
   (package
     (name "erlang")
-    (version "20.2.3")
+    (version "23.2.1")
     (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
-                "0s9g4ijdbqq21k4cqggz074d3fiimah942qisv2kgizhlivpw2nm"))
+                "1p3lw4bcm2dph3pf1h4i0d9pzrcfr83r0iadqanxkwbmm1bl11pm"))
               (patches (search-patches "erlang-man-path.patch"))))
     (build-system gnu-build-system)
     (native-inputs
@@ -64,7 +69,7 @@
                                (version-major+minor version) ".tar.gz"))
            (sha256
             (base32
-             "1pyb8wbk7znsyni8d1k4dj1m01lr191dcrrzisli1z27ks7hh3lm"))))))
+             "0rq0rw68f02vckgdiwmvx8bvyv00l81s27cq59i3h79j9prfal2n"))))))
     (inputs
      `(("ncurses" ,ncurses)
        ("openssl" ,openssl)
            (lambda _
              (invoke "./otp_build" "autoconf")
              #t))
+         (add-after 'autoconf 'patch-configure-script-shell
+           (lambda _
+             (substitute* "configure"
+               (("cmd_str=\"./configure")
+                (string-append "cmd_str=\""
+                               (which "sh")
+                               " ./configure")))
+             #t))
          (add-after 'install 'patch-erl
            ;; This only works after install.
            (lambda* (#:key outputs #:allow-other-keys)
@@ -209,3 +222,21 @@ built-in support for concurrency, distribution and fault tolerance.")
     ;; 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)))