From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qLZOAmIlB2NjBgAAbAwnHQ (envelope-from ) for ; Thu, 25 Aug 2022 09:31:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IOtCAmIlB2MEcAAAauVa8A (envelope-from ) for ; Thu, 25 Aug 2022 09:31:46 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CB5DD16E02 for ; Thu, 25 Aug 2022 09:31:45 +0200 (CEST) Received: from localhost ([::1]:44396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR7L6-0000K1-T9 for larch@yhetil.org; Thu, 25 Aug 2022 03:31:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR7Ee-0004T9-Mn for guix-patches@gnu.org; Thu, 25 Aug 2022 03:25:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oR7Ee-0006Lo-DX for guix-patches@gnu.org; Thu, 25 Aug 2022 03:25:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oR7Ee-0000BU-9I for guix-patches@gnu.org; Thu, 25 Aug 2022 03:25:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57086] [PATCH v3 5/7] guix: emacs-utils: Add emacs-compile-directory. References: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com> In-Reply-To: <4c232648145659a2c3edca6d32725d8120cc14d3.camel@gmail.com> Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Aug 2022 07:25:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57086 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57086@debbugs.gnu.org Received: via spool by 57086-submit@debbugs.gnu.org id=B57086.1661412291626 (code B ref 57086); Thu, 25 Aug 2022 07:25:04 +0000 Received: (at 57086) by debbugs.gnu.org; 25 Aug 2022 07:24:51 +0000 Received: from localhost ([127.0.0.1]:48751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR7ER-0000A1-3g for submit@debbugs.gnu.org; Thu, 25 Aug 2022 03:24:51 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:38665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR7ED-00008V-0H for 57086@debbugs.gnu.org; Thu, 25 Aug 2022 03:24:37 -0400 Received: by mail-ej1-f66.google.com with SMTP id u9so8825507ejy.5 for <57086@debbugs.gnu.org>; Thu, 25 Aug 2022 00:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:content-transfer-encoding:to:subject:date :from:from:to:cc; bh=JbthDGXXHfxjli2NIWJGjYdprZIFZnZlZXQcKcM5itU=; b=PfSI7QtZn0Q6x49Vf23OWxfMGxcsl72O2H1HKWV1+D7KhnD7bH/59tDckgOqvVhduf XbXDUEFIwKVOx0RzAbyIKxftQC6vzoHNxsRRNSfs2F8TSVlgXxX4byoe5ZWf7TXzNDMD BKFJh4+HtmORt4qIROnMlGavrBfpHJTzaABhST4sOUE9ldLKT+62C5ymm099FNzgRDTs Gcc3TvbtpFTA2wT8d87UI6oVzPRU1AZYDZQJyTli26XuDpnsGFnASWBmMhtlu2nt4mxe 5n1ZdTBEUcHHuaPJZVGRWaeE4RRvjB2bgefLz9ipSu8ypiDIDMValcyGR6luup+Ycc/Q loUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:content-transfer-encoding:to:subject:date :from:x-gm-message-state:from:to:cc; bh=JbthDGXXHfxjli2NIWJGjYdprZIFZnZlZXQcKcM5itU=; b=NaMtItSBo/mvlIc8aN/8+mSWST7srbh2VMXM25ha/O4rr3LhoxKftpNZ2qbs7uGnok JKxVbTd5s/usB62NBcwmx0fD6eKhJNf2vfBt4xA45ok/yBbtkEzllVSpt1wBIpM+k5ku W2eF+QQYrtdjngEcJQ0V4WvxBbD48DinuT4l9tXwofMoimqjqNtZh3FQzi5jteqTgV6n RlgMumSzMZxsv97mF9Y+bzRp+chCrk23Ypjoq1/nnepEWMxRQxaNJucynnS7+RQzSRg1 U6SV2a21g2ql3uqstjnunNeXSVIIvy+f5IGu/G/3tUKT5t4bQsdeK3htAj6+Ia5tgzAe JzpQ== X-Gm-Message-State: ACgBeo1fGB5ONGV6WUumnO0NKHRDkCEVs7PzjklFwti30QdZ0uNh2YOR Q/J656/nmFVS5SqoHLOPsEdaoui5/uk= X-Google-Smtp-Source: AA6agR7AgdUkjy0hlZoyq2pE0uTC6NBLWIs3Pl751JBQ1yLlq5uJP8VZFaeH+W3l4vuMeMmM1Z+EmA== X-Received: by 2002:a17:906:58c9:b0:73c:37bb:c4d4 with SMTP id e9-20020a17090658c900b0073c37bbc4d4mr1556523ejs.467.1661412271493; Thu, 25 Aug 2022 00:24:31 -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 g2-20020a170906538200b0073d62cc3270sm2019690ejo.118.2022.08.25.00.24.30 for <57086@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 00:24:30 -0700 (PDT) From: Liliana Marie Prikler Date: Tue, 9 Aug 2022 20:26:06 +0200 Content-Transfer-Encoding: 7bit Message-ID: <3854e9646995cc34c07f92e27c949753ce7d6c5f.camel@gmail.com> 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661412705; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=JbthDGXXHfxjli2NIWJGjYdprZIFZnZlZXQcKcM5itU=; b=V2nEVbuLgTsg49akOSxWRBqr3S/1hjKKEYfuk12Rj4sJmhzlJz2T0M6C36CF5kRjla2i/G cT9Nx5tIoc3plAW/vwn/RP4rcIkOc7TZVkQuXafS0o1BLT5EolW3MXDluTjOkX0nUOrLh1 PRboRNgwysrnOzu/74TraCYKXqi6pP5sf8yapaCok5ajIA6gcUN5DA46fWfjxohTYPf1LW zmqnVwro9pHA4ZxUq8lPaocvp0qRPcjs41TWKuPtSWw8GK1MyrdUSDhsnP5STb73TZPgPZ ZerxS3CABgHep3YAqrrYPQ+rFV1vmiK4cJ/AFgcJgQHgTnnXMay6G8TWYcnowA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661412705; a=rsa-sha256; cv=none; b=cIAJzDbqgMR4BPTlLRWCnDkLw8rwEDsrF0TcvBkadQX7JexR4hdD6oFvuvm0+umYYM8Rk9 y2KQ6rIP6tOPpCW47/EOpw5pwoSeGHeowqo7HV6/yvzr70d7/+GALi6BqkKdejRjZhWRe8 IdLcTVhtYKDbQUqYL8Eu4yySnAcks+Np8SWezeOkDLczXLkTw36cTPsruV5L/oHj0d8nms c+QHLCLXPp/HzCEjDRDWF4OkrYTDp0/z6Dpg75FyhSSA9zgKpOaSfucyni/EOTrSjjXW/W 6LJ2aZ3UV+14DNTwpoNVBCc6iYiCYXiCaSEU0V3ZK2cHY+uytVZK445U9cO96w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=PfSI7QtZ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.79 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=PfSI7QtZ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: CB5DD16E02 X-Spam-Score: 5.79 X-Migadu-Scanner: scn0.migadu.com X-TUID: Tei6QkeoXDaB * guix/build/emacs-utils.scm (emacs-compile-directory): New variable. --- guix/build/emacs-utils.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 8ee547f2b3..fdca05602e 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -38,6 +38,7 @@ (define-module (guix build emacs-utils) emacs-generate-autoloads emacs-byte-compile-directory + emacs-compile-directory emacs-header-parse as-display @@ -115,6 +116,35 @@ (define* (emacs-byte-compile-directory dir) (byte-recompile-directory (file-name-as-directory ,dir) 0 1)))) (emacs-batch-eval expr))) +(define* (emacs-compile-directory dir) + "Compile all files in DIR to native code. + +If native code is not supported, compile to bytecode instead." + (emacs-batch-eval + `(let ((byte-compile-debug t) ; for proper exit status + (byte+native-compile (native-comp-available-p)) + (files (directory-files-recursively ,dir "\\.el$"))) + (mapc + (lambda (file) + (let (byte-to-native-output-file + ;; First entry is the eln-cache of the homeless shelter, + ;; second entry is the install directory. + (eln-dir (and (native-comp-available-p) + (cadr native-comp-eln-load-path)))) + (if byte+native-compile + (native-compile file + (comp-el-to-eln-filename file eln-dir)) + (byte-compile-file file)) + ;; Sadly, we can't use pcase because quasiquote works different in + ;; Emacs. See `batch-byte+native-compile' in comp.el for the + ;; actual shape of byte-to-native-output-file. + (unless (null byte-to-native-output-file) + (rename-file (car byte-to-native-output-file) + (cdr byte-to-native-output-file) + t)))) + files)) + #:dynamic? #t)) + (define (emacs-header-parse section file) "Parse the header SECTION in FILE and return it as a string." (emacs-batch-script -- 2.37.2