]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/dropbear/dropbear.mk
236f9b4762bb7e02201c3b6ade8aa08b9ea5e76a
[coffee/buildroot.git] / package / dropbear / dropbear.mk
1 ################################################################################
2 #
3 # dropbear
4 #
5 ################################################################################
6
7 DROPBEAR_VERSION = 2018.76
8 DROPBEAR_SITE = https://matt.ucc.asn.au/dropbear/releases
9 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
10 DROPBEAR_LICENSE = MIT, BSD-2-Clause-like, BSD-2-Clause
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_CONF_OPTS += --enable-static
27 endif
28
29 # Ensure that dropbear doesn't use crypt() when it's not available
30 define DROPBEAR_SVR_PASSWORD_AUTH
31         echo '#if !HAVE_CRYPT'                          >> $(@D)/localoptions.h
32         echo '#define DROPBEAR_SVR_PASSWORD_AUTH 0'     >> $(@D)/localoptions.h
33         echo '#endif'                                   >> $(@D)/localoptions.h
34 endef
35 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_SVR_PASSWORD_AUTH
36
37 define DROPBEAR_ENABLE_REVERSE_DNS
38         echo '#define DO_HOST_LOOKUP 1'                 >> $(@D)/localoptions.h
39 endef
40
41 define DROPBEAR_BUILD_FEATURED
42         echo '#define DROPBEAR_SMALL_CODE 0'            >> $(@D)/localoptions.h
43         echo '#define DROPBEAR_BLOWFISH 1'              >> $(@D)/localoptions.h
44         echo '#define DROPBEAR_TWOFISH128 1'            >> $(@D)/localoptions.h
45         echo '#define DROPBEAR_TWOFISH256 1'            >> $(@D)/localoptions.h
46 endef
47
48 define DROPBEAR_DISABLE_STANDALONE
49         echo '#define NON_INETD_MODE 0'                 >> $(@D)/localoptions.h
50 endef
51
52 define DROPBEAR_INSTALL_INIT_SYSTEMD
53         $(INSTALL) -D -m 644 package/dropbear/dropbear.service \
54                 $(TARGET_DIR)/usr/lib/systemd/system/dropbear.service
55         mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
56         ln -fs ../../../../usr/lib/systemd/system/dropbear.service \
57                 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/dropbear.service
58 endef
59
60 ifeq ($(BR2_USE_MMU),y)
61 define DROPBEAR_INSTALL_INIT_SYSV
62         $(INSTALL) -D -m 755 package/dropbear/S50dropbear \
63                 $(TARGET_DIR)/etc/init.d/S50dropbear
64 endef
65 else
66 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
67 endif
68
69 ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
70 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
71 endif
72
73 ifeq ($(BR2_PACKAGE_DROPBEAR_SMALL),y)
74 DROPBEAR_CONF_OPTS += --disable-zlib
75 else
76 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_BUILD_FEATURED
77 DROPBEAR_DEPENDENCIES += zlib
78 endif
79
80 ifneq ($(BR2_PACKAGE_DROPBEAR_WTMP),y)
81 DROPBEAR_CONF_OPTS += --disable-wtmp
82 endif
83
84 ifneq ($(BR2_PACKAGE_DROPBEAR_LASTLOG),y)
85 DROPBEAR_CONF_OPTS += --disable-lastlog
86 endif
87
88 define DROPBEAR_INSTALL_TARGET_CMDS
89         $(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
90         for f in $(DROPBEAR_TARGET_BINS); do \
91                 ln -snf ../sbin/dropbear $(TARGET_DIR)/usr/bin/$$f ; \
92         done
93         ln -snf /var/run/dropbear $(TARGET_DIR)/etc/dropbear
94 endef
95
96 $(eval $(autotools-package))