%global major 8
%filter_provides_in %{python_sitearch}/.*\.so$
Summary: Library and tool to control NAT in UPnP-enabled routers
Name: miniupnpc
Version: 1.6
Release: 10%{?dist}
License: BSD
Group: System Environment/Libraries
URL: http://miniupnp.free.fr/
Source: http://miniupnp.free.fr/files/%{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: python-devel
# Install headers and add extra file to compilation
# Patch originally from Mageia Linux
Patch0: %{name}-1.6-files.patch
# Do not create libminiupnpc.so.1.5 and libminiupnpc.so.8 linking to it
Patch1: %{name}-1.6-version.patch
# Link to and find libminiupnpc
Patch2: %{name}-1.6-tests.patch
Source1: USAGE
%description
miniupnpc is an implementation of a UPnP client library, enabling
applications to access the services provided by an UPnP "Internet
Gateway Device" present on the network. In UPnP terminology, it is
a UPnP Control Point.
This package includes upnpc, a UPnP client application for configuring
port forwarding in UPnP enabled routers.
%package devel
Summary: Development files for miniupnpc
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package contains the header files and development documentation
for %{name}.
%package -n python-%{name}
Summary: Python interface to %{name}
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python-%{name}
This package contains python interfaces to %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
cp %{SOURCE1} .
sed -i "s|\(\tpython setup.py install\)$|\1 --root=\$(DESTDIR)/|" Makefile
# version not updated in setup.py
sed -i 's/"1\.5"/"%{version}"/' setup.py
%build
mkdir -p build
pushd build
%cmake \
-DUPNPC_BUILD_STATIC=OFF \
-DUPNPC_BUILD_TESTS=ON \
..
make upnpc-shared all
popd
make pythonmodule
make upnpc-shared
%install
make install DESTDIR=$RPM_BUILD_ROOT -C build
make DESTDIR=$RPM_BUILD_ROOT installpythonmodule
install -D -m644 man3/miniupnpc.3 $RPM_BUILD_ROOT/%{_mandir}/man3/miniupnpc.3
install -D -m 0755 upnpc-shared $RPM_BUILD_ROOT%{_bindir}/upnpc
%check
make CFLAGS="%{optflags} -DMINIUPNPC_SET_SOCKET_TIMEOUT" check
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc Changelog.txt
%doc LICENSE
%doc README
%{_libdir}/libminiupnpc.so.%{major}
%{_bindir}/upnpc
%doc USAGE
%files devel
%{_includedir}/miniupnpc
%{_libdir}/libminiupnpc.so
%{_mandir}/man3/miniupnpc.3*
%files -n python-%{name}
%{python_sitearch}/miniupnpc-%{version}-py?.?.egg-info
%{python_sitearch}/miniupnpc.so
%changelog
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Mar 05 2013 Domingo Becker <domingobecker@gmail.com> - 1.6-9
- Added upnpc, a client side tool, to the main package.
- Added USAGE file with instructions on how to use upnpc.
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed May 30 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-6
- Add Changelog.txt to documentation.
- Correct package version in setup.py.
- Correct rpmlint warning on source rpm.
- Filter provides of private python shared object (817311#c19).
* Sat May 26 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-5
- Build python module (817311#c14).
* Mon May 21 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-4
- Use %%name for source and patch names.
- Enable %%check.
* Mon May 7 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-3
- Prefer %%global over %%define.
- Add proper documentation to main package.
- Ensure library is built before making simple test programs.
* Wed May 2 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-2
- Rename package to miniupnpc to match source tarball.
- Add patch to enable build of tests.
- Include manual page to devel package.
- Change License to match LICENSE file.
* Sat Apr 28 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-1
- Initial libminiupnpc spec.