2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
16 http
://matt.ucc.asn.au
/dropbear
/releases
/ \
17 https
://dropbear.nl
/mirror
/releases
/
18 PKG_HASH
:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
21 PKG_LICENSE_FILES
:=LICENSE libtomcrypt
/LICENSE libtommath
/LICENSE
22 PKG_CPE_ID
:=cpe
:/a
:matt_johnston
:dropbear_ssh_server
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 CONFIG_DROPBEAR_DBCLIENT
34 include $(INCLUDE_DIR
)/package.mk
37 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell echo
$(CONFIG_TARGET_INIT_PATH
) | mkhash md5
)
40 define Package
/dropbear
/Default
41 URL
:=http
://matt.ucc.asn.au
/dropbear
/
44 define Package
/dropbear
/config
45 source
"$(SOURCE)/Config.in"
48 define Package
/dropbear
49 $(call Package
/dropbear
/Default
)
52 TITLE
:=Small SSH2 client
/server
53 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
55 100:/usr
/bin
/ssh
:/usr
/sbin
/dropbear \
56 100:/usr
/bin
/scp
:/usr
/sbin
/dropbear \
60 define Package
/dropbear
/description
61 A small SSH2 server
/client designed for small memory environments.
64 define Package
/dropbear
/conffiles
65 $(if
$(CONFIG_DROPBEAR_ECC
),/etc
/dropbear
/dropbear_ecdsa_host_key
)
66 /etc
/dropbear
/dropbear_rsa_host_key
70 define Package
/dropbearconvert
71 $(call Package
/dropbear
/Default
)
74 TITLE
:=Utility for converting SSH keys
83 $(if
$(CONFIG_DROPBEAR_UTMP
),,--disable-utmp
) \
87 $(if
$(CONFIG_DROPBEAR_PUTUTLINE
),,--disable-pututline
) \
88 --disable-pututxline \
89 $(if
$(CONFIG_DROPBEAR_ZLIB
),,--disable-zlib
) \
90 --enable-bundled-libtom
92 TARGET_CFLAGS
+= -DARGTYPE
=3 -ffunction-sections
-fdata-sections
-flto
93 TARGET_LDFLAGS
+= -Wl
,--gc-sections
-flto
=jobserver
95 define Build
/Configure
96 : > $(PKG_BUILD_DIR
)/localoptions.h
98 $(Build
/Configure
/Default
)
100 echo
'#define DEFAULT_PATH "$(TARGET_INIT_PATH)"' >> \
101 $(PKG_BUILD_DIR
)/localoptions.h
103 echo
'#define DROPBEAR_CURVE25519 $(if $(CONFIG_DROPBEAR_CURVE25519),1,0)' >> \
104 $(PKG_BUILD_DIR
)/localoptions.h
106 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH
; do \
107 echo
"#define $$$$OPTION $(if $(CONFIG_DROPBEAR_ECC),1,0)" >> \
108 $(PKG_BUILD_DIR
)/localoptions.h
; \
111 # remove protocol idented software version number
112 $(ESED
) 's,^(#define LOCAL_IDENT) .*$$$$,\1 "SSH-2.0-dropbear",g' \
113 $(PKG_BUILD_DIR
)/sysoptions.h
115 # disable legacy/unsafe methods and unused functionality
116 for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
117 DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
118 DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV
; do \
119 echo
"#define $$$$OPTION 0" >> \
120 $(PKG_BUILD_DIR
)/localoptions.h
; \
123 # enable nistp384 and nistp521 only if full ECC support was requested
124 for OPTION in DROPBEAR_ECC_384 DROPBEAR_ECC_521
; do \
125 $(ESED
) 's,^(#define '$$$$OPTION') .*$$$$,\1 $(if $(CONFIG_DROPBEAR_ECC_FULL),1,0),g' \
126 $(PKG_BUILD_DIR
)/sysoptions.h
; \
129 # Enforce rebuild of svr-chansession.c
130 rm -f
$(PKG_BUILD_DIR
)/svr-chansession.o
134 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
135 $(TARGET_CONFIGURE_OPTS
) \
136 PROGRAMS
="dropbear $(if $(CONFIG_DROPBEAR_DBCLIENT),dbclient,) dropbearkey scp" \
137 MULTI
=1 SCPPROGRESS
=1
138 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
139 $(TARGET_CONFIGURE_OPTS
) \
140 PROGRAMS
="dropbearconvert"
143 define Package
/dropbear
/install
144 $(INSTALL_DIR
) $(1)/usr
/sbin
145 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearmulti
$(1)/usr
/sbin
/dropbear
146 $(INSTALL_DIR
) $(1)/usr
/bin
147 $(if
$(CONFIG_DROPBEAR_DBCLIENT
),$(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dbclient
,)
148 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dropbearkey
149 $(INSTALL_DIR
) $(1)/etc
/config
150 $(INSTALL_CONF
) .
/files
/dropbear.config
$(1)/etc
/config
/dropbear
151 $(INSTALL_DIR
) $(1)/etc
/init.d
152 $(INSTALL_BIN
) .
/files
/dropbear.init
$(1)/etc
/init.d
/dropbear
153 $(INSTALL_DIR
) $(1)/usr
/lib
/opkg
/info
154 $(INSTALL_DIR
) $(1)/etc
/dropbear
155 $(if
$(CONFIG_DROPBEAR_ECC
),touch
$(1)/etc
/dropbear
/dropbear_ecdsa_host_key
)
156 touch
$(1)/etc
/dropbear
/dropbear_rsa_host_key
159 define Package
/dropbearconvert
/install
160 $(INSTALL_DIR
) $(1)/usr
/bin
161 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearconvert
$(1)/usr
/bin
/dropbearconvert
164 $(eval
$(call BuildPackage
,dropbear
))
165 $(eval
$(call BuildPackage
,dropbearconvert
))