7e21e45
%if 0%{?fedora} >= 18
7e21e45
%global with_python3	1
7e21e45
%global basepy3dir	%(echo ../`basename %{py3dir}`)
7e21e45
%else
7e21e45
%global with_python3	0
7e21e45
%endif
9c7ab57
%global major	16
2f7408e
%filter_provides_in %{python_sitearch}/.*\.so$ 
2f7408e
2f7408e
Summary:	Library and tool to control NAT in UPnP-enabled routers
2f7408e
Name:		miniupnpc
9c7ab57
Version:	2.0
a8c04ab
Release:	4%{?dist}
2f7408e
License:	BSD
2f7408e
Group:		System Environment/Libraries
2f7408e
URL:		http://miniupnp.free.fr/
2f7408e
Source:		http://miniupnp.free.fr/files/%{name}-%{version}.tar.gz
2f7408e
BuildRequires:	cmake
7e21e45
BuildRequires:	python2-devel
08a96c8
# Do not create libminiupnpc.so.%%{version} and libminiupnpc.so.%%{major} linking to it
9c7ab57
Patch0:		%{name}-version.patch
2f7408e
# Link to and find libminiupnpc
9c7ab57
Patch1:		%{name}-tests.patch
0e6f5db
Source1:	USAGE
2f7408e
2f7408e
%description
2f7408e
miniupnpc is an implementation of a UPnP client library, enabling
2f7408e
applications to access the services provided by an UPnP "Internet
2f7408e
Gateway Device" present on the network. In UPnP terminology, it is
2f7408e
a UPnP Control Point.
2f7408e
0e6f5db
This package includes upnpc, a UPnP client application for configuring 
0e6f5db
port forwarding in UPnP enabled routers.
0e6f5db
2f7408e
%package	devel
2f7408e
Summary:	Development files for miniupnpc 
2f7408e
Group:		Development/Libraries
2f7408e
Requires:	%{name}%{?_isa} = %{version}-%{release}
2f7408e
2f7408e
%description	devel
2f7408e
This package contains the header files and development documentation
2f7408e
for %{name}.
2f7408e
2f7408e
%package	-n python-%{name}
2f7408e
Summary:	Python interface to %{name}
2f7408e
Group:		System Environment/Libraries
2f7408e
Requires:	%{name}%{?_isa} = %{version}-%{release}
2f7408e
2f7408e
%description	-n python-%{name}
2f7408e
This package contains python interfaces to %{name}.
2f7408e
7e21e45
%if %{with_python3}
7e21e45
%package	-n python3-%{name}
7e21e45
Summary:	Python3 interface to %{name}
7e21e45
Group:		System Environment/Libraries
7e21e45
Requires:	%{name}%{?_isa} = %{version}-%{release}
7e21e45
BuildRequires:	python3-devel
7e21e45
7e21e45
%description	-n python3-%{name}
7e21e45
This package contains python3 interfaces to %{name}.
7e21e45
%endif
7e21e45
2f7408e
%prep
2f7408e
%setup -q
9c7ab57
%patch0 -p0
2f7408e
%patch1 -p1
0e6f5db
cp %{SOURCE1} .
2f7408e
2f7408e
sed -i "s|\(\tpython setup.py install\)$|\1 --root=\$(DESTDIR)/|" Makefile
7e21e45
%if %{with_python3}
7e21e45
sed -i "s|\(\tpython3 setup.py install\)$|\1 --root=\$(DESTDIR)/|" Makefile
7e21e45
%endif
2f7408e
2f7408e
# version not updated in setup.py
7e21e45
sed -i 's/"1\.7"/"%{version}"/' setup.py
7e21e45
7e21e45
# Changelog says added -ansi without reason, but that
7e21e45
# breaks C files (python module) using C++ comments
7e21e45
sed -i 's/\(CFLAGS += -ansi\)/#\1/' Makefile
2f7408e
2f7408e
%build
2f7408e
mkdir -p build
2f7408e
pushd build
2f7408e
%cmake					\
2f7408e
	-DUPNPC_BUILD_STATIC=OFF	\
2f7408e
	-DUPNPC_BUILD_TESTS=ON		\
2f7408e
	..
2f7408e
    make upnpc-shared all
