replace lots of manual install commands with INSTALL_* variables
[openwrt/svn-archive/archive.git] / net / openssh / 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:=openssh
12 PKG_VERSION:=4.4p1
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
18 ftp://openbsd.wiretapped.net/pub/OpenBSD/OpenSSH/portable/ \
19 ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/ \
20 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/
21 PKG_MD5SUM:=793a709a8de695c22f523024d7e9bf07
22 PKG_CAT:=zcat
23
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25 PKG_BUILDDEP:=libopenssl
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/openssh-client
30 SECTION:=net
31 CATEGORY:=Network
32 DEPENDS:=+libopenssl +zlib
33 TITLE:=OpenSSH client
34 DESCRIPTION:=OpenSSH client.
35 URL:=http://www.openssh.com/
36 endef
37
38 define Package/openssh-client/conffiles
39 /etc/ssh/ssh_config
40 endef
41
42 define Package/openssh-client-utils
43 SECTION:=net
44 CATEGORY:=Network
45 DEPENDS:=openssh-client
46 TITLE:=OpenSSH client utilities
47 DESCRIPTION:=OpenSSH client utilities.
48 URL:=http://www.openssh.com/
49 endef
50
51 define Package/openssh-server
52 SECTION:=net
53 CATEGORY:=Network
54 DEPENDS:=+libopenssl +zlib
55 TITLE:=OpenSSH server
56 DESCRIPTION:=OpenSSH server.
57 URL:=http://www.openssh.com/
58 endef
59
60 define Package/openssh-server/conffiles
61 /etc/ssh/sshd_config
62 endef
63
64 define Package/openssh-sftp-client
65 SECTION:=net
66 CATEGORY:=Network
67 DEPENDS:=+libopenssl +zlib
68 TITLE:=OpenSSH SFTP client
69 DESCRIPTION:=OpenSSH SFTP client.
70 URL:=http://www.openssh.com/
71 endef
72
73 define Package/openssh-sftp-server
74 SECTION:=net
75 CATEGORY:=Network
76 DEPENDS:=
77 TITLE:=OpenSSH SFTP server
78 DESCRIPTION:=OpenSSH SFTP server.
79 URL:=http://www.openssh.com/
80 endef
81
82 define Build/Configure
83 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
84 $(TARGET_CONFIGURE_OPTS) \
85 CFLAGS="$(TARGET_CFLAGS)" \
86 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
87 LD="$(TARGET_CC)" \
88 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
89 ./configure \
90 --target=$(GNU_TARGET_NAME) \
91 --host=$(GNU_TARGET_NAME) \
92 --build=$(GNU_HOST_NAME) \
93 --program-prefix="" \
94 --program-suffix="" \
95 --prefix=/usr \
96 --exec-prefix=/usr \
97 --bindir=/usr/bin \
98 --datadir=/usr/share \
99 --includedir=/usr/include \
100 --infodir=/usr/share/info \
101 --libdir=/usr/lib \
102 --libexecdir=/usr/lib \
103 --localstatedir=/var \
104 --mandir=/usr/share/man \
105 --sbindir=/usr/sbin \
106 --sysconfdir=/etc/ssh \
107 $(DISABLE_LARGEFILE) \
108 $(DISABLE_NLS) \
109 --enable-shared \
110 --disable-static \
111 --disable-debug \
112 --disable-strip \
113 --disable-etc-default-login \
114 --disable-lastlog \
115 --disable-utmp \
116 --disable-utmpx \
117 --disable-wtmp \
118 --disable-wtmpx \
119 --without-bsd-auth \
120 --without-kerberos5 \
121 --without-pam \
122 --without-x \
123 );
124 endef
125
126 define Build/Compile
127 rm -rf $(PKG_INSTALL_DIR)
128 mkdir -p $(PKG_INSTALL_DIR)
129 $(MAKE) -C $(PKG_BUILD_DIR) \
130 DESTDIR="$(PKG_INSTALL_DIR)" \
131 LIBS="" \
132 sftp-server
133 $(MAKE) -C $(PKG_BUILD_DIR) \
134 DESTDIR="$(PKG_INSTALL_DIR)" \
135 all install
136 endef
137
138 define Package/openssh-client/install
139 $(INSTALL_DIR) $(1)/etc/ssh
140 chmod 0700 $(1)/etc/ssh
141 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
142 $(INSTALL_DIR) $(1)/usr/bin
143 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
144 $(CP) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
145 endef
146
147 define Package/openssh-client-utils/install
148 $(INSTALL_DIR) $(1)/usr/bin
149 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-add $(1)/usr/bin/
150 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-agent $(1)/usr/bin/
151 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-keyscan $(1)/usr/bin/
152 endef
153
154 define Package/openssh-server/install
155 $(INSTALL_DIR) $(1)/etc/ssh
156 chmod 0700 $(1)/etc/ssh
157 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
158 $(INSTALL_DIR) $(1)/etc/init.d
159 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
160 $(INSTALL_DIR) $(1)/usr/bin
161 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
162 $(INSTALL_DIR) $(1)/usr/sbin
163 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
164 endef
165
166 define Package/openssh-sftp-client/install
167 $(INSTALL_DIR) $(1)/usr/bin
168 $(CP) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
169 endef
170
171 define Package/openssh-sftp-server/install
172 $(INSTALL_DIR) $(1)/usr/lib
173 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
174 $(INSTALL_DIR) $(1)/usr/libexec
175 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
176 endef
177
178 $(eval $(call BuildPackage,openssh-client))
179 $(eval $(call BuildPackage,openssh-client-utils))
180 $(eval $(call BuildPackage,openssh-server))
181 $(eval $(call BuildPackage,openssh-sftp-client))
182 $(eval $(call BuildPackage,openssh-sftp-server))