all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#53456] [PATCH] gnu: Add fnlfmt.
@ 2022-01-22 21:28 Brandon Lucas
  2022-01-22 21:33 ` Maxime Devos
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Brandon Lucas @ 2022-01-22 21:28 UTC (permalink / raw)
  To: 53456; +Cc: Brandon Lucas

* gnu/packages/lua.scm (fnlfmt): New variable.
---
 gnu/packages/lua.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 99f09a26f1..50f97c3912 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.
 ;;;
@@ -1208,3 +1209,48 @@ (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"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'patch-makefile
+           ;; Use input fennel instead of bundled fennel.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "Makefile"
+               (("./fennel") (search-input-file inputs "/bin/fennel")))))
+         (add-after 'build 'patch-fnlfmt
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "fnlfmt"
+               (("/usr/bin/env .*lua") (search-input-file 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"))))))))
+    (inputs (list fennel))
+    (propagated-inputs (list lua))
+    (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






^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  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
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:33 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +         (add-after 'build 'patch-fnlfmt
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (substitute* "fnlfmt"
> +               (("/usr/bin/env .*lua") (search-input-file inputs
> "/bin/lua")))))
> +    (inputs (list fennel))
> +    (propagated-inputs (list lua))

Given that the shebang in 'fnlfmt' has been patched appropriately, what
is the point of propagating here?  Can lua be moved to 'inputs'?

Greetings,
Maxime

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:39 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +           ;; Use input fennel instead of bundled fennel.
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (substitute* "Makefile"
> +               (("./fennel") (search-input-file inputs "/bin/fennel")))))

'fennel' is in native-inputs, not inputs.  For historical reasons,
the 'inputs' in the phase contains both the native-inputs and native-
inputs in the phase is #false when compiling natively, which can be
confusing (maybe that can be addressed someday).

I suggest:

   (lambda* (#:key native-inputs inputs #:allow-other-keys)
     (substitute* "Makefile"
       (("./fennel")
        (search-input-file (or native-inputs inputs) "/bin/fennel")))))

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:41 UTC (permalink / raw)
  To: Brandon Lucas, 53456

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +         (add-after 'build 'patch-fnlfmt
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (substitute* "fnlfmt"
> +               (("/usr/bin/env .*lua") (search-input-file inputs "/bin/lua")))))

I think modifying the Makefile (in patch-makefile) to replace the
/usr/bin/env lua there would be a little simpler.






^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
                   ` (2 preceding siblings ...)
  2022-01-22 21:41 ` Maxime Devos
@ 2022-01-22 21:43 ` Maxime Devos
  2022-01-22 21:46 ` Maxime Devos
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:43 UTC (permalink / raw)
  To: Brandon Lucas, 53456

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +    (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"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     '(#:test-target "test"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (add-before 'build 'patch-makefile
> +           ;; Use input fennel instead of bundled fennel.
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (substitute* "Makefile"
> +               (("./fennel") (search-input-file inputs "/bin/fennel")))))

Unbundling is conventionally done using an origin snippet.
See ‘17.4.5 Snippets versus Phases’ in the manual.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
                   ` (3 preceding siblings ...)
  2022-01-22 21:43 ` Maxime Devos
@ 2022-01-22 21:46 ` Maxime Devos
  2022-01-22 21:53 ` Maxime Devos
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:46 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +                    (url "https://git.sr.ht/~technomancy/fnlfmt")
> +                    (commit version)))

Upstream appears to be violating the Expat license of the bundled
'fennel' by not including a copy of the Expat license:

  [...], subject to the following conditions:

  The above copyright notice and this permission notice shall be
  included in all copies of substantial portions of the Software.

  [...]

Can this be adddressed (upstream)?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
                   ` (4 preceding siblings ...)
  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 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
  2022-01-23 12:14 ` [bug#53456] [PATCH v3 " Brandon Lucas
  7 siblings, 1 reply; 15+ messages in thread
From: Maxime Devos @ 2022-01-22 21:53 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

Brandon Lucas schreef op za 22-01-2022 om 21:28 [+0000]:
> +    (license license:lgpl3+)))

The lgpl3+ is by itself not a complete license, it is structured as a
few exceptions under conditions to the gpl.  The lgpl3 even asks you to
include both a copy of the GPL3 and the LGPL3 license text:

https://git.sr.ht/~technomancy/fnlfmt/tree/main/item/LICENSE#L91

   b) Accompany the Combined Work with a copy of the GNU GPL and this
      license document.

Strictly speaking that's only for ‘Combined works’, and I don't expect
any trouble in practice.  However, it would be nice to do things
properly.  Would you be up to asking upstream to include a copy of the
GPL as well (which upstream isn't doing currently)?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v2 1/2] gnu: Add fnlfmt.
  2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
                   ` (5 preceding siblings ...)
  2022-01-22 21:53 ` Maxime Devos
@ 2022-01-23  0:16 ` Brandon Lucas
  2022-01-23  0:19   ` [bug#53456] [PATCH v2 2/2] gnu: fennel: Update to 03c1c95 Brandon Lucas
                     ` (2 more replies)
  2022-01-23 12:14 ` [bug#53456] [PATCH v3 " Brandon Lucas
  7 siblings, 3 replies; 15+ messages in thread
From: Brandon Lucas @ 2022-01-23  0:16 UTC (permalink / raw)
  To: 53456; +Cc: Brandon Lucas

* 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






^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v2 2/2] gnu: fennel: Update to 03c1c95.
  2022-01-23  0:16 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
@ 2022-01-23  0:19   ` 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
  2 siblings, 0 replies; 15+ messages in thread
