From: Brandon Lucas <br@ndon.dk>
To: 53456@debbugs.gnu.org
Cc: Brandon Lucas <br@ndon.dk>
Subject: [bug#53456] [PATCH v2 1/2] gnu: Add fnlfmt.
Date: Sun, 23 Jan 2022 00:16:07 +0000 [thread overview]
Message-ID: <20220123001509.484504-1-br@ndon.dk> (raw)
In-Reply-To: <20220122212723.396566-1-br@ndon.dk>
* 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(+)
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 <paul@apatience.com>
;;; Copyright © 2021 Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com>
;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
+;;; Copyright © 2022 Brandon Lucas <br@ndon.dk>
;;;
;;; 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+)))
--
2.34.0
next prev parent reply other threads:[~2022-01-23 0:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
2022-01-22 21:33 ` Maxime Devos
2022-01-22 21:39 ` Maxime Devos
2022-01-22 21:41 ` Maxime Devos
2022-01-22 21:43 ` Maxime Devos
2022-01-22 21:46 ` Maxime Devos
2022-01-22 21:53 ` Maxime Devos
2022-01-23 20:50 ` Brandon
2022-01-23 0:16 ` Brandon Lucas [this message]
2022-01-23 0:19 ` [bug#53456] [PATCH v2 2/2] gnu: fennel: Update to 03c1c95 Brandon Lucas
2022-01-23 11:05 ` [bug#53456] [PATCH v2 1/2] gnu: Add fnlfmt Maxime Devos
2022-01-23 11:11 ` Maxime Devos
2022-01-23 12:14 ` [bug#53456] [PATCH v3 " Brandon Lucas
2022-01-23 12:14 ` [bug#53456] [PATCH v3 2/2] gnu: fennel: Update to 03c1c95 Brandon Lucas
2022-01-26 15:52 ` bug#53456: [PATCH] gnu: Add fnlfmt Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220123001509.484504-1-br@ndon.dk \
--to=br@ndon.dk \
--cc=53456@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.