sqlite3: make cli-editing support selectable
authorSebastian Kemper <sebastian_ml@gmx.net>
Thu, 27 Dec 2018 10:11:20 +0000 (11:11 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Thu, 27 Dec 2018 10:11:22 +0000 (11:11 +0100)
sqlite3 can use libedit, readline or disable command-line editing
support altogether. This commit adds a choice to menuselect.

The default is changed from readline to libedit, as the latter is
upstream's first choice and is also a bit smaller than readline.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
libs/sqlite3/Config-cli.in [new file with mode: 0644]
libs/sqlite3/Makefile

diff --git a/libs/sqlite3/Config-cli.in b/libs/sqlite3/Config-cli.in
new file mode 100644 (file)
index 0000000..752db6e
--- /dev/null
@@ -0,0 +1,24 @@
+menu "Configuration"
+       depends on PACKAGE_sqlite3-cli
+
+choice
+       prompt "Select command-line editing support"
+       default SQLITE3_LIBEDIT
+
+       config SQLITE3_LIBEDIT
+       bool "libedit"
+       help
+         Link against libedit. This is the default.
+
+       config SQLITE3_READLINE
+       bool "readline"
+       help
+         Link against GNU readline.
+
+       config SQLITE3_READLINE_NONE
+       bool "none"
+       help
+         Disable command-line editing support.
+
+endchoice
+endmenu
index d1a558717df632761b02a0c01b1c2595644b1943..21cd04f4a6d175e56249dafa7ea60e8bc590eca4 100644 (file)
@@ -30,6 +30,8 @@ PKG_CONFIG_DEPENDS := \
        CONFIG_SQLITE3_FTS4 \
        CONFIG_SQLITE3_FTS5 \
        CONFIG_SQLITE3_JSON1 \
+       CONFIG_SQLITE3_LIBEDIT \
+       CONFIG_SQLITE3_READLINE \
        CONFIG_SQLITE3_RTREE \
        CONFIG_SQLITE3_SESSION \
        CONFIG_SQLITE3_THREADSAFE
@@ -70,7 +72,11 @@ define Package/sqlite3-cli
   $(call Package/sqlite3/Default)
   SECTION:=utils
   CATEGORY:=Utilities
-  DEPENDS:=+libsqlite3 +libncurses +libreadline
+  DEPENDS := \
+         +libsqlite3 \
+         +SQLITE3_LIBEDIT:libedit \
+         +SQLITE3_READLINE:libreadline \
+         +SQLITE3_READLINE:libncursesw
   TITLE+= (cli)
 endef
 
@@ -81,6 +87,10 @@ $(call Package/sqlite3/Default/description)
  formats.
 endef
 
+define Package/sqlite3-cli/config
+  source "$(SOURCE)/Config-cli.in"
+endef
+
 TARGET_CFLAGS += \
        -DHAVE_ISNAN=1 \
        -DHAVE_MALLOC_USABLE_SIZE=1 \
@@ -89,7 +99,6 @@ TARGET_CFLAGS += \
 CONFIGURE_ARGS += \
        --enable-shared \
        --enable-static \
-       --disable-editline \
        --disable-static-shell \
        $(if $(CONFIG_SQLITE3_DYNAMIC_EXTENSIONS),--enable-dynamic-extensions,--disable-dynamic-extensions) \
        $(if $(CONFIG_SQLITE3_FTS3),--enable-fts3,--disable-fts3) \
@@ -100,6 +109,14 @@ CONFIGURE_ARGS += \
        $(if $(CONFIG_SQLITE3_SESSION),--enable-session,--disable-session) \
        $(if $(CONFIG_SQLITE3_THREADSAFE),--enable-threadsafe,--disable-threadsafe)
 
+ifeq ($(CONFIG_SQLITE3_LIBEDIT),y)
+CONFIGURE_ARGS+=--disable-readline
+else ifeq ($(CONFIG_SQLITE3_READLINE),y)
+CONFIGURE_ARGS+=--disable-editline
+else
+CONFIGURE_ARGS+=--disable-editline --disable-readline
+endif
+
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/sqlite3{,ext}.h $(1)/usr/include/