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