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
:=6cbc1dcb1c9709d226dff669e5604172a18cf5dbf9a201474d5618ae4465098c
21 PKG_LICENSE_FILES
:=LICENSE libtomcrypt
/LICENSE libtommath
/LICENSE
22 PKG_CPE_ID
:=cpe
:/a
:matt_johnston
:dropbear_ssh_server
27 PKG_CONFIG_DEPENDS
:= \
28 CONFIG_TARGET_INIT_PATH CONFIG_DROPBEAR_ECC \
29 CONFIG_DROPBEAR_CURVE25519 CONFIG_DROPBEAR_ZLIB \
30 CONFIG_DROPBEAR_UTMP CONFIG_DROPBEAR_PUTUTLINE
32 include $(INCLUDE_DIR
)/package.mk
35 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell echo
$(CONFIG_TARGET_INIT_PATH
) | mkhash md5
)
38 define Package
/dropbear
/Default
39 URL
:=http
://matt.ucc.asn.au
/dropbear
/
42 define Package
/dropbear
/config
43 source
"$(SOURCE)/Config.in"
46 define Package
/dropbear
47 $(call Package
/dropbear
/Default
)
50 TITLE
:=Small SSH2 client
/server
51 DEPENDS
:= +DROPBEAR_ZLIB
:zlib
54 define Package
/dropbear
/description
55 A small SSH2 server
/client designed for small memory environments.
58 define Package
/dropbear
/conffiles
59 /etc
/dropbear
/dropbear_rsa_host_key
63 define Package
/dropbearconvert
64 $(call Package
/dropbear
/Default
)
67 TITLE
:=Utility for converting SSH keys
76 $(if
$(CONFIG_DROPBEAR_UTMP
),,--disable-utmp
) \
80 $(if
$(CONFIG_DROPBEAR_PUTUTLINE
),,--disable-pututline
) \
81 --disable-pututxline \
82 $(if
$(CONFIG_DROPBEAR_ZLIB
),,--disable-zlib
) \
83 --enable-bundled-libtom
85 TARGET_CFLAGS
+= -DARGTYPE
=3 -ffunction-sections
-fdata-sections
86 TARGET_LDFLAGS
+= -Wl
,--gc-sections
88 define Build
/Configure
89 $(Build
/Configure
/Default
)
91 $(SED
) 's,^#define DEFAULT_PATH .*$$$$,#define DEFAULT_PATH "$(TARGET_INIT_PATH)",g' \
92 $(PKG_BUILD_DIR
)/options.h
94 awk
'BEGIN { rc = 1 } \
95 /'DROPBEAR_CURVE25519
'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519
'"; rc = 0 } \
97 END { exit(rc) }' $(PKG_BUILD_DIR
)/options.h \
98 >$(PKG_BUILD_DIR
)/options.h.new
&& \
99 mv
$(PKG_BUILD_DIR
)/options.h.new
$(PKG_BUILD_DIR
)/options.h
101 # Enforce that all replacements are made, otherwise options.h has changed
102 # format and this logic is broken.
103 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH
; do \
104 awk
'BEGIN { rc = 1 } \
105 /'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \
107 END { exit(rc) }' $(PKG_BUILD_DIR
)/options.h \
108 >$(PKG_BUILD_DIR
)/options.h.new
&& \
109 mv
$(PKG_BUILD_DIR
)/options.h.new
$(PKG_BUILD_DIR
)/options.h || exit
1; \
112 # remove protocol idented software version number
113 $(SED
) 's,^#define LOCAL_IDENT .*$$$$,#define LOCAL_IDENT "SSH-2.0-dropbear",g' \
114 $(PKG_BUILD_DIR
)/sysoptions.h
116 # Enforce rebuild of svr-chansession.c
117 rm -f
$(PKG_BUILD_DIR
)/svr-chansession.o
121 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
122 $(TARGET_CONFIGURE_OPTS
) \
123 PROGRAMS
="dropbear dbclient dropbearkey scp" \
124 MULTI
=1 SCPPROGRESS
=1
125 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
126 $(TARGET_CONFIGURE_OPTS
) \
127 PROGRAMS
="dropbearconvert"
130 define Package
/dropbear
/install
131 $(INSTALL_DIR
) $(1)/usr
/sbin
132 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearmulti
$(1)/usr
/sbin
/dropbear
133 $(INSTALL_DIR
) $(1)/usr
/bin
134 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/scp
135 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/ssh
136 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dbclient
137 $(LN
) ..
/sbin
/dropbear
$(1)/usr
/bin
/dropbearkey
138 $(INSTALL_DIR
) $(1)/etc
/config
139 $(INSTALL_DATA
) .
/files
/dropbear.config
$(1)/etc
/config
/dropbear
140 $(INSTALL_DIR
) $(1)/etc
/init.d
141 $(INSTALL_BIN
) .
/files
/dropbear.init
$(1)/etc
/init.d
/dropbear
142 $(INSTALL_DIR
) $(1)/usr
/lib
/opkg
/info
143 $(INSTALL_DIR
) $(1)/etc
/dropbear
144 touch
$(1)/etc
/dropbear
/dropbear_rsa_host_key
147 define Package
/dropbearconvert
/install
148 $(INSTALL_DIR
) $(1)/usr
/bin
149 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/dropbearconvert
$(1)/usr
/bin
/dropbearconvert
152 $(eval
$(call BuildPackage
,dropbear
))
153 $(eval
$(call BuildPackage
,dropbearconvert
))