[PATCH] gnu: Add ftxui

  • Done
  • quality assurance status badge
Details
2 participants
  • Mathieu Othacehe
  • Artyom V. Poptsov
Owner
unassigned
Submitted by
Artyom V. Poptsov
Severity
normal

Debbugs page

Artyom V. Poptsov wrote 2 years ago
(address . guix-patches@gnu.org)
87r0w9fsgh.fsf@gmail.com
Hello,

this patch adds FXTUI[1], a simple C++ library for terminal based user
interfaces.
From 3453ac53e0d1bfe28e5536a89411584fc2461e29 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Thu, 5 Jan 2023 08:03:15 +0300
Subject: [PATCH] gnu: Add ftxui

* gnu/packages/tui.scm: New module.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add "tui.scm".
---
gnu/local.mk | 1 +
gnu/packages/tui.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 gnu/packages/tui.scm

Toggle diff (82 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bc0309ee87..c110b54bef 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -605,6 +605,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/tmux.scm \
%D%/packages/toolkits.scm \
%D%/packages/tor.scm \
+ %D%/packages/tui.scm \
%D%/packages/tv.scm \
%D%/packages/uglifyjs.scm \
%D%/packages/uml.scm \
diff --git a/gnu/packages/tui.scm b/gnu/packages/tui.scm
new file mode 100644
index 0000000000..7a3037073b
--- /dev/null
+++ b/gnu/packages/tui.scm
@@ -0,0 +1,62 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages tui)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module (guix build-system cmake)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages version-control))
+
+(define-public ftxui
+ (package
+ (name "ftxui")
+ (version "3.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ArthurSonzogni/FTXUI")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "10a4yw2h29kixxyhll6cvrwyscsvz9asxry857a9l8nqvbhs946s"))
+ (file-name (git-file-name name version))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:tests? #f)) ;Tests require gtest
+ (home-page "https://github.com/ArthurSonzogni/FTXUI")
+ (synopsis "C++ Functional Terminal User Interface")
+ (description
+ "Functional Terminal (X) User interface (FTXUI) is a simple C++ library for
+terminal based user interfaces.
+
+Main features:
+@itemize
+@item Functional style.
+@item Keyboard & mouse navigation.
+@item Support for UTF8 and fullwidth chars.
+@item Support for animations.
+@item Support for drawing.
+@item No dependencies.
+@end itemize")
+ (license license:expat)))
--
2.34.1
I decided to place this package in a separate module called "tui.scm" as
there are other libraries for building text-based user interfaces that
can be added in the future (like [2], for example.)

Also to check if the library installed right I tried to build "tiles"
game[3] that is using FXTUI:

Toggle snippet (9 lines)
git clone https://github.com/tusharpm/tiles.git
cd tiles
guix shell binutils gcc
mkdir build
cd build
cmake ..
make -j$(nproc)

Which worked out flawlessly.

Thanks,
- avp

References:

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmO2Yy4ZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigL3p4B/9F0LDO3jhDmelKJVz6Dthl
q2mrIvJFwSfqjroze2RBdTSuovd5gxlzBxOp7w8L6GuprUxhfcgptKLod1BoDfeY
lab7hj3UQ2S0mySfy55OBB2Ij1jS05E0452Y66DrqVaEI1kgdTS5hUuO9T567It5
PQwqCvgeb2X3V5EoclV0ky7ayLO+N+lDgAPt831lr1pVivZyk+kSgkzkzPZN2tYo
2BRyP/YbOeSFrlv2R04dqtvzxF/1KbWF48Dem6mb7DhWCMaL1DPtnlcSWIox4IaX
gpbPAtWQ8LGAvSyh2icvVuI+d/GaCNiLEHDdqmhOZtlthw6kHeoDUrOBMk8AVmnM
=PKyY
-----END PGP SIGNATURE-----

Mathieu Othacehe wrote 2 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 60567@debbugs.gnu.org)
87358l2byf.fsf@gnu.org
Hello Artyom,

Toggle quote (2 lines)
> +++ b/gnu/packages/tui.scm

I'm not sure about the new tui module because a lot of packages could
fall into that category, all ncurses based programs for instance.

