package/nnn: new package
PATCH 1/1 package/nnn: new package
nnn is a fast and minimal text-based file manager. It is written in C and has minimal dependencies, which makes it portable and suitable for embedded systems.
Project page: https://github.com/jarun/nnn
Wiki: https://en.wikipedia.org/wiki/Nnn_(file_manager)
--- package/Config.in | 1 + package/nnn/Config.in | 9 +++++++++ package/nnn/nnn.hash | 3 +++ package/nnn/nnn.mk | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 package/nnn/Config.in create mode 100644 package/nnn/nnn.hash create mode 100644 package/nnn/nnn.mk
package/Config.in +1 -0
@@ -2805,6 +2805,7 @@ comment "Utilities" source "package/lowdown/Config.in" source "package/minisign/Config.in" source "package/neofetch/Config.in" + source "package/nnn/Config.in" source "package/pdmenu/Config.in" source "package/pinentry/Config.in" source "package/qprint/Config.in"
package/nnn/Config.in new file +9 -0
@@ -0,0 +1,9 @@ +config BR2_PACKAGE_NNN + bool "nnn" + depends on BR2_PACKAGE_READLINE && BR2_PACKAGE_NCURSES + help + nnn is a lightweight yet powerful terminal file manager. + It is written in C, has minimal dependency, and works + out of the box. + + https://github.com/jarun/nnn
package/nnn/nnn.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed +sha256 9faaff1e3f5a2fd3ed570a83f6fb3baf0bfc6ebd6a9abac16203d057ac3fffe3 nnn-v5.1.tar.gz +sha256 829f485dc4f2f51c2471b36a99e22f15ff214966e16b72cd79768b2338b4132b LICENSE
package/nnn/nnn.mk new file +32 -0
@@ -0,0 +1,32 @@ +################################################################################ +# +# nnn +# +################################################################################ + +NNN_VERSION = v5.1 +NNN_LICENSE = BSD-2-Clause +NNN_LICENSE_FILES = LICENSE +NNN_SITE = $(call github,jarun,nnn,$(NNN_VERSION)) +NNN_DEPENDENCIES = readline ncurses +NNN_INSTALL_STAGING = YES +NNN_BIN = usr/bin/nnn + +define NNN_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" +endef + +# Install the binaries, manuals, and other items described in the Makefile to the staging directory +define NNN_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + DESTDIR=$(STAGING_DIR) PREFIX=/usr install +endef + +# Put a stripped binary into the target directory +define NNN_INSTALL_TARGET_CMDS + $(INSTALL) -Dm755 $(STAGING_DIR)/$(NNN_BIN) $(TARGET_DIR)/$(NNN_BIN) + $(TARGET_STRIP) $(TARGET_DIR)/$(NNN_BIN) +endef + +$(eval $(generic-package))
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/1 package/nnn: new package
Hi everyone,
Let me provide some more information about the nnn package.
Motivation:
1) I found the package useful during my personal work with devices. I thought Buildroot would be a great place to share this work to avoid building the app and its dependencies manually.
2) nnn often looks and feels like a lightweight version of ranger, but without the need to build and ship Python. So I figured it’d be handy to have a file manager like this with minimal dependencies.
Tests:
1) I've tested it manually using QEMU (aarch64), Raspberry Pi 3, and Orange Pi Zero.
2) https://gitlab.com/alexs-sh/nnn-buildroot - this is my GitLab project with a configured CI pipeline that automatically runs checks and builds images for QEMU, Raspberry Pi, and Orange Pi. I'm ready to make further modifications and/or improvements as needed. :)
Thank you!
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Alexander,
Thank you for our patch! I have a bunch of comments. Could you fix those and
re-send? I've marked your patch as Changes Requested in patchwork.
Quoted 7 lines · Alexander Shirokov
nnn is a fast and minimal text-based file manager. It is written in C and has minimal dependencies, which makes it portable and suitable for embedded systems.
Project page: https://github.com/jarun/nnn
Wiki: https://en.wikipedia.org/wiki/Nnn_(file_manager)
Quoted 6 lines
Signed-off-by Alexander Shirokov <[email protected]>--- package/Config.in | 1 + package/nnn/Config.in | 9 +++++++++ package/nnn/nnn.hash | 3 +++ package/nnn/nnn.mk | 32 ++++++++++++++++++++++++++++++++
Please also add yourself to the DEVELOPERS file for this package.
Quoted 10 lines
4 files changed, 45 insertions(+)create mode 100644 package/nnn/Config.in
create mode 100644 package/nnn/nnn.hash
create mode 100644package/nnn/nnn.mkpackage/Config.in +0
-0
package/Config.in comment "Utilities" · line 2808
Quoted 4 lines
package/Config.in +1
-0@@ -2805,6 +2805,7 @@ comment "Utilities" source "package/lowdown/Config.in" source "package/minisign/Config.in" source "package/neofetch/Config.in" + source "package/nnn/Config.in"
Midnight Commander is in the "Text editors and viewers" menu. Not sure if that
is the best place, but at least mc and nnn should be in the same menu, since they do the same thing. Sort of.
package/nnn/Config.in line 3
Quoted 12 lines
package/Config.in +0
-0source "package/pdmenu/Config.in" source "package/pinentry/Config.in" source "package/qprint/Config.in"package/nnn/Config.in new file +3
-0@@ -0,0 +1,9 @@ +config BR2_PACKAGE_NNN + bool "nnn" + depends on BR2_PACKAGE_READLINE && BR2_PACKAGE_NCURSES
We as much as possible use "select" instead of "depends on", so users don't
have to go and find those dependencies before they can enable nnn. See [1]. Note that you'll also need to propagate ncurses' dependencies and add a comment for it.
Readline, however, is an optional dependency for nnn. You can specify O_NORL=1
on the make command line to disable it. See below.
Quoted 21 lines
package/nnn/Config.in new file +6
-0+ help + nnn is a lightweight yet powerful terminal file manager. + It is written in C, has minimal dependency, and works + out of the box. + + https://github.com/jarun/nnnpackage/nnn/nnn.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally computed +sha256 9faaff1e3f5a2fd3ed570a83f6fb3baf0bfc6ebd6a9abac16203d057ac3fffe3 nnn-v5.1.tar.gz +sha256 829f485dc4f2f51c2471b36a99e22f15ff214966e16b72cd79768b2338b4132b LICENSEpackage/nnn/nnn.mk new file +0
-0
package/nnn/nnn.mk line 7
Quoted 7 lines
package/nnn/nnn.mk new file +7
-0@@ -0,0 +1,32 @@ +################################################################################ +# +# nnn +# +################################################################################ + +NNN_VERSION = v5.1
Try to keep VERSION at the "clean" version, i.e. 5.1
package/nnn/nnn.mk line 10
Quoted 3 lines
package/nnn/nnn.mk new file +3
-0+NNN_LICENSE = BSD-2-Clause +NNN_LICENSE_FILES = LICENSE +NNN_SITE = $(call github,jarun,nnn,$(NNN_VERSION))
And here you use $(call github,jarun,nnn,v$(NNN_VERSION))
(note that the file name also changes so you have to update the hash file as well.
package/nnn/nnn.mk line 12
Quoted 2 lines
package/nnn/nnn.mk new file +2
-0+NNN_DEPENDENCIES = readline ncurses +NNN_INSTALL_STAGING = YES
This only installs a binary so installation to staging is not needed.
package/nnn/nnn.mk line 17
Quoted 5 lines
package/nnn/nnn.mk new file +5
-0+NNN_BIN = usr/bin/nnn + +define NNN_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)"
The Makefile has a lot of options (O_xxx, documented at the top). We generally
like to specify all of them explicitly, though in this case honestly it is a bit too much.
There are a few options though that you do have to specify. O_NORL, as
mentioned above. O_DEBUG is better to set explicitly to 0, we want to override it with Buildroot's debug options. Similarly, CFLAGS_OPTIMIZATION should be set to empty to remove the -O3.
In addition, CPPFLAGS, LDFLAGS and PKG_CONFIG should be passed into theMakefile. These are in TARGET_CONFIGURE_OPTS, it's easiest to just pass those.
So, that brings us to this:
NNN_MAKE_FLAGS = \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS_OPTIMIZATION= \ O_DEBUG=0
ifeq ($(BR2_PACKAGE_READLINE),y)NNN_DEPENDENCIES += readlineNNN_MAKE_FLAGS += O_NORL=0
elseNNN_MAKE_FLAGS += O_NORL=1
endif
define NNN_BUILD_CMDS
$(MAKE) -C $(@D) $(NNN_MAKE_FLAGS) all
endef
package/nnn/nnn.mk line 23
Quoted 6 lines
package/nnn/nnn.mk new file +6
-0+endef + +# Install the binaries, manuals, and other items described in the Makefile to the staging directory +define NNN_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + DESTDIR=$(STAGING_DIR) PREFIX=/usr install
For consistency, it is best to repeat NNN_MAKE_FLAGS also in the install step.
package/nnn/nnn.mk line 29
Quoted 6 lines
package/nnn/nnn.mk new file +6
-0+endef + +# Put a stripped binary into the target directory +define NNN_INSTALL_TARGET_CMDS + $(INSTALL) -Dm755 $(STAGING_DIR)/$(NNN_BIN) $(TARGET_DIR)/$(NNN_BIN) + $(TARGET_STRIP) $(TARGET_DIR)/$(NNN_BIN)
You can just use make install with DESTDIR set to TARGET_DIR. The man pages will be removed again during target finalization.
Regards,
Arnout
package/nnn/nnn.mk line 32
Quoted 3 lines
package/nnn/nnn.mk new file +3
-0+endef + +$(eval $(generic-package))
[1] https://buildroot.org/downloads/manual/manual.html#depends-on-vs-select
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/1 package/nnn: new package
Hi Arnout,
Many thanks for your review and the informative comments. I’ll make the changes, test them, and resend the v2 in a couple of days.
Regards,
Alexander
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/1 package/nnn: new package
In reply to Alexander Shirokovnnn is a fast and minimal text-based file manager. It is written in C and has minimal dependencies, which makes it portable and suitable for embedded systems.
Project page: https://github.com/jarun/nnn
Wiki: https://en.wikipedia.org/wiki/Nnn_(file_manager)
---
Changes v1 -> v2:
- Updating dependencies and selecting "ncurses" flags
- Using "readline" as an optional dependency
- Simplifying build and installation steps
- Fixing the package version
- Placing the package to the "Text editors and viewers" section. Close to "mc"
- Updating DEVELOPERS
--- DEVELOPERS | 3 +++ package/Config.in | 1 + package/nnn/Config.in | 14 ++++++++++++++ package/nnn/nnn.hash | 3 +++ package/nnn/nnn.mk | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 package/nnn/Config.in create mode 100644 package/nnn/nnn.hash create mode 100644 package/nnn/nnn.mk
DEVELOPERS +3 -0
@@ -91,6 +91,9 @@ F: package/modem-manager/ N: Aleksandr Makarov <[email protected]> F: package/cpp-httplib/ +N: Alexander Shirokov <[email protected]> +F: package/nnn/ + N: Alessandro Partesotti <[email protected]> F: package/oatpp/
package/Config.in +1 -0
@@ -2973,6 +2973,7 @@ menu "Text editors and viewers" source "package/mg/Config.in" source "package/most/Config.in" source "package/nano/Config.in" + source "package/nnn/Config.in" source "package/uemacs/Config.in" source "package/vim/Config.in" endmenu
package/nnn/Config.in new file +14 -0
@@ -0,0 +1,14 @@ +config BR2_PACKAGE_NNN + bool "nnn" + # Building nnn without widechar/UTF support is theoretically + # possible, but in practice it leads to unstable builds. + # That’s why the WCHAR dependency is here. + depends on BR2_USE_WCHAR + select BR2_PACKAGE_NCURSES + select BR2_PACKAGE_NCURSES_WCHAR + help + nnn is a lightweight yet powerful terminal file manager. + It is written in C, has minimal dependency, and works + out of the box. + + https://github.com/jarun/nnn
package/nnn/nnn.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed +sha256 9faaff1e3f5a2fd3ed570a83f6fb3baf0bfc6ebd6a9abac16203d057ac3fffe3 nnn-5.1.tar.gz +sha256 829f485dc4f2f51c2471b36a99e22f15ff214966e16b72cd79768b2338b4132b LICENSE
package/nnn/nnn.mk new file +33 -0
@@ -0,0 +1,33 @@ +################################################################################ +# +# nnn +# +################################################################################ + +NNN_VERSION = 5.1 +NNN_LICENSE = BSD-2-Clause +NNN_LICENSE_FILES = LICENSE +NNN_SITE = $(call github,jarun,nnn,v$(NNN_VERSION)) +NNN_DEPENDENCIES = ncurses +NNN_MAKE_FLAGS = CFLAGS_OPTIMIZATION= + +# "readline" is an optional dependency. If the package is enabled, +# add it to the dependencies list. Otherwise, build the "norl" target. +ifeq ($(BR2_PACKAGE_READLINE),y) +NNN_DEPENDENCIES += readline +else +NNN_MAKE_FLAGS += norl +endif + +define NNN_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D) $(NNN_MAKE_FLAGS) +endef + +define NNN_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D) $(NNN_MAKE_FLAGS) \ + DESTDIR=$(TARGET_DIR) PREFIX=/usr install +endef + +$(eval $(generic-package))
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Alexander,
Quoted 8 lines · Alexander Shirokov
nnn is a fast and minimal text-based file manager. It is written in C and has minimal dependencies, which makes it portable and suitable for embedded systems.
Project page: https://github.com/jarun/nnn
Wiki: https://en.wikipedia.org/wiki/Nnn_(file_manager)Signed-off-by Alexander Shirokov <[email protected]>
Applied to next, thanks.
I still had to make quite a lot of changes, see below for a list. A major
element is that you should use the utils/test-pkg script to test it in different configurations.
- add missing dependency on BR2_USE_MMU (found with test-pkg);
- add missing comment in Config.in;
- add musl-fls dependency when needed (found with test-pkg);
- add host-pkgconf dependency;
- add NNN_MAKE_ENV to collect everything in make environment;
- drop TARGET_MAKE_ENV from environment, it's already in TARGET_CONFIGURE_OPTS;
- add PREFIX to NNN_MAKE_FLAGS: it is currently not used in the build step, but in the future it may be used;
- use NORL=0/1 for readline optional dependency, the Makefile says that the "norl" target is legacy;
- remove comment about readline dependency, it's obvious;
- indent continuation line with an extra tab.
Regards,
Arnout
Quoted 107 lines
---
Changes v1 -> v2:
- Updating dependencies and selecting "ncurses" flags
- Using "readline" as an optional dependency
- Simplifying build and installation steps
- Fixing the package version
- Placing the package to the "Text editors and viewers" section. Close to "mc"
- Updating DEVELOPERSSigned-off-by Alexander Shirokov <[email protected]>--- DEVELOPERS | 3 +++ package/Config.in | 1 + package/nnn/Config.in | 14 ++++++++++++++ package/nnn/nnn.hash | 3 +++ package/nnn/nnn.mk | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+)create mode 100644 package/nnn/Config.in
create mode 100644 package/nnn/nnn.hash
create mode 100644package/nnn/nnn.mkDEVELOPERS +3
-0@@ -91,6 +91,9 @@ F: package/modem-manager/ N: Aleksandr Makarov <[email protected]> F: package/cpp-httplib/ +N: Alexander Shirokov <[email protected]> +F: package/nnn/ + N: Alessandro Partesotti <[email protected]> F: package/oatpp/package/Config.in +1
-0@@ -2973,6 +2973,7 @@ menu "Text editors and viewers" source "package/mg/Config.in" source "package/most/Config.in" source "package/nano/Config.in" + source "package/nnn/Config.in" source "package/uemacs/Config.in" source "package/vim/Config.in" endmenupackage/nnn/Config.in new file +14
-0@@ -0,0 +1,14 @@ +config BR2_PACKAGE_NNN + bool "nnn" + # Building nnn without widechar/UTF support is theoretically + # possible, but in practice it leads to unstable builds. + # That’s why the WCHAR dependency is here. + depends on BR2_USE_WCHAR + select BR2_PACKAGE_NCURSES + select BR2_PACKAGE_NCURSES_WCHAR + help + nnn is a lightweight yet powerful terminal file manager. + It is written in C, has minimal dependency, and works + out of the box. + + https://github.com/jarun/nnnpackage/nnn/nnn.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally computed +sha256 9faaff1e3f5a2fd3ed570a83f6fb3baf0bfc6ebd6a9abac16203d057ac3fffe3 nnn-5.1.tar.gz +sha256 829f485dc4f2f51c2471b36a99e22f15ff214966e16b72cd79768b2338b4132b LICENSEpackage/nnn/nnn.mk new file +23
-0@@ -0,0 +1,33 @@ +################################################################################ +# +# nnn +# +################################################################################ + +NNN_VERSION = 5.1 +NNN_LICENSE = BSD-2-Clause +NNN_LICENSE_FILES = LICENSE +NNN_SITE = $(call github,jarun,nnn,v$(NNN_VERSION)) +NNN_DEPENDENCIES = ncurses +NNN_MAKE_FLAGS = CFLAGS_OPTIMIZATION= + +# "readline" is an optional dependency. If the package is enabled, +# add it to the dependencies list. Otherwise, build the "norl" target. +ifeq ($(BR2_PACKAGE_READLINE),y) +NNN_DEPENDENCIES += readline +else +NNN_MAKE_FLAGS += norl +endif + +define NNN_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \
package/nnn/nnn.mk line 33
Quoted 10 lines
package/nnn/nnn.mk new file +10
-0+ -C $(@D) $(NNN_MAKE_FLAGS) +endef + +define NNN_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \ + -C $(@D) $(NNN_MAKE_FLAGS) \ + DESTDIR=$(TARGET_DIR) PREFIX=/usr install +endef + +$(eval $(generic-package))
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/1 package/nnn: new package
Hello Arnout,
I just noticed your changes in the patch. Thank you very much.
Regards,
Alexander
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot