[packages/sip] - added outoftree patch to fix out-of-tree builds - _sipfiles dir goes to sip package - added python

qboosh qboosh at pld-linux.org
Tue Oct 28 20:36:41 CET 2014


commit 4c69315071df9139e00e134909f36cf87f480f3c
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Oct 28 20:36:34 2014 +0100

    - added outoftree patch to fix out-of-tree builds
    - _sipfiles dir goes to sip package
    - added python3 modules

 sip-outoftree.patch |  86 +++++++++++++++++++++++++++++++++++
 sip.spec            | 128 +++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 193 insertions(+), 21 deletions(-)
---
diff --git a/sip.spec b/sip.spec
index ead6aae..6157987 100644
--- a/sip.spec
+++ b/sip.spec
@@ -1,3 +1,9 @@
+# TODO: __pycache__ for python3-sip-devel
+#
+# Conditional build:
+%bcond_without	python2	# CPython 2.x modules
+%bcond_without	python3	# CPython 3.x modules
+
 Summary:	Python bindings generator for C++ class libraries
 Summary(pl.UTF-8):	Generator powiązań Pythona z bibliotekami klas C++
 Name:		sip
@@ -8,6 +14,7 @@ License:	SIP (redistributable, see LICENSE) or GPL v2 or GPL v3
 Group:		Development/Languages/Python
 Source0:	http://downloads.sourceforge.net/pyqt/sip-%{version}.tar.gz
 # Source0-md5:	884d60b6f17fc5b910da4665caf6fd85
+Patch0:		%{name}-outoftree.patch
 URL:		http://www.riverbankcomputing.com/software/sip/
 BuildRequires:	libstdc++-devel
 BuildRequires:	python-devel >= 2.3
@@ -18,51 +25,88 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 %define		_sipfilesdir	%{_datadir}/sip
 
 %description
-Generates Python bindings for C++ class libraries from a set of class
-specification files. It supports Python v2 and v3.
+SIP generates Python bindings for C++ class libraries from a set of
+class specification files. It supports Python v2 and v3.
 
 %description -l pl.UTF-8
-Generuje powiązania Pythona z bibliotekami klas C++ ze zbioru plików
-ze specyfikacjami klas. Obsługiwany jest Python 2 i 3.
+SIP generuje powiązania Pythona z bibliotekami klas C++ ze zbioru
+plików ze specyfikacjami klas. Obsługiwany jest Python 2 i 3.
 
 %package -n python-sip
-Summary:	Python module needed by generated bindings
-Summary(pl.UTF-8):	Moduł Pythona wymagany przez wygenerowane powiązania
+Summary:	Python 2 module needed by SIP generated bindings
+Summary(pl.UTF-8):	Moduł Pythona 2 wymagany przez wiązania wygenerowane przez SIP
 Group:		Libraries/Python
-%pyrequires_eq	python-libs
+Requires:	python-libs
 
 %description -n python-sip
-Generates Python bindings for C++ class libraries from a set of class
-specification files. This package includes runtime library needed by
-all generated bindings.
+SIP generates Python bindings for C++ class libraries from a set of
+class specification files. This package includes Python 2 runtime
+library needed by all generated bindings.
 
 %description -n python-sip -l pl.UTF-8
-Generuje powiązania Pythona z bibliotekami klas C++ ze zbioru plików
-ze specyfikacjami klas. Ten pakiet zawiera bibliotekę potrzebną do
-uruchomienia wszystkich wygenerowanych powiązań.
+SIP generuje powiązania Pythona z bibliotekami klas C++ ze zbioru
+plików ze specyfikacjami klas. Ten pakiet zawiera bibliotekę Pythona 2
+potrzebną do uruchomienia wszystkich wygenerowanych powiązań.
 
 %package -n python-sip-devel
-Summary:	Development files needed to build bindings
-Summary(pl.UTF-8):	Pliki programistyczne potrzebne do budowania powiązań
+Summary:	Python 2 development files needed to build bindings using SIP
+Summary(pl.UTF-8):	Pliki programistyczne Pythona 2 potrzebne do budowania wiązań przy użyciu SIP-a
 Group:		Development/Libraries
 Requires:	%{name} = %{epoch}:%{version}-%{release}
 Requires:	python-devel >= 2.3
-%pyrequires_eq	python-libs
 
 %description -n python-sip-devel
