Check SSP support availabily for openssh and avahi
[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
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
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 CONFIGURE_OPTS+= \
103 --enable-shared \
104 --disable-static \
105 --disable-debug \
106 --disable-strip \
107 --disable-etc-default-login \
108 --disable-lastlog \
109 --disable-utmp \
110 --disable-utmpx \
111 --disable-wtmp \
112 --disable-wtmpx \
113 --without-bsd-auth \
114 --without-kerberos5 \
115 --without-pam \
116 --without-x
117
118 ifneq ($(CONFIG_SSP_SUPPORT),y)
119 CONFIGURE_OPTS+= \
120 --without-stackprotect
121 endif
122
123 define Build/Configure
124 (cd $(PKG_BUILD_DIR); rm -f config.cache; \
125 $(TARGET_CONFIGURE_OPTS) \
126 CFLAGS="$(TARGET_CFLAGS)" \
127 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
128 LD="$(TARGET_CC)" \
129 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
130 ./configure \
131 --target=$(GNU_TARGET_NAME) \
132 --host=$(GNU_TARGET_NAME) \
133 --build=$(GNU_HOST_NAME) \
134 --program-prefix="" \
135 --program-suffix="" \
136 --prefix=/usr \
137 --exec-prefix=/usr \
138 --bindir=/usr/bin \
139 --datadir=/usr/share \
140 --includedir=/usr/include \
141 --infodir=/usr/share/info \
142 --libdir=/usr/lib \
143 --libexecdir=/usr/lib \
144 --localstatedir=/var \
145 --mandir=/usr/share/man \
146 --sbindir=/usr/sbin \
147 --sysconfdir=/etc/ssh \
148 $(DISABLE_LARGEFILE) \
149 $(DISABLE_NLS) \
150 $(CONFIGURE_OPTS) \
151 );
152 endef
153
154 define Build/Compile
155 rm -rf $(PKG_INSTALL_DIR)
156 mkdir -p $(PKG_INSTALL_DIR)
157 $(MAKE) -C $(PKG_BUILD_DIR) \
158 DESTDIR="$(PKG_INSTALL_DIR)" \
159 LIBS="" \
160 sftp-server
161 $(MAKE) -C $(PKG_BUILD_DIR) \
162 DESTDIR="$(PKG_INSTALL_DIR)" \
163 all install
164 endef
165
166 define Package/openssh-client/install
167 $(INSTALL_DIR) $(1)/etc/ssh
168 chmod 0700 $(1)/etc/ssh
169 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
170 $(INSTALL_DIR) $(1)/usr/bin
171 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
172 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
173 endef
174
175 define Package/openssh-client-utils/install
176 $(INSTALL_DIR) $(1)/usr/bin
177 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
178 endef
179
180 define Package/openssh-server/install
181 $(INSTALL_DIR) $(1)/etc/ssh
182 chmod 0700 $(1)/etc/ssh
183 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
184 $(INSTALL_DIR) $(1)/etc/init.d
185 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
186 $(INSTALL_DIR) $(1)/usr/bin
187 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
188 $(INSTALL_DIR) $(1)/usr/sbin
189 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
190 endef
191
192 define Package/openssh-server/postinst
193 #!/bin/sh
194
195 name=sshd
196 id=99
197
198 # do not change below
199 # check if we are on real system
200 if [ -z "$${IPKG_INSTROOT}" ]; then
201 # create copies of passwd and group, if we use squashfs
202 rootfs=`mount |awk '/root/ { print $$5 }'`
203 if [ "$$rootfs" = "squashfs" ]; then
204 if [ -h /etc/group ]; then
205 rm /etc/group
206 cp /rom/etc/group /etc/group
207 fi
208 if [ -h /etc/passwd ]; then
209 rm /etc/passwd
210 cp /rom/etc/passwd /etc/passwd
211 fi
212 fi
213 fi
214
215 echo ""
216 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
217 echo "adding group $$name to /etc/group"
218 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
219 fi
220
221 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
222 echo "adding user $$name to /etc/passwd"
223 echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
224 fi
225
226 grep -q '^ssh[[:space:]]*22/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
227 if [ $$? -ne 0 ]; then
228 echo "ssh 22/tcp" >>$${IPKG_INSTROOT}/etc/services
229 fi
230 endef
231
232 define Package/openssh-sftp-client/install
233 $(INSTALL_DIR) $(1)/usr/bin
234 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
235 endef
236
237 define Package/openssh-sftp-server/install
238 $(INSTALL_DIR) $(1)/usr/lib
239 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
240 $(INSTALL_DIR) $(1)/usr/libexec
241 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
242 endef
243
244 $(eval $(call BuildPackage,openssh-client))
245 $(eval $(call BuildPackage,openssh-client-utils))
246 $(eval $(call BuildPackage,openssh-server))
247 $(eval $(call BuildPackage,openssh-sftp-client))
248 $(eval $(call BuildPackage,openssh-sftp-server))