From patchwork Thu Oct 19 04:06:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liliana Marie Prikler X-Patchwork-Id: 55016 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 4B8EF27BBE2; Thu, 19 Oct 2023 06:54:27 +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 A1F2D27BBEA for ; Thu, 19 Oct 2023 06:54:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtLyU-0003j6-KW; Thu, 19 Oct 2023 01:53:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtLyR-0003iH-Ks for guix-patches@gnu.org; Thu, 19 Oct 2023 01:53:36 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtLyR-0002NX-Bf for guix-patches@gnu.org; Thu, 19 Oct 2023 01:53:35 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtLyr-0000vB-JZ; Thu, 19 Oct 2023 01:54:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66624] [PATCH emacs-team 01/15] guix: emacs-build-system: Process package source in build tree. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 19 Oct 2023 05:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66624 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66624@debbugs.gnu.org Cc: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com X-Debbugs-Original-Xcc: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com Received: via spool by 66624-submit@debbugs.gnu.org id=B66624.16976948133357 (code B ref 66624); Thu, 19 Oct 2023 05:54:01 +0000 Received: (at 66624) by debbugs.gnu.org; 19 Oct 2023 05:53:33 +0000 Received: from localhost ([127.0.0.1]:35473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtLyO-0000s4-BR for submit@debbugs.gnu.org; Thu, 19 Oct 2023 01:53:32 -0400 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:58780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtLyL-0000ra-PD for 66624@debbugs.gnu.org; Thu, 19 Oct 2023 01:53:30 -0400 Received: by mail-ed1-x541.google.com with SMTP id 4fb4d7f45d1cf-53f9af41444so263635a12.1 for <66624@debbugs.gnu.org>; Wed, 18 Oct 2023 22:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697694777; x=1698299577; darn=debbugs.gnu.org; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :from:to:cc:subject:date:message-id:reply-to; bh=69c2V3RnTf25qd4I7MfyaW6muQgnLDJZkvWsa0n+taU=; b=law77mn5mqv8X4AsN4MkSyYeATHNWhU88SMW7JtRhZ7fpmrKDf64nTPz1AkolqnWZs vxZmnXN63mOwMZ+zINNTU8Z49ruQZCKPXq7GUYecR7Z5VOmsNFeOhcfmChW/DORF2+ag mgPycddUGRlVrVHxRZ8rJYCyBej1HhmIc5xof1RHEDyOlfe0aUmJ0VwQLek8OtNdGuqV D3IaKZlNJPnLeq42EPCcMfmnTUSi2D7wKUdPHB43c9xkkt/vZjcfwTVV10r/8Gk44e9V rktICHBX1BaO7CKPiGJ7GDQCqwkNJvsHFuIEsUjJfZ2ZVHejbdCQX8MOA7fKxJx826pm ncWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697694777; x=1698299577; h=mime-version:to:subject:date:from:references:in-reply-to:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=69c2V3RnTf25qd4I7MfyaW6muQgnLDJZkvWsa0n+taU=; b=ebO9Z0Ch9L90+HVzvfiNrnlKwXH8PL8VX7K+38qFLNESJ9sPJ6tIrWO/NYlZizCL8N CRH7XdcgTYXZN5DF6WO8Dosy0ei8dljBetRYahi5IU88PzZ1bJbrbjpXVRNtXn2nA57x kPYILqfpwpPKm82jfObUPe86qspRx0Nk9JZHb2NiIQNsbm9EmKWGQBYdUOIRy7PiuS/O qcmQQojNMLv4Zk45rGM8A5Ioen9KXpF4G6IcWbUuuGWe869UVTVsISdXu3pSLgqDdLeu JFWJ32xyJqY4Lr8zwZ5NDMouNbu3dBOC9MMaXKFOwXwFZ3MQCmC6jSYqnp+c+aBdMqhV MHCA== X-Gm-Message-State: AOJu0Yy5r9WWINdfG2F72JoHaTyP5WSIbXDCqnQZ87+7rHi046M3NimT yyaENUw90rEklwDcqyUNpGMJA0DL0VLyAA== X-Google-Smtp-Source: AGHT+IHXXbOHceUHML/eR0FC9DXwtMFYGBOnTch463wKJje+4R7HWiSz2sxrMCMjUUoV45m1ioErsA== X-Received: by 2002:a50:cc83:0:b0:53e:7d91:611f with SMTP id q3-20020a50cc83000000b0053e7d91611fmr714186edi.11.1697694777189; Wed, 18 Oct 2023 22:52:57 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id s22-20020a50ab16000000b0053e589016a7sm3605507edc.16.2023.10.18.22.52.56 for <66624@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 22:52:56 -0700 (PDT) Message-ID: In-Reply-To: References: From: Liliana Marie Prikler Date: Thu, 19 Oct 2023 06:06:48 +0200 MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build/emacs-build-system.scm (ensure-package-description) (patch-el-files, make-autoloads): Operate on the current working directory, either implicitly, or through (getcwd). (enable-autoloads-compilation): Deleted variable, logic moved into make-autoloads. (%standard-phases): Adjust accordingly. --- guix/build/emacs-build-system.scm | 85 +++++++++++++------------------ 1 file changed, 34 insertions(+), 51 deletions(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 3808b60445..aa083c6409 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -132,29 +132,25 @@ (define* (build #:key outputs inputs #:allow-other-keys) (parameterize ((%emacs emacs)) (emacs-compile-directory (elpa-directory out))))) -(define* (patch-el-files #:key outputs #:allow-other-keys) - "Substitute the absolute \"/bin/\" directory with the right location in the -store in '.el' files." - - (let* ((out (assoc-ref outputs "out")) - (elpa-name-ver (store-directory->elpa-name-version out)) - (el-dir (string-append out %install-dir "/" elpa-name-ver)) - (el-files (find-files (getcwd) "\\.el$"))) - (define (substitute-program-names) - (substitute* el-files - (("\"/bin/([^.]\\S*)\"" _ cmd-name) - (let ((cmd (which cmd-name))) - (unless cmd - (error "patch-el-files: unable to locate " cmd-name)) - (string-append "\"" cmd "\""))))) - - (with-directory-excursion el-dir - ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still - ;; ISO-8859-1-encoded. - (unless (false-if-exception (substitute-program-names)) - (with-fluids ((%default-port-encoding "ISO-8859-1")) - (substitute-program-names)))) - #t)) +(define* (patch-el-files #:key inputs outputs #:allow-other-keys) + "Substitute the absolute \"/bin/\" and \"/sbin\" directories with the right +locations in the store in '.el' files." + + (define substitute-program-names + (let ((el-files (find-files (getcwd) "\\.el$"))) + (lambda () + (substitute* el-files + (("\"/(s?bin/[^.]\\S*)\"" _ cmd) + (let ((cmd (search-input-file inputs cmd))) + (unless cmd + (error "patch-el-files: unable to locate " (basename cmd))) + (string-append "\"" cmd "\""))))))) + + (unless (false-if-exception (substitute-program-names)) + ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still + ;; ISO-8859-1-encoded. + (with-fluids ((%default-port-encoding "ISO-8859-1")) + (substitute-program-names)))) (define (find-root-library-file name) (let loop ((parts (string-split @@ -224,10 +220,8 @@ (define* (ensure-package-description #:key outputs #:allow-other-keys) (emacs-batch-edit-file (string-append name ".el") %write-pkg-file-form))) - (let* ((out (assoc-ref outputs "out")) - (elpa-name-ver (store-directory->elpa-name-version out))) - (with-directory-excursion (elpa-directory out) - (and=> (find-root-library-file elpa-name-ver) write-pkg-file)))) + (let ((name (store-directory->elpa-name-version (assoc-ref outputs "out")))) + (and=> (find-root-library-file name) write-pkg-file))) (define* (check #:key tests? (test-command '("make" "check")) (parallel-tests? #t) #:allow-other-keys) @@ -306,24 +300,15 @@ (define* (move-doc #:key outputs #:allow-other-keys) info-files))) #t)) -(define* (make-autoloads #:key outputs inputs #:allow-other-keys) +(define* (make-autoloads #:key outputs #:allow-other-keys) "Generate the autoloads file." - (let* ((emacs (search-input-file inputs "/bin/emacs")) - (out (assoc-ref outputs "out")) - (elpa-name-ver (store-directory->elpa-name-version out)) - (elpa-name (package-name->name+version elpa-name-ver)) - (el-dir (elpa-directory out))) - (parameterize ((%emacs emacs)) - (emacs-generate-autoloads elpa-name el-dir)))) - -(define* (enable-autoloads-compilation #:key outputs #:allow-other-keys) - "Remove the NO-BYTE-COMPILATION local variable embedded in the generated -autoload files." - (let* ((out (assoc-ref outputs "out")) - (autoloads (find-files out "-autoloads.el$"))) - (substitute* autoloads - ((";; no-byte-compile.*") "")) - #t)) + (emacs-generate-autoloads + (package-name->name+version (store-directory->elpa-name-version + (assoc-ref outputs "out"))) + (getcwd)) + ;; Ensure that autoloads can be byte-compiled. + (substitute* (find-files "." "-autoloads\\.el$") + ((";; no-byte-compile.*") ""))) (define* (validate-compiled-autoloads #:key outputs #:allow-other-keys) "Verify whether the byte compiled autoloads load fine." @@ -358,7 +343,11 @@ (define (elpa-directory store-dir) (define %standard-phases (modify-phases gnu:%standard-phases (replace 'unpack unpack) + (add-after 'unpack 'ensure-package-description + ensure-package-description) (add-after 'unpack 'expand-load-path expand-load-path) + (add-after 'unpack 'patch-el-files patch-el-files) + (add-after 'expand-load-path 'make-autoloads make-autoloads) (add-after 'expand-load-path 'add-install-to-native-load-path add-install-to-native-load-path) (delete 'bootstrap) @@ -366,14 +355,8 @@ (define %standard-phases (delete 'build) (replace 'check check) (replace 'install install) - (add-after 'install 'make-autoloads make-autoloads) - (add-after 'make-autoloads 'enable-autoloads-compilation - enable-autoloads-compilation) - (add-after 'enable-autoloads-compilation 'patch-el-files patch-el-files) - (add-after 'patch-el-files 'ensure-package-description - ensure-package-description) ;; The .el files are byte compiled directly in the store. - (add-after 'ensure-package-description 'build build) + (add-after 'install 'build build) (add-after 'build 'validate-compiled-autoloads validate-compiled-autoloads) (add-after 'validate-compiled-autoloads 'move-doc move-doc)))