diff --git a/libunbound-devel-mini.spec b/libunbound-devel-mini.spec index 45d4342..861efa4 100644 --- a/libunbound-devel-mini.spec +++ b/libunbound-devel-mini.spec @@ -12,7 +12,7 @@ # 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/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # diff --git a/unbound.changes b/unbound.changes index a542c17..6a36359 100644 --- a/unbound.changes +++ b/unbound.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sat Apr 13 18:51:31 UTC 2019 - Dirk Stoecker + +- build python2 and python3 packages with proper name + ------------------------------------------------------------------- Mon Mar 18 12:16:58 UTC 2019 - Michael Ströder diff --git a/unbound.spec b/unbound.spec index 22af8b7..8e00ae3 100644 --- a/unbound.spec +++ b/unbound.spec @@ -12,7 +12,7 @@ # 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/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -21,24 +21,12 @@ %define _fillupdir /var/adm/fillup-templates %endif -%bcond_without python +%bcond_without python2 +%bcond_without python3 %bcond_without munin %bcond_without hardened_build - -%if 0%{?suse_version} > 1320 -%bcond_without dnstap -%else -%bcond_with dnstap -%endif - -%if 0%{?suse_version} >= 1230 +%bcond_without dnstap %bcond_without systemd -%else -%bcond_with systemd -%endif - -# only needed for < 1310 -%{!?_tmpfilesdir:%global _tmpfilesdir /usr/lib/tmpfiles.d} # %define _sharedstatedir /var/lib/ @@ -46,16 +34,7 @@ %define fwdir /etc/sysconfig/SuSEfirewall2.d/services # -%if 0%{?suse_version} > 1220 %define piddir /run -%else -%define piddir %{_localstatedir}/run -%endif - -%if 0%{?suse_version} < 1330 && %{with python} -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%endif Name: unbound Version: 1.9.1 @@ -69,18 +48,19 @@ BuildRequires: libevent-devel BuildRequires: libexpat-devel BuildRequires: libsodium-devel BuildRequires: openssl-devel -%if 0%{?suse_version} < 1330 -BuildRequires: python-devel -%else -BuildRequires: python-rpm-macros -BuildRequires: python3-devel -%endif %if %{with dnstap} BuildRequires: libfstrm-devel BuildRequires: libprotobuf-c-devel >= 1.0.0 BuildRequires: protobuf-c >= 1.0.0 %endif -%if %{with python} +%if %{with python2} +BuildRequires: python-rpm-macros +BuildRequires: python2-devel +BuildRequires: swig +%endif +%if %{with python3} +BuildRequires: python-rpm-macros +BuildRequires: python3-devel BuildRequires: swig %endif @@ -181,13 +161,27 @@ Unbound is a validating, recursive, and caching DNS(SEC) resolver. This package contains the tools to manage the anchor certs. -%if %{with python} -%package python +%if %{with python3} +%package -n python3-unbound +Summary: Python modules and extensions for unbound +Group: Applications/System +Requires: %{libname} = %{version} +Obsoletes: unbound-python +Provides: unbound-python + +%description -n python3-unbound +Unbound is a validating, recursive, and caching DNS(SEC) resolver. + +This package holds the Python modules and extensions for unbound. +%endif + +%if %{with python2} +%package -n python2-unbound Summary: Python modules and extensions for unbound Group: Applications/System Requires: %{libname} = %{version} -%description python +%description -n python2-unbound Unbound is a validating, recursive, and caching DNS(SEC) resolver. This package holds the Python modules and extensions for unbound. @@ -195,10 +189,18 @@ This package holds the Python modules and extensions for unbound. %prep %setup +%if %{with python2} +pushd .. +cp -pr %{name}-%{version} p2 +popd +%endif %build export CFLAGS="%{optflags}" export CXXFLAGS="%{optflags}" + +%if %{with python2} +pushd ../p2 %configure \ --disable-rpath \ --with-libevent \ @@ -217,19 +219,47 @@ export CXXFLAGS="%{optflags}" %endif --with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \ --with-pidfile=%{piddir}%{name}/%{name}.pid \ -%if %{with python} -%if 0%{?suse_version} < 1330 - --with-pythonmodule --with-pyunbound\ -%else - --with-pythonmodule --with-pyunbound PYTHON=%{__python3}\ + --with-pythonmodule --with-pyunbound PYTHON=%{__python2}\ + --with-rootkey-file=%{_sharedstatedir}/unbound/root.key + +make %{?_smp_mflags} all streamtcp +popd %endif + +%configure \ + --disable-rpath \ + --with-libevent \ + --with-pthreads \ + --disable-static \ + --with-ldns=%{_prefix} \ + --enable-sha2 \ + --enable-gost \ + --enable-ecdsa \ + --enable-event-api \ + --enable-pie \ + --enable-relro-now \ + --enable-dnscrypt \ +%if %{with dnstap} + --enable-dnstap \ +%endif + --with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \ + --with-pidfile=%{piddir}%{name}/%{name}.pid \ +%if %{with python3} + --with-pythonmodule --with-pyunbound PYTHON=%{__python3}\ %endif --with-rootkey-file=%{_sharedstatedir}/unbound/root.key make %{?_smp_mflags} all streamtcp %install +%if %{with python2} +pushd ../p2 %make_install +popd +%endif + +%make_install + install -d -m 0750 %{buildroot}/var/lib/unbound install -d 0755 %{buildroot}%{_unitdir} install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unbound.service @@ -273,16 +303,6 @@ install -m 0644 %{SOURCE8} %{buildroot}%{_tmpfilesdir}/unbound.conf install -m 0644 %{SOURCE5} %{SOURCE6} %{buildroot}%{_sysconfdir}/unbound/ install -m 0644 %{SOURCE13} %{buildroot}%{_sharedstatedir}/unbound/root.key -# remove static library from install (fedora packaging guidelines) -rm %{buildroot}%{_libdir}/*.la -%if %{with python} -%if 0%{?suse_version} < 1330 -rm %{buildroot}%{python_sitearch}/*.la -%else -rm %{buildroot}%{python3_sitearch}/*.la -%endif -%endif - # create softlink for all functions of libunbound man pages for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd ub_ctx_resolvconf ub_ctx_hosts ub_ctx_add_ta ub_ctx_add_ta_file ub_ctx_trustedkeys ub_ctx_debugout ub_ctx_debuglevel ub_ctx_async ub_poll ub_wait ub_fd ub_process ub_resolve ub_resolve_async ub_cancel ub_resolve_free ub_strerror ub_ctx_print_local_zones ub_ctx_zone_add ub_ctx_zone_remove ub_ctx_data_add ub_ctx_data_remove; do @@ -398,18 +418,22 @@ systemd-tmpfiles --create %{_tmpfilesdir}/unbound.conf || : %defattr(-,root,root,-) %{_libdir}/libunbound.so.* -%if %{with python} -%files python +%if %{with python3} +%files -n python3-unbound %defattr(-,root,root,-) -%if 0%{?suse_version} < 1330 -%{python_sitearch}/* -%else %{python3_sitearch}/* -%endif %doc libunbound/python/examples/* %doc pythonmod/examples/* %endif +%if %{with python2} +%files -n python2-unbound +%defattr(-,root,root,-) +%{python2_sitearch}/* +%doc ../p2/libunbound/python/examples/* +%doc ../p2/pythonmod/examples/* +%endif + %if %{with munin} %files munin %defattr(-,root,root,-) @@ -427,6 +451,7 @@ systemd-tmpfiles --create %{_tmpfilesdir}/unbound.conf || : %{_includedir}/unbound.h %{_includedir}/unbound-event.h %{_libdir}/libunbound.so +%exclude %{_libdir}/libunbound.la %{_libdir}/pkgconfig/libunbound.pc %{_mandir}/man3/libunbound.3* %{_mandir}/man3/ub_*.3*