e5ac5dc4048005fe15d004657c1bd6c2df9f2999
[openwrt/openwrt.git] / openwrt / package / dropbear_sshd / dropbear_sshd.mk
1 #############################################################
2 #
3 # dropbear_sshd
4 #
5 #############################################################
6 DROPBEAR_SSHD_SOURCE:=dropbear-0.44.tar.bz2
7 DROPBEAR_SSHD_SITE:=http://matt.ucc.asn.au/dropbear/releases/
8 DROPBEAR_SSHD_DIR:=$(BUILD_DIR)/dropbear-0.44
9 DROPBEAR_SSHD_CAT:=bzcat
10 DROPBEAR_SSHD_BINARY:=dropbearmulti
11 DROPBEAR_SSHD_TARGET_BINARY:=usr/sbin/dropbear
12
13
14 $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE):
15 $(WGET) -P $(DL_DIR) $(DROPBEAR_SSHD_SITE)/$(DROPBEAR_SSHD_SOURCE)
16
17 dropbear_sshd-source: $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE)
18
19 $(DROPBEAR_SSHD_DIR)/.unpacked: $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE)
20 $(DROPBEAR_SSHD_CAT) $(DL_DIR)/$(DROPBEAR_SSHD_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
21 toolchain/patch-kernel.sh $(DROPBEAR_SSHD_DIR) package/dropbear_sshd/ dropbear-\*.patch
22 $(SED) 's,^/\* #define DROPBEAR_MULTI.*,#define DROPBEAR_MULTI,g' $(DROPBEAR_SSHD_DIR)/options.h
23 touch $(DROPBEAR_SSHD_DIR)/.unpacked
24
25 $(DROPBEAR_SSHD_DIR)/.configured: $(DROPBEAR_SSHD_DIR)/.unpacked
26 (cd $(DROPBEAR_SSHD_DIR); rm -rf config.cache; \
27 autoconf; \
28 $(TARGET_CONFIGURE_OPTS) \
29 CFLAGS="$(TARGET_CFLAGS)" \
30 ./configure \
31 --target=$(GNU_TARGET_NAME) \
32 --host=$(GNU_TARGET_NAME) \
33 --build=$(GNU_HOST_NAME) \
34 --prefix=/usr \
35 --exec-prefix=/usr \
36 --bindir=/usr/bin \
37 --sbindir=/usr/sbin \
38 --libexecdir=/usr/lib \
39 --sysconfdir=/etc \
40 --datadir=/usr/share \
41 --localstatedir=/var \
42 --mandir=/usr/man \
43 --infodir=/usr/info \
44 $(DISABLE_NLS) \
45 --with-shared \
46 );
47 touch $(DROPBEAR_SSHD_DIR)/.configured
48
49 $(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY): $(DROPBEAR_SSHD_DIR)/.configured
50 $(MAKE) $(TARGET_CONFIGURE_OPTS) LD=$(TARGET_CC) \
51 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" \
52 MULTI=1 SCPPROGRESS=1 -C $(DROPBEAR_SSHD_DIR)
53
54 $(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY): $(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY)
55 #$(MAKE) DESTDIR=$(TARGET_DIR) $(TARGET_CONFIGURE_OPTS) \
56 # LD=$(TARGET_CC) -C $(DROPBEAR_SSHD_DIR) install
57 #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
58 # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc
59 install -d -m 755 $(TARGET_DIR)/usr/sbin
60 install -d -m 755 $(TARGET_DIR)/usr/bin
61 install -m 755 $(DROPBEAR_SSHD_DIR)/$(DROPBEAR_SSHD_BINARY) \
62 $(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY)
63 ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/scp
64 ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/ssh
65 ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/dropbearkey
66 ln -sf ../sbin/dropbear $(TARGET_DIR)/usr/bin/dropbearconvert
67 cp $(DROPBEAR_SSHD_DIR)/S50dropbear $(TARGET_DIR)/etc/init.d/
68 chmod a+x $(TARGET_DIR)/etc/init.d/S50dropbear
69
70 dropbear_sshd: uclibc $(TARGET_DIR)/$(DROPBEAR_SSHD_TARGET_BINARY)
71
72 dropbear_sshd-clean:
73 $(MAKE) DESTDIR=$(TARGET_DIR) $(TARGET_CONFIGURE_OPTS) \
74 LD=$(TARGET_CC) -C $(DROPBEAR_SSHD_DIR) uninstall
75 -$(MAKE) -C $(DROPBEAR_SSHD_DIR) clean
76
77 dropbear_sshd-dirclean:
78 rm -rf $(DROPBEAR_SSHD_DIR)
79
80 ifeq ($(strip $(BR2_PACKAGE_DROPBEAR_SSHD)),y)
81 TARGETS+=dropbear_sshd
82 endif