Try to build dropwatch

Greetings,
I am currently trying to build dropwatch for OpenWRT 22.03.5 as a package. I have added another subfolder named "dropwatch" under openwrt/package/utils/ in which my Makefile and another subfolder "src" is located in which the current repo of dropwatch is cloned. I have difficulties with the dependencies at the moment. To be exact it is about "readline". Despite that I have specified "libreadline" and "libncurses" as dependencies, the build breaks with the message:

checking for READLINE... no
configure: error: libreadline is required

The config.log says the following:

configure:12522: checking for READLINE
configure:12529: $PKG_CONFIG --exists --print-errors "readline"
configure:12532: $? = 0
configure:12546: $PKG_CONFIG --exists --print-errors "readline"
configure:12549: $? = 0
configure:12563: result: no
Package 'ncurses', required by 'readline', not found
configure:12579: error: libreadline is required

My Makefile currently looks like this:

include $(TOPDIR)/rules.mk

PKG_NAME:=dropwatch
PKG_VERSION:=1.0.0
PKG_RELEASE:=1

PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

define Package/dropwatch
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=DropWatch
  DEPENDS:=+libpcap +libncurses +libreadline +libnl-core +libnl-genl
endef

TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include

define Build/Configure
  $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef

define Package/dropwatch/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropwatch $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,dropwatch))

Does anyone have any advice on this?

ncurses-devel ?

Do you mean for the openwrt build environment or for the local build machine? libncurses-dev is installed on my debian machine. I can also compile Dropwatch for the locale platform without problems. But not as openwrt package for my router platform. (mips)

During the build process it also compiles ncurses and readline without problems. Nevertheless, it then complains during the configuration of dropwatch that readline would not be available.

You should patch the configure.ac

Index: dropwtach-20240219/configure.ac
===================================================================
--- dropwtach-20240219.orig/configure.ac
+++ dropwtach-20240219/configure.ac
@@ -17,11 +17,36 @@ AC_CHECK_FUNCS(getopt_long)
 
 PKG_CHECK_MODULES([LIBNL3], [libnl-3.0], [], [AC_MSG_ERROR([libnl-3.0 is required])])
 PKG_CHECK_MODULES([LIBNLG3], [libnl-genl-3.0], [], [AC_MSG_ERROR([libnl-genl-3.0 is required])])
-PKG_CHECK_MODULES([READLINE], [readline], [], [AC_MSG_ERROR([libreadline is required])])
 PKG_CHECK_MODULES([LIBPCAP], [libpcap], [], [
         AC_CHECK_LIB(pcap, pcap_open_live,[],
                 [AC_MSG_ERROR([libpcap is required])])])
 
+prev_libs="$LIBS"
+  AC_CHECK_LIB([readline], [readline], [
+    LIBREADLINE="-lreadline"
+  ], [
+    dnl readline failed - it might be incorrectly linked and missing its
+    dnl termcap/tinfo/curses dependency.  see if we can fix that...
+    AC_SEARCH_LIBS([tputs], [termcap tinfo curses ncurses], [
+      LIBREADLINE="$ac_cv_search_tputs"
+    ], [
+      AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
+    ])
+
+    dnl re-try with the lib we found above
+    unset ac_cv_lib_readline_main
+    AC_CHECK_LIB([readline], [main], [
+      LIBREADLINE="-lreadline $LIBREADLINE"
+    ], [
+      AC_MSG_ERROR([libreadline (needed for vtysh) not found and/or missing dependencies])
+    ], [$LIBREADLINE])
+  ], [])
+  LIBS="$LIBS -lreadline"
+  AC_CHECK_FUNCS([rl_clear_visible_line])
+  LIBS="$prev_libs"
+AC_SUBST([LIBREADLINE])
+
+
 AC_ARG_WITH([bfd],
 	[AS_HELP_STRING([--without-bfd], [Build without bfd library (default: yes)])],
 	[with_bfd=$withval],