a848a5daf25d276bf07b38a9b9af664252882134
[librecmc/librecmc.git] / obsolete-buildroot / make / dropbear.mk
1 ######################################################
2 #
3 #  An example makefile to fetch a package from sources
4 #  then fetch the ipkg updates required to the base package
5 #  extract the archives into the build tree
6 #  and then build the source
7 #
8 ######################################################
9
10
11 #  For this example we'll use a fairly simple package that compiles easily
12 #  and has sources available for download at sourceforge
13 DROPBEAR=dropbear-0.44
14 DROPBEAR_TARGET=.built
15 DROPBEAR_DIR=$(BUILD_DIR)/$(DROPBEAR)
16 DROPBEAR_IPK=$(BUILD_DIR)/$(DROPBEAR)_mipsel.ipk
17 DROPBEAR_IPK_DIR=$(BUILD_DIR)/$(DROPBEAR)-ipk
18
19 DROPBEAR_SITE=http://matt.ucc.asn.au/dropbear/
20 DROPBEAR_SOURCE=$(DROPBEAR).tar.bz2
21
22
23 # We need to download sources if we dont have them
24 $(DL_DIR)/$(DROPBEAR_SOURCE) :
25         $(WGET) -P $(DL_DIR) $(DROPBEAR_SITE)/$(DROPBEAR_SOURCE)
26
27 # if we have the sources, they do no good unless they are unpacked
28 $(DROPBEAR_DIR)/.unpacked:      $(DL_DIR)/$(DROPBEAR_SOURCE)
29         bzcat $(DL_DIR)/$(DROPBEAR_SOURCE) | tar -C $(BUILD_DIR) -xvf -
30         cat $(SOURCE_DIR)/openwrt/ipkg/dropbear/dropbear.patch | patch -p1 -d $(DROPBEAR_DIR)
31         touch $(DROPBEAR_DIR)/.unpacked
32         
33 # if we have the sources unpacked, we need to configure them
34 $(DROPBEAR_DIR)/.configured:    $(DROPBEAR_DIR)/.unpacked
35         (cd $(DROPBEAR_DIR); rm -rf config.cache; \
36                 $(TARGET_CONFIGURE_OPTS) \
37                 LD=$(TARGET_CROSS)gcc \
38                 ./configure \
39                 --target=$(GNU_TARGET_NAME) \
40                 --host=$(GNU_TARGET_NAME) \
41                 --build=$(GNU_HOST_NAME) \
42                 --prefix=/usr \
43                 --exec-prefix=/usr \
44                 --bindir=/usr/bin \
45                 --sbindir=/usr/sbin \
46                 --disable-zlib \
47         );
48         touch $(DROPBEAR_DIR)/.configured
49         
50         
51 # now that we have it all in place, just build it
52 $(DROPBEAR_DIR)/$(DROPBEAR_TARGET):     $(DROPBEAR_DIR)/.configured
53         mkdir -p $(DROPBEAR_IPK_DIR)/usr/bin
54         cd $(DROPBEAR_DIR) && make PROGRAMS="dbclient dropbear" MULTI=1 && rm -f ssh && ln -s dbclient ssh
55         $(STAGING_DIR)/bin/sstrip $(DROPBEAR_DIR)/dropbearmulti
56         cd $(DROPBEAR_DIR) && cp -dpf dropbearmulti ssh dropbear dbclient $(DROPBEAR_IPK_DIR)/usr/bin
57         
58         cd $(DROPBEAR_DIR) && make SCPPROGRESS=1 scp
59         $(STAGING_DIR)/bin/sstrip $(DROPBEAR_DIR)/scp
60         cd $(DROPBEAR_DIR) && cp -dpf scp $(DROPBEAR_IPK_DIR)/usr/bin
61         
62         cd $(DROPBEAR_DIR) && make clean && make dropbearkey 
63         $(STAGING_DIR)/bin/sstrip $(DROPBEAR_DIR)/dropbearkey
64         mkdir -p $(DROPBEAR_IPK_DIR)/tmp
65         cd $(DROPBEAR_DIR) && cp -dpf dropbearkey $(DROPBEAR_IPK_DIR)/tmp/dropbearkey
66         touch $(DROPBEAR_DIR)/$(DROPBEAR_TARGET)
67         
68 $(DROPBEAR_IPK): uclibc $(DROPBEAR_DIR)/$(DROPBEAR_TARGET)
69         mkdir -p $(DROPBEAR_IPK_DIR)/CONTROL
70         cp $(SOURCE_DIR)/openwrt/ipkg/dropbear/CONTROL/conffiles $(DROPBEAR_IPK_DIR)/CONTROL
71         cp $(SOURCE_DIR)/openwrt/ipkg/dropbear/CONTROL/control $(DROPBEAR_IPK_DIR)/CONTROL
72         cp $(SOURCE_DIR)/openwrt/ipkg/dropbear/CONTROL/postinst $(DROPBEAR_IPK_DIR)/CONTROL
73         mkdir -p $(DROPBEAR_IPK_DIR)/etc/init.d
74         cp $(SOURCE_DIR)/openwrt/ipkg/dropbear/S51dropbear $(DROPBEAR_IPK_DIR)/etc/init.d
75
76         cd $(BUILD_DIR); $(IPKG_BUILD) $(DROPBEAR_IPK_DIR)
77
78 dropbear-ipk: $(DROPBEAR_IPK)