nano: Add a plus variant with more features
authorHannu Nyman <hannu.nyman@iki.fi>
Tue, 1 Feb 2022 21:44:21 +0000 (23:44 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Tue, 1 Feb 2022 21:44:21 +0000 (23:44 +0200)
Nano is by default built as "tiny" with most features disabled.
That is suitable for basic tasks in routers with small flash.

Add a new nano-plus variant that enables selected additional
features in the build config:
 * multiple files (multibuffer)
 * Unicode/utf8
 * justify
 * .nanorc support
 * help
 * also some key bindings get enabled as "tiny" configure option
   is removed.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit 85cb71d8d81af3c549406d5f42080ed58be9b9b0)

utils/nano/Makefile

index 24f8f51ba0e2bb115e6f9be2e887bbc17b2cadf4..f5b37f620ebb274b5060d75d284913f38ea04356 100644 (file)
@@ -25,15 +25,27 @@ PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/nano
+define Package/nano/Default
   SUBMENU:=Editors
   SECTION:=utils
   CATEGORY:=Utilities
-  TITLE:=GNU nano - enhanced clone of the Pico text editor
   URL:=https://www.nano-editor.org/
   DEPENDS:=+libncurses
 endef
 
+define Package/nano
+  $(call Package/nano/Default)
+  TITLE:=GNU nano text editor (minimal features)
+  VARIANT:=tiny
+  DEFAULT_VARIANT:=1
+endef
+
+define Package/nano-plus
+  $(call Package/nano/Default)
+  TITLE:=GNU nano text editor (more features, Unicode)
+  VARIANT:=plus
+endef
+
 define Package/nano/description
   Nano is a small and simple text editor for use on the terminal.
 
@@ -44,11 +56,41 @@ define Package/nano/description
   Nano is an official GNU package.
 endef
 
-CONFIGURE_ARGS += \
+define Package/nano-plus/description
+  nano-plus - Additional features enabled, larger size than default nano.
+  (multibuffer, Unicode/UTF-8, help, justify, nanorc, some key bindings)
+
+  $(call Package/nano/description)
+endef
+
+ifeq ($(BUILD_VARIANT),plus)
+# plus variant with more features included
+  CONFIGURE_ARGS += \
+       --enable-help \
+       --enable-justify \
+       --enable-linenumbers \
+       --enable-multibuffer \
+       --enable-nanorc \
+       --enable-utf8 \
+       --disable-browser \
+       --disable-color \
+       --disable-comment \
+       --disable-extra \
+       --disable-histories \
+       --disable-libmagic \
+       --disable-mouse \
+       --disable-operatingdir \
+       --disable-speller \
+       --disable-tabcomp \
+       --disable-wordcomp
+else
+# default tiny variant
+  CONFIGURE_ARGS += \
        --enable-tiny \
-       --disable-utf8 \
+       --enable-linenumbers \
        --disable-color \
-       --enable-linenumbers
+       --disable-utf8
+endif
 
 CONFIGURE_VARS += \
        ac_cv_header_regex_h=no \
@@ -58,5 +100,10 @@ define Package/nano/install
        $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
 endef
 
+define Package/nano-plus/install
+       $(call Package/nano/install,$1)
+endef
+
 $(eval $(call BuildPackage,nano))
+$(eval $(call BuildPackage,nano-plus))