dropbear: bump to 2019.78
[openwrt/staging/lynxis.git] / package / network / services / dropbear / Makefile
1 #
2 # Copyright (C) 2006-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=dropbear
11 PKG_VERSION:=2019.78
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:= \
16 http://matt.ucc.asn.au/dropbear/releases/ \
17 https://dropbear.nl/mirror/releases/
18 PKG_HASH:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
19
20 PKG_LICENSE:=MIT
21 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
22 PKG_CPE_ID:=cpe:/a:matt_johnston:dropbear_ssh_server
23
24 PKG_BUILD_PARALLEL:=1
25 PKG_USE_MIPS16:=0
26 PKG_FIXUP:=autoreconf
27
28 PKG_CONFIG_DEPENDS:= \
29 CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC CONFIG_DROPBEAR_ECC_FULL \
30 CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
31 CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE
32
33 include $(INCLUDE_DIR)/package.mk
34
35 ifneq ($(DUMP),1)
36 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5)
37 endif
38
39 define Package/dropbear/Default
40 URL:=http://matt.ucc.asn.au/dropbear/
41 endef
42
43 define Package/dropbear/config
44 source "$(SOURCE)/Config.in"
45 endef
46
47 define Package/dropbear
48 $(call Package/dropbear/Default)
49 SECTION:=net
50 CATEGORY:=Base system
51 TITLE:=Small SSH2 client/server
52 DEPENDS:= +DROPBEAR_ZLIB:zlib
53 ALTERNATIVES:=\
54 100:/usr/bin/ssh:/usr/sbin/dropbear \
55 100:/usr/bin/scp:/usr/sbin/dropbear \
56
57 endef
58
59 define Package/dropbear/description
60 A small SSH2 server/client designed for small memory environments.
61 endef
62
63 define Package/dropbear/conffiles
64 $(if $(CONFIG_DROPBEAR_ECC),/etc/dropbear/dropbear_ecdsa_host_key)
65 /etc/dropbear/dropbear_rsa_host_key
66 /etc/config/dropbear
67 endef
68
69 define Package/dropbearconvert
70 $(call Package/dropbear/Default)
71 SECTION:=utils
72 CATEGORY:=Utilities
73 TITLE:=Utility for converting SSH keys
74 endef
75
76 CONFIGURE_ARGS += \
77 --disable-pam \
78 --enable-openpty \
79 --enable-syslog \
80 --disable-lastlog \
81 --disable-utmpx \
82 $(if $(CONFIG_DROPBEAR_UTMP),,--disable-utmp) \
83 --disable-wtmp \
84 --disable-wtmpx \
85 --disable-loginfunc \
86 $(if $(CONFIG_DROPBEAR_PUTUTLINE),,--disable-pututline) \
87 --disable-pututxline \
88 $(if $(CONFIG_DROPBEAR_ZLIB),,--disable-zlib) \
89 --enable-bundled-libtom
90
91 TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections -flto
92 TARGET_LDFLAGS += -Wl,--gc-sections -flto=jobserver
93
94 define Build/Configure
95 : > $(PKG_BUILD_DIR)/localoptions.h
96
97 $(Build/Configure/Default)
98
99 echo '#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
100 $(PKG_BUILD_DIR)/localoptions.h
101
102 echo '#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
103 $(PKG_BUILD_DIR)/localoptions.h
104
105 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
106 echo "#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \
107 $(PKG_BUILD_DIR)/localoptions.h; \
108 done
109
110 # remove protocol idented software version number
111 $(ESED) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
112 $(PKG_BUILD_DIR)/sysoptions.h
113
114 # disable legacy/unsafe methods and unused functionality
115 for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
116 DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
117 DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV; do \
118 echo "#define $$$$OPTION 0" >> \
119 $(PKG_BUILD_DIR)/localoptions.h; \
120 done
121
122 # enable nistp384 and nistp521 only if full ECC support was requested
123 for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521; do \
124 $(ESED) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \
125 $(PKG_BUILD_DIR)/sysoptions.h; \
126 done
127
128 # Enforce rebuild of svr-chansession.c
129 rm -f $(PKG_BUILD_DIR)/svr-chansession.o
130 endef
131
132 define Build/Compile
133 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
134 $(TARGET_CONFIGURE_OPTS) \
135 PROGRAMS="dropbear dbclient dropbearkey scp" \
136 MULTI=1 SCPPROGRESS=1
137 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
138 $(TARGET_CONFIGURE_OPTS) \
139 PROGRAMS="dropbearconvert"
140 endef
141
142 define Package/dropbear/install
143 $(INSTALL_DIR) $(1)/usr/sbin
144 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
145 $(INSTALL_DIR) $(1)/usr/bin
146 $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
147 $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
148 $(INSTALL_DIR) $(1)/etc/config
149 $(INSTALL_CONF) ./files/dropbear.config $(1)/etc/config/dropbear
150 $(INSTALL_DIR) $(1)/etc/init.d
151 $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
152 $(INSTALL_DIR) $(1)/usr/lib/opkg/info
153 $(INSTALL_DIR) $(1)/etc/dropbear
154 $(if $(CONFIG_DROPBEAR_ECC),touch $(1)/etc/dropbear/dropbear_ecdsa_host_key)
155 touch $(1)/etc/dropbear/dropbear_rsa_host_key
156 endef
157
158 define Package/dropbearconvert/install
159 $(INSTALL_DIR) $(1)/usr/bin
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
161 endef
162
163 $(eval $(call BuildPackage,dropbear))
164 $(eval $(call BuildPackage,dropbearconvert))