-Development files needed to build bindings for C++ classes.
+Python 2 development files needed to build bindings for C++ classes
+using SIP.
 
 %description -n python-sip-devel -l pl.UTF-8
-Pliki programistyczne potrzebne do budowania powiązań z klasami C++.
+Pliki programistyczne Pythona 2 potrzebne do budowania wiązań dla klas
+C++ przy użyciu SIP-a.
+
+%package -n python3-sip
+Summary:	Python 3 module needed by SIP generated bindings
+Summary(pl.UTF-8):	Moduł Pythona 3 wymagany przez wiązania wygenerowane przez SIP
+Group:		Libraries/Python
+Requires:	python3-libs
+
+%description -n python3-sip
+SIP generates Python bindings for C++ class libraries from a set of
+class specification files. This package includes Python 3 runtime
+library needed by all generated bindings.
+
+%description -n python3-sip -l pl.UTF-8
+SIP generuje powiązania Pythona z bibliotekami klas C++ ze zbioru
+plików ze specyfikacjami klas. Ten pakiet zawiera bibliotekę Pythona 3
+potrzebną do uruchomienia wszystkich wygenerowanych powiązań.
+
+%package -n python3-sip-devel
+Summary:	Python 3 development files needed to build bindings using SIP
+Summary(pl.UTF-8):	Pliki programistyczne Pythona 3 potrzebne do budowania wiązań przy użyciu SIP-a
+Group:		Development/Libraries
+Requires:	%{name} = %{epoch}:%{version}-%{release}
+Requires:	python3-devel >= 1:3.2
+
+%description -n python3-sip-devel
+Python 3 development files needed to build bindings for C++ classes
+using SIP.
+
+%description -n python3-sip-devel -l pl.UTF-8
+Pliki programistyczne Pythona 3 potrzebne do budowania wiązań dla klas
+C++ przy użyciu SIP-a.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 # configure.py notes:
 # - macros overrides must be last
 # - cannot pass CXXFLAGS+="%{rpmcflags}" or so - builtin -O2 overrides rpmcflags
-%{__python} configure.py \
+
+%if %{with python2}
+install -d build-py2
+cd build-py2
+%{__python} ../configure.py \
 	-b %{_bindir} \
 	-e %{py_incdir} \
 	-v %{_sipfilesdir} \
@@ -75,16 +119,44 @@ Pliki programistyczne potrzebne do budowania powiązań z klasami C++.
 	LINK_SHLIB="%{__cxx}"
 
 %{__make}
+cd ..
+%endif
+
+%if %{with python3}
+install -d build-py3
+cd build-py3
+%{__python3} ../configure.py \
+	-b %{_bindir} \
+	-e %{py3_incdir} \
+	-v %{_sipfilesdir} \
+	-d %{py3_sitedir} \
+	CC="%{__cc}" \
+	CXX="%{__cxx}" \
+	CFLAGS="%{rpmcflags} %{rpmcppflags}" \
+	CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
+	LINK="%{__cxx}" \
+	LINK_SHLIB="%{__cxx}"
+
+%{__make}
+cd ..
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_sipfilesdir}
 
-%{__make} install \
+%if %{with python2}
+%{__make} -C build-py2 install \
 	DESTDIR=$RPM_BUILD_ROOT
 
 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%endif
+
+%if %{with python3}
+%{__make} -C build-py3 install \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -93,11 +165,12 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc LICENSE NEWS README doc/html
 %attr(755,root,root) %{_bindir}/sip
+%dir %{_sipfilesdir}
 
+%if %{with python2}
 %files -n python-sip
 %defattr(644,root,root,755)
 %attr(755,root,root) %{py_sitedir}/sip.so
-%dir %{_sipfilesdir}
 
 %files -n python-sip-devel
 %defattr(644,root,root,755)
@@ -106,3 +179,16 @@ rm -rf $RPM_BUILD_ROOT
 %{py_sitedir}/sipdistutils.py
 %{py_sitedir}/sipdistutils.py[co]
 %{py_incdir}/sip.h
