dropbear: allow build without dbclient
[openwrt/openwrt.git] / package / network / services / dropbear / Makefile
index ca39f845b9dd3eb0483766c23eb0a34cba08fb91..63204042f71a250f257ed5cdfb98bffb66a56bd7 100644 (file)
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
-PKG_VERSION:=2019.77
-PKG_RELEASE:=1
+PKG_VERSION:=2019.78
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
        http://matt.ucc.asn.au/dropbear/releases/ \
        https://dropbear.nl/mirror/releases/
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
        http://matt.ucc.asn.au/dropbear/releases/ \
        https://dropbear.nl/mirror/releases/
-PKG_HASH:=d91f78ebe633be1d071fd1b7e5535b9693794048b019e9f4bea257e1992b458d
+PKG_HASH:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
@@ -26,9 +26,10 @@ PKG_USE_MIPS16:=0
 PKG_FIXUP:=autoreconf
 
 PKG_CONFIG_DEPENDS:= \
 PKG_FIXUP:=autoreconf
 
 PKG_CONFIG_DEPENDS:= \
-       CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC \
+       CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
        CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
        CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
-       CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE
+       CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE \
+       CONFIG_DROPBEAR_DBCLIENT
 
 include $(INCLUDE_DIR)/package.mk
 
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -119,6 +120,12 @@ define Build/Configure
                        $(PKG_BUILD_DIR)/localoptions.h; \
        done
 
                        $(PKG_BUILD_DIR)/localoptions.h; \
        done
 
+       # enable nistp384 and nistp521 only if full ECC support was requested
+       for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521; do \
+               $(ESED) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \
+               $(PKG_BUILD_DIR)/sysoptions.h; \
+       done
+
        # Enforce rebuild of svr-chansession.c
        rm -f $(PKG_BUILD_DIR)/svr-chansession.o
 endef
        # Enforce rebuild of svr-chansession.c
        rm -f $(PKG_BUILD_DIR)/svr-chansession.o
 endef
@@ -126,7 +133,7 @@ endef
 define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
 define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
-               PROGRAMS="dropbear dbclient dropbearkey scp" \
+               PROGRAMS="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \
                MULTI=1 SCPPROGRESS=1
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
                MULTI=1 SCPPROGRESS=1
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
@@ -137,7 +144,7 @@ define Package/dropbear/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
        $(INSTALL_DIR) $(1)/usr/bin
-       $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
+       $(if $(CONFIG_DROPBEAR_DBCLIENT),$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient,)
        $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear
        $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear