Name:          libnl3
Version:       3.4.0
Release:       8
Summary:       Providing APIs to netlink protocol based Linux kernel interfaces
License:       LGPLv2
URL:           http://www.infradead.org/~tgr/libnl/
Source:        http://www.infradead.org/~tgr/libnl/files/libnl-%{version}.tar.gz
Source1:       http://www.infradead.org/~tgr/libnl/files/libnl-doc-%{version}.tar.gz
Patch9000:     solve-redefinition-of-struct-ipv6_mreq.patch

Patch6001:     libnl3-route-vlan-fix-memory-corruption-in-rtnl_link_vlan_s.patch
Patch6002:     libnl3-route-vlan-fix-cloning-vlan-link-in-vlan_clone.patch
Patch6003:     libnl3-route-vlan-add-capability-to-indicate-heap-overflow-.patch
Patch6004:     libnl3-route-fix-handling-old_nh-in-rtnl_route_parse-and-av.patch
Patch6005:     libnl3-route-vrf-initalize-clone-destination-with-NULL-in-v.patch
Patch6006:     libnl3-route-link-fix-sequence-number-handling-in-rtnl_link.patch
Patch6007:     libnl3-nl-neigh-list-free-allocated-items.patch
Patch6008:     libnl3-route-link-vxlan-Fix-IPv4-set_local-resetting-ce_mas.patch
Patch6009:     libnl3-ipgre-Fix-wrong-array-size-initialization.patch
Patch6010:     libnl3-ipvti-Fix-wrong-array-size-initialization.patch
Patch6011:     libnl3-lib-tc-ensure-correct-error-code-in-rtnl_tc_msg_buil.patch
Patch6012:     libnl3-lib-tc-fix-uninitalized-err-variable-in-rtnl_tc_msg_.patch
Patch6013:     libnl3-route-cls-fix-potential-memory-leak.patch
Patch6014:     libnl3-nla_ok-fix-overrun-in-attribute-iteration.patch
Patch6015:     libnl3-link-macvlan-fixes.patch

BuildRequires: flex bison libtool autoconf automake swig
Requires:      %{name} = %{version}-%{release}

Provides:      %{name}-cli
Obsoletes:     %{name}-cli

%description
This package contains a collection of libraries providing
APIs to netlink based Linux kernel sockets interfaces.

%package devel
Summary: Libraries and headers for libnl3
Requires: %{name} = %{version}-%{release} kernel-headers

%description devel
This package provides various libraries and headers for using libnl3

%package help
Summary: Document for libnl3
Requires:      %{name} = %{version}-%{release}

Provides:      %{name}-doc = %{version}-%{release}
Obsoletes:     %{name}-doc < %{version}-%{release}

%description help
This package contains libnl3 related documentations

%package -n python3-libnl3
Summary: Python3 binding for libnl3
BuildRequires: python3-devel
Requires: %{name} = %{version}-%{release}

%description -n python3-libnl3
Python3 bindings for libnl3

%package -n python2-libnl3
Summary: Python2 bindings for libnl3
BuildRequires: python2-devel
Requires: %{name} = %{version}-%{release}

%description -n python2-libnl3
Python2 bindings for libnl3
%prep
%autosetup -n libnl-%{version} -p1

tar -xzf %SOURCE1

%build
autoreconf -vif
%configure --disable-static
%make_build

cd python
CFLAGS="$RPM_OPT_FLAGS" %py2_build
CFLAGS="$RPM_OPT_FLAGS" %py2_build
CFLAGS="$RPM_OPT_FLAGS" %py3_build
CFLAGS="$RPM_OPT_FLAGS" %py3_build

%install
%make_install

find $RPM_BUILD_ROOT -name *.la |xargs rm -f

cd python
%py2_install
%py3_install

%check
make check

cd python
%{__python2} setup.py check
%{__python3} setup.py check

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%doc COPYING
%{_libdir}/libnl-*.so.*
%config(noreplace) %{_sysconfdir}/*
%{_libdir}/libnl/
%{_bindir}/*

%files devel
%{_includedir}/libnl3/netlink/
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc

%files help
%doc libnl-doc-%{version}/*.html
%doc libnl-doc-%{version}/*.css
%doc libnl-doc-%{version}/stylesheets/*
%doc libnl-doc-%{version}/images/*
%doc libnl-doc-%{version}/images/icons/*
%doc libnl-doc-%{version}/images/icons/callouts/*
%doc libnl-doc-%{version}/api/*
%{_mandir}/man8/*

%files -n python3-libnl3
%{python3_sitearch}/netlink
%{python3_sitearch}/netlink-*.egg-info

%files -n python2-libnl3
%{python2_sitearch}/netlink
%{python2_sitearch}/netlink-*.egg-info

%changelog
* Wed Dec 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.4.0-8
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:provides libnl3-doc

* Sat Sep 7 2019 liyongqiang<liyongqiang10@huawei.com> - 3.4.0-7
- Package init