Toggle quote (3 lines)
> + (arguments
> + (list #:tests? #f)) ;Tests require gtest

Providing googletest as a native-inputs doesn't help here?

Thanks,

Mathieu
Artyom V. Poptsov wrote 2 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 60567@debbugs.gnu.org)
87a62svrup.fsf@gmail.com
Hello Mathieu!

Thank you for the patch review.

I fixed the patch, please find the updated version attached.
From a996eaee955cd933ef963d397b745421d6c4f402 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Thu, 5 Jan 2023 08:03:15 +0300
Subject: [PATCH] gnu: Add ftxui.

* gnu/packages/tui.scm: New module.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add "tui.scm".
---
gnu/local.mk | 1 +
gnu/packages/tui.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+)
create mode 100644 gnu/packages/tui.scm

Toggle diff (99 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bc0309ee87..c110b54bef 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -605,6 +605,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/tmux.scm \
%D%/packages/toolkits.scm \
%D%/packages/tor.scm \
+ %D%/packages/tui.scm \
%D%/packages/tv.scm \
%D%/packages/uglifyjs.scm \
%D%/packages/uml.scm \
diff --git a/gnu/packages/tui.scm b/gnu/packages/tui.scm
new file mode 100644
index 0000000000..8a8f80addf
--- /dev/null
+++ b/gnu/packages/tui.scm
@@ -0,0 +1,79 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Artyom V. Poptsov <poptsov.artyom@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages tui)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix packages)
+ #:use-module (guix build-system cmake)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages version-control))
+
+(define-public ftxui
+ (package
+ (name "ftxui")
+ (version "3.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ArthurSonzogni/FTXUI")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "10a4yw2h29kixxyhll6cvrwyscsvz9asxry857a9l8nqvbhs946s"))
+ (file-name (git-file-name name version))))
+ (build-system cmake-build-system)
+ (native-inputs (list googletest))
+ (arguments
+ (list #:configure-flags
+ #~(list "-DFTXUI_BUILD_TESTS:BOOL=ON"
+ "-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake-tests
+ (lambda _
+ (substitute* "cmake/ftxui_test.cmake"
+ (("NOT googletest_POPULATED")
+ "FALSE"))
+ ;; Disable benchmarks for a while as they require bundled Google
+ ;; benchmark and when the 'googlebenchmark' is unbundled, there's
+ ;; a CMake configuration error.
+ (substitute* "cmake/ftxui_benchmark.cmake"
+ (("NOT WIN32")
+ "FALSE")))) )))
+ (home-page "https://github.com/ArthurSonzogni/FTXUI")
+ (synopsis "C++ Functional Terminal User Interface")
+ (description
+ "Functional Terminal (X) User interface (FTXUI) is a simple C++ library for
+terminal based user interfaces.
+
+Main features:
+@itemize
+@item Functional style.
+@item Keyboard & mouse navigation.
+@item Support for UTF8 and fullwidth chars.
+@item Support for animations.
+@item Support for drawing.
+@item No dependencies.
+@end itemize")
+ (license license:expat)))
--
2.34.1
Thanks,
- avp

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmO7Aj4ZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigL+ZrB/wJd6wcGzmorDoYGZnWSGFr
/O6BodclFy8bnGaKA6+0x0oOrvnQ44YRVB/OLEJDDAyO3bPooEYnPHnZOe+L1RMe
BcM8ZLytp5eHT79PTr0u6DXU5bNC8t0aUeuHhTUDbUC7DkU6SBTq9N3c/99ECCVu
hewzNUDZdlRheBhCozNHj4SoGiiiz2uKC9TKyK6ORujG4bsX1ow7uiFbqq1cYYGM
jX8/eCAzsd9G2sqQynARKUal2UmoovXa2FRM/7m8/898WRoGcEsl1xWMpFJUsxIN
W/y3uG97236oMW+oUST8RFkUMsxyJRJuvqnP4cG6DKKLNPF+YSHrlrkbjSmBTN48
=faLS
-----END PGP SIGNATURE-----

Artyom V. Poptsov wrote 2 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 60567@debbugs.gnu.org)
875ydgvrpg.fsf@gmail.com
Toggle quote (3 lines)
> I'm not sure about the new tui module because a lot of packages could
> fall into that category, all ncurses based programs for instance.

I'm not sure about the new module either, but where would you put this
package?

- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmO7AvsZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigLxzQB/0R4mqmJeGhBDmEPNdd3j+E
bQDnjbcamBmo2/7FxvNyGfcnwfAZzs2IUAKYGd1/VP9HHGw+f2izYVCwfz6icP6v
l6sL9WWXVaqAle8S27nU1c/Zwdl6D+Kx7NTSL+PeR34MpVlSVDJArvi0dQ0ryMo2
3x1JDRFTYoWlrGYc45FxltP/AL23lSeE2ZHxRBvFD4T0LDSmdAQEX+nNXOHW4sUg
KyJqOBbO4kqT9aoojpOOk+34sab09+KNdYxQvpzy13BBI3NGS0CEkKqDaxb+onrj
UeDLD7lp05cfxfRp2Z+/qTG3xENpnWvfY61UP+IQFopdvMSt6WSEtQcJcDml4q8b
=FVTX
-----END PGP SIGNATURE-----

Artyom V. Poptsov wrote 2 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 60567@debbugs.gnu.org)
87y1qblby3.fsf@gmail.com
Hello,

I decided to move the FTXUI package to "cpp.scm" module as the library
provides API mainly for C++ programs.
From 74c0a34861242b913ab90ad77af9bdd778562016 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Thu, 5 Jan 2023 08:03:15 +0300
Subject: [PATCH] gnu: Add ftxui.

* gnu/packages/cpp.scm (ftxui): New variable.
---
gnu/packages/cpp.scm | 49 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)

Toggle diff (59 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index cc594e56c5..23ea05cf9e 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2343,3 +2343,52 @@ (define-public wdl
@item And more.
@end itemize")
(license license:zlib))))
+
+(define-public ftxui
+ (package
+ (name "ftxui")
+ (version "3.0.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ArthurSonzogni/FTXUI")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "10a4yw2h29kixxyhll6cvrwyscsvz9asxry857a9l8nqvbhs946s"))
+ (file-name (git-file-name name version))))
+ (build-system cmake-build-system)
+ (native-inputs (list googletest))
+ (arguments
+ (list #:configure-flags
+ #~(list "-DFTXUI_BUILD_TESTS:BOOL=ON"
+ "-DFTXUI_BUILD_TESTS_FUZZER:BOOL=OFF")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake-tests
+ (lambda _
+ (substitute* "cmake/ftxui_test.cmake"
+ (("NOT googletest_POPULATED")
+ "FALSE"))
+ ;; Disable benchmarks for a while as they require bundled Google
+ ;; benchmark and when the 'googlebenchmark' is unbundled, there's
+ ;; a CMake configuration error.
+ (substitute* "cmake/ftxui_benchmark.cmake"
+ (("NOT WIN32")
+ "FALSE")))) )))
+ (home-page "https://github.com/ArthurSonzogni/FTXUI")
+ (synopsis "C++ Functional Terminal User Interface")
+ (description
+ "Functional Terminal (X) User interface (FTXUI) is a simple C++ library for
+terminal based user interfaces.
+
+Main features:
+@itemize
+@item Functional style.
+@item Keyboard & mouse navigation.
+@item Support for UTF8 and fullwidth chars.
+@item Support for animations.
+@item Support for drawing.
+@item No dependencies.
+@end itemize")
+ (license license:expat)))
--
2.34.1
- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmO8cUQZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigLxPrCAC2RWN4vOcgocVCvGmvEh6m
nVfNAKKLg5W2+XtlIEFn6byv1Hj2zohZJZK5EjW8sDQd7yeAgU2ZP+1tQYl0LH2J
cflb91O/fGGj/HdAt+vdec7sdushiSFagcMnswDxx6k0msYAhMMKnHuBnjbnTpXn
4ihzs6AVokCg7KdkDkne+ERhLC4g82R0b54aH4ol3m0PjaHxzB3qXdzuL8aRERxV
fJM4BmpA1ZX409bU7tGOrduJIzVKcnJoLK4kaCqK1RSUaZble9E6+CUp8h5OUwAH
/97OMIXWO5BspzKHnPqmzWBDCHlnSWq8bx+UTWc8r/ZtWoerEcN8NXbfjUKfQg9r
=WxA/
-----END PGP SIGNATURE-----

Mathieu Othacehe wrote 2 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 60567-done@debbugs.gnu.org)
87cz7molcf.fsf@gnu.org
Hell Artyom,

Toggle quote (3 lines)
> I decided to move the FTXUI package to "cpp.scm" module as the library
> provides API mainly for C++ programs.

OK, thanks for the v2!

Applied.

Mathieu
Closed
Mathieu Othacehe wrote 2 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 60567@debbugs.gnu.org)
878riaogr5.fsf@gnu.org
Hey Artyom,

I noticed that the package is failing on non-x86_64 architectures:

Could you please have a look?

Thanks,

Mathieu
?
Your comment

This issue is archived.

To comment on this conversation send an email to 60567@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 60567
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help