new (last?) attempt at standardizing Makefiles
[openwrt.git] / package / dropbear / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=dropbear
12 PKG_VERSION:=0.48.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://matt.ucc.asn.au/dropbear/releases/
17 PKG_MD5SUM:=ca8e53a766faec831882831364568421
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/dropbear/Default
25   URL:=http://matt.ucc.asn.au/dropbear/
26 endef
27
28 define Package/dropbear
29   $(call Package/dropbear/Default)
30   SECTION:=net
31   CATEGORY:=Base system
32   DEFAULT:=y
33   TITLE:=Small SSH2 client/server
34   DESCRIPTION:=\
35         A small SSH2 server/client designed for small memory environments.
36 endef
37
38 define Package/dropbearconvert
39   $(call Package/dropbear/Default)
40   SECTION:=utils
41   CATEGORY:=Utilities
42   TITLE:=Utility for converting SSH keys
43 endef
44
45 define Build/Configure
46         $(SED) 's,^/\* #define PKG_MULTI.*,#define PKG_MULTI,g' $(PKG_BUILD_DIR)/options.h
47         $(SED) 's,^#define DO_HOST_LOOKUP,/* & */,g' $(PKG_BUILD_DIR)/options.h
48         (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
49                 $(TARGET_CONFIGURE_OPTS) \
50                 CFLAGS="$(TARGET_CFLAGS)" \
51                 ./configure \
52                         --target=$(GNU_TARGET_NAME) \
53                         --host=$(GNU_TARGET_NAME) \
54                         --build=$(GNU_HOST_NAME) \
55                         --program-prefix="" \
56                         --program-suffix="" \
57                         --prefix=/usr \
58                         --exec-prefix=/usr \
59                         --bindir=/usr/bin \
60                         --datadir=/usr/share \
61                         --includedir=/usr/include \
62                         --infodir=/usr/share/info \
63                         --libdir=/usr/lib \
64                         --libexecdir=/usr/lib \
65                         --localstatedir=/var \
66                         --mandir=/usr/share/man \
67                         --sbindir=/usr/sbin \
68                         --sysconfdir=/etc \
69                         $(DISABLE_LARGEFILE) \
70                         $(DISABLE_NLS) \
71                         --with-shared \
72                         --disable-pam \
73                         --enable-openpty \
74                         --enable-syslog \
75                         --disable-shadow \
76                         --disable-lastlog \
77                         --disable-utmp \
78                         --disable-utmpx \
79                         --disable-wtmp \
80                         --disable-wtmpx \
81                         --disable-loginfunc \
82                         --disable-pututline \
83                         --disable-pututxline \
84                         --disable-zlib \
85         );
86 endef
87
88 define Build/Compile
89         $(MAKE) -C $(PKG_BUILD_DIR) \
90                 $(TARGET_CONFIGURE_OPTS) \
91                 LD="$(TARGET_CC)" \
92                 PROGRAMS="dropbear dbclient dropbearkey scp" \
93                 MULTI=1 SCPPROGRESS=1
94         $(MAKE) -C $(PKG_BUILD_DIR) \
95                 $(TARGET_CONFIGURE_OPTS) \
96                 LD="$(TARGET_CC)" \
97                 PROGRAMS="dropbearconvert"
98 endef
99         
100 define Package/dropbear/install
101         install -d -m0755 $(1)/usr/sbin
102         install -m0755 $(PKG_BUILD_DIR)/dropbearmulti \
103                 $(1)/usr/sbin/dropbear
104         install -d -m0755 $(1)/usr/bin
105         ln -sf ../sbin/dropbear $(1)/usr/bin/scp
106         ln -sf ../sbin/dropbear $(1)/usr/bin/ssh
107         ln -sf ../sbin/dropbear $(1)/usr/bin/dbclient
108         ln -sf ../sbin/dropbear $(1)/usr/bin/dropbearkey
109         install -d -m0755 $(1)/etc/init.d
110         install -m0755 ./files/dropbear.init $(1)/etc/init.d/S50dropbear
111 endef
112
113 define Package/dropbearconvert/install
114         install -d -m0755 $(1)/usr/bin
115         install -m0755 $(PKG_BUILD_DIR)/dropbearconvert \
116                 $(1)/usr/bin/dropbearconvert
117 endef
118
119 $(eval $(call BuildPackage,dropbear))
120 $(eval $(call BuildPackage,dropbearconvert))