File libnet.spec of Package libnet

#
# spec file for package libnet
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           libnet
Summary:        A C Library for Portable Packet Creation
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Version:        1.1.5
Release:        0
Url:            http://sourceforge.net/projects/libnet-dev
Source:         libnet-%{version}.tar.bz2
Patch1:         libnet-1.1.2.1-uninitialized-fix.diff
Patch2:         libnet-1.1.5-arrray-fix.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  libtool

%description
Libnet is an API to help with the construction and handling of network
packets. It provides a portable framework for low-level network packet
writing and handling. Libnet includes packet creation at the IP layer
and at the link layer as well as a host of supplementary and
complementary functionality. Libnet is very useful for writing network
tools and network test code. See the man page and sample test code for
more detailed information.

%package -n libnet1
Summary:        A C Library for Portable Packet Creation
Group:          Development/Libraries/C and C++
# was last used in openSUSE 11.3
Provides:       libnet = 1.1.5
Obsoletes:      libnet < 1.1.5

%description -n libnet1
Libnet is an API to help with the construction and handling of network
packets. It provides a portable framework for low-level network packet
writing and handling. Libnet includes packet creation at the IP layer
and at the link layer as well as a host of supplementary and
complementary functionality. Libnet is very useful for writing network
tools and network test code. See the man page and sample test code for
more detailed information.

%package devel
Summary:        Devel files for libnet
Group:          Development/Libraries/C and C++
Requires:       libnet1 = %{version}

%description devel
Libnet is an API to help with the construction and handling of network
packets. This package contains devel files.

%package doc
Summary:        Documentation for libnet
Group:          Development/Libraries/C and C++

%description doc
Libnet is an API to help with the construction and handling of network
packets. This package contains documentation.

%prep
%setup -q
%patch1
%patch2

%build
autoreconf -fiv
CFLAGS="%{optflags} -Wall -Wno-unused" \
%configure --libdir=/%{_lib} --disable-static --with-pic
%{__make} %{?_smp_mflags}

%install
%{makeinstall}
install -d -m 755 %{buildroot}/{%{_bindir},%{_mandir}/man3}
install -m 755 libnet-config %{buildroot}/%{_bindir}
install -m 644 doc/man/man3/*.3 %{buildroot}/%{_mandir}/man3
find doc/ sample/ -name "Makefile*" -o -name ".libs" | xargs rm -rf
find sample -name "*.o" -o -type f -perm +111 |xargs rm -rf
%{__rm} -v %{buildroot}/%{_lib}/*.la
%{__install} -d -m 0755 %{buildroot}%{_libdir}
%{__ln_s} -v /%{_lib}/$(readlink %{buildroot}/%{_lib}/libnet.so) %{buildroot}%{_libdir}/libnet.so
%{__rm} -v %{buildroot}/%{_lib}/libnet.so

%post -n libnet1 -p /sbin/ldconfig

%postun -n libnet1 -p /sbin/ldconfig

%files -n libnet1
%defattr(-,root,root)
%doc doc/COPYING
/%{_lib}/libnet.so.*

%files devel
%defattr(-,root,root)
%{_bindir}/libnet-config
%{_includedir}/libnet*
%{_libdir}/libnet.so
%doc %{_mandir}/man3/*

%files doc
%defattr(-,root,root)
%doc doc/* sample

%changelog
openSUSE Build Service is sponsored by