GNU bug report logs - #65107
[PATCH] gnu: Add gf.

Previous Next

Package: guix-patches;

Reported by: dan <i <at> dan.games>

Date: Sun, 6 Aug 2023 05:53:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 65107 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#65107; Package guix-patches. (Sun, 06 Aug 2023 05:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to dan <i <at> dan.games>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 06 Aug 2023 05:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: dan <i <at> dan.games>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add gf.
Date: Sun,  6 Aug 2023 13:52:12 +0800
---
 gnu/packages/debug.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index e2a29a3ae9..104ecc3091 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Matthew James Kraai <kraai <at> ftbfs.org>
 ;;; Copyright © 2023 Andy Tai <atai <at> atai.org>
 ;;; Copyright © 2023 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2023 dan <i <at> dan.games>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,6 +51,7 @@ (define-module (gnu packages debug)
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
@@ -918,3 +920,57 @@ (define-public delve
     (synopsis "Debugger for the Go programming language")
     (description "Delve is a debugger for the Go programming language.")
     (license license:expat)))
+
+(define-public gf
+  (let ((commit "77a1f69204ceca5e62936976f97c62085a705126")
+        (revision "0"))
+    (package
+      (name "gf")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/nakst/gf")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "167ykfv7vf5vajxd5m3ggw4avpcim0i0bfmbxb495n8rgpaiizdy"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ; no test
+             #:phases #~(modify-phases %standard-phases
+                          (delete 'configure)
+                          (replace 'build
+                            (lambda* _
+                              (invoke "g++"
+                                      "gf2.cpp"
+                                      "-o"
+                                      "gf2"
+                                      "-g"
+                                      "-O2"
+                                      "-lX11"
+                                      "-lfreetype"
+                                      "-pthread"
+                                      (string-append "-I"
+                                                     #$freetype
+                                                     "/include/freetype2")
+                                      "-DUI_FREETYPE"
+                                      "-DUI_NO_COLOR_PICKER"
+                                      "-DUI_SSE2"
+                                      "-Wall"
+                                      "-Wextra"
+                                      "-Wno-unused-parameter"
+                                      "-Wno-unused-result"
+                                      "-Wno-missing-field-initializers"
+                                      "-Wno-format-truncation")))
+                          (replace 'install
+                            (lambda* _
+                              (install-file "gf2"
+                                            (string-append #$output "/bin")))))))
+      (inputs (list libx11 libxext libxcursor freetype))
+      (propagated-inputs (list gdb))
+      (home-page "https://github.com/nakst/gf")
+      (synopsis "GDB frontend")
+      (description "A graphical GDB frontend for Linux.")
+      (license license:expat))))

base-commit: c4b9f726e3a1889b92a4b14a2af1c25f10798469
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65107; Package guix-patches. (Sun, 06 Aug 2023 14:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 65107 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: dan <i <at> dan.games>
Cc: 65107 <at> debbugs.gnu.org
Subject: Re: [bug#65107] [PATCH] gnu: Add gf.
Date: Sun, 06 Aug 2023 22:51:30 +0800
Hi dan,

On Sun, 06 Aug 2023 13:52:12 +0800,
dan wrote:
>
> ---
>  gnu/packages/debug.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
>
> diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
> index e2a29a3ae9..104ecc3091 100644
> --- a/gnu/packages/debug.scm
> +++ b/gnu/packages/debug.scm
[...]
> +      (build-system gnu-build-system)
> +      (arguments
> +       (list #:tests? #f ; no test
> +             #:phases #~(modify-phases %standard-phases
> +                          (delete 'configure)
> +                          (replace 'build
> +                            (lambda* _
> +                              (invoke "g++"
> +                                      "gf2.cpp"
> +                                      "-o"
> +                                      "gf2"
> +                                      "-g"
> +                                      "-O2"
> +                                      "-lX11"
> +                                      "-lfreetype"
> +                                      "-pthread"
> +                                      (string-append "-I"
> +                                                     #$freetype
> +                                                     "/include/freetype2")


I think #$freetype can be changed to #$(this-package-input "freetype")


> +                                      "-DUI_FREETYPE"
> +                                      "-DUI_NO_COLOR_PICKER"
> +                                      "-DUI_SSE2"
> +                                      "-Wall"
> +                                      "-Wextra"
> +                                      "-Wno-unused-parameter"
> +                                      "-Wno-unused-result"
> +                                      "-Wno-missing-field-initializers"
> +                                      "-Wno-format-truncation")))


Can you move these flags to #:make-flags?

For example:
--8<---------------cut here---------------start------------->8---
(arguments
 (list [...]
       #:make-flags
       #~(list "-g" "-O2" [...])
       #:phases
       #~(modify-phases %standard-phases
           (replace 'build
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke
                      `(#$(cxx-for-target) "gf2.cpp" "-o" "gf2"
                        ,@make-flags)))))))
--8<---------------cut here---------------end--------------->8---


> +                          (replace 'install
> +                            (lambda* _
> +                              (install-file "gf2"
> +                                            (string-append #$output "/bin")))))))
> +      (inputs (list libx11 libxext libxcursor freetype))
> +      (propagated-inputs (list gdb))


There're「"gdb"」occurrences in the source, can adding gdb to inputs
and substituting them avoid the propagation?
--8<---------------cut here---------------start------------->8---
(substitute* "gf2.cpp"
  (("\"gdb\"")
   (format
    #f "\"~a\""
    (search-input-file inputs "/bin/gdb"))))
--8<---------------cut here---------------end--------------->8---
(A keyword argument inputs should be added to the relevant procedure)

And the program seems to depend on Vim as well.


> +      (home-page "https://github.com/nakst/gf")
> +      (synopsis "GDB frontend")
> +      (description "A graphical GDB frontend for Linux.")
> +      (license license:expat))))
>
> base-commit: c4b9f726e3a1889b92a4b14a2af1c25f10798469
> --
> 2.41.0


I have built the package locally, running it with xvfb-run reports
"vim: command not found".

XWayland is disabled in my setup so I haven't checked whether the
program works.

Thanks




Information forwarded to guix-patches <at> gnu.org:
bug#65107; Package guix-patches. (Mon, 07 Aug 2023 02:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 65107 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: dan <i <at> dan.games>
Cc: 65107 <at> debbugs.gnu.org
Subject: Re: [bug#65107] [PATCH] gnu: Add gf.
Date: Mon, 07 Aug 2023 09:58:24 +0800
On Sun, 06 Aug 2023 22:51:30 +0800,
Hilton Chain wrote:
> Can you move these flags to #:make-flags?
>
> For example:
> --8<---------------cut here---------------start------------->8---
> (arguments
>  (list [...]
>        #:make-flags
>        #~(list "-g" "-O2" [...])
>        #:phases
>        #~(modify-phases %standard-phases
>            (replace 'build
>              (lambda* (#:key make-flags #:allow-other-keys)
>                (apply invoke
>                       `(#$(cxx-for-target) "gf2.cpp" "-o" "gf2"
>                         ,@make-flags)))))))
> --8<---------------cut here---------------end--------------->8---

Sorry, `quasiquote' is not necessary here because `apply' accepts one
list for the last argument and the above code just makes a list.  The
`apply' invocation I wrote should be replaced to:
--8<---------------cut here---------------start------------->8---
(apply invoke
       #$(cxx-for-target) "gf2.cpp" "-o" "gf2"
       make-flags)
--8<---------------cut here---------------end--------------->8---

Thanks




Information forwarded to guix-patches <at> gnu.org:
bug#65107; Package guix-patches. (Tue, 08 Aug 2023 02:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 65107 <at> debbugs.gnu.org (full text, mbox):

From: dan <i <at> dan.games>
To: 65107 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: Add gf.
Date: Tue,  8 Aug 2023 09:57:59 +0800
The following is the updated patch changed according to Hilton's
suggestion. Note that for the vim version in guix we don't have `--servername'
support, but I patched it anyway.

---
 gnu/packages/debug.scm | 91 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index e2a29a3ae9..57d0d3b479 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2022 Matthew James Kraai <kraai <at> ftbfs.org>
 ;;; Copyright © 2023 Andy Tai <atai <at> atai.org>
 ;;; Copyright © 2023 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2023 dan <i <at> dan.games>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,6 +51,8 @@ (define-module (gnu packages debug)
   #:use-module (gnu packages code)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
@@ -71,6 +74,7 @@ (define-module (gnu packages debug)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages vim)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
@@ -918,3 +922,90 @@ (define-public delve
     (synopsis "Debugger for the Go programming language")
     (description "Delve is a debugger for the Go programming language.")
     (license license:expat)))
+
+(define-public gf
+  (let ((commit "77a1f69204ceca5e62936976f97c62085a705126")
+        (revision "0"))
+    (package
+      (name "gf")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/nakst/gf")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "167ykfv7vf5vajxd5m3ggw4avpcim0i0bfmbxb495n8rgpaiizdy"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ; no test
+             #:make-flags #~(list "-g"
+                                  "-O2"
+                                  "-lX11"
+                                  "-lfreetype"
+                                  "-pthread"
+                                  (string-append "-I"
+                                                 #$(this-package-input
+                                                    "freetype")
+                                                 "/include/freetype2")
+                                  "-DUI_FREETYPE"
+                                  "-DUI_NO_COLOR_PICKER"
+                                  "-DUI_SSE2"
+                                  "-Wall"
+                                  "-Wextra"
+                                  "-Wno-unused-parameter"
+                                  "-Wno-unused-result"
+                                  "-Wno-missing-field-initializers"
+                                  "-Wno-format-truncation")
+             #:phases #~(modify-phases %standard-phases
+                          (add-after 'unpack 'patch-path
+                            (lambda* (#:key inputs outputs #:allow-other-keys)
+                              (substitute* "gf2.cpp"
+                                (("\"gdb\";")
+                                 (format #f "\"~a\";"
+                                         (search-input-file inputs "/bin/gdb")))
+                                (("\"vim ")
+                                 (format #f "\"~a "
+                                         (search-input-file inputs "/bin/vim")))
+                                (("grep")
+                                 (format #f "~a"
+                                         (search-input-file inputs "/bin/grep")))
+                                (("fc-list")
+                                 (format #f "~a"
+                                         (search-input-file inputs
+                                                            "/bin/fc-list")))
+                                (("fc-match")
+                                 (format #f "~a"
+                                         (search-input-file inputs
+                                                            "/bin/fc-match")))
+                                (("awk")
+                                 (format #f "~a"
+                                         (search-input-file inputs "/bin/awk"))))))
+                          (delete 'configure)
+                          (replace 'build
+                            (lambda* (#:key make-flags #:allow-other-keys)
+                              (apply invoke
+                                     #$(cxx-for-target)
+                                     "gf2.cpp"
+                                     "-o"
+                                     "gf2"
+                                     make-flags)))
+                          (replace 'install
+                            (lambda* _
+                              (install-file "gf2"
+                                            (string-append #$output "/bin")))))))
+      (inputs (list fontconfig
+                    freetype
+                    gawk
+                    gdb
+                    grep
+                    libx11
+                    libxext
+                    libxcursor
+                    vim))
+      (home-page "https://github.com/nakst/gf")
+      (synopsis "GDB frontend")
+      (description "A graphical GDB frontend for Linux.")
+      (license license:expat))))

base-commit: d43b53c476b4e9322b31274b788e851d37e72302
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65107; Package guix-patches. (Wed, 16 Aug 2023 14:25:02 GMT) Full text and rfc822 format available.

Message #17 received at 65107 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: dan <i <at> dan.games>
Cc: 65107 <at> debbugs.gnu.org
Subject: Re: [bug#65107] [PATCH v2] gnu: Add gf.
Date: Wed, 16 Aug 2023 22:23:27 +0800
Hi dan,

On Tue, 08 Aug 2023 09:57:59 +0800,
dan wrote:
>
> The following is the updated patch changed according to Hilton's
> suggestion. Note that for the vim version in guix we don't have `--servername'
> support, but I patched it anyway.
>
> ---


If you want to add explanation which isn't part of the commit message
to a patch, you can add it below the first "---" (i.e. here).  Content
above that line is used as git commit message.

And in Guix there's a vim-full package.


>  gnu/packages/debug.scm | 91 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 91 insertions(+)
>
> diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
> index e2a29a3ae9..57d0d3b479 100644
> --- a/gnu/packages/debug.scm
> +++ b/gnu/packages/debug.scm
[...]
> +             #:phases #~(modify-phases %standard-phases
> +                          (add-after 'unpack 'patch-path
> +                            (lambda* (#:key inputs outputs #:allow-other-keys)
> +                              (substitute* "gf2.cpp"
> +                                (("\"gdb\";")
> +                                 (format #f "\"~a\";"
> +                                         (search-input-file inputs "/bin/gdb")))
> +                                (("\"vim ")
> +                                 (format #f "\"~a "
> +                                         (search-input-file inputs "/bin/vim")))
> +                                (("grep")
> +                                 (format #f "~a"
> +                                         (search-input-file inputs "/bin/grep")))
> +                                (("fc-list")
> +                                 (format #f "~a"
> +                                         (search-input-file inputs
> +                                                            "/bin/fc-list")))
> +                                (("fc-match")
> +                                 (format #f "~a"
> +                                         (search-input-file inputs
> +                                                            "/bin/fc-match")))
> +                                (("awk")
> +                                 (format #f "~a"
> +                                         (search-input-file inputs "/bin/awk"))))))


Then here, search-input-file returns a string so those (format #f "~a"
...) invocations are unnecessary, some of the substitutions can be
merged into one as well:
--8<---------------cut here---------------start------------->8---
(("grep|fc-list|fc-match|awk" cmd)
 (search-input-file
  inputs (string-append "/bin/" cmd)))
--8<---------------cut here---------------end--------------->8---

Thanks




This bug report was last modified 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.