use CMake as the build system

This commit is contained in:
Kamil Dudka 2016-02-17 10:02:34 +01:00
parent f9f6b45015
commit ea83d635c0
1 changed files with 24 additions and 8 deletions

View File

@ -12,7 +12,7 @@
Name: libssh2
Version: 1.7.0
Release: 3%{?dist}
Release: 3.1%{?dist}
Summary: A library implementing the SSH2 protocol
Group: System Environment/Libraries
License: BSD
@ -20,6 +20,7 @@ URL: http://www.libssh2.org/
Source0: http://libssh2.org/download/libssh2-%{version}.tar.gz
Patch2: CVE-2016-0787.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires: cmake
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: gcc
@ -70,9 +71,14 @@ developing applications that use libssh2.
%prep
%setup -q
# remove auto-generated files
rm -v {src,example}/libssh2_config.h.in
find -name Makefile.am -delete
find -name Makefile.in -delete
# Replace hard wired port number in the test suite to avoid collisions
# between 32-bit and 64-bit builds running on a single build-host
sed -i s/4711/47%{?__isa_bits}/ tests/ssh2.{c,sh}
sed -i s/4711/47%{?__isa_bits}/ tests/{ssh2.c,sshd_fixture.sh.in}
# diffie_hellman_sha1: Convert bytes to bits (additional fix for CVE-2016-0787)
%patch2 -p1
@ -85,24 +91,31 @@ chcon $(/usr/sbin/matchpathcon -n /etc/ssh/ssh_host_key) tests/etc/{host,user} |
%endif
%build
%configure --disable-silent-rules --disable-static --enable-shared
mkdir libssh2_build
cd libssh2_build
%{cmake} .. -DBUILD_SHARED_LIBS=ON
make %{?_smp_mflags}
# Avoid polluting libssh2.pc with linker options (#947813)
sed -i -e 's|[[:space:]]-Wl,[^[:space:]]*||' libssh2.pc
sed -i -e 's|[[:space:]]-Wl,[^[:space:]]*||' src/libssh2.pc
%install
rm -rf %{buildroot}
cd libssh2_build
make install DESTDIR=%{buildroot} INSTALL="install -p"
find %{buildroot} -name '*.la' -exec rm -f {} \;
# clean things up a bit for packaging
make -C example clean
rm -rf example/.deps
find example/ -type f '(' -name '*.am' -o -name '*.in' ')' -exec rm -v {} \;
# avoid multilib conflict on libssh2-devel
mv -v example example.%{_arch}
mv -v ../example ../example.%{_arch}
# remove redundant files installed by CMake
rm -rf %{buildroot}/usr/{lib/cmake,share/libssh2}
# these are going to be installed by %%license and %%doc
rm -f %{buildroot}/usr/share/doc/libssh2/{COPYING,HACKING}
%check
echo "Running tests for %{_arch}"
@ -122,7 +135,7 @@ echo "exit 0" > tests/ssh2.sh
echo "Skipping mansyntax test on PPC* and aarch64"
echo "exit 0" > tests/mansyntax.sh
%endif
make -C tests check
make -C libssh2_build test
%clean
rm -rf %{buildroot}
@ -154,6 +167,9 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/libssh2.pc
%changelog
* Tue Mar 15 2016 Kamil Dudka <kdudka@redhat.com> - 1.7.0-3.1
- use CMake as the build system
* Wed Feb 24 2016 Paul Howarth <paul@city-fan.org> - 1.7.0-3
- Drop UTF-8 patch, which breaks things rather than fixes them