- Use %bcond_with and %bcond_without instead of plain %global
- Make primary python3 in primary build, python2 in optional
This commit is contained in:
parent
a5fd74d24b
commit
e1786302b6
70
ldns.spec
70
ldns.spec
@ -1,6 +1,11 @@
|
||||
%global _hardened_build 1
|
||||
%{?!with_python2: %global with_python2 1}
|
||||
%{?!with_python3: %global with_python3 1}
|
||||
|
||||
%bcond_without python3
|
||||
%if 0%{?fedora} > 1 || 0%{?rhel} <= 7
|
||||
%bcond_without python2
|
||||
%else
|
||||
%bcond_with python2
|
||||
%endif
|
||||
%{?!with_perl: %global with_perl 1}
|
||||
%{?!with_ecdsa: %global with_ecdsa 1}
|
||||
# GOST is not allowed in Fedora/RHEL due to legal reasons (not NIST ECC)
|
||||
@ -9,7 +14,7 @@
|
||||
%{?!disable_dane: %global disable_dane 0}
|
||||
%{?!snapshot: %global snapshot 0}
|
||||
|
||||
%if %{with_python2}
|
||||
%if %{with python2}%{with python3}
|
||||
%{!?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)")}
|
||||
%{?filter_setup:
|
||||
@ -58,11 +63,11 @@ BuildRequires: doxygen
|
||||
|
||||
# for snapshots only
|
||||
# BuildRequires: libtool, autoconf, automake
|
||||
%if %{with_python2}
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-devel, swig
|
||||
%endif
|
||||
%if %{with_python3}
|
||||
BuildRequires: python3-devel
|
||||
%if %{with python3}
|
||||
BuildRequires: python3-devel, swig
|
||||
%endif
|
||||
%if %{with_perl}
|
||||
BuildRequires: perl-devel
|
||||
@ -96,7 +101,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Collection of tools to get, check or alter DNS(SEC) data.
|
||||
|
||||
|
||||
%if %{with_python2}
|
||||
%if %{with python2}
|
||||
%package -n python2-ldns
|
||||
Summary: Python2 extensions for ldns
|
||||
Group: Applications/System
|
||||
@ -108,7 +113,7 @@ Python2 extensions for ldns
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with_python3}
|
||||
%if %{with python3}
|
||||
%package -n python3-ldns
|
||||
Summary: Python3 extensions for ldns
|
||||
Group: Applications/System
|
||||
@ -144,12 +149,12 @@ This package contains documentation for the ldns library
|
||||
|
||||
%setup -qcn %{pkgname}
|
||||
|
||||
%if 0%{with_python2}
|
||||
mv %{pkgname} %{pkgname}_python2
|
||||
pushd %{pkgname}_python2
|
||||
%if %{with python3}
|
||||
mv %{pkgname} %{pkgname}_python3
|
||||
pushd %{pkgname}_python3
|
||||
%else
|
||||
pushd %{pkgname}
|
||||
%endif # with_python2
|
||||
%endif # with python3
|
||||
|
||||
%patch1 -p2 -b .multilib
|
||||
%patch2 -p1 -b .limit
|
||||
@ -171,9 +176,9 @@ cp -p contrib/ldnsx/LICENSE ../LICENSE.ldnsx
|
||||
cp -p contrib/ldnsx/README ../README.ldnsx
|
||||
popd
|
||||
|
||||
%if 0%{?with_python3}
|
||||
cp -a %{pkgname}_python2 %{pkgname}_python3
|
||||
%endif # with_python3
|
||||
%if %{with python2}
|
||||
cp -a %{pkgname}_python3 %{pkgname}_python2
|
||||
%endif # with python2
|
||||
|
||||
|
||||
%build
|
||||
@ -207,18 +212,18 @@ export CFLAGS CXXFLAGS LDFLAGS
|
||||
--disable-static \\\
|
||||
|
||||
|
||||
%if 0%{with_python2}
|
||||
pushd %{pkgname}_python2
|
||||
%if 0%{with python3}
|
||||
pushd %{pkgname}_python3
|
||||
%else
|
||||
pushd %{pkgname}
|
||||
%endif # with_python2
|
||||
%endif # with python3
|
||||
|
||||
%configure \
|
||||
%{common_args} \
|
||||
--with-examples \
|
||||
--with-drill \
|
||||
%if %{with_python2}
|
||||
--with-pyldns PYTHON_VERSION=2
|
||||
%if %{with python3}
|
||||
--with-pyldns PYTHON_VERSION=3
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
@ -237,11 +242,11 @@ make %{?_smp_mflags} doc
|
||||
sed -i "s~$RPM_LD_FLAGS~~" packaging/ldns-config
|
||||
popd
|
||||
|
||||
%if 0%{with_python3}
|
||||
pushd %{pkgname}_python3
|
||||
%if %{with python2}
|
||||
pushd %{pkgname}_python2
|
||||
%configure \
|
||||
%{common_args} \
|
||||
--with-pyldns PYTHON_VERSION=3
|
||||
--with-pyldns PYTHON_VERSION=2
|
||||
|
||||
make %{?_smp_mflags}
|
||||
popd
|
||||
@ -252,8 +257,8 @@ popd
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%if 0%{with_python2}
|
||||
pushd %{pkgname}_python2
|
||||
%if %{with python3}
|
||||
pushd %{pkgname}_python3
|
||||
%else
|
||||
pushd %{pkgname}
|
||||
%endif
|
||||
@ -263,8 +268,8 @@ make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-doc
|
||||
|
||||
# remove .la files
|
||||
rm -rf %{buildroot}%{_libdir}/*.la
|
||||
%if 0%{with_python2}
|
||||
rm -rf %{buildroot}%{python2_sitearch}/*.la
|
||||
%if %{with python3}
|
||||
rm -rf %{buildroot}%{python3_sitearch}/*.la
|
||||
%endif
|
||||
|
||||
# install pkg-config file
|
||||
@ -276,10 +281,10 @@ install -D -m644 packaging/libldns.pc %{buildroot}%{_libdir}/pkgconfig/ldns.pc
|
||||
%endif
|
||||
popd
|
||||
|
||||
%if %{with_python3}
|
||||
pushd %{pkgname}_python3
|
||||
%if %{with python2}
|
||||
pushd %{pkgname}_python2
|
||||
make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-pyldns install-pyldnsx
|
||||
rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python3_sitearch}/*.la
|
||||
rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python2_sitearch}/*.la
|
||||
popd
|
||||
%endif
|
||||
|
||||
@ -316,14 +321,14 @@ rm -rf doc/man
|
||||
%{_includedir}/ldns/*.h
|
||||
%{_mandir}/man3/*.3.gz
|
||||
|
||||
%if %{with_python2}
|
||||
%if %{with python2}
|
||||
%files -n python2-ldns
|
||||
%doc %{pkgname}_python2/contrib/python/Changelog README.ldnsx
|
||||
%license LICENSE.ldnsx
|
||||
%{python2_sitearch}/*
|
||||
%endif
|
||||
|
||||
%if %{with_python3}
|
||||
%if %{with python3}
|
||||
%files -n python3-ldns
|
||||
%doc %{pkgname}_python3/contrib/python/Changelog README.ldnsx
|
||||
%license LICENSE.ldnsx
|
||||
@ -344,6 +349,7 @@ rm -rf doc/man
|
||||
* Wed Feb 21 2018 Petr Menšík <pemensik@redhat.com> - 1.7.0-14
|
||||
- Add only extra flags to default RPM LDFLAGS
|
||||
- Fix multilib conflict of ldns-config (#1463423)
|
||||
- Make primary python3 in primary build, python2 in optional
|
||||
|
||||
* Wed Feb 21 2018 Petr Menšík <pemensik@redhat.com> - 1.7.0-13
|
||||
- Support for python3 package (#1323248)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user