From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wOikBwFH7WEUjwAAgWs5BA (envelope-from ) for ; Sun, 23 Jan 2022 13:16:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iC+KBAFH7WEFgwAAauVa8A (envelope-from ) for ; Sun, 23 Jan 2022 13:16:01 +0100 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 2395C1A68E for ; Sun, 23 Jan 2022 13:16:00 +0100 (CET) Received: from localhost ([::1]:32780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBbmo-00013F-DO for larch@yhetil.org; Sun, 23 Jan 2022 07:15:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBblu-00012u-4u for guix-patches@gnu.org; Sun, 23 Jan 2022 07:15:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBblt-0006gt-Rn for guix-patches@gnu.org; Sun, 23 Jan 2022 07:15:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBblt-00079q-No for guix-patches@gnu.org; Sun, 23 Jan 2022 07:15:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53456] [PATCH v3 1/2] gnu: Add fnlfmt. References: <20220122212723.396566-1-br@ndon.dk> In-Reply-To: <20220122212723.396566-1-br@ndon.dk> Resent-From: Brandon Lucas Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jan 2022 12:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53456 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53456@debbugs.gnu.org Cc: Brandon Lucas Received: via spool by 53456-submit@debbugs.gnu.org id=B53456.164294009227477 (code B ref 53456); Sun, 23 Jan 2022 12:15:01 +0000 Received: (at 53456) by debbugs.gnu.org; 23 Jan 2022 12:14:52 +0000 Received: from localhost ([127.0.0.1]:38691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBblk-000797-9n for submit@debbugs.gnu.org; Sun, 23 Jan 2022 07:14:52 -0500 Received: from mail-4022.proton.ch ([185.70.40.22]:26225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBblf-00078m-2S for 53456@debbugs.gnu.org; Sun, 23 Jan 2022 07:14:51 -0500 Date: Sun, 23 Jan 2022 12:14:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndon.dk; s=protonmail; t=1642940079; bh=Pj0cR4NADSo8KN3Ux1nmLJ55/9Jns80B/Vy+5ZruOkU=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc; b=XLJ5lmQE2NBwNUmgM+VddytjH9peQwYvytLWCfUomWXxKBluhPrO8GRL52wgOlFv5 XVshDMY90dbGDQlpRkMAKyuAg/GODBfgBx1AoaM7H9wVO8cZ3S9rUQk4t28JJxM9Ld jYmcig54MWOdx3o91XKiE133QInyX6Yu4oAgpGu40rVs2Pi/U2Y8rXeqlflh7qP3e4 ADDhnpx9k4jnw9nkFKQk1w9JQB0HIqni2yukqR8M7x91Y+FyfttRCAUYvD93tjQcE3 lOKakg/43hwrTnnPNRVYEQD5h6tKSj4KGt9zRnUitZzMmXn0V7Be9LqR168/Z5Pfg+ +xKk48Q/74Dwg== From: Brandon Lucas Message-ID: <20220123121405.1123976-1-br@ndon.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , Reply-To: Brandon Lucas Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642940160; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=Pj0cR4NADSo8KN3Ux1nmLJ55/9Jns80B/Vy+5ZruOkU=; b=fwodEMjorzokwNflVCpIdCR1694yYuBetJ9pML/U08QHbbVeq90ZtlqkOpU3WoJezZEMHz Kr4Czh04GQfvqvEy92A177UVVbe9zV0SG4seFp3Z3/wJx53zt7r7e4upi+a2SNqUBDo8oV UiahEybGklgMQi6Vga7u6Jt4mLTdePR83f1+UdQCQctUU4nVkFsldDaP/rcGFgOxjCu34U pTTUEbPmkb+4OwG/LJy1r7zU1WKXXbH/ieMWFSC14TxFMlADlVVePCj8GGcVrxpCQlQNpX H0HKSGEIVl/3wK1HAwH8VE5ErfL5VPDwGnj71jXleT2hKG2GogFA/By5umOgHA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642940160; a=rsa-sha256; cv=none; b=o0YozoPWZLxv1kLuoyLDdUtCBn/Swvv4bUXOFLEK9b5L6z1fsLPphbgzJ1I6gYIez4mP8S WAt5Y2TknssQroqdkNj96Gucms2B0HayAWnonpyN6Il1CHj0Zgeys0uUF4S5Ji9s+L0UXY ZLeXJhcgtnry+AR8g4lqxli9q6mlVGTY3zZ2yfxncD3KmkNQYRsppkEcc2lq8jOjrdRnzF xEbaORQtpb+kx1VpmZ98wY50R8fJtNYzbMfuQ+rdmh+841bhP8ii5/f5N7i6OqBAFLbxPT N6zveNy4KdOplUnqlu7u+0k2ReTellbUxDy5p8xXZgLfE2+KqyfotfaWuyBv2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ndon.dk header.s=protonmail header.b=XLJ5lmQE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=ndon.dk (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: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ndon.dk header.s=protonmail header.b=XLJ5lmQE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=ndon.dk (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: 2395C1A68E X-Spam-Score: -1.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: OYFROJOc5IaG * gnu/packages/lua.scm (fnlfmt): New variable. --- You are right, fennel must be a native-input. Lua must be as well. Thank you for the tip about cross-compiling. :) I also simplified to delete-file as suggested. gnu/packages/lua.scm | 66 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 99f09a26f1..2250990af9 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -15,6 +15,7 @@ ;;; Copyright =C2=A9 2020 Paul A. Patience ;;; Copyright =C2=A9 2021 Vin=C3=ADcius dos Santos Oliveira ;;; Copyright =C2=A9 2021 Greg Hogan +;;; Copyright =C2=A9 2022 Brandon Lucas ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,12 +37,14 @@ (define-module (gnu packages lua) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) + #:use-module (guix gexp) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (guix build-system meson) #:use-module (guix build-system trivial) #:use-module (gnu packages) + #:use-module (gnu packages bash) #:use-module (gnu packages boost) #:use-module (gnu packages build-tools) #:use-module (gnu packages glib) @@ -1208,3 +1211,66 @@ (define-public fennel simplicity, and reach of Lua with the flexibility of a Lisp syntax and mac= ro system.") (license license:expat))) + +(define-public fnlfmt + (package + (name "fnlfmt") + (version "0.2.2") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://git.sr.ht/~technomancy/fnlfmt") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1rv0amqhy5ypi3pvxfaadn3k1cy4mjlc49wdzl2psz3i11w9gr36")) + (modules '((guix build utils))) + (snippet + #~(begin + ;; Use input fennel instead of bundled fennel. + (delete-file "fennel") + (delete-file "fennel.lua") + (substitute* "Makefile" + (("./fennel") "fennel")))))) + (build-system gnu-build-system) + (arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 match)) + #:test-target "test" + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'patch-makefile + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (substitute* "Makefile" + ;; Patch lua shebang that gets inserted to fnlfmt. + (("/usr/bin/env lua") + (search-input-file (or native-inputs inputs) "/bin/lua"))))) + (replace 'install + ;; There is no install target; manually install the output file. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (for-each (lambda (file) + (install-file file bin)) + (find-files "." "fnlfmt"))))) + (add-after 'install 'wrap + (lambda* (#:key inputs native-inputs outputs #:allow-other-keys) + (let* ((all-inputs (or native-inputs inputs)) + (fnlfmt (assoc-ref outputs "out")) + (lua-version ,(version-major+minor (package-version lua))= ) + (fennel (assoc-ref all-inputs "fennel"))) + (wrap-program (string-append fnlfmt "/bin/fnlfmt") + `("LUA_PATH" ";" suffix + (,(format #f "~a/share/lua/~a/?.lua" fennel lua-version)))) + #t)))))) + (inputs (list bash-minimal)) + (native-inputs (list lua fennel)) + (home-page "https://git.sr.ht/~technomancy/fnlfmt") + (synopsis "Automatic formatting of Fennel code") + (description + "Fnlfmt is a tool for automatically formatting Fennel code in a consi= stent +way, following established lisp conventions.") + (license license:lgpl3+))) -- 2.34.0