b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (C) 2015-2018 OpenWrt.org |
| 3 | # |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=libssh2 |
| 11 | PKG_VERSION:=1.11.0 |
| 12 | PKG_RELEASE:=1 |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz |
| 15 | PKG_SOURCE_URL:=https://www.libssh2.org/download |
| 16 | PKG_HASH:=3736161e41e2693324deb38c26cfdc3efe6209d634ba4258db1cecff6a5ad461 |
| 17 | |
| 18 | PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu> |
| 19 | PKG_LICENSE:=BSD-3-Clause |
| 20 | PKG_LICENSE_FILES:=COPYING |
| 21 | PKG_CPE_ID:=cpe:/a:libssh2:libssh2 |
| 22 | |
| 23 | CMAKE_INSTALL:=1 |
| 24 | |
| 25 | PKG_CONFIG_DEPENDS:= \ |
| 26 | CONFIG_LIBSSH2_MBEDTLS \ |
| 27 | CONFIG_LIBSSH2_OPENSSL |
| 28 | |
| 29 | include $(INCLUDE_DIR)/package.mk |
| 30 | include $(INCLUDE_DIR)/cmake.mk |
| 31 | |
| 32 | define Package/libssh2 |
| 33 | SECTION:=libs |
| 34 | CATEGORY:=Libraries |
| 35 | TITLE:=SSH2 library |
| 36 | URL:=https://www.libssh2.org/ |
| 37 | DEPENDS:=+LIBSSH2_MBEDTLS:libmbedtls +!LIBSSH2_MBEDTLS:libopenssl +zlib |
| 38 | ABI_VERSION:=1 |
| 39 | endef |
| 40 | |
| 41 | define Package/libssh2/description |
| 42 | libssh2 is a client-side C library implementing the SSH2 protocol. |
| 43 | endef |
| 44 | |
| 45 | define Package/libssh2/config |
| 46 | if PACKAGE_libssh2 |
| 47 | |
| 48 | choice |
| 49 | prompt "Choose crypto backend" |
| 50 | default LIBSSH2_OPENSSL |
| 51 | |
| 52 | config LIBSSH2_OPENSSL |
| 53 | bool "openssl" |
| 54 | |
| 55 | config LIBSSH2_MBEDTLS |
| 56 | bool "mbedtls" |
| 57 | endchoice |
| 58 | |
| 59 | endif |
| 60 | endef |
| 61 | |
| 62 | CMAKE_OPTIONS += \ |
| 63 | -DBUILD_SHARED_LIBS=ON \ |
| 64 | -DBUILD_TESTING=OFF \ |
| 65 | -DENABLE_ZLIB_COMPRESSION=ON \ |
| 66 | -DCLEAR_MEMORY=ON \ |
| 67 | -DCRYPTO_BACKEND=$(if $(CONFIG_LIBSSH2_MBEDTLS),mbedTLS,OpenSSL) |
| 68 | |
| 69 | define Package/libssh2/install |
| 70 | $(INSTALL_DIR) $(1)/usr/lib |
| 71 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libssh2.so.$(ABI_VERSION)* $(1)/usr/lib/ |
| 72 | endef |
| 73 | |
| 74 | $(eval $(call BuildPackage,libssh2)) |