File libssh2_org.spec of Package libssh2_org.30348

#
# spec file for package libssh2_org
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Summary:        A library implementing the SSH2 protocol
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++

Name:           libssh2_org
Version:        1.4.3
Release:        0
URL:            http://www.libssh2.org/
%define pkg_name libssh2
Source0:        http://www.libssh2.org/download/%{pkg_name}-%{version}.tar.gz
Source2:        baselibs.conf
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
#for the test suite
BuildRequires:  groff
BuildRequires:  libtool
BuildRequires:  man
BuildRequires:  openssh
# drops build cycle in Factory
#!BuildIgnore:  groff-full
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch0:         libssh2-ocloexec.patch
Patch1:         CVE-2015-1782.patch
Patch2:         CVE-2016-0787.patch
# fate#320343 add DH group exchange sha256 support
Patch3:         0001-Add-support-for-HMAC-SHA-256-and-HMAC-SHA-512.patch
Patch4:         0001-kex-Added-diffie-hellman-group-exchange-sha256-suppo.patch
Patch5:         libssh2-configure_detect_aes_ctr.patch
Patch6:         bsc974691.patch
# PATCH-FIX-UPSTREAM bsc#1128471 CVE-2019-3855
Patch7:         libssh2_org-CVE-2019-3855.patch
# PATCH-FIX-UPSTREAM bsc#1128472 CVE-2019-3856
Patch8:         libssh2_org-CVE-2019-3856.patch
# PATCH-FIX-UPSTREAM bsc#1128474 CVE-2019-3857
Patch9:         libssh2_org-CVE-2019-3857.patch
# PATCH-FIX-UPSTREAM bsc#1128476 CVE-2019-3858
Patch10:        libssh2_org-CVE-2019-3858.patch
# PATCH-FIX-UPSTREAM bsc#1128480 CVE-2019-3859
Patch11:        libssh2_org-CVE-2019-3859.patch
# PATCH-FIX-UPSTREAM bsc#1128481 CVE-2019-3860
Patch12:        libssh2_org-CVE-2019-3860.patch
# PATCH-FIX-UPSTREAM bsc#1128490 CVE-2019-3861
Patch13:        libssh2_org-CVE-2019-3861.patch
# PATCH-FIX-UPSTREAM bsc#1128492 CVE-2019-3862
Patch14:        libssh2_org-CVE-2019-3862.patch
# PATCH-FIX-UPSTREAM bsc#1128493 CVE-2019-3863
Patch15:        libssh2_org-CVE-2019-3863.patch
# PATCH-FIX-UPSTREAM bsc#1091236
Patch16:        libssh2_org-knownhosts-handle-unknown-key-types.patch
# PATCH-FIX-UPSTREAM bsc#1133528 Fix upstream patch for CVE-2019-3859
Patch17:        libssh2_org-CVE-2019-3859-fix.patch
# PATCH-FIX-UPSTREAM bsc#1136570 Fix upstream patch for CVE-2019-3860
Patch18:        libssh2_org-CVE-2019-3860-fix.patch
# PATCH-FIX-UPSTREAM bsc#1154862 CVE-2019-17498
Patch19:        libssh2_org-CVE-2019-17498.patch
# PATCH-FIX-UPSTREAM bsc#1214527 CVE-2020-22218 out of bounds memory access
Patch20:        libssh2_org-CVE-2020-22218.patch

%description
libssh2 is a library implementing the SSH2 protocol as defined by
Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION,
SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and
SECSH-PUBLICKEY.

%package -n libssh2-1
Summary:        A library implementing the SSH2 protocol
Group:          Development/Libraries/C and C++

%description -n libssh2-1
libssh2 is a library implementing the SSH2 protocol as defined by
Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION,
SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and
SECSH-PUBLICKEY.

%package -n libssh2-devel
Summary:        A library implementing the SSH2 protocol
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libssh2-1 = %{version}

%description -n libssh2-devel
libssh2 is a library implementing the SSH2 protocol as defined by
Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION,
SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and
SECSH-PUBLICKEY.

%prep
%setup -q -n %{pkg_name}-%{version}
# problem with sle 11 sp1 target as it has older kernel and as such fail this
%if 0%{?suse_version} > 1110
%patch0 -p1
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p0
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p0
%patch10 -p0
%patch11 -p1
%patch12 -p0
%patch13 -p0
%patch14 -p0
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1

%build
sed -i -e 's@AM_CONFIG_HEADER@AC_CONFIG_HEADERS@g' configure.ac
cp src/libssh2_config.h.in example/libssh2_config.h
# remove m4 macro files for libtool as they should be picked up by
# autoreconf
rm -v m4/libtool.m4 m4/lt*
autoreconf -fiv
export CFLAGS="%optflags -DOPENSSL_LOAD_CONF"
%configure 	\
			--disable-static --with-pic \
			--disable-rpath --with-libz=%{_prefix} \
			--with-openssl=%{_prefix}
make %{?_smp_mflags}

%if !0%{?sles_version}
 %if 0%{?suse_version} >= 1230

%check
make check

 %endif
%endif

%install
make install DESTDIR=%{buildroot}
rm -f  %{buildroot}%{_libdir}/*.la %{buildroot}%{_libdir}/*.a

%post -n libssh2-1 -p /sbin/ldconfig

%postun -n libssh2-1 -p /sbin/ldconfig

%files -n libssh2-1
%defattr(-,root,root)
%{_libdir}/libssh2.so.1*

%files -n libssh2-devel
%defattr(-,root,root)
%doc NEWS
%{_libdir}/libssh2.so
%{_includedir}/*.h
%{_mandir}/man3/*
%{_libdir}/pkgconfig/libssh2.pc

%changelog
openSUSE Build Service is sponsored by