commit:     38adb1e500880665e8d3c9e3821555ce8393e6a0
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Wed May  4 05:48:30 2022 +0000
Commit:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
CommitDate: Sat May  7 01:29:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=38adb1e5

net-libs/libssh2: Added

The only difference with the gentoo ebuild is appending
-DHAVE_OPAQUE_STRUCTS=1 to the cflags when both the gcrypt
and mbedtls USE flags are disabled.

This solution is taken from the OpenBSD libssh2 Makefile.

Signed-off-by: orbea <orbea <AT> riseup.net>
Closes: https://github.com/gentoo/libressl/pull/403
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>

 net-libs/libssh2/Manifest                          |  1 +
 .../libssh2/files/libssh2-1.8.0-mansyntax_sh.patch | 41 ++++++++++++++++
 net-libs/libssh2/libssh2-1.10.0.ebuild             | 55 ++++++++++++++++++++++
 net-libs/libssh2/metadata.xml                      | 15 ++++++
 4 files changed, 112 insertions(+)

diff --git a/net-libs/libssh2/Manifest b/net-libs/libssh2/Manifest
new file mode 100644
index 0000000..95b30d0
--- /dev/null
+++ b/net-libs/libssh2/Manifest
@@ -0,0 +1 @@
+DIST libssh2-1.10.0.tar.gz 965044 BLAKE2B 
0e6f571cc723e0050bf7ba7492f361ef222547dcbc311019cb6762f01405b4906e0418207a7d484c5170bee5e6f666827a7ea0d0cf233f684f999f896ce0b415
 SHA512 
e064ee1089eb8e6cd5fa2617f4fd8ff56c2721c5476775a98bdb68c6c4ee4d05c706c3bb0eb479a27a8ec0b17a8a5ef43e1d028ad3f134519aa582d3981a3a30

diff --git a/net-libs/libssh2/files/libssh2-1.8.0-mansyntax_sh.patch 
b/net-libs/libssh2/files/libssh2-1.8.0-mansyntax_sh.patch
new file mode 100644
index 0000000..3a33bf7
--- /dev/null
+++ b/net-libs/libssh2/files/libssh2-1.8.0-mansyntax_sh.patch
@@ -0,0 +1,41 @@
+--- a/tests/mansyntax.sh
++++ b/tests/mansyntax.sh
+@@ -1,37 +1,2 @@
+ #!/bin/sh
+-set -e
+-
+-# Written by Mikhail Gusarov
+-#
+-# Run syntax checks for all manpages in the documentation tree.
+-#
+-
+-srcdir=${srcdir:-$PWD}
+-dstdir=${builddir:-$PWD}
+-mandir=${srcdir}/../docs
+-
+-#
+-# Only test if suitable man is available
+-#
+-if ! man --help | grep -q warnings; then
+-  echo "man version not suitable, skipping tests"
+-  exit 0
+-fi
+-
+-ec=0
+-
+-trap "rm -f $dstdir/man3" EXIT
+-
+-ln -sf "$mandir" "$dstdir/man3"
+-
+-for manpage in $mandir/libssh2_*.*; do
+-  echo "$manpage"
+-  warnings=$(LANG=en_US.UTF-8 MANWIDTH=80 man -M "$dstdir" --warnings \
+-    -E UTF-8 -l "$manpage" 2>&1 >/dev/null)
+-  if [ -n "$warnings" ]; then
+-    echo "$warnings"
+-    ec=1
+-  fi
+-done
+-
+-exit $ec
++:

diff --git a/net-libs/libssh2/libssh2-1.10.0.ebuild 
b/net-libs/libssh2/libssh2-1.10.0.ebuild
new file mode 100644
index 0000000..843cfe6
--- /dev/null
+++ b/net-libs/libssh2/libssh2-1.10.0.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+CMAKE_ECLASS=cmake
+inherit cmake-multilib
+
+DESCRIPTION="Library implementing the SSH2 protocol"
+HOMEPAGE="https://www.libssh2.org";
+SRC_URI="https://www.libssh2.org/download/${P}.tar.gz";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc 
x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-solaris"
+IUSE="gcrypt mbedtls zlib"
+REQUIRED_USE="?? ( gcrypt mbedtls )"
+# Tests try to set containers up using docker (and fail for some reason).
+RESTRICT="test"
+
+RDEPEND="
+       gcrypt? ( >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] )
+       !gcrypt? (
+               mbedtls? ( net-libs/mbedtls:0=[${MULTILIB_USEDEP}] )
+               !mbedtls? (
+                       >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}]
+               )
+       )
+       zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
+"
+DEPEND="
+       ${RDEPEND}
+"
+
+multilib_src_configure() {
+       local crypto_backend=OpenSSL
+       if use gcrypt; then
+               crypto_backend=Libgcrypt
+       elif use mbedtls; then
+               crypto_backend=mbedTLS
+       else
+               append-cflags -DHAVE_OPAQUE_STRUCTS=1
+       fi
+
+       local mycmakeargs=(
+               -DBUILD_SHARED_LIBS=ON
+               -DCRYPTO_BACKEND=${crypto_backend}
+               -DENABLE_ZLIB_COMPRESSION=$(usex zlib)
+       )
+       cmake_src_configure
+}
+
+multilib_src_install_all() {
+       einstalldocs
+       find "${ED}" -name '*.la' -delete || die
+}

diff --git a/net-libs/libssh2/metadata.xml b/net-libs/libssh2/metadata.xml
new file mode 100644
index 0000000..f072d71
--- /dev/null
+++ b/net-libs/libssh2/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+<email>net...@gentoo.org</email>
+</maintainer>
+<maintainer type="person">
+       <email>mgo...@gentoo.org</email>
+       <name>Michał Górny</name>
+</maintainer>
+<use>
+       <flag name="gcrypt">Use <pkg>dev-libs/libgcrypt</pkg> instead of 
<pkg>dev-libs/openssl</pkg></flag>
+       <flag name="mbedtls">Use <pkg>net-libs/mbedtls</pkg> instead of 
<pkg>dev-libs/openssl</pkg></flag>
+</use>
+</pkgmetadata>

Reply via email to