From patchwork Sun Apr 10 11:28:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 38592 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AFA9D27BBEA; Thu, 14 Apr 2022 20:48:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4915A27BBEC for ; Thu, 14 Apr 2022 20:48:29 +0100 (BST) Received: from localhost ([::1]:39518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nf5S8-0008Fz-Do for patchwork@mira.cbaines.net; Thu, 14 Apr 2022 15:48:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nf5Ri-0008Dy-Hh for guix-patches@gnu.org; Thu, 14 Apr 2022 15:48:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nf5Ri-0005Hq-8V for guix-patches@gnu.org; Thu, 14 Apr 2022 15:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nf5Ri-0001WJ-6F for guix-patches@gnu.org; Thu, 14 Apr 2022 15:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54829] [PATCH v3 2/3] gnu: emacs: Use new package style. References: In-Reply-To: Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Apr 2022 19:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54829 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54829@debbugs.gnu.org Cc: Maxime Devos , zimoun Received: via spool by 54829-submit@debbugs.gnu.org id=B54829.16499656695758 (code B ref 54829); Thu, 14 Apr 2022 19:48:02 +0000 Received: (at 54829) by debbugs.gnu.org; 14 Apr 2022 19:47:49 +0000 Received: from localhost ([127.0.0.1]:57422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nf5RU-0001Ui-L1 for submit@debbugs.gnu.org; Thu, 14 Apr 2022 15:47:49 -0400 Received: from mail-ej1-f65.google.com ([209.85.218.65]:44658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nf5RP-0001TV-W3 for 54829@debbugs.gnu.org; Thu, 14 Apr 2022 15:47:48 -0400 Received: by mail-ej1-f65.google.com with SMTP id u15so11933336ejf.11 for <54829@debbugs.gnu.org>; Thu, 14 Apr 2022 12:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:subject:mime-version:to:cc:content-transfer-encoding :message-id; bh=XBqO4d8eS1vAF19J5uxDwr8nm+JfRuz9E4f7TlxOohk=; b=qeK0L+jWTumlS+hc6yBhLUL4WFm+WwuSEBWvFJoU8WESjsDpxTbufYjJgDpQZuiBYw RCsBNtQwtqFCBvCvqWrabebd1m6lKkWOHvTuVIU4q0WeI2CoCroxZZ9Cid+LSF3IMr8D FfBC4El0wXHrdzri0NsGIWTg9yE1O1K8MoSPvf1q52iEftTxRR+OmqTDPYT+a5OCTOMw R7y+Lj/ulnZIziApfP58PpgOuGd2D4vcyyaUwx39tzaT9wsA+jB6aV3phlP4WP4XwCJK dBjy7w8sIP7ulTvsXinK8uDmKWRL6jq2V7OS8C6DEIY55wC34w/0+r0BzULba8jMGFjC iHSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:subject:mime-version:to:cc :content-transfer-encoding:message-id; bh=XBqO4d8eS1vAF19J5uxDwr8nm+JfRuz9E4f7TlxOohk=; b=aGCCZyebX4kRkM/72Tbs0nsZ+FBlA3vHyGS9atMGDgdUs7ceMCUwfBcolt5bz/Zfv2 oUekMXwRHz10R6MUDQ2hkErgSL9Jo+YvTIo7z2rqGWbo1cOP3jhAP/Cku628AZsERWos t1AAgF44mTyAz0QNf+tiS5yeh2ElxitcX/6zrYoR2bZjCllhL7NnPas79Yp2Q1eBcdWY SVRbsRTq/CVtkL8T5FmCJcXlcl1BsIa15o9Jaw8AF1SkfXVLhL0WhTOeQGy1sXsSBN11 qm6hDD/JLtW7egoxqq3yDwbBDtK+BLYkXaWU5UpnJ3rLU0I8+/QWFUpCGUvhMLzNWDAp OIjw== X-Gm-Message-State: AOAM530f21HxmcWCqvsmsMO1x/ajLG0cYmfeg5UXD54OJWscVTsyqGUU E+PPh1pb3e4Qsf5vcv1nMoqrGW3QmX4= X-Google-Smtp-Source: ABdhPJzTOQyLvzz3OJE81Ib1CN2V1DSNy1vIUUFhGjJQeHZC4ynARGQPZ9+IpJcxSD0yqiTtyJ2bRQ== X-Received: by 2002:a17:907:724d:b0:6df:ff4c:8941 with SMTP id ds13-20020a170907724d00b006dfff4c8941mr3728828ejc.10.1649965658096; Thu, 14 Apr 2022 12:47:38 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id u19-20020a17090617d300b006cea86ca384sm953906eje.40.2022.04.14.12.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 12:47:37 -0700 (PDT) From: Liliana Marie Prikler Date: Sun, 10 Apr 2022 13:28:05 +0200 MIME-Version: 1.0 Message-ID: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/emacs.scm (emacs)[source]: 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. --- gnu/packages/emacs.scm | 327 ++++++++++++++++++++--------------------- 1 file changed, 161 insertions(+), 166 deletions(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 7d791250d2..a32fe624dd 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -41,6 +41,7 @@ (define-module (gnu packages emacs) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) + #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) @@ -51,6 +52,7 @@ (define-module (gnu packages emacs) #:use-module (gnu packages base) #:use-module (gnu packages compression) #:use-module (gnu packages fontutils) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages fribidi) #:use-module (gnu packages gd) #:use-module (gnu packages gettext) @@ -119,183 +121,176 @@ (define-public emacs (list line "\"~/.guix-profile/include\"" "\"/var/guix/profiles/system/profile/include\"") - " "))) - #t)))) + " "))))))) (build-system glib-or-gtk-build-system) (arguments - `(#:tests? #f ; no check target - #:configure-flags (list "--with-modules" - "--with-cairo" - "--disable-build-details") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'patch-program-file-names - (lambda* (#:key inputs #:allow-other-keys) - (substitute* '("src/callproc.c" - "lisp/term.el" - "lisp/htmlfontify.el" - "lisp/textmodes/artist.el" - "lisp/progmodes/sh-script.el") - (("\"/bin/sh\"") - (format #f "~s" (which "sh")))) - (substitute* "lisp/doc-view.el" - (("\"(gs|dvipdf|ps2pdf)\"" all what) - (let ((ghostscript (assoc-ref inputs "ghostscript"))) - (if ghostscript - (string-append "\"" ghostscript "/bin/" what "\"") - all))) - (("\"(pdftotext)\"" all what) - (let ((poppler (assoc-ref inputs "poppler"))) - (if poppler - (string-append "\"" poppler "/bin/" what "\"") - all)))) - ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real" - ;; respectively when looking for GVFS processes. - (substitute* "lisp/net/tramp-gvfs.el" - (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process) - (format #f "(or ~a (tramp-compat-process-running-p ~s))" - all (string-append "." process "-real")))) - #t)) - (add-before 'configure 'fix-/bin/pwd - (lambda _ - ;; Use `pwd', not `/bin/pwd'. - (substitute* (find-files "." "^Makefile\\.in$") - (("/bin/pwd") - "pwd")) - #t)) - (add-after 'install 'install-site-start - ;; Use 'guix-emacs' in "site-start.el", which is used autoload the - ;; Elisp packages found in EMACSLOADPATH. - (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"))) + (list + #:tests? #f ; no check target + #:configure-flags #~(list "--with-modules" + "--with-cairo" + "--disable-build-details") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-program-file-names + (lambda* (#:key inputs #:allow-other-keys) + (substitute* '("src/callproc.c" + "lisp/term.el" + "lisp/htmlfontify.el" + "lisp/textmodes/artist.el" + "lisp/progmodes/sh-script.el") + (("\"/bin/sh\"") + (format #f "~s" (search-input-file inputs "/bin/sh")))) + (substitute* "lisp/doc-view.el" + (("\"(gs|dvipdf|ps2pdf|pdftotext)\"" all what) + (let ((replacement (search-input-file + inputs + (string-append "/bin/" what)))) + (if replacement + (string-append "\"" replacement "\"") + all)))) + ;; match ".gvfs-fuse-daemon-real" and ".gvfsd-fuse-real" + ;; respectively when looking for GVFS processes. + (substitute* "lisp/net/tramp-gvfs.el" + (("\\(tramp-compat-process-running-p \"(.*)\"\\)" all process) + (format #f "(or ~a (tramp-compat-process-running-p ~s))" + all (string-append "." process "-real")))))) + (add-before 'configure 'fix-/bin/pwd + (lambda _ + ;; Use `pwd', not `/bin/pwd'. + (substitute* (find-files "." "^Makefile\\.in$") + (("/bin/pwd") + "pwd")))) + (add-after 'install 'install-site-start + ;; Use 'guix-emacs' in "site-start.el", which is used autoload the + ;; Elisp packages found in EMACSLOADPATH. + (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. - (define* (emacs-byte-compile-directory dir) - (let ((expr `(progn - (setq byte-compile-debug t) - (byte-recompile-directory - (file-name-as-directory ,dir) 0 1)))) - (invoke emacs "--quick" "--batch" - (format #f "--eval=~s" expr)))) + ;; This is duplicated from emacs-utils to prevent coupling. + (define* (emacs-byte-compile-directory dir) + (let ((expr `(progn + (setq byte-compile-debug t) + (byte-recompile-directory + (file-name-as-directory ,dir) 0 1)))) + (invoke emacs "--quick" "--batch" + (format #f "--eval=~s" expr)))) - (copy-file (assoc-ref inputs "guix-emacs.el") - (string-append lisp-dir "/guix-emacs.el")) - (with-output-to-file (string-append lisp-dir "/site-start.el") - (lambda () - (display - (string-append - "(when (require 'guix-emacs nil t)\n" - " (guix-emacs-autoload-packages)\n" - " (advice-add 'package-load-all-descriptors" - " :after #'guix-emacs-load-package-descriptors))")))) - ;; Remove the extraneous subdirs.el file, as it causes Emacs to - ;; add recursively all the the sub-directories of a profile's - ;; share/emacs/site-lisp union when added to EMACSLOADPATH, - ;; which leads to conflicts. - (delete-file (string-append lisp-dir "/subdirs.el")) - ;; Byte compile the site-start files. - (emacs-byte-compile-directory lisp-dir)) - #t)) - (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp - ;; restore the dump file that Emacs installs somewhere in - ;; libexec/ to its original state - (lambda* (#:key outputs target #:allow-other-keys) - (let* ((libexec (string-append (assoc-ref outputs "out") - "/libexec")) - ;; each of these ought to only match a single file, - ;; but even if not (find-files) sorts by string<, - ;; so the Nth element in one maps to the Nth element of - ;; the other - (pdmp (find-files libexec "\\.pdmp$")) - (pdmp-real (find-files libexec "\\.pdmp-real$"))) - (for-each rename-file pdmp-real pdmp)))) - (add-after 'glib-or-gtk-wrap 'strip-double-wrap - (lambda* (#:key outputs #:allow-other-keys) - ;; 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 - ;; able to track emacs back to emacs.desktop. - (with-directory-excursion (assoc-ref outputs "out") - (copy-file - (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$")) - "bin/emacs") - #t))) - (add-after 'strip-double-wrap 'wrap-emacs-paths - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (lisp-dirs (find-files (string-append out "/share/emacs") - "^lisp$" - #:directories? #t))) - (for-each - (lambda (prog) - (wrap-program prog - ;; emacs-next and variants rely on uname being in PATH for - ;; Tramp. Tramp paths can't be hardcoded, because they - ;; need to be portable. - `("PATH" suffix - ,(map (lambda (in) (string-append in "/bin")) - (list (assoc-ref inputs "gzip") - (assoc-ref inputs "coreutils")))) - `("EMACSLOADPATH" suffix ,lisp-dirs))) - (find-files (string-append out "/bin") - ;; Matches versioned and unversioned emacs binaries. - ;; We don't patch emacsclient, because it takes its - ;; environment variables from emacs. - ;; Likewise, we don't need to patch helper binaries - ;; like etags, ctags or ebrowse. - "^emacs(-[0-9]+(\\.[0-9]+)*)?$")))))))) + (copy-file #$(local-file + (search-auxiliary-file "emacs/guix-emacs.el")) + (string-append lisp-dir "/guix-emacs.el")) + (with-output-to-file (string-append lisp-dir "/site-start.el") + (lambda () + (display + (string-append + "(when (require 'guix-emacs nil t)\n" + " (guix-emacs-autoload-packages)\n" + " (advice-add 'package-load-all-descriptors" + " :after #'guix-emacs-load-package-descriptors))")))) + ;; Remove the extraneous subdirs.el file, as it causes Emacs to + ;; add recursively all the the sub-directories of a profile's + ;; share/emacs/site-lisp union when added to EMACSLOADPATH, + ;; which leads to conflicts. + (delete-file (string-append lisp-dir "/subdirs.el")) + ;; Byte compile the site-start files. + (emacs-byte-compile-directory lisp-dir)))) + (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp + ;; restore the dump file that Emacs installs somewhere in + ;; libexec/ to its original state + (lambda* (#:key outputs target #:allow-other-keys) + (let* ((libexec (string-append (assoc-ref outputs "out") + "/libexec")) + ;; each of these ought to only match a single file, + ;; but even if not (find-files) sorts by string<, + ;; so the Nth element in one maps to the Nth element of + ;; the other + (pdmp (find-files libexec "\\.pdmp$")) + (pdmp-real (find-files libexec "\\.pdmp-real$"))) + (for-each rename-file pdmp-real pdmp)))) + (add-after 'glib-or-gtk-wrap 'strip-double-wrap + (lambda* (#:key outputs #:allow-other-keys) + ;; 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 + ;; able to track emacs back to emacs.desktop. + (with-directory-excursion (assoc-ref outputs "out") + (copy-file + (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$")) + "bin/emacs")))) + (add-after 'strip-double-wrap 'wrap-emacs-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lisp-dirs (find-files (string-append out "/share/emacs") + "^lisp$" + #:directories? #t))) + (for-each + (lambda (prog) + (wrap-program prog + ;; emacs-next and variants rely on uname being in PATH for + ;; Tramp. Tramp paths can't be hardcoded, because they + ;; need to be portable. + `("PATH" suffix + ,(map dirname + (list (search-input-file inputs "/bin/gzip") + ;; for coreutils + (search-input-file inputs "/bin/yes")))) + `("EMACSLOADPATH" suffix ,lisp-dirs))) + (find-files (string-append out "/bin") + ;; Matches versioned and unversioned emacs binaries. + ;; We don't patch emacsclient, because it takes its + ;; environment variables from emacs. + ;; Likewise, we don't need to patch helper binaries + ;; like etags, ctags or ebrowse. + "^emacs(-[0-9]+(\\.[0-9]+)*)?$")))))))) (inputs - `(("gnutls" ,gnutls) - ("ncurses" ,ncurses) + (list gnutls + ncurses - ;; Required for "core" functionality, such as dired and compression. - ("coreutils" ,coreutils) - ("gzip" ,gzip) + ;; Required for "core" functionality, such as dired and compression. + coreutils + gzip - ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email - ;; only via insecure channels. This is not needed for (modern) IMAP. - ("mailutils" ,mailutils) + ;; Avoid Emacs's limited movemail substitute that retrieves POP3 + ;; email only via insecure channels. + ;; This is not needed for (modern) IMAP. + mailutils - ;; TODO: Add the optional dependencies. - ("gpm" ,gpm) - ("libx11" ,libx11) - ("gtk+" ,gtk+) - ("cairo" ,cairo) - ("pango" ,pango) - ("harfbuzz" ,harfbuzz) - ("libxft" ,libxft) - ("libtiff" ,libtiff) - ("giflib" ,giflib) - ("libjpeg" ,libjpeg-turbo) - ("acl" ,acl) - ("jansson" ,jansson) - ("gmp" ,gmp) - ("ghostscript" ,ghostscript) - ("poppler" ,poppler) + ;; TODO: Add the optional dependencies. + gpm + libx11 + gtk+ + cairo + pango + harfbuzz + libxft + libtiff + giflib + libjpeg-turbo + acl + jansson + gmp + ghostscript + poppler - ;; When looking for libpng `configure' links with `-lpng -lz', so we - ;; must also provide zlib as an input. - ("libpng" ,libpng) - ("zlib" ,zlib) - ("librsvg" ,@(if (target-x86-64?) - (list librsvg-bootstrap) - (list librsvg-2.40))) - ("libxpm" ,libxpm) - ("libxml2" ,libxml2) - ("libice" ,libice) - ("libsm" ,libsm) - ("alsa-lib" ,alsa-lib) - ("dbus" ,dbus) + ;; When looking for libpng `configure' links with `-lpng -lz', so we + ;; must also provide zlib as an input. + libpng + zlib + (if (target-x86-64?) + librsvg-bootstrap + librsvg-2.40) + libxpm + libxml2 + libice + libsm + alsa-lib + dbus - ;; multilingualization support - ("libotf" ,libotf) - ("m17n-lib" ,m17n-lib))) + ;; multilingualization support + libotf + m17n-lib)) (native-inputs - `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) - ("pkg-config" ,pkg-config) - ("texinfo" ,texinfo))) - + (list pkg-config texinfo)) (native-search-paths (list (search-path-specification (variable "EMACSLOADPATH")