Add libssp dependency to openssh client and server (#3780)
[openwrt/svn-archive/archive.git] / net / openssh / Makefile
1 #
2 # Copyright (C) 2006,2008 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:=5.0p1
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:=1f1dfaa775f33dd3328169de9bdc292a
22
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 PKG_BUILD_DEPENDS:=libopenssl
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/openssh-client
30 SECTION:=net
31 CATEGORY:=Network
32 DEPENDS:=+libopenssl +zlib +libssp
33 TITLE:=OpenSSH client
34 URL:=http://www.openssh.com/
35 SUBMENU:=SSH
36 endef
37
38 define Package/openssh-client/description
39 OpenSSH client.
40 endef
41
42 define Package/openssh-client/conffiles
43 /etc/ssh/ssh_config
44 endef
45
46 define Package/openssh-client-utils
47 SECTION:=net
48 CATEGORY:=Network
49 DEPENDS:=openssh-client
50 TITLE:=OpenSSH client utilities
51 URL:=http://www.openssh.com/
52 SUBMENU:=SSH
53 endef
54
55 define Package/openssh-client-utils/description
56 OpenSSH client utilities.
57 endef
58
59 define Package/openssh-server
60 SECTION:=net
61 CATEGORY:=Network
62 DEPENDS:=+libopenssl +zlib +libssp
63 TITLE:=OpenSSH server
64 URL:=http://www.openssh.com/
65 SUBMENU:=SSH
66 endef
67
68 define Package/openssh-server/description
69 OpenSSH server.
70 endef
71
72 define Package/openssh-server/conffiles
73 /etc/ssh/sshd_config
74 endef
75
76 define Package/openssh-sftp-client
77 SECTION:=net
78 CATEGORY:=Network
79 DEPENDS:=+libopenssl +zlib
80 TITLE:=OpenSSH SFTP client
81 URL:=http://www.openssh.com/
82 SUBMENU:=SSH
83 endef
84
85 define Package/openssh-sftp-client/description
86 OpenSSH SFTP client.
87 endef
88
89 define Package/openssh-sftp-server
90 SECTION:=net
91 CATEGORY:=Network
92 DEPENDS:=
93 TITLE:=OpenSSH SFTP server
94 URL:=http://www.openssh.com/
95 SUBMENU:=SSH
96 endef
97
98 define Package/openssh-sftp-server/description
99 OpenSSH SFTP server.
100 endef
101
102 define Build/Configure
103 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
104 $(TARGET_CONFIGURE_OPTS) \
105 CFLAGS="$(TARGET_CFLAGS)" \
106 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
107 LD="$(TARGET_CC)" \
108 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
109 ./configure \
110 --target=$(GNU_TARGET_NAME) \
111 --host=$(GNU_TARGET_NAME) \
112 --build=$(GNU_HOST_NAME) \
113 --program-prefix="" \
114 --program-suffix="" \
115 --prefix=/usr \
116 --exec-prefix=/usr \
117 --bindir=/usr/bin \
118 --datadir=/usr/share \
119 --includedir=/usr/include \
120 --infodir=/usr/share/info \
121 --libdir=/usr/lib \
122 --libexecdir=/usr/lib \
123 --localstatedir=/var \
124 --mandir=/usr/share/man \
125 --sbindir=/usr/sbin \
126 --sysconfdir=/etc/ssh \
127 $(DISABLE_LARGEFILE) \
128 $(DISABLE_NLS) \
129 --enable-shared \
130 --disable-static \
131 --disable-debug \
132 --disable-strip \
133 --disable-etc-default-login \
134 --disable-lastlog \
135 --disable-utmp \
136 --disable-utmpx \
137 --disable-wtmp \
138 --disable-wtmpx \
139 --without-bsd-auth \
140 --without-kerberos5 \
141 --without-pam \
142 --without-x \
143 );
144 endef
145
146 define Build/Compile
147 rm -rf $(PKG_INSTALL_DIR)
148 mkdir -p $(PKG_INSTALL_DIR)
149 $(MAKE) -C $(PKG_BUILD_DIR) \
150 DESTDIR="$(PKG_INSTALL_DIR)" \
151 LIBS="" \
152 sftp-server
153 $(MAKE) -C $(PKG_BUILD_DIR) \
154 DESTDIR="$(PKG_INSTALL_DIR)" \
155 all install
156 endef
157
158 define Package/openssh-client/install
159 $(INSTALL_DIR) $(1)/etc/ssh
160 chmod 0700 $(1)/etc/ssh
161 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
162 $(INSTALL_DIR) $(1)/usr/bin
163 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
164 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
165 endef
166
167 define Package/openssh-client-utils/install
168 $(INSTALL_DIR) $(1)/usr/bin
169 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
170 endef
171
172 define Package/openssh-server/install
173 $(INSTALL_DIR) $(1)/etc/ssh
174 chmod 0700 $(1)/etc/ssh
175 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
176 $(INSTALL_DIR) $(1)/etc/init.d
177 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
178 $(INSTALL_DIR) $(1)/usr/bin
179 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
180 $(INSTALL_DIR) $(1)/usr/sbin
181 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
182 endef
183
184 define Package/openssh-server/postinst
185 #!/bin/sh
186
187 name=sshd
188 id=99
189
190 # do not change below
191 # check if we are on real system
192 if [ -z "$${IPKG_INSTROOT}" ]; then
193 # create copies of passwd and group, if we use squashfs
194 rootfs=`mount |awk '/root/ { print $$5 }'`
195 if [ "$$rootfs" = "squashfs" ]; then
196 if [ -h /etc/group ]; then
197 rm /etc/group
198 cp /rom/etc/group /etc/group
199 fi
200 if [ -h /etc/passwd ]; then
201 rm /etc/passwd
202 cp /rom/etc/passwd /etc/passwd
203 fi
204 fi
205 fi
206
207 echo ""
208 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
209 echo "adding group $$name to /etc/group"
210 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
211 fi
212
213 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
214 echo "adding user $$name to /etc/passwd"
215 echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
216 fi
217
218 grep -q '^ssh[[:space:]]*22/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
219 if [ $$? -ne 0 ]; then
220 echo "ssh 22/tcp" >>$${IPKG_INSTROOT}/etc/services
221 fi
222 endef
223
224 define Package/openssh-sftp-client/install
225 $(INSTALL_DIR) $(1)/usr/bin
226 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
227 endef
228
229 define Package/openssh-sftp-server/install
230 $(INSTALL_DIR) $(1)/usr/lib
231 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
232 $(INSTALL_DIR) $(1)/usr/libexec
233 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
234 endef
235
236 $(eval $(call BuildPackage,openssh-client))
237 $(eval $(call BuildPackage,openssh-client-utils))
238 $(eval $(call BuildPackage,openssh-server))
239 $(eval $(call BuildPackage,openssh-sftp-client))
240 $(eval $(call BuildPackage,openssh-sftp-server))