2f7408e
popd
2f7408e
make pythonmodule
7e21e45
%if %{with_python3}
7e21e45
make pythonmodule3
7e21e45
%endif
0e6f5db
make upnpc-shared
2f7408e
2f7408e
%install
2f7408e
make install DESTDIR=$RPM_BUILD_ROOT -C build
2f7408e
make DESTDIR=$RPM_BUILD_ROOT installpythonmodule
7e21e45
%if %{with_python3}
7e21e45
make DESTDIR=$RPM_BUILD_ROOT installpythonmodule3
7e21e45
%endif
2f7408e
install -D -m644 man3/miniupnpc.3 $RPM_BUILD_ROOT/%{_mandir}/man3/miniupnpc.3
0e6f5db
install -D -m 0755 upnpc-shared $RPM_BUILD_ROOT%{_bindir}/upnpc
2f7408e
2f7408e
%check
2f7408e
make CFLAGS="%{optflags} -DMINIUPNPC_SET_SOCKET_TIMEOUT" check
2f7408e
2f7408e
%post -p /sbin/ldconfig
2f7408e
2f7408e
%postun -p /sbin/ldconfig
2f7408e
2f7408e
%files
2f7408e
%doc Changelog.txt
2f7408e
%doc LICENSE
2f7408e
%doc README
2f7408e
%{_libdir}/libminiupnpc.so.%{major}
0e6f5db
%{_bindir}/upnpc
0e6f5db
%doc USAGE
2f7408e
2f7408e
%files		devel
2f7408e
%{_includedir}/miniupnpc
2f7408e
%{_libdir}/libminiupnpc.so
2f7408e
%{_mandir}/man3/miniupnpc.3*
2f7408e
2f7408e
%files		-n python-%{name}
2f7408e
%{python_sitearch}/miniupnpc-%{version}-py?.?.egg-info
2f7408e
%{python_sitearch}/miniupnpc.so
2f7408e
7e21e45
%if %{with_python3}
7e21e45
%files		-n python3-%{name}
7e21e45
%{python3_sitearch}/miniupnpc-%{version}-py?.?.egg-info
7e21e45
%{python3_sitearch}/miniupnpc*.so
7e21e45
%endif
7e21e45
2f7408e
%changelog
a8c04ab
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-4
a8c04ab
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
a8c04ab
afd6062
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2.0-3
afd6062
- Rebuild for Python 3.6
afd6062
b4d62ba
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-2
b4d62ba
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
b4d62ba
9c7ab57
* Wed Jun 08 2016 François Kooman <fkooman@tuxed.net> - 2.0-1
9c7ab57
- update to 2.0
9c7ab57
a8c7186
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-8
a8c7186
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
a8c7186
98ca1c9
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-7
98ca1c9
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
98ca1c9
9d37ef0
* Sat Oct 31 2015 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.9-6
9d37ef0
- Correct buffer overflow in XML parsing (#1270842, #1270182)
9d37ef0
8915cf8
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-5
8915cf8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
8915cf8
a5705ce
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-4
a5705ce
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
a5705ce
7459ce5
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-3
7459ce5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
7459ce5
c21894f
* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 1.9-2
c21894f
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
c21894f
08a96c8
* Wed Apr 16 2014 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.9-1
08a96c8
- Update to latest upstream release (#1062206)
08a96c8
- Correct possible DoS crash vector (patch already in tarball) (#1085618)
08a96c8
7e21e45
* Tue Aug 13 2013 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.8-1
7e21e45
- Update to latest upstream release (#996357)
7e21e45
- Build extra python3 module
7e21e45
4956bea
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-10
4956bea
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
4956bea
0e6f5db
* Tue Mar 05 2013 Domingo Becker <domingobecker@gmail.com> - 1.6-9
0e6f5db
- Added upnpc, a client side tool, to the main package.
0e6f5db
- Added USAGE file with instructions on how to use upnpc.
0e6f5db
ad73942
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-8
ad73942
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
ad73942
c3913bc
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-7
c3913bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
c3913bc
2f7408e
* Wed May 30 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-6
2f7408e
- Add Changelog.txt to documentation.
2f7408e
- Correct package version in setup.py.
2f7408e
- Correct rpmlint warning on source rpm.
2f7408e
- Filter provides of private python shared object (817311#c19).
2f7408e
2f7408e
* Sat May 26 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-5
2f7408e
- Build python module (817311#c14).
2f7408e
2f7408e
* Mon May 21 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-4
2f7408e
- Use %%name for source and patch names.
2f7408e
- Enable %%check.
2f7408e
2f7408e
* Mon May 7 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-3
2f7408e
- Prefer %%global over %%define.
2f7408e
- Add proper documentation to main package.
2f7408e
- Ensure library is built before making simple test programs.
2f7408e
2f7408e
* Wed May 2 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-2
2f7408e
- Rename package to miniupnpc to match source tarball.
2f7408e
- Add patch to enable build of tests.
2f7408e
- Include manual page to devel package.
2f7408e
- Change License to match LICENSE file.
2f7408e
2f7408e
* Sat Apr 28 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.6-1
2f7408e
- Initial libminiupnpc spec.