+%endif
+
+%if %{with python3}
+%files -n python3-sip
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/sip.so
+
+%files -n python3-sip-devel
+%defattr(644,root,root,755)
+%{py3_sitedir}/sipconfig.py
+%{py3_sitedir}/sipdistutils.py
+%{py3_incdir}/sip.h
+%endif
diff --git a/sip-outoftree.patch b/sip-outoftree.patch
new file mode 100644
index 0000000..fc08abb
--- /dev/null
+++ b/sip-outoftree.patch
@@ -0,0 +1,86 @@
+--- sip-4.16.3/configure.py.orig	2014-09-11 19:12:51.000000000 +0200
++++ sip-4.16.3/configure.py	2014-10-27 17:54:50.981640566 +0100
+@@ -47,6 +47,7 @@
+ sip_sip_dir = ''
+ sysroot = ''
+ src_dir = os.path.dirname(os.path.abspath(__file__))
++build_dir = os.getcwd()
+ sip_module_base = None
+ build_platform = None
+ 
+@@ -455,10 +456,11 @@
+ 
+         sipconfig.ModuleMakefile(
+             configuration=cfg,
+-            build_file=os.path.join(src_dir, "siplib", "siplib.sbf"),
++            build_file=os.path.join(build_dir, "siplib", "siplib.sbf"),
+             dir="siplib",
++            src_dir=os.path.join(src_dir, "siplib"),
+             install_dir=cfg.sip_mod_dir,
+-            installs=([os.path.join(src_dir, "siplib", "sip.h")], cfg.sip_inc_dir),
++            installs=([os.path.join(build_dir, "siplib", "sip.h")], cfg.sip_inc_dir),
+             console=1,
+             warnings=0,
+             static=opts.static,
+--- sip-4.16.3/siputils.py.orig	2014-09-07 17:30:09.000000000 +0200
++++ sip-4.16.3/siputils.py	2014-10-27 22:19:01.287642057 +0100
+@@ -202,7 +202,7 @@
+     def __init__(self, configuration, console=0, qt=0, opengl=0, python=0,
+                  threaded=0, warnings=1, debug=0, dir=None,
+                  makefile="Makefile", installs=None, universal=None,
+-                 arch=None, deployment_target=None):
++                 arch=None, deployment_target=None, src_dir=None):
+         """Initialise an instance of the target.  All the macros are left
+         unchanged allowing scripts to manipulate them at will.
+ 
+@@ -264,8 +264,11 @@
+         else:
+             self.dir = os.path.curdir
+ 
+-        # Assume we are building in the source tree.
+-        self._src_dir = self.dir
++        if src_dir is not None:
++            self._src_dir = src_dir
++        else:
++            # Assume we are building in the source tree.
++            self._src_dir = self.dir
+ 
+         if universal is None:
+             self._universal = configuration.universal
+@@ -381,6 +381,8 @@
+         defines.extend(self.optional_list("DEFINES"))
+ 
+         incdir = _UniqueList(["."])
++        if self.dir != self._src_dir:
++            incdir.append(self._src_dir)
+         incdir.extend(self.extra_include_dirs)
+         incdir.extend(self.optional_list("INCDIR"))
+ 
+@@ -1029,7 +1031,8 @@
+         else:
+             if os.path.isabs(filename):
+                 # We appear to be building out of the source tree.
+-                self._src_dir = os.path.dirname(filename)
++                if self._src_dir == self.dir:
++                    self._src_dir = os.path.dirname(filename)
+                 bfname = filename
+             else:
+                 bfname = os.path.join(self.dir, filename)
+@@ -1465,7 +1471,7 @@
+                  console=0, qt=0, opengl=0, threaded=0, warnings=1, debug=0,
+                  dir=None, makefile="Makefile", installs=None, strip=1,
+                  export_all=0, universal=None, arch=None,
+-                 deployment_target=None):
++                 deployment_target=None, src_dir=None):
+         """Initialise an instance of a module Makefile.
+ 
+         build_file is the file containing the target specific information.  If
+@@ -1479,7 +1485,7 @@
+         increases the size of the module and slows down module load times but
+         may avoid problems with modules that use exceptions.  The default is 0.
+         """
+-        Makefile.__init__(self, configuration, console, qt, opengl, 1, threaded, warnings, debug, dir, makefile, installs, universal, arch, deployment_target)
++        Makefile.__init__(self, configuration, console, qt, opengl, 1, threaded, warnings, debug, dir, makefile, installs, universal, arch, deployment_target, src_dir)
+ 
+         self._build = self.parse_build_file(build_file)
+         self._install_dir = install_dir
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/sip.git/commitdiff/4c69315071df9139e00e134909f36cf87f480f3c



More information about the pld-cvs-commit mailing list