You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
6.4 KiB

  1. #
  2. # Copyright (C) 2006-2011 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=openssh
  9. PKG_VERSION:=6.6p1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
  13. ftp://openbsd.wiretapped.net/pub/OpenBSD/OpenSSH/portable/ \
  14. ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/ \
  15. ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/
  16. PKG_MD5SUM:=3e9800e6bca1fbac0eea4d41baa7f239
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  18. PKG_BUILD_DEPENDS:=libopenssl
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/openssh/Default
  21. SECTION:=net
  22. CATEGORY:=Network
  23. DEPENDS:=+libopenssl +zlib +SSP_SUPPORT:libssp
  24. TITLE:=OpenSSH
  25. MAINTAINER:=Peter Wagner <tripolar@gmx.at>
  26. URL:=http://www.openssh.com/
  27. SUBMENU:=SSH
  28. VARIANT:=without-pam
  29. endef
  30. define Package/openssh-moduli
  31. $(call Package/openssh/Default)
  32. DEPENDS+= +openssh-keygen
  33. TITLE+= moduli file
  34. endef
  35. define Package/openssh-moduli/description
  36. OpenSSH server moduli file.
  37. endef
  38. define Package/openssh-client
  39. $(call Package/openssh/Default)
  40. TITLE+= client
  41. endef
  42. define Package/openssh-client/description
  43. OpenSSH client.
  44. endef
  45. define Package/openssh-client/conffiles
  46. /etc/ssh/ssh_config
  47. endef
  48. define Package/openssh-client-utils
  49. $(call Package/openssh/Default)
  50. DEPENDS+= +openssh-client +openssh-keygen
  51. TITLE+= client utilities
  52. endef
  53. define Package/openssh-client-utils/description
  54. OpenSSH client utilities.
  55. endef
  56. define Package/openssh-keygen
  57. $(call Package/openssh/Default)
  58. TITLE+= keygen
  59. endef
  60. define Package/openssh-keygen/description
  61. OpenSSH keygen.
  62. endef
  63. define Package/openssh-server
  64. $(call Package/openssh/Default)
  65. DEPENDS+= +openssh-keygen
  66. TITLE+= server
  67. endef
  68. define Package/openssh-server/description
  69. OpenSSH server.
  70. endef
  71. define Package/openssh-server/conffiles
  72. /etc/ssh/sshd_config
  73. endef
  74. define Package/openssh-server-pam
  75. $(call Package/openssh/Default)
  76. DEPENDS+= +libpthread +openssh-keygen +libpam
  77. TITLE+= server (with PAM support)
  78. VARIANT:=with-pam
  79. endef
  80. define Package/openssh-server-pam/description
  81. OpenSSH server (with PAM support).
  82. endef
  83. define Package/openssh-server-pam/conffiles
  84. /etc/pam.d/sshd
  85. /etc/security/access-sshd-local.conf
  86. /etc/ssh/sshd_config
  87. endef
  88. define Package/openssh-sftp-client
  89. $(call Package/openssh/Default)
  90. TITLE+= SFTP client
  91. endef
  92. define Package/openssh-sftp-client/description
  93. OpenSSH SFTP client.
  94. endef
  95. define Package/openssh-sftp-server
  96. $(call Package/openssh/Default)
  97. TITLE+= SFTP server
  98. DEPENDS:=+SSP_SUPPORT:libssp
  99. endef
  100. define Package/openssh-sftp-server/description
  101. OpenSSH SFTP server.
  102. endef
  103. CONFIGURE_ARGS+= \
  104. $(DISABLE_NLS) \
  105. --sysconfdir=/etc/ssh \
  106. --with-privsep-user=sshd \
  107. --with-privsep-path=/var/empty \
  108. --enable-shared \
  109. --disable-static \
  110. --disable-debug \
  111. --disable-strip \
  112. --disable-etc-default-login \
  113. --disable-lastlog \
  114. --disable-utmp \
  115. --disable-utmpx \
  116. --disable-wtmp \
  117. --disable-wtmpx \
  118. --without-bsd-auth \
  119. --without-kerberos5 \
  120. --without-x
  121. ifeq ($(BUILD_VARIANT),with-pam)
  122. CONFIGURE_ARGS += \
  123. --with-pam
  124. else
  125. CONFIGURE_ARGS += \
  126. --without-pam
  127. endif
  128. ifeq ($(CONFIG_OPENSSL_ENGINE),y)
  129. CONFIGURE_ARGS+= \
  130. --with-ssl-engine
  131. endif
  132. ifneq ($(CONFIG_SSP_SUPPORT),y)
  133. CONFIGURE_ARGS += \
  134. --without-stackprotect
  135. endif
  136. CONFIGURE_VARS += LD="$(TARGET_CC)"
  137. ifeq ($(BUILD_VARIANT),with-pam)
  138. TARGET_LDFLAGS += -lpthread
  139. endif
  140. define Build/Compile
  141. $(MAKE) -C $(PKG_BUILD_DIR) \
  142. DESTDIR="$(PKG_INSTALL_DIR)" \
  143. LIBS="" \
  144. sftp-server
  145. $(MAKE) -C $(PKG_BUILD_DIR) \
  146. DESTDIR="$(PKG_INSTALL_DIR)" \
  147. STRIP_OPT="" \
  148. all install
  149. endef
  150. define Package/openssh-client/preinst
  151. #!/bin/sh
  152. if [ -L $${IPKG_INSTROOT}/usr/bin/ssh ] && [ -L $${IPKG_INSTROOT}/usr/bin/scp ]; then
  153. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  154. fi
  155. exit 0
  156. endef
  157. define Package/openssh-client/postrm
  158. #!/bin/sh
  159. rm -f $${IPKG_INSTROOT}/usr/bin/ssh $${IPKG_INSTROOT}/usr/bin/scp;
  160. if [ -x $${IPKG_INSTROOT}/usr/sbin/dropbear ] ; then
  161. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/ssh;
  162. ln -s /usr/sbin/dropbear $${IPKG_INSTROOT}/usr/bin/scp;
  163. fi
  164. exit 0
  165. endef
  166. define Package/openssh-moduli/install
  167. $(INSTALL_DIR) $(1)/etc/ssh
  168. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/moduli $(1)/etc/ssh/
  169. endef
  170. define Package/openssh-client/install
  171. $(INSTALL_DIR) $(1)/etc/ssh
  172. chmod 0700 $(1)/etc/ssh
  173. $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
  174. $(INSTALL_DIR) $(1)/usr/bin
  175. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
  176. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
  177. endef
  178. define Package/openssh-client-utils/install
  179. $(INSTALL_DIR) $(1)/usr/bin
  180. $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
  181. endef
  182. define Package/openssh-keygen/install
  183. $(INSTALL_DIR) $(1)/usr/bin
  184. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
  185. endef
  186. define Package/openssh-server/install
  187. $(INSTALL_DIR) $(1)/etc/ssh
  188. chmod 0700 $(1)/etc/ssh
  189. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
  190. $(INSTALL_DIR) $(1)/etc/init.d
  191. $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
  192. $(INSTALL_DIR) $(1)/usr/sbin
  193. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
  194. endef
  195. define Package/openssh-server-pam/install
  196. $(call Package/openssh-server/install,$(1))
  197. sed -i 's,#PasswordAuthentication yes,PasswordAuthentication no,g' $(1)/etc/ssh/sshd_config
  198. sed -i 's,#UsePAM no,UsePAM yes,g' $(1)/etc/ssh/sshd_config
  199. $(INSTALL_DIR) $(1)/etc/pam.d
  200. $(INSTALL_DATA) ./files/sshd.pam $(1)/etc/pam.d/sshd
  201. $(INSTALL_DIR) $(1)/etc/security
  202. $(INSTALL_DATA) ./files/sshd.pam-access $(1)/etc/security/access-sshd-local.conf
  203. endef
  204. define Package/openssh-sftp-client/install
  205. $(INSTALL_DIR) $(1)/usr/bin
  206. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
  207. endef
  208. define Package/openssh-sftp-server/install
  209. $(INSTALL_DIR) $(1)/usr/lib
  210. $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
  211. $(INSTALL_DIR) $(1)/usr/libexec
  212. ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
  213. endef
  214. $(eval $(call BuildPackage,openssh-client))
  215. $(eval $(call BuildPackage,openssh-moduli))
  216. $(eval $(call BuildPackage,openssh-client-utils))
  217. $(eval $(call BuildPackage,openssh-keygen))
  218. $(eval $(call BuildPackage,openssh-server))
  219. $(eval $(call BuildPackage,openssh-server-pam))
  220. $(eval $(call BuildPackage,openssh-sftp-client))
  221. $(eval $(call BuildPackage,openssh-sftp-server))