Use proper versioning for bundled libraries

This commit is contained in:
Pavel Zhukov 2017-08-03 13:29:02 +02:00
parent 34503ac954
commit 88b1917ff9
2 changed files with 58 additions and 10 deletions

View File

@ -0,0 +1,51 @@
commit 32153fe41b9a3f461326348f16c9a71c6d980e89
Author: Pavel Zhukov <pzhukov@redhat.com>
Date: Thu Aug 3 13:18:01 2017 +0200
Use nmap-libssh2 and nmap-zlib headers for included only
Nmap specific libssh2/libz headers contain hardcoded version number thus
version information is incorrect if system version of library is chosen.
diff --git a/nmap.cc b/nmap.cc
index 512cb4a6e..79f7e77b5 100644
--- a/nmap.cc
+++ b/nmap.cc
@@ -182,11 +182,19 @@
#endif
#if HAVE_LIBSSH2
+#ifdef LIBSSH2_INCLUDED
#include "libssh2/libssh2v.h"
+#else
+#include "libssh2.h"
+#endif
#endif
#if HAVE_LIBZ
+#ifdef ZLIB_INCLUDED
#include "libz/libzv.h"
+#else
+#include "zlib.h"
+#endif
#endif
/* To get the version number only. */
@@ -2722,7 +2730,7 @@ static void display_nmap_version() {
#ifdef LIBSSH2_INCLUDED
with.push_back(std::string("nmap-libssh2-") + get_word_or_quote(LIBSSH2_VERSION_TEXT, 1));
#else
- with.push_back(std::string("libssh2-") + get_word_or_quote(LIBSSH2_VERSION_TEXT, 1));
+ with.push_back(std::string("libssh2-") + get_word_or_quote(LIBSSH2_VERSION, 0));
#endif
#else
without.push_back("libssh2");
@@ -2732,7 +2740,7 @@ static void display_nmap_version() {
#ifdef ZLIB_INCLUDED
with.push_back(std::string("nmap-libz-") + get_word_or_quote(LIBZ_VERSION_TEXT, 1));
#else
- with.push_back(std::string("libz-") + get_word_or_quote(LIBZ_VERSION_TEXT, 1));
+ with.push_back(std::string("libz-") + get_word_or_quote(ZLIB_VERSION, 0));
#endif
#else
without.push_back("libz");

View File

@ -8,7 +8,7 @@ Name: nmap
Epoch: 2
Version: 7.60
#global prerelease TEST5
Release: 5%{?dist}
Release: 6%{?dist}
# Uses combination of licenses based on GPL license, but with extra modification
# so it got its own license tag rhbz#1055861
License: Nmap
@ -28,6 +28,7 @@ Patch2: nmap-4.52-noms.patch
# upstream provided patch for rhbz#845005, not yet in upstream repository
Patch5: ncat_reg_stdin.diff
Patch6: nmap-6.25-displayerror.patch
Patch7: nmap-7.60-bundled_libssh2_libz.patch
URL: http://nmap.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -94,19 +95,12 @@ BuildArch: noarch
%patch2 -p1 -b .noms
%patch5 -p1 -b .ncat_reg_stdin
%patch6 -p1 -b .displayerror
%patch7 -p1 -b .libssh2
#be sure we're not using tarballed copies of some libraries
#rm -rf liblua libpcap libpcre macosx mswin32 ###TODO###
## Deleteling libssh2 and libz but keeping
## nmap specific definition
for lib in libssh2 libz; do
mkdir ".${lib}" && cp "${lib}/${lib}v.h" ".${lib}/"
rm -rf "$lib"
mv ".${lib}" "${lib}"
done;
rm -rf libpcap libpcre macosx mswin32
rm -rf libpcap libpcre macosx mswin32 libssh2 libz
# for aarch64 support, not needed with autotools 2.69+
for f in acinclude.m4 configure.ac nping/configure.ac
@ -245,6 +239,9 @@ rm -rf %{buildroot}
%{_mandir}/man1/xnmap.1.gz
%changelog
* Thu Aug 3 2017 Pavel Zhukov <pzhukov@redhat.com> - 2:7.60-7
- Fix library version for non-included libraries
* Thu Aug 3 2017 Pavel Zhukov <pzhukov@redhat.com> - 2:7.60-4
- Keep nmap specific libssh and libz headers
- Drop unused libssh2 patch