bc65d69c05fe8b10df6defde474467ea2decb2f5
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / dropbear / dropbear.mk
1 ################################################################################
2 #
3 # dropbear
4 #
5 ################################################################################
6
7 DROPBEAR_VERSION = 2015.67
8 DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
9 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
10 DROPBEAR_LICENSE = MIT, BSD-2c-like, BSD-2c
11 DROPBEAR_LICENSE_FILES = LICENSE
12 DROPBEAR_TARGET_BINS = dropbearkey dropbearconvert scp
13 DROPBEAR_PROGRAMS = dropbear $(DROPBEAR_TARGET_BINS)
14
15 ifeq ($(BR2_PACKAGE_DROPBEAR_CLIENT),y)
16 # Build dbclient, and create a convenience symlink named ssh
17 DROPBEAR_PROGRAMS += dbclient
18 DROPBEAR_TARGET_BINS += dbclient ssh
19 endif
20
21 DROPBEAR_MAKE = \
22         $(MAKE) MULTI=1 SCPPROGRESS=1 \
23         PROGRAMS="$(DROPBEAR_PROGRAMS)"
24
25 ifeq ($(BR2_STATIC_LIBS),y)
26 DROPBEAR_MAKE += STATIC=1
27 endif
28
29 define DROPBEAR_FIX_XAUTH
30         $(SED) 's,^#define XAUTH_COMMAND.*/xauth,#define XAUTH_COMMAND "/usr/bin/xauth,g' $(@D)/options.h
31 endef
32
33 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_FIX_XAUTH
34
35 define DROPBEAR_ENABLE_REVERSE_DNS
36         $(SED) 's:.*\(#define DO_HOST_LOOKUP\).*:\1:' $(@D)/options.h
37 endef
38
39 define DROPBEAR_BUILD_SMALL
40         $(SED) 's:.*\(#define NO_FAST_EXPTMOD\).*:\1:' $(@D)/options.h
41 endef
42
43 define DROPBEAR_BUILD_FEATURED
44         $(SED) 's:^#define DROPBEAR_SMALL_CODE::' $(@D)/options.h
45         $(SED) 's:.*\(#define DROPBEAR_BLOWFISH\).*:\1:' $(@D)/options.h
46         $(SED) 's:.*\(#define DROPBEAR_TWOFISH128\).*:\1:' $(@D)/options.h
47         $(SED) 's:.*\(#define DROPBEAR_TWOFISH256\).*:\1:' $(@D)/options.h
48 endef
49
50 define DROPBEAR_DISABLE_STANDALONE
51         $(SED) 's:\(#define NON_INETD_MODE\):/*\1 */:' $(@D)/options.h
52 endef
53
54 define DROPBEAR_INSTALL_INIT_SYSTEMD
55         $(INSTALL) -D -m 644 package/dropbear/dropbear.service \
56                 $(TARGET_DIR)/usr/lib/systemd/system/dropbear.service
57         mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
58         ln -fs ../../../../usr/lib/systemd/system/dropbear.service \
59                 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dropbear.service
60 endef
61
62 ifeq ($(BR2_USE_MMU),y)
63 define DROPBEAR_INSTALL_INIT_SYSV
64         $(INSTALL) -D -m 755 package/dropbear/S50dropbear \
65                 $(TARGET_DIR)/etc/init.d/S50dropbear
66 endef
67 else
68 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
69 endif
70
71 ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
72 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
73 endif
74
75 ifeq ($(BR2_PACKAGE_DROPBEAR_SMALL),y)
76 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_SMALL
77 DROPBEAR_CONF_OPTS += --disable-zlib
78 else
79 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_FEATURED
80 DROPBEAR_DEPENDENCIES += zlib
81 endif
82
83 ifneq ($(BR2_PACKAGE_DROPBEAR_WTMP),y)
84 DROPBEAR_CONF_OPTS += --disable-wtmp
85 endif
86
87 ifneq ($(BR2_PACKAGE_DROPBEAR_LASTLOG),y)
88 DROPBEAR_CONF_OPTS += --disable-lastlog
89 endif
90
91 define DROPBEAR_INSTALL_TARGET_CMDS
92         $(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
93         for f in $(DROPBEAR_TARGET_BINS); do \
94                 ln -snf ../sbin/dropbear $(TARGET_DIR)/usr/bin/$$f ; \
95         done
96         mkdir -p $(TARGET_DIR)/etc/dropbear
97 endef
98
99 $(eval $(autotools-package))