From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Dirk-Jan C. Binnema" Newsgroups: gmane.emacs.devel Subject: Re: [PROPOSAL] Builder, a build system integration for Emacs Date: Wed, 24 May 2023 09:09:28 +0300 Message-ID: <87wn0ytefw.fsf@gmail.com> References: <95980ffc-86e7-ad54-4a20-539d8c6ea5d0@mailo.com> <3f68f4bc-d426-0bcc-1329-674c12b29386@mailo.com> <76e12f7c-335f-476b-ffb3-fd8e8e4ab5d0@mailo.com> <87pm6rx4ea.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1065"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.6; emacs 29.0.91 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 24 08:46:46 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q1iGk-000AbH-7w for ged-emacs-devel@m.gmane-mx.org; Wed, 24 May 2023 08:46:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1iGM-0003HN-4J; Wed, 24 May 2023 02:46:24 -0400 Original-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 1q1iGC-0003Gw-CN for emacs-devel@gnu.org; Wed, 24 May 2023 02:46:12 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1iGA-0001bf-6V for emacs-devel@gnu.org; Wed, 24 May 2023 02:46:11 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4f4ba3e0b98so436620e87.2 for ; Tue, 23 May 2023 23:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684910768; x=1687502768; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=dBBKH6qT57RW95W3uQ/YuXqCgUVpUrOBnygK2v1y+5g=; b=IksmTanuwOqKZVam3qVzlOb2qLjs2EKaOjexh8GuKQLXwbtE73OsMa5+q2R0mUsSbO ZF6Y/ulMdMJas1ghwTLAbUj+/IW7YqvwzdzzJEXXAacPAVIiMixd/CSciQxXRm+LgNmg Ky7ZDqh+ibSuYwLOUhruexPVrDDts5FoNmUV71Sn2DH8LhQsBltZcEfVdNTTAQ7ftDXs jxUsKQvGc+95pDI2Mwrwb3Zbl8wKpaXeyConkZAAaF03a3sGri7jvb4UJfE6AOkO+77D rjUiNrCN+wBg/CBgER0B0ewhy1GOd/pI2zOwbQyGvCwC037eheRU6HjxrZKwu+PEcWiN 4fnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684910768; x=1687502768; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:user-agent:references:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dBBKH6qT57RW95W3uQ/YuXqCgUVpUrOBnygK2v1y+5g=; b=Ka9pEuNwH24Or0Ecg0yx9VkSTvZRfX43Acu6nXEb3ryJuqpgIElKdxwNl+yWRh7v4C o4RTU7v5vIoONLJJQht1wGkxqxgKGkBUCaZzT6JSp7XUwP70ymcWHujmIZzBmaN5hnFI mlOg0NR4vhJy2eNfV5UFZOI4wV2jdiAxO7YdT/Ji2oZB4SFb33mzqUhWJuG1dJy0VPCA ratOxUZgG6DbrPZE+zdxJIer2jpZlnNtk+DyMraz86x3t83/WxXIPSk01um5223t+GlQ m/yt7myz5L4SNoOXXCH7RODoWFtHGUFD8X4kW+go5pXzXF3/ocJiY/azmSVWoxRIOsOo ZbdA== X-Gm-Message-State: AC+VfDxkmhcJbZNgbyJlUkchJz6/21cUFhsDhvITdnUj+wqdbZYBXy86 sdIpXAPTPjGyD3x3llXJBko7LPpS008= X-Google-Smtp-Source: ACHHUZ5ImxRh/kI0jp6EPz7mp5H7nEjf13QMyTwz07qC4udysAteG8iZrfU57TbIp1LAYh2207c84g== X-Received: by 2002:a05:6512:38d1:b0:4f2:53ab:8a2d with SMTP id p17-20020a05651238d100b004f253ab8a2dmr4976146lft.4.1684910767638; Tue, 23 May 2023 23:46:07 -0700 (PDT) Original-Received: from evergrey (85-76-40-89-nat.elisa-mobile.fi. [85.76.40.89]) by smtp.gmail.com with ESMTPSA id b26-20020ac2411a000000b004f399531e8csm1602345lfi.226.2023.05.23.23.46.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 23:46:07 -0700 (PDT) In-reply-to: Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=djcb.bulk@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306291 Archived-At: On Tuesday May 23 2023, Augustin Ch=C3=A9neau (BTuin) wrote: > Le 23/05/2023 =C3=A0 02:44, Po Lu a =C3=A9crit=C2=A0: >> "Augustin Ch=C3=A9neau (BTuin)" writes: >>=20 >>> Oh I didn't mean a simple toggle, I meant an arbitrary command >>> variant. For instance with Builder you can define a "debug2", >>> "compile_arm" or any other command. >> I don't understand how this works; before you can change targets, you >> need to regenerate the build system for your program by running >> configure. >> Are you saying that in Builder, `configure' is an extra step, run each >> time the target changes? >>=20 > > Yes, it is. > > Let's illustrate with an hypothetical workflow: you work on Emacs, and yo= u want > to easily switch between multiple configurations, say "minimal" which ena= ble > very few features to ease debugging and "regular" which enable many featu= res, > such as pgtk, json, native compilation... (and possibly many other varian= ts, > there is no limit of number). > > First, you execute `builder-configure' which detects the build system, fi= nds > Autotools and asks you to chose between "minimal", "regular", and others.= Once > you've chosen, the minibuffer is filled with the "minimal" command (for e= xample > `../configure --without-threads --without-toolkit-scroll-bars`. You press > enter, the command is executed in a compile buffer. > > Then, you need to compile. You call `builder-compile', and you may have = to > chose between multiple targets, for example "default" with the value "mak= e" and > "parallel" with the value "make -jN", N being the number of cores on you > processor. Once you've chosen, the same as for configure happens, the co= mmand > is executed in a compilation buffer. > > If you want to change to the "regular" configuration target, you call > `builder-configure` and select this target. Then, you call `builder-comp= ile` to > compile the project. > > So each time you want to change the target you call `builder-configure`. = But > with out of tree builds, it could be possible to create one build directo= ry for > each configuration, which would remove the need to execute the configurat= ion > step each time you want to change. It's not yet available as it is reall= y not > trivial to implement, but I'll try to find a satisfying solution. Sounds useful! I did some experiments in this area; I'm using some (private for now) code to do something like that; it does some detection (e.g a =C2=B4cargo' = or a 'meson' project, 'autotools' project), and generates an alist per project-type, which maps 'verbs' like 'build', 'run', 'test' to project-type-specific commands, e.g. this specifies detection of a rust project and the accompanying verbs. --8<---------------cut here---------------start------------->8--- (defvar breeze-cargo-project ((and (fboundp 'rust-mode) (locate-dominating-file "." "Cargo.toml")) . ((build . rust-compile) (run . rust-run) (test . rust-test))) "A project we can build with cargo/rust-mode?") --8<---------------cut here---------------end--------------->8--- and I can now map a common key binding for building or testing etc. the current project. In many cases _ultimately_ it's just a fancy way to fill `compile-command', but depending on the project it can be anything. Some of my projects don't quite fit the generic type, so I allow for overriding on a per-project basis; e.g. when there are a few different things to build, I use a transient as the build command: --8<---------------cut here---------------start------------->8--- (transient-define-prefix build-my-special-targets() "Transient for special build commands." [:class transient-columns ["Build" ("a" "Build A" (lambda () (interactive) (build-special "a"))) ("b" "Build B" (lambda () (interactive) (build-special "b")))=20=20 ("c" "Build C" (lambda () (interactive) (build-special "c"))) ]]) --8<---------------cut here---------------end--------------->8--- so I get some nice menu. It'd be great to have such a facility in emacs. Kind regards, Dirk. --=20 Dirk-Jan C. Binnema Helsinki, Finland e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036