diff --git a/sip.spec b/sip.spec index 9811f8d..3da157c 100644 --- a/sip.spec +++ b/sip.spec @@ -1,18 +1,18 @@ -%global with_python3 0 +%if 0%{?fedora} > 13 +%global with_python3 1 +%endif %if 0%{?with_python3} %{!?python3_inc:%global python3_inc %(%{__python3} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc(1))")} -%global python3dir python3-%{name}-%{version}%{?snap:-snapshot-%{snap}} %endif - %{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %{!?python_inc:%global python_inc %(%{__python} -c "from distutils.sysconfig import get_python_inc; print get_python_inc(1)")} Summary: SIP - Python/C++ Bindings Generator Name: sip Version: 4.10.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 or GPLv3 Group: Development/Tools Url: http://www.riverbankcomputing.com/software/sip/intro @@ -45,22 +45,34 @@ explicit support for the signal slot mechanism used by the Qt/KDE class libraries. However, SIP can be used to generate Python bindings for any C++ class library. + %package devel Summary: Files needed to generate Python bindings for any C++ class library Group: Development/Libraries Requires: %{name} = %{version}-%{release} +Requires: %{name}-macros = %{version}-%{release} Requires: python-devel -Requires: rpm %description devel This package contains files needed to generate Python bindings for any C++ classes library. + +%package macros +Summary: RPM macros for use when working with SIP +Group: Development/Tools +Requires: rpm +%description macros +This package contains RPM macros for use when working with SIP. +%if 0%{?with_python3} +It is used by both the sip-devel (python 2) and python3-sip-devel subpackages. +%endif + + %if 0%{?with_python3} %package -n python3-sip Summary: SIP - Python 3/C++ Bindings Generator Group: Development/Tools Provides: python3-sip-api(%{_sip_api_major}) = %{_sip_api} - %description -n python3-sip This is the Python 3 build of SIP. @@ -77,10 +89,9 @@ class library. %package -n python3-sip-devel Summary: Files needed to generate Python 3 bindings for any C++ class library Group: Development/Libraries +Requires: %{name}-macros = %{version}-%{release} Requires: python3-sip = %{version}-%{release} Requires: python3-devel -Requires: rpm - %description -n python3-sip-devel This package contains files needed to generate Python 3 bindings for any C++ classes library. @@ -92,10 +103,8 @@ classes library. %setup -q -n %{name}-%{version}%{?snap:-snapshot-%{snap}} %if 0%{?with_python3} -#FIXME: rdieter says: reuse the %setup macro - but this is a simple case, without lots of patch application etc -pushd .. -cp -a %{name}-%{version}%{?snap:-snapshot-%{snap}} %{python3dir} -popd +rm -rf %{py3dir} +cp -a . %{py3dir} %endif @@ -105,7 +114,7 @@ popd make %{?_smp_mflags} %if 0%{?with_python3} -pushd ../%{python3dir} +pushd %{py3dir} %{__python3} configure.py -d %{python3_sitearch} CXXFLAGS="%{optflags}" CFLAGS="%{optflags}" --sipdir=%{_datadir}/python3-sip make %{?_smp_mflags} @@ -116,19 +125,23 @@ popd %install rm -rf %{buildroot} -make install DESTDIR=%{buildroot} -mkdir -p %{buildroot}%{_datadir}/sip - -install -D -p -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.sip - +# Perform the Python 3 installation first, to avoid stomping over the Python 2 +# /usr/bin/sip: %if 0%{?with_python3} -pushd ../%{python3dir} -#FIXME: this is going to stomp over /usr/bin/sip from the python2 build above: +pushd %{py3dir} make install DESTDIR=%{buildroot} mkdir -p %{buildroot}%{_datadir}/python3-sip +mv %{buildroot}%{_bindir}/sip %{buildroot}%{_bindir}/python3-sip popd %endif +# Python 2 installation: +make install DESTDIR=%{buildroot} +mkdir -p %{buildroot}%{_datadir}/sip + +# Macros used by -devel subpackages: +install -D -p -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/macros.sip + %clean rm -rf %{buildroot} @@ -145,6 +158,9 @@ rm -rf %{buildroot} %{_bindir}/sip %{_datadir}/sip/ %{python_inc}/* + +%files macros +%defattr(-,root,root,-) %{_sysconfdir}/rpm/macros.sip %if 0%{?with_python3} @@ -152,14 +168,22 @@ rm -rf %{buildroot} %{python3_sitearch}/* %files -n python3-sip-devel -# FIXME: what should the python3 sip binary be named? It gets invoked by name in various places higher up in the KDE-Python stack... -%{_bindir}/sip-3 -%{_datadir}/python-3sip/ +# Note that the "sip" binary is invoked by name in a few places higher up +# in the KDE-Python stack; these will need changing to "python3-sip": +%{_bindir}/python3-sip +%{_datadir}/python3-sip/ %{python3_inc}/* %endif %changelog +* Mon Apr 26 2010 David Malcolm - 4.10.2-2 +- enable "with_python3" in the build +- use py3dir throughout, as provided by python3-devel +- name the python 3 sip binary "python3-sip" +- fix a typo in the name of the data dir: python-3sip -> python3-sip +- split out macros.sip into a new subpackage + * Sat Apr 17 2010 Rex Dieter - 4.10.2-1 - sip-4.10.2