hostapd: update to version 2016-01-15
[openwrt.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:=2015.71
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:=2ccc0a2f3e37ca221db12c5af6a88137
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 CONFIG_DROPBEAR_CURVE25519
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/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         awk 'BEGIN { rc = 1 } \
84              /'DROPBEAR_CURVE25519'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_CURVE25519),,// )#define 'DROPBEAR_CURVE25519'"; rc = 0 } \
85              { print } \
86              END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
87              >$(PKG_BUILD_DIR)/options.h.new && \
88         mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h
89
90         # Enforce that all replacements are made, otherwise options.h has changed
91         # format and this logic is broken.
92         for OPTION in DROPBEAR_ECDSA DROPBEAR_ECDH; do \
93           awk 'BEGIN { rc = 1 } \
94                /'$$$$OPTION'/ { $$$$0 = "$(if $(CONFIG_DROPBEAR_ECC),,// )#define '$$$$OPTION'"; rc = 0 } \
95                { print } \
96                END { exit(rc) }' $(PKG_BUILD_DIR)/options.h \
97                >$(PKG_BUILD_DIR)/options.h.new && \
98           mv $(PKG_BUILD_DIR)/options.h.new $(PKG_BUILD_DIR)/options.h || exit 1; \
99         done
100 endef
101
102 define Build/Compile
103         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
104                 $(TARGET_CONFIGURE_OPTS) \
105                 PROGRAMS="dropbear dbclient dropbearkey scp" \
106                 MULTI=1 SCPPROGRESS=1
107         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
108                 $(TARGET_CONFIGURE_OPTS) \
109                 PROGRAMS="dropbearconvert"
110 endef
111
112 define Package/dropbear/install
113         $(INSTALL_DIR) $(1)/usr/sbin
114         $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
115         $(INSTALL_DIR) $(1)/usr/bin
116         $(LN) ../sbin/dropbear $(1)/usr/bin/scp
117         $(LN) ../sbin/dropbear $(1)/usr/bin/ssh
118         $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
119         $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
120         $(INSTALL_DIR) $(1)/etc/config
121         $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
122         $(INSTALL_DIR) $(1)/etc/init.d
123         $(INSTALL_BIN) ./files/dropbear.init $(1)/etc/init.d/dropbear
124         $(INSTALL_DIR) $(1)/usr/lib/opkg/info
125         $(INSTALL_DIR) $(1)/etc/dropbear
126         touch $(1)/etc/dropbear/dropbear_rsa_host_key
127 endef
128
129 define Package/dropbearconvert/install
130         $(INSTALL_DIR) $(1)/usr/bin
131         $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearconvert $(1)/usr/bin/dropbearconvert
132 endef
133
134 $(eval $(call BuildPackage,dropbear))
135 $(eval $(call BuildPackage,dropbearconvert))