net-libs/rpcsvc-proto: Removed old.
[gentoo.git] / net-libs / libssh / libssh-0.7.5-r2.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 MY_P="${PN}-${PV/_rc/rc}"
7 inherit cmake-multilib
8
9 DESCRIPTION="Access a working SSH implementation by means of a library"
10 HOMEPAGE="https://www.libssh.org/"
11 SRC_URI="https://red.libssh.org/attachments/download/218/${MY_P}.tar.xz -> ${P}.tar.xz"
12
13 LICENSE="LGPL-2.1"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux"
15 SLOT="0/4" # subslot = soname major version
16 IUSE="debug doc examples gcrypt gssapi libressl pcap server +sftp ssh1 static-libs test zlib"
17 # Maintainer: check IUSE-defaults at DefineOptions.cmake
18
19 RDEPEND="
20         !gcrypt? (
21                 !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
22                 libressl? ( dev-libs/libressl:=[${MULTILIB_USEDEP}] )
23         )
24         gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
25         gssapi? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
26         zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
27 "
28 DEPEND="${RDEPEND}
29         doc? ( app-doc/doxygen )
30         test? ( >=dev-util/cmocka-0.3.1[${MULTILIB_USEDEP}] )
31 "
32
33 DOCS=( AUTHORS README ChangeLog )
34
35 S="${WORKDIR}/${MY_P}"
36
37 PATCHES=(
38         "${FILESDIR}"/${PN}-0.5.0-tests.patch
39         "${FILESDIR}"/${P}-fix-config-parsing.patch
40         "${FILESDIR}"/${P}-fix-config-buffer-underflow.patch
41         "${FILESDIR}"/${P}-add-macro-for-MAX.patch
42         "${FILESDIR}"/${P}-fix-internal-algo-selection.patch
43 )
44
45 src_prepare() {
46         cmake-utils_src_prepare
47
48         # just install the examples do not compile them
49         sed -i \
50                 -e '/add_subdirectory(examples)/s/^/#DONOTWANT/' \
51                 CMakeLists.txt || die
52
53         # keyfile torture test is currently broken
54         sed -i \
55                 -e '/torture_keyfiles/d' \
56                 tests/unittests/CMakeLists.txt || die
57 }
58
59 multilib_src_configure() {
60         local mycmakeargs=(
61                 -DWITH_DEBUG_CALLTRACE="$(usex debug)"
62                 -DWITH_DEBUG_CRYPTO="$(usex debug)"
63                 -DWITH_GCRYPT="$(usex gcrypt)"
64                 -DWITH_GSSAPI="$(usex gssapi)"
65                 -DWITH_NACL=no
66                 -DWITH_PCAP="$(usex pcap)"
67                 -DWITH_SERVER="$(usex server)"
68                 -DWITH_SFTP="$(usex sftp)"
69                 -DWITH_SSH1="$(usex ssh1)"
70                 -DWITH_STATIC_LIB="$(usex static-libs)"
71                 -DWITH_STATIC_LIB="$(usex test)"
72                 -DWITH_TESTING="$(usex test)"
73                 -DWITH_ZLIB="$(usex zlib)"
74         )
75
76         cmake-utils_src_configure
77 }
78
79 multilib_src_compile() {
80         cmake-utils_src_compile
81         multilib_is_native_abi && use doc && cmake-utils_src_compile doc
82 }
83
84 multilib_src_install() {
85         cmake-utils_src_install
86
87         if multilib_is_native_abi && use doc ; then
88                 docinto html
89                 dodoc -r doc/html/.
90         fi
91
92         use static-libs || rm -f "${D}"/usr/$(get_libdir)/libssh{,_threads}.a
93 }
94
95 multilib_src_install_all() {
96         einstalldocs
97
98         if use examples; then
99                 docinto examples
100                 dodoc examples/*.{c,h,cpp}
101         fi
102 }