From patchwork Sun Jan 23 00:16:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brandon X-Patchwork-Id: 36756 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 B050D27BBEA; Sun, 23 Jan 2022 00:17:35 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED 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 1EC0827BBE9 for ; Sun, 23 Jan 2022 00:17:35 +0000 (GMT) Received: from localhost ([::1]:50180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBQZa-0000iC-6R for patchwork@mira.cbaines.net; Sat, 22 Jan 2022 19:17:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBQZ4-0000hp-Tb for guix-patches@gnu.org; Sat, 22 Jan 2022 19:17:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBQZ4-0008DH-KD for guix-patches@gnu.org; Sat, 22 Jan 2022 19:17:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBQZ4-000361-FK for guix-patches@gnu.org; Sat, 22 Jan 2022 19:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53456] [PATCH v2 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 00:17:02 +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.164289698511854 (code B ref 53456); Sun, 23 Jan 2022 00:17:02 +0000 Received: (at 53456) by debbugs.gnu.org; 23 Jan 2022 00:16:25 +0000 Received: from localhost ([127.0.0.1]:38204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBQYT-000357-13 for submit@debbugs.gnu.org; Sat, 22 Jan 2022 19:16:25 -0500 Received: from mail-4018.proton.ch ([185.70.40.18]:16965) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBQYP-00034q-24 for 53456@debbugs.gnu.org; Sat, 22 Jan 2022 19:16:23 -0500 Date: Sun, 23 Jan 2022 00:16:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndon.dk; s=protonmail; t=1642896973; bh=L5ubtRpUtvTvTqV5TRPXD8UWvxEbNXlzUkrQMKoePOY=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc; b=wm8TDiDRQJDNlP+nFfICD8kOtKG7lxlRa7wqThpBCTjPu0FeJM9L6OHZPvVA+jPt+ d+YPWX7S1y4NmYSRsmxOVo9DSRXFg7mb2rpyixG7/bh8USmkMWaR4YL/1Yh2w+9ICQ r6r2H6lSxg6Z3QA1WLz9Xbm97eQdiNQj9gWSaDBkZcwvd1rSOuEyXt+LxeXNAU7lCb TDWT7vh6AFD37WC6sPJjk6rYGdhu//tH193Zpy4E2sv2012dN7aZSTE1CQU7NF8u5M xLz5C8UVB818JaagfaofaM4WgBS8l2b2cstN58Mte6qPMHbNeBDUaYsplWnYZqV2f5 U4rRPUETDz+9Q== From: Brandon Lucas Message-ID: <20220123001509.484504-1-br@ndon.dk> 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: , Reply-To: Brandon Lucas Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/lua.scm (fnlfmt): New variable. --- Thank you for the review. I learned a lot. :) I also realized that if I truly unbundle fennel from fnlfmt, I also need to wrap it, so that it can load fennel at runtime. It only worked before because I had failed to remove the fennel.lua file from the checkout. I have tried to apply your other suggestions here as well. I will also write to upstream and attempt to get the licensing clarified. gnu/packages/lua.scm | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) -- 2.34.0 diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 99f09a26f1..1543d7bd11 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2020 Paul A. Patience ;;; Copyright © 2021 Vinícius dos Santos Oliveira ;;; Copyright © 2021 Greg Hogan +;;; Copyright © 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,65 @@ (define-public fennel simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro 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-recursively "fennel") + (delete-file-recursively "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 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 consistent +way, following established lisp conventions.") + (license license:lgpl3+))) From patchwork Sun Jan 23 00:19:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon X-Patchwork-Id: 36757 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 DE5BE27BBEA; Sun, 23 Jan 2022 00:20:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED 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 9870B27BBE9 for ; Sun, 23 Jan 2022 00:20:12 +0000 (GMT) Received: from localhost ([::1]:50416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBQc7-0000xB-Od for patchwork@mira.cbaines.net; Sat, 22 Jan 2022 19:20:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBQby-0000wp-A1 for guix-patches@gnu.org; Sat, 22 Jan 2022 19:20:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45307) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBQbx-0008R8-VE for guix-patches@gnu.org; Sat, 22 Jan 2022 19:20:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBQbx-0003AR-Rc for guix-patches@gnu.org; Sat, 22 Jan 2022 19:20:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53456] [PATCH v2 2/2] gnu: fennel: Update to 03c1c95. Resent-From: Brandon Lucas Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jan 2022 00:20: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.164289717712140 (code B ref 53456); Sun, 23 Jan 2022 00:20:01 +0000 Received: (at 53456) by debbugs.gnu.org; 23 Jan 2022 00:19:37 +0000 Received: from localhost ([127.0.0.1]:38210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBQbY-00039j-KL for submit@debbugs.gnu.org; Sat, 22 Jan 2022 19:19:36 -0500 Received: from mail-4317.proton.ch ([185.70.43.17]:64999) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBQbW-00039V-Fd for 53456@debbugs.gnu.org; Sat, 22 Jan 2022 19:19:35 -0500 Date: Sun, 23 Jan 2022 00:19:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndon.dk; s=protonmail; t=1642897167; bh=y/pfLOVxlppjesNltX6LMY21elURE7AUWfpHwgKmaKg=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc; b=yXrfcLvDzVbSrB2IpzHkVCDHVwIc9shEzWI7lupeL1aQ6mpXMgPdQwTQf+yF4qP/h PCG1tU3v5oz2tzboUUSXBk3ACbXN56RcM/yxeUEAiWwNZBiw+AQZ/lzOin8Z0Y57/a HxzxwUVIdHGSDKv2kVFInhLF9hSegHm56akTKgB5KKW+JtP8cx77hlDx14gZV9dTpZ gvEkGxqkKgnPVetSiXHHXtGGqs4HvNB8USyWWafW03ik68aeX3BJs5jN7vxEbsG4Bp zF0ZbrfsbtZEN8LQCx/nLomy2SdXeI3IBl2mfkIgHCQqhUhZD4lHP4d/qlNUHmlKs7 +2d5oSe87oJ5w== From: Brandon Lucas Message-ID: <20220123001509.484504-2-br@ndon.dk> In-Reply-To: <20220123001509.484504-1-br@ndon.dk> References: <20220123001509.484504-1-br@ndon.dk> 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: , Reply-To: Brandon Lucas Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/lua.scm (fennel): Update to 03c1c95. --- In order to properly wrap fnlfmt with LUA_PATH to fennel, we need to know which /share/lua/x.x dir fennel got installed under. The 1.0.0 release had a bug where fennel installed under 5.4 no matter what lua was used to compile it. There has since been an update that corrects this issue, so we can rely on the version of the lua input to determine where the fennel.lua file got installed to. gnu/packages/lua.scm | 66 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) -- 2.34.0 diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 1543d7bd11..568505a457 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -1175,42 +1175,44 @@ (define-public emilua (license license:boost1.0))) (define-public fennel - (package - (name "fennel") - (version "1.0.0") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://git.sr.ht/~technomancy/fennel") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0d4rpf0f2aqxlca3kxrbhjjhf1knhiz8ccwlx8xid05mc16la70y")))) - (build-system gnu-build-system) - (arguments - '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) - #:tests? #t ; even on cross-build - #:test-target "test" - #:phases - (modify-phases %standard-phases - (delete 'configure) - (add-after 'build 'patch-fennel + (let ((commit "03c1c95f2a79e45a9baf607f96a74c693b8b70f4") + (revision "0")) + (package + (name "fennel") + (version (git-version "1.0.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://git.sr.ht/~technomancy/fennel") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1znp38h5q819gvcyl248zwvjsljfxdxdk8n82fnj6lyibiiqzgvx")))) + (build-system gnu-build-system) + (arguments + '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) + #:tests? #t ; even on cross-build + #:test-target "test" + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'build 'patch-fennel (lambda* (#:key inputs #:allow-other-keys) - (substitute* "fennel" - (("/usr/bin/env .*lua") - (search-input-file inputs "/bin/lua"))))) - (delete 'check) - (add-after 'install 'check + (substitute* "fennel" + (("/usr/bin/env .*lua") + (search-input-file inputs "/bin/lua"))))) + (delete 'check) + (add-after 'install 'check (assoc-ref %standard-phases 'check))))) - (inputs (list lua)) - (home-page "https://fennel-lang.org/") - (synopsis "Lisp that compiles to Lua") - (description - "Fennel is a programming language that brings together the speed, + (inputs (list lua)) + (home-page "https://fennel-lang.org/") + (synopsis "Lisp that compiles to Lua") + (description + "Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a Lisp syntax and macro system.") - (license license:expat))) + (license license:expat)))) (define-public fnlfmt (package