From: Brandon Lucas @ 2022-01-23  0:19 UTC (permalink / raw)
  To: 53456; +Cc: Brandon Lucas

* 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(-)

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
--
2.34.0






^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v2 1/2] gnu: Add fnlfmt.
  2022-01-23  0:16 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
  2022-01-23  0:19   ` [bug#53456] [PATCH v2 2/2] gnu: fennel: Update to 03c1c95 Brandon Lucas
@ 2022-01-23 11:05   ` Maxime Devos
  2022-01-23 11:11   ` Maxime Devos
  2 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-23 11:05 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

Brandon Lucas schreef op zo 23-01-2022 om 00:16 [+0000]:
> +                   (delete-file-recursively "fennel")
> +                   (delete-file-recursively "fennel.lua")

This is not wrong, but 'fennel' and 'fennel.lua' are regular files and
not directories, so (delete-file "fennel") (delete-file "fennel.lua")
would be sufficient.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v2 1/2] gnu: Add fnlfmt.
  2022-01-23  0:16 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
  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
  2 siblings, 0 replies; 15+ messages in thread
From: Maxime Devos @ 2022-01-23 11:11 UTC (permalink / raw)
  To: Brandon Lucas, 53456

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

Brandon Lucas schreef op zo 23-01-2022 om 00:16 [+0000]:
> +    (inputs (list bash-minimal lua fennel))

'fennel' is used as a tool run during building
(https://git.sr.ht/~technomancy/fnlfmt/tree/main/item/Makefile#L3),
so it needs to be in native-inputs.  It is also used as a kind of
library (see LUA_PATH in 'wrap' phase), so it needs to be in
native-inputs as well.

Summarised: 'fennel' needs to be in both inputs and native-inputs.

As a test, you can try to cross-compile fnlfmt:

# warning: this will first build a cross-compiler wich will take a lot
# of time
$ ./pre-inst-env guix build fnlfmt --target=aarch64-linux-gnu

It is not guaranteed that if it builds, it will work, but it is a
useful test.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v3 1/2] gnu: Add fnlfmt.
  2022-01-22 21:28 [bug#53456] [PATCH] gnu: Add fnlfmt Brandon Lucas
                   ` (6 preceding siblings ...)
  2022-01-23  0:16 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
@ 2022-01-23 12:14 ` 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
  7 siblings, 2 replies; 15+ messages in thread
From: Brandon Lucas @ 2022-01-23 12:14 UTC (permalink / raw)
  To: 53456; +Cc: Brandon Lucas

* 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 © 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,66 @@ (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 "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 consistent
+way, following established lisp conventions.")
+    (license license:lgpl3+)))
--
2.34.0






^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH v3 2/2] gnu: fennel: Update to 03c1c95.
  2022-01-23 12:14 ` [bug#53456] [PATCH v3 " Brandon Lucas
@ 2022-01-23 12:14   ` Brandon Lucas
  2022-01-26 15:52   ` bug#53456: [PATCH] gnu: Add fnlfmt Ludovic Courtès
  1 sibling, 0 replies; 15+ messages in thread
From: Brandon Lucas @ 2022-01-23 12:14 UTC (permalink / raw)
  To: 53456; +Cc: Brandon Lucas

* gnu/packages/lua.scm (fennel): Update to 03c1c95.
---
 gnu/packages/lua.scm | 66 +++++++++++++++++++++++---------------------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 2250990af9..4286475a2c 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
--
2.34.0






^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [bug#53456] [PATCH] gnu: Add fnlfmt.
  2022-01-22 21:53 ` Maxime Devos
@ 2022-01-23 20:50   ` Brandon
  0 siblings, 0 replies; 15+ messages in thread
From: Brandon @ 2022-01-23 20:50 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53456

<maximedevos@telenet.be> wrote:

> Would you be up to asking upstream to include a copy of the
> GPL as well (which upstream isn't doing currently)?

Hi Maxime,

I wrote to upstream about this and the inclusion of the expat
license, and the author has updated the repo to include both
the full GPL text as well as the Expat license.

Kind regards,
Brandon.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#53456: [PATCH] gnu: Add fnlfmt.
  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   ` Ludovic Courtès
  1 sibling, 0 replies; 15+ messages in thread
From: Ludovic Courtès @ 2022-01-26 15:52 UTC (permalink / raw)
  To: Brandon Lucas; +Cc: Maxime Devos, 53456-done

Hi,

Brandon Lucas <br@ndon.dk> skribis:

> * gnu/packages/lua.scm (fnlfmt): New variable.

[...]

> * gnu/packages/lua.scm (fennel): Update to 03c1c95.

Applied.

Since we normally don’t package snapshots, I took the liberty to add the
justification you gave as a comment in next to the commit definition.

Thank you, and thanks Maxime for the thorough review!

Ludo’.




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-01-26 15:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [bug#53456] [PATCH v2 1/2] " Brandon Lucas
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

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.