File mingw64-wpcap.spec of Package mingw64-wpcap

#
# spec file for package mingw64-wpcap
#
# Copyright (c) 2015 SUSE LINUX 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/
#

%define versionmajor 4
%define versionminor 1
%define versionsuffix 3
%define wpcapexamples %{_docdir}/%{name}/examples
%define wpcapdoc %{_docdir}/%{name}

Name:           mingw64-wpcap
Version:        %{versionmajor}.%{versionminor}.final%{versionsuffix}
Release:        0
Summary:        MinGW user-level packet capture
License:        BSD-2-Clause
Group:          System/Libraries
Url:            http://www.winpcap.org/
Source0:        http://www.winpcap.org/install/bin/WpcapSrc_%{versionmajor}_%{versionminor}_%{versionsuffix}.zip
Source1:        wpcap.pc
Patch0:         wpcap.patch
Patch1:         wpcap-w2k.patch
Patch2:         winpcap-mingw-w64-compatibility.patch
BuildRequires:  bison
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  flex
BuildRequires:  mingw64-cross-binutils
BuildRequires:  mingw64-cross-gcc
BuildRequires:  mingw64-cross-pkg-config
BuildRequires:  mingw64-filesystem
BuildRequires:  unzip
BuildArch:      noarch
%_mingw64_package_header_debug
%_mingw64_debug_package

%description
WinPcap is an open source library for packet capture and network analysis for 
the Win32 platforms.

%package devel
Summary:        Development files for the winpcap library
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
WinPcap is an open source library for packet capture and network analysis for 
the Win32 platforms.

%prep
%setup -q -n winpcap
%patch -P 0  -b .build
%patch -P 2  -b .mingw-w64

find . -type f -print0 |xargs -0 dos2unix
pushd wpcap/libpcap/Win32/Include/
mv ip6_misc.h IP6_misc.h
popd

%patch -P 1  -b .w2k

find . -name GNUmakefile |xargs perl -i -pe 's,-mno-cygwin,,'

# Prevent a conflict between getaddrinfo.c and ws2_32
sed -i s@../libpcap/Win32/Src/getaddrinfo.o@@ wpcap/PRJ/GNUmakefile


%build
pushd packetNtx/Dll/Project
make -f GNUmakefile CC=x86_64-w64-mingw32-gcc YACC=bison %{?_smp_mflags}
popd

pushd wpcap/PRJ
make -f GNUmakefile CC=x86_64-w64-mingw32-gcc YACC=bison %{?_smp_mflags}
popd


%install
install -d %{buildroot}/%{_mingw64_bindir}
install -d %{buildroot}/%{_mingw64_libdir}/pkgconfig
install -m0644 %{SOURCE1} %{buildroot}/%{_mingw64_libdir}/pkgconfig
install -m0644 packetNtx/Dll/Project/libpacket.a %{buildroot}/%{_mingw64_libdir}/libpacket.dll.a
install -m0644 packetNtx/Dll/Project/Packet.dll %{buildroot}/%{_mingw64_bindir}/packet.dll
install -m0644 wpcap/lib/libwpcap.a %{buildroot}/%{_mingw64_libdir}/libwpcap.dll.a
install -m0644 wpcap/PRJ/wpcap.dll %{buildroot}/%{_mingw64_bindir}
install -m0644 packetNtx/Dll/Packet.def %{buildroot}/%{_mingw64_libdir}/packet.def
install -m0644 wpcap/PRJ/WPCAP.DEF %{buildroot}/%{_mingw64_libdir}/wpcap.def
install -d %{buildroot}/%{_mingw64_includedir}/wpcap/pcap
install -m0644 wpcap/libpcap/pcap/*.h %{buildroot}/%{_mingw64_includedir}/wpcap/pcap
install -m0644 wpcap/libpcap/pcap.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/pcap-int.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/pcap-bpf.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/pcap-namedb.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/remote-ext.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/pcap-stdinc.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/Win32-Extensions/Win32-Extensions.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/Win32/Include/bittypes.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/Win32/Include/IP6_misc.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 wpcap/libpcap/Win32/Include/Gnuc.h %{buildroot}/%{_mingw64_includedir}/wpcap/
install -m0644 Common/Packet32.h %{buildroot}/%{_mingw64_includedir}/wpcap/

%files
%defattr(-,root,root)
%doc wpcap/libpcap/LICENSE
%{_mingw64_bindir}/packet.dll
%{_mingw64_bindir}/wpcap.dll

%files devel
%defattr(-,root,root)
%{_mingw64_includedir}/wpcap
%{_mingw64_libdir}/libpacket.dll.a
%{_mingw64_libdir}/libwpcap.dll.a
%{_mingw64_libdir}/packet.def
%{_mingw64_libdir}/wpcap.def
%{_mingw64_libdir}/pkgconfig/wpcap.pc

%changelog
openSUSE Build Service is sponsored by