From 13805b5303dac5f6ab1f44d7f81272836a00a707 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Aug 28 2019 02:04:01 +0000 Subject: Build a namespaced sip module, wx.siplib, for wxpython (#1739469) --- diff --git a/sip-4.19.18-no_hardcode_sip_so.patch b/sip-4.19.18-no_hardcode_sip_so.patch new file mode 100644 index 0000000..b6fe637 --- /dev/null +++ b/sip-4.19.18-no_hardcode_sip_so.patch @@ -0,0 +1,12 @@ +diff -up sip-4.19.18/configure.py.orig sip-4.19.18/configure.py +--- sip-4.19.18/configure.py.orig 2019-07-04 12:28:08.000000000 -0400 ++++ sip-4.19.18/configure.py 2019-08-27 21:56:33.871428348 -0400 +@@ -447,7 +447,7 @@ def create_makefiles(macros): + if sys.platform == 'win32': + mod = 'sip.lib' if opts.static else 'sip.pyd' + else: +- mod = 'libsip.a' if opts.static else 'sip.so' ++ mod = 'libsip.a' if opts.static else sip_module_name.split('.')[-1] + '.so' + + all_installs.append((mod, sip_module_dest_dir)) + diff --git a/sip.spec b/sip.spec index 439b7b9..3bbd051 100644 --- a/sip.spec +++ b/sip.spec @@ -24,7 +24,7 @@ Summary: SIP - Python/C++ Bindings Generator Name: sip Version: 4.19.18 -Release: 3%{?dist} +Release: 4%{?dist} # sipgen/parser.{c.h} is GPLv3+ with exceptions (bison) License: GPLv2 or GPLv3 and (GPLv3+ with exceptions) @@ -43,6 +43,8 @@ Patch51: sip-4.18-no_rpath.patch # set sip_bin properly for python3 build (needswork to be upstreamable) # no longer needed? keep for a little while before dropping completely -- rex #Patch52: sip-4.19.3-python3_sip_bin.patch +# Avoid hardcoding sip.so (needed for wxpython's siplib.so) +Patch53: sip-4.19.18-no_hardcode_sip_so.patch # extracted from sip.h, SIP_API_MAJOR_NR SIP_API_MINOR_NR defines Source1: macros.sip @@ -107,6 +109,13 @@ Provides: python2-pyqt5-sip-api(%{_sip_api_major})%{?_isa} = %{_sip_api} %{?python_provide:%python_provide python2-pyqt5-sip} %description -n python2-pyqt5-sip %_description +%package -n python2-wx-siplib +Summary: %summary +Provides: python2-wx-siplib-api(%{_sip_api_major}) = %{_sip_api} +Provides: python2-wx-siplib-api(%{_sip_api_major})%{?_isa} = %{_sip_api} +%{?python_provide:%python_provide python2-wx-siplib} +%description -n python2-wx-siplib %_description + %if %{with python3} %if 0%{?no_namespace} %package -n python%{python3_pkgversion}-sip @@ -144,6 +153,14 @@ Provides: python%{python3_pkgversion}-pyqt5-sip-api(%{_sip_api_major})%{?_isa} = %description -n python%{python3_pkgversion}-pyqt5-sip This is the Python 3 build of pyqt5-SIP. +%package -n python%{python3_pkgversion}-wx-siplib +Summary: SIP - Python 3/C++ Bindings Generator for wx +BuildRequires: python%{python3_pkgversion}-devel +Provides: python%{python3_pkgversion}-wx-siplib-api(%{_sip_api_major}) = %{_sip_api} +Provides: python%{python3_pkgversion}-wx-siplib-api(%{_sip_api_major})%{?_isa} = %{_sip_api} +%description -n python%{python3_pkgversion}-wx-siplib +This is the Python 3 build of wx-siplib. + %_description %endif @@ -155,6 +172,7 @@ This is the Python 3 build of pyqt5-SIP. %patch50 -p1 -b .no_strip %patch51 -p1 -b .no_rpath +%patch53 -p1 -b .no_sip_so %build @@ -189,6 +207,18 @@ pushd %{_target_platform}-python2-pyqt5 %make_build popd +sed -i -e 's|target = sip|target = siplib|g' siplib/siplib.sbf +mkdir %{_target_platform}-python2-wx +pushd %{_target_platform}-python2-wx +%{__python2} ../configure.py \ + --sip-module=wx.siplib \ + -b %{_bindir} -d %{python2_sitearch} -e %{_includedir}/python%{python2_version} \ + CFLAGS+="%{optflags}" CXXFLAGS+="%{optflags}" LFLAGS+="%{?__global_ldflags}" + +%make_build +popd +sed -i -e 's|target = siplib|target = sip|g' siplib/siplib.sbf + %if %{with python3} %if 0%{?no_namespace} mkdir %{_target_platform}-python3 @@ -221,6 +251,18 @@ pushd %{_target_platform}-python3-pyqt5 %make_build popd +sed -i -e 's|target = sip|target = siplib|g' siplib/siplib.sbf +mkdir %{_target_platform}-python3-wx +pushd %{_target_platform}-python3-wx +%{__python3} ../configure.py \ + --sip-module=wx.siplib \ + -b %{_bindir} -d %{python3_sitearch} -e %{_includedir}/python%{python3_version} \ + CXXFLAGS+="%{optflags}" CFLAGS+="%{optflags}" LFLAGS+="%{?__global_ldflags}" + +%make_build +popd +sed -i -e 's|target = siplib|target = sip|g' siplib/siplib.sbf + %endif @@ -233,6 +275,8 @@ popd %endif %make_install -C %{_target_platform}-python3-pyqt4 %make_install -C %{_target_platform}-python3-pyqt5 +%make_install -C %{_target_platform}-python3-wx +mv %{buildroot}%{python3_sitearch}/wx/sip.pyi %{buildroot}%{python3_sitearch}/wx/siplib.pyi ln -s sip %{buildroot}%{_bindir}/python3-sip ## toplevel __pycache__ creation is ... inconsistent @@ -246,12 +290,16 @@ mkdir -p %{buildroot}%{python3_sitearch}/__pycache__/exclude_rpm_hack %endif %make_install -C %{_target_platform}-python2-pyqt4 %make_install -C %{_target_platform}-python2-pyqt5 +%make_install -C %{_target_platform}-python2-wx +mv %{buildroot}%{python2_sitearch}/wx/sip.pyi %{buildroot}%{python2_sitearch}/wx/siplib.pyi # sip-wrapper install %{SOURCE10} %{buildroot}%{_bindir}/sip-pyqt4 install %{SOURCE10} %{buildroot}%{_bindir}/sip-pyqt5 +install %{SOURCE10} %{buildroot}%{_bindir}/sip-wx sed -i -e 's|@SIP_MODULE@|PyQt4.sip|g' %{buildroot}%{_bindir}/sip-pyqt4 sed -i -e 's|@SIP_MODULE@|PyQt5.sip|g' %{buildroot}%{_bindir}/sip-pyqt5 +sed -i -e 's|@SIP_MODULE@|wx.siplib|g' %{buildroot}%{_bindir}/sip-wx mkdir -p %{buildroot}%{_datadir}/sip @@ -266,6 +314,7 @@ install -D -p -m644 %{SOURCE1} %{buildroot}%{rpm_macros_dir}/macros.sip # sip-wrappers %{_bindir}/sip-pyqt4 %{_bindir}/sip-pyqt5 +%{_bindir}/sip-wx # compat symlink %{_bindir}/python3-sip %dir %{_datadir}/sip/ @@ -297,6 +346,13 @@ install -D -p -m644 %{SOURCE1} %{buildroot}%{rpm_macros_dir}/macros.sip %{python2_sitearch}/PyQt5/sip.* %{python2_sitearch}/PyQt5_sip-%{version}.dist-info/ +%files -n python2-wx-siplib +%doc NEWS README +%license LICENSE LICENSE-GPL2 LICENSE-GPL3 +%dir %{python2_sitearch}/wx/ +%{python2_sitearch}/wx/siplib.* +%{python2_sitearch}/wx_siplib-%{version}.dist-info/ + %if %{with python3} %files -n python%{python3_pkgversion}-sip-devel %{_prefix}/include/python%{python3_version}/sip.h @@ -326,10 +382,20 @@ install -D -p -m644 %{SOURCE1} %{buildroot}%{rpm_macros_dir}/macros.sip %dir %{python3_sitearch}/PyQt5/ %{python3_sitearch}/PyQt5/sip.* %{python3_sitearch}/PyQt5_sip-%{version}.dist-info/ + +%files -n python%{python3_pkgversion}-wx-siplib +%doc NEWS README +%license LICENSE LICENSE-GPL2 LICENSE-GPL3 +%dir %{python3_sitearch}/wx/ +%{python3_sitearch}/wx/siplib.* +%{python3_sitearch}/wx_siplib-%{version}.dist-info/ %endif %changelog +* Mon Aug 19 2019 Scott Talbert - 4.19.18-4 +- Build a namespaced sip module, wx.siplib, for wxpython (#1739469) + * Mon Aug 19 2019 Gwyn Ciesla - 4.19.18-3 - Set paths for flatpak.