gnu: emacs: Use new package style.
* gnu/packages/emacs.scm (emacs)[source]<snippet>: Drop trailing ‘#t’. [arguments]: Convert to list of G-Expressions. Use ‘search-input-file’ where possible. Inline references to auxiliary files. Drop trailing ‘#t’s. [inputs, native-inputs]: Drop labels.master
parent
b65a1e4a21
commit
64557bc695
|
@ -41,6 +41,7 @@
|
||||||
(define-module (gnu packages emacs)
|
(define-module (gnu packages emacs)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
#:use-module (gnu packages base)
|
#:use-module (gnu packages base)
|
||||||
#:use-module (gnu packages compression)
|
#:use-module (gnu packages compression)
|
||||||
#:use-module (gnu packages fontutils)
|
#:use-module (gnu packages fontutils)
|
||||||
|
#:use-module (gnu packages freedesktop)
|
||||||
#:use-module (gnu packages fribidi)
|
#:use-module (gnu packages fribidi)
|
||||||
#:use-module (gnu packages gd)
|
#:use-module (gnu packages gd)
|
||||||
#:use-module (gnu packages gettext)
|
#:use-module (gnu packages gettext)
|
||||||
|
@ -119,183 +121,176 @@
|
||||||
(list line
|
(list line
|
||||||
"\"~/.guix-profile/include\""
|
"\"~/.guix-profile/include\""
|
||||||
"\"/var/guix/profiles/system/profile/include\"")
|
"\"/var/guix/profiles/system/profile/include\"")
|
||||||
" ")))
|
" ")))))))
|
||||||
#t))))
|
|
||||||
(build-system glib-or-gtk-build-system)
|
(build-system glib-or-gtk-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:tests? #f ; no check target
|
(list
|
||||||
#:configure-flags (list "--with-modules"
|
#:tests? #f ; no check target
|
||||||
"--with-cairo"
|
#:configure-flags #~(list "--with-modules"
|
||||||
"--disable-build-details")
|
"--with-cairo"
|
||||||
#:phases
|
"--disable-build-details")
|
||||||
(modify-phases %standard-phases
|
#:phases
|
||||||
(add-after 'unpack 'patch-program-file-names
|
#~(modify-phases %standard-phases
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(add-after 'unpack 'patch-program-file-names
|
||||||
(substitute* '("src/callproc.c"
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
"lisp/term.el"
|
(substitute* '("src/callproc.c"
|
||||||
"lisp/htmlfontify.el"
|
"lisp/term.el"
|
||||||
"lisp/textmodes/artist.el"
|
"lisp/htmlfontify.el"
|
||||||
"lisp/progmodes/sh-script.el")
|
"lisp/textmodes/artist.el"
|
||||||
(("\"/bin/sh\"")
|
"lisp/progmodes/sh-script.el")
|
||||||
(format #f "~s" (which "sh"))))
|
(("\"/bin/sh\"")
|
||||||
(substitute* "lisp/doc-view.el"
|
(format #f "~s" (search-input-file inputs "/bin/sh"))))
|
||||||
(("\"(gs|dvipdf|ps2pdf)\"" all what)
|
(substitute* "lisp/doc-view.el"
|
||||||
(let ((ghostscript (assoc-ref inputs "ghostscript")))
|
(("\"(gs|dvipdf|ps2pdf|pdftotext)\"" all what)
|
||||||
(if ghostscript
|
(let ((replacement (search-input-file
|
||||||
(string-append "\"" ghostscript "/bin/" what "\"")
|
inputs
|
||||||
all)))
|
(string-append "/bin/" what))))
|
||||||
(("\"(pdftotext)\"" all what)
|
(if replacement
|
||||||
(let ((poppler (assoc-ref inputs "poppler")))
|
(string-append "\"" replacement "\"")
|
||||||
(if poppler
|
all))))
|
||||||
(string-append "\"" poppler "/bin/" what "\"")
|
;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
|
||||||
all))))
|
;; respectively when looking for GVFS processes.
|
||||||
;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real"
|
(substitute* "lisp/net/tramp-gvfs.el"
|
||||||
;; respectively when looking for GVFS processes.
|
(("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
|
||||||
(substitute* "lisp/net/tramp-gvfs.el"
|
(format #f "(or ~a (tramp-compat-process-running-p ~s))"
|
||||||
(("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process)
|
all (string-append "." process "-real"))))))
|
||||||
(format #f "(or ~a (tramp-compat-process-running-p ~s))"
|
(add-before 'configure 'fix-/bin/pwd
|
||||||
all (string-append "." process "-real"))))
|
(lambda _
|
||||||
#t))
|
;; Use `pwd', not `/bin/pwd'.
|
||||||
(add-before 'configure 'fix-/bin/pwd
|
(substitute* (find-files "." "^Makefile\\.in$")
|
||||||
(lambda _
|
(("/bin/pwd")
|
||||||
;; Use `pwd', not `/bin/pwd'.
|
"pwd"))))
|
||||||
(substitute* (find-files "." "^Makefile\\.in$")
|
(add-after 'install 'install-site-start
|
||||||
(("/bin/pwd")
|
;; Use 'guix-emacs' in "site-start.el", which is used autoload the
|
||||||
"pwd"))
|
;; Elisp packages found in EMACSLOADPATH.
|
||||||
#t))
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(add-after 'install 'install-site-start
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
;; Use 'guix-emacs' in "site-start.el", which is used autoload the
|
(lisp-dir (string-append out "/share/emacs/site-lisp"))
|
||||||
;; Elisp packages found in EMACSLOADPATH.
|
(emacs (string-append out "/bin/emacs")))
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
|
||||||
(lisp-dir (string-append out "/share/emacs/site-lisp"))
|
|
||||||
(emacs (string-append out "/bin/emacs")))
|
|
||||||
|
|
||||||
;; This is duplicated from emacs-utils to prevent coupling.
|
;; This is duplicated from emacs-utils to prevent coupling.
|
||||||
(define* (emacs-byte-compile-directory dir)
|
(define* (emacs-byte-compile-directory dir)
|
||||||
(let ((expr `(progn
|
(let ((expr `(progn
|
||||||
(setq byte-compile-debug t)
|
(setq byte-compile-debug t)
|
||||||
(byte-recompile-directory
|
(byte-recompile-directory
|
||||||
(file-name-as-directory ,dir) 0 1))))
|
(file-name-as-directory ,dir) 0 1))))
|
||||||
(invoke emacs "--quick" "--batch"
|
(invoke emacs "--quick" "--batch"
|
||||||
(format #f "--eval=~s" expr))))
|
(format #f "--eval=~s" expr))))
|
||||||
|
|
||||||
(copy-file (assoc-ref inputs "guix-emacs.el")
|
(copy-file #$(local-file
|
||||||
(string-append lisp-dir "/guix-emacs.el"))
|
(search-auxiliary-file "emacs/guix-emacs.el"))
|
||||||
(with-output-to-file (string-append lisp-dir "/site-start.el")
|
(string-append lisp-dir "/guix-emacs.el"))
|
||||||
(lambda ()
|
(with-output-to-file (string-append lisp-dir "/site-start.el")
|
||||||
(display
|
(lambda ()
|
||||||
(string-append
|
(display
|
||||||
"(when (require 'guix-emacs nil t)\n"
|
(string-append
|
||||||
" (guix-emacs-autoload-packages)\n"
|
"(when (require 'guix-emacs nil t)\n"
|
||||||
" (advice-add 'package-load-all-descriptors"
|
" (guix-emacs-autoload-packages)\n"
|
||||||
" :after #'guix-emacs-load-package-descriptors))"))))
|
" (advice-add 'package-load-all-descriptors"
|
||||||
;; Remove the extraneous subdirs.el file, as it causes Emacs to
|
" :after #'guix-emacs-load-package-descriptors))"))))
|
||||||
;; add recursively all the the sub-directories of a profile's
|
;; Remove the extraneous subdirs.el file, as it causes Emacs to
|
||||||
;; share/emacs/site-lisp union when added to EMACSLOADPATH,
|
;; add recursively all the the sub-directories of a profile's
|
||||||
;; which leads to conflicts.
|
;; share/emacs/site-lisp union when added to EMACSLOADPATH,
|
||||||
(delete-file (string-append lisp-dir "/subdirs.el"))
|
;; which leads to conflicts.
|
||||||
;; Byte compile the site-start files.
|
(delete-file (string-append lisp-dir "/subdirs.el"))
|
||||||
(emacs-byte-compile-directory lisp-dir))
|
;; Byte compile the site-start files.
|
||||||
#t))
|
(emacs-byte-compile-directory lisp-dir))))
|
||||||
(add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
|
(add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp
|
||||||
;; restore the dump file that Emacs installs somewhere in
|
;; restore the dump file that Emacs installs somewhere in
|
||||||
;; libexec/ to its original state
|
;; libexec/ to its original state
|
||||||
(lambda* (#:key outputs target #:allow-other-keys)
|
(lambda* (#:key outputs target #:allow-other-keys)
|
||||||
(let* ((libexec (string-append (assoc-ref outputs "out")
|
(let* ((libexec (string-append (assoc-ref outputs "out")
|
||||||
"/libexec"))
|
"/libexec"))
|
||||||
;; each of these ought to only match a single file,
|
;; each of these ought to only match a single file,
|
||||||
;; but even if not (find-files) sorts by string<,
|
;; but even if not (find-files) sorts by string<,
|
||||||
;; so the Nth element in one maps to the Nth element of
|
;; so the Nth element in one maps to the Nth element of
|
||||||
;; the other
|
;; the other
|
||||||
(pdmp (find-files libexec "\\.pdmp$"))
|
(pdmp (find-files libexec "\\.pdmp$"))
|
||||||
(pdmp-real (find-files libexec "\\.pdmp-real$")))
|
(pdmp-real (find-files libexec "\\.pdmp-real$")))
|
||||||
(for-each rename-file pdmp-real pdmp))))
|
(for-each rename-file pdmp-real pdmp))))
|
||||||
(add-after 'glib-or-gtk-wrap 'strip-double-wrap
|
(add-after 'glib-or-gtk-wrap 'strip-double-wrap
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
|
;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
|
||||||
;; twice. This also fixes a minor issue, where WMs would not be
|
;; twice. This also fixes a minor issue, where WMs would not be
|
||||||
;; able to track emacs back to emacs.desktop.
|
;; able to track emacs back to emacs.desktop.
|
||||||
(with-directory-excursion (assoc-ref outputs "out")
|
(with-directory-excursion (assoc-ref outputs "out")
|
||||||
(copy-file
|
(copy-file
|
||||||
(car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
|
(car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
|
||||||
"bin/emacs")
|
"bin/emacs"))))
|
||||||
#t)))
|
(add-after 'strip-double-wrap 'wrap-emacs-paths
|
||||||
(add-after 'strip-double-wrap 'wrap-emacs-paths
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(lisp-dirs (find-files (string-append out "/share/emacs")
|
||||||
(lisp-dirs (find-files (string-append out "/share/emacs")
|
"^lisp$"
|
||||||
"^lisp$"
|
#:directories? #t)))
|
||||||
#:directories? #t)))
|
(for-each
|
||||||
(for-each
|
(lambda (prog)
|
||||||
(lambda (prog)
|
(wrap-program prog
|
||||||
(wrap-program prog
|
;; emacs-next and variants rely on uname being in PATH for
|
||||||
;; emacs-next and variants rely on uname being in PATH for
|
;; Tramp. Tramp paths can't be hardcoded, because they
|
||||||
;; Tramp. Tramp paths can't be hardcoded, because they
|
;; need to be portable.
|
||||||
;; need to be portable.
|
`("PATH" suffix
|
||||||
`("PATH" suffix
|
,(map dirname
|
||||||
,(map (lambda (in) (string-append in "/bin"))
|
(list (search-input-file inputs "/bin/gzip")
|
||||||
(list (assoc-ref inputs "gzip")
|
;; for coreutils
|
||||||
(assoc-ref inputs "coreutils"))))
|
(search-input-file inputs "/bin/yes"))))
|
||||||
`("EMACSLOADPATH" suffix ,lisp-dirs)))
|
`("EMACSLOADPATH" suffix ,lisp-dirs)))
|
||||||
(find-files (string-append out "/bin")
|
(find-files (string-append out "/bin")
|
||||||
;; Matches versioned and unversioned emacs binaries.
|
;; Matches versioned and unversioned emacs binaries.
|
||||||
;; We don't patch emacsclient, because it takes its
|
;; We don't patch emacsclient, because it takes its
|
||||||
;; environment variables from emacs.
|
;; environment variables from emacs.
|
||||||
;; Likewise, we don't need to patch helper binaries
|
;; Likewise, we don't need to patch helper binaries
|
||||||
;; like etags, ctags or ebrowse.
|
;; like etags, ctags or ebrowse.
|
||||||
"^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))))))
|
"^emacs(-[0-9]+(\\.[0-9]+)*)?$"))))))))
|
||||||
(inputs
|
(inputs
|
||||||
`(("gnutls" ,gnutls)
|
(list gnutls
|
||||||
("ncurses" ,ncurses)
|
ncurses
|
||||||
|
|
||||||
;; Required for "core" functionality, such as dired and compression.
|
;; Required for "core" functionality, such as dired and compression.
|
||||||
("coreutils" ,coreutils)
|
coreutils
|
||||||
("gzip" ,gzip)
|
gzip
|
||||||
|
|
||||||
;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
|
;; Avoid Emacs's limited movemail substitute that retrieves POP3
|
||||||
;; only via insecure channels. This is not needed for (modern) IMAP.
|
;; email only via insecure channels.
|
||||||
("mailutils" ,mailutils)
|
;; This is not needed for (modern) IMAP.
|
||||||
|
mailutils
|
||||||
|
|
||||||
;; TODO: Add the optional dependencies.
|
;; TODO: Add the optional dependencies.
|
||||||
("gpm" ,gpm)
|
gpm
|
||||||
("libx11" ,libx11)
|
libx11
|
||||||
("gtk+" ,gtk+)
|
gtk+
|
||||||
("cairo" ,cairo)
|
cairo
|
||||||
("pango" ,pango)
|
pango
|
||||||
("harfbuzz" ,harfbuzz)
|
harfbuzz
|
||||||
("libxft" ,libxft)
|
libxft
|
||||||
("libtiff" ,libtiff)
|
libtiff
|
||||||
("giflib" ,giflib)
|
giflib
|
||||||
("libjpeg" ,libjpeg-turbo)
|
libjpeg-turbo
|
||||||
("acl" ,acl)
|
acl
|
||||||
("jansson" ,jansson)
|
jansson
|
||||||
("gmp" ,gmp)
|
gmp
|
||||||
("ghostscript" ,ghostscript)
|
ghostscript
|
||||||
("poppler" ,poppler)
|
poppler
|
||||||
|
|
||||||
;; When looking for libpng `configure' links with `-lpng -lz', so we
|
;; When looking for libpng `configure' links with `-lpng -lz', so we
|
||||||
;; must also provide zlib as an input.
|
;; must also provide zlib as an input.
|
||||||
("libpng" ,libpng)
|
libpng
|
||||||
("zlib" ,zlib)
|
zlib
|
||||||
("librsvg" ,@(if (target-x86-64?)
|
(if (target-x86-64?)
|
||||||
(list librsvg-bootstrap)
|
librsvg-bootstrap
|
||||||
(list librsvg-2.40)))
|
librsvg-2.40)
|
||||||
("libxpm" ,libxpm)
|
libxpm
|
||||||
("libxml2" ,libxml2)
|
libxml2
|
||||||
("libice" ,libice)
|
libice
|
||||||
("libsm" ,libsm)
|
libsm
|
||||||
("alsa-lib" ,alsa-lib)
|
alsa-lib
|
||||||
("dbus" ,dbus)
|
dbus
|
||||||
|
|
||||||
;; multilingualization support
|
;; multilingualization support
|
||||||
("libotf" ,libotf)
|
libotf
|
||||||
("m17n-lib" ,m17n-lib)))
|
m17n-lib))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
|
(list pkg-config texinfo))
|
||||||
("pkg-config" ,pkg-config)
|
|
||||||
("texinfo" ,texinfo)))
|
|
||||||
|
|
||||||
(native-search-paths
|
(native-search-paths
|
||||||
(list (search-path-specification
|
(list (search-path-specification
|
||||||
(variable "EMACSLOADPATH")
|
(variable "EMACSLOADPATH")
|
||||||
|
|
Reference in New Issue