f793e9b8a76b00815e30c186541034df3de7d229
[openwrt/staging/chunkeey.git] / package / network / services / dropbear / Makefile
1 #
2 # Copyright (C) 2006-2012 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:=2014.65
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_MD5SUM:=1918604238817385a156840fa2c39490
19
20 PKG_LICENSE:=MIT
21 PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
22
23 PKG_BUILD_PARALLEL:=1
24
25 PKG_CONFIG_DEPENDS:=CONFIG_DROPBEAR_ECC
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/dropbear/Default
30 URL:=http://matt.ucc.asn.au/dropbear/
31 endef
32
33 define Package/dropbear/config
34 source "$(SOURCE)/Config.in"
35 endef
36
37 define Package/dropbear
38 $(call Package/dropbear/Default)
39 SECTION:=net
40 CATEGORY:=Base system
41 TITLE:=Small SSH2 client/server
42 endef
43
44 define Package/dropbear/description
45 A small SSH2 server/client designed for small memory environments.
46 endef
47
48 define Package/dropbear/conffiles
49 /etc/dropbear/dropbear_rsa_host_key
50 /etc/dropbear/dropbear_dss_host_key
51 /etc/config/dropbear
52 endef
53
54 define Package/dropbearconvert
55 $(call Package/dropbear/Default)
56 SECTION:=utils
57 CATEGORY:=Utilities
58 TITLE:=Utility for converting SSH keys
59 endef
60
61 CONFIGURE_ARGS += \
62 --disable-pam \
63 --enable-openpty \
64 --enable-syslog \
65 $(if $(CONFIG_SHADOW_PASSWORDS),,--disable-shadow) \
66 --disable-lastlog \
67 --disable-utmp \
68 --disable-utmpx \
69 --disable-wtmp \
70 --disable-wtmpx \
71 --disable-loginfunc \
72 --disable-pututline \
73 --disable-pututxline \
74 --disable-zlib \
75 --enable-bundled-libtom
76
77 TARGET_CFLAGS += -DARGTYPE=3 -ffunction-sections -fdata-sections
78 TARGET_LDFLAGS += -Wl,--gc-sections
79
80 define Build/Configure
81 $(Build/Configure/Default)
82
83 # Enforce that all replacements are made, otherwise options.h has changed
84 # format and this logic is broken.
85 for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH DROPBEAR_CURVE25519; do \
86 awk 'BEGIN { rc = 1 } \
87 /'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \
88 { print } \
89 END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
90 >$(PKG_BUILD_DIR)/options.h.new && \
91 mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \
92 done
93 endef
94
95 define Build/Compile
96 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
97 $(TARGET_CONFIGURE_OPTS) \
98 PROGRAMS="dropbear dbclient dropbearkey scp" \
99 MULTI=1 SCPPROGRESS=1
100 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
101 $(TARGET_CONFIGURE_OPTS) \
102 PROGRAMS="dropbearconvert"
103 endef
104
105 define Package/dropbear/install
106 $(INSTALL_DIR) $(1)/usr/sbin
107 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
108 $(INSTALL_DIR) $(1)/usr/bin
109 ln -sf ../sbin/dropbear $(1)/usr/bin/scp
110 ln -sf ../sbin/dropbear $(1)/usr/bin/ssh
111 ln -sf ../sbin/dropbear $(1)/usr/bin/dbclient
112 ln -sf ../sbin/dropbear $(1)/usr/bin/dropbearkey
113 $(INSTALL_DIR) $(1)/etc/config
114 $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
115 $(INSTALL_DIR) $(1)/etc/init.d
116 $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
117 $(INSTALL_DIR) $(1)/usr/lib/opkg/info
118 $(INSTALL_DIR) $(1)/etc/dropbear
119 touch $(1)/etc/dropbear/dropbear_rsa_host_key
120 touch $(1)/etc/dropbear/dropbear_dss_host_key
121 endef
122
123 define Package/dropbearconvert/install
124 $(INSTALL_DIR) $(1)/usr/bin
125 $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
126 endef
127
128 $(eval $(call BuildPackage,dropbear))
129 $(eval $(call BuildPackage,dropbearconvert))