Blob Blame History Raw
%{?mingw_package_header}

# Disable debuginfo subpackages and debugsource packages for now to use old logic
%undefine _debugsource_packages
%undefine _debuginfo_subpackages

# Override the __debug_install_post argument as this package
# contains both native as well as cross compiled binaries
%global __debug_install_post %%{mingw_debug_install_post}; %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%%{?buildsubdir}" %{nil}


%global native_dir %{_builddir}/native-%{name}-%{version}-%{release}
%global win64_dir %{_builddir}/mingw64-%{name}-%{version}-%{release}

%global pkgname python-qt5
%global qt_ver 5.11.1

#define pre dev1805251538

Name:           mingw-%{pkgname}
Summary:        MinGW Windows PyQt5
Version:        5.11.2
Release:        1%{?pre:.%pre}%{?dist}

# GPLv2 exceptions(see GPL_EXCEPTIONS*.txt)
License:        (GPLv3 or GPLv2 with exceptions) and BSD
Url:            http://www.riverbankcomputing.com/software/pyqt/
%if 0%{?pre:1}
Source0: http://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-%{version}.%{pre}.tar.gz
%else
Source0: http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-%{version}/PyQt5_gpl-%{version}.tar.gz
%endif
# Don't see why enum34 should be required
Patch0:         PyQt5_enum.patch
# Don't see how "from PyQt5 import sip" could ever work
Patch1:         PyQt5_sip.patch
# Fix broken mk_distinfo install prefix handling (just took the mk_distinfo from sip which works)
Patch2:         PyQt5_mkdistinfo.patch
# Hack in WS_WIN instead of WS_X11 in sip-flags
Patch3:         PyQt5_wswin.patch
# Tweak configure for cross build
Patch4:         PyQt5_configure.patch


BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  python2-devel
BuildRequires:  sip-devel

BuildRequires:  qt5-qtbase-devel >= %{qt_ver}
BuildRequires:  qt5-qtlocation-devel >= %{qt_ver}
BuildRequires:  qt5-qtmultimedia-devel >= %{qt_ver}
BuildRequires:  qt5-qtsensors-devel >= %{qt_ver}
BuildRequires:  qt5-qtserialport-devel >= %{qt_ver}
BuildRequires:  qt5-qtsvg-devel >= %{qt_ver}
BuildRequires:  qt5-qttools-devel >= %{qt_ver}
BuildRequires:  qt5-qtwebkit-devel
BuildRequires:  qt5-qtxmlpatterns-devel >= %{qt_ver}

BuildRequires:  mingw32-filesystem >= 102
BuildRequires:  mingw32-gcc-c++
BuildRequires:  mingw32-python2
BuildRequires:  mingw32-qt5-qtbase >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtlocation >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtmultimedia >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtsensors >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtserialport >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtsvg >= %{qt_ver}
BuildRequires:  mingw32-qt5-qttools >= %{qt_ver}
BuildRequires:  mingw32-qt5-qtwebkit
BuildRequires:  mingw32-qt5-qtxmlpatterns >= %{qt_ver}
BuildRequires:  mingw32-sip

BuildRequires:  mingw64-filesystem >= 102
BuildRequires:  mingw64-gcc-c++
BuildRequires:  mingw64-python2
BuildRequires:  mingw64-qt5-qtbase >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtlocation >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtmultimedia >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtsensors >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtserialport >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtsvg >= %{qt_ver}
BuildRequires:  mingw64-qt5-qttools >= %{qt_ver}
BuildRequires:  mingw64-qt5-qtwebkit
BuildRequires:  mingw64-qt5-qtxmlpatterns >= %{qt_ver}
BuildRequires:  mingw64-sip

%description
MinGW Windows PyQt5

%package -n mingw32-python2-qt5
Summary:       MinGW Windows Python2-Qt5
Requires:      qt5-qtbase = %{qt_ver}
Requires:      sip
Requires:      mingw32-qt5-qtbase >= %{qt_ver}
Requires:      mingw32-qt5-qttools >= %{qt_ver}
Requires:      mingw32-sip

%description -n mingw32-python2-qt5
MinGW Windows Python2-Qt5


%package -n mingw64-python2-qt5
Summary:       MinGW Windows Python2-Qt5
Requires:      qt5-qtbase = %{qt_ver}
Requires:      sip
Requires:      mingw64-qt5-qtbase >= %{qt_ver}
Requires:      mingw64-qt5-qttools >= %{qt_ver}
Requires:      mingw64-sip

%description -n mingw64-python2-qt5
MinGW Windows Python2-Qt5


%{?mingw_debug_package}


%prep
%setup -q -n PyQt5_gpl-%{version}%{?pre:.%pre}
%patch0 -p1
%patch1 -p1
%patch2 -p1
rm -rf %{native_dir}
cp -a . %{native_dir}
pushd %{native_dir}
%patch3 -p1
popd

%patch4 -p1
rm -rf %{win64_dir}
cp -a . %{win64_dir}

%build
PREFIX=%{mingw32_prefix} mingw32-python configure.py \
  --assume-shared \
  --confirm-license \
  --sip=/usr/bin/mingw32-sip \
  --qmake=%{mingw32_qmake_qt5} \
  --no-qsci-api \
  --verbose

%mingw32_make %{?_smp_mflags}

(
cd %{win64_dir}
PREFIX=%{mingw64_prefix} mingw64-python configure.py \
  --assume-shared \
  --confirm-license \
  --sip=/usr/bin/mingw64-sip \
  --qmake=%{mingw64_qmake_qt5} \
  --no-qsci-api \
  --verbose

%mingw64_make %{?_smp_mflags}
)

(
cd %{native_dir}
%{__python2} configure.py \
  --assume-shared \
  --confirm-license \
  --qmake=%{_qt5_qmake} \
  --no-qsci-api \
  --verbose

%make_build
)


%install
%mingw32_make install INSTALL_ROOT=%{buildroot}
%mingw32_make install INSTALL_ROOT=%{buildroot} -C %{win64_dir}
%mingw32_make install INSTALL_ROOT=%{buildroot} -C %{native_dir}

# Remove Python 3 code from Python 2.x directory
rm -rf %{buildroot}%{mingw32_python2_sitearch}/PyQt5/uic/port_v3/
rm -rf %{buildroot}%{mingw64_python2_sitearch}/PyQt5/uic/port_v3/
rm -rf %{buildroot}%{python2_sitearch}/PyQt5/uic/port_v3/

# Move native build to host libs
find %{buildroot}%{python2_sitearch}/PyQt5/ -type f -name '*.so' -exec chmod +x {} \;
mkdir -p %{buildroot}%{_prefix}/%{mingw32_target}/lib/python2.7/site-packages/
mkdir -p %{buildroot}%{_prefix}/%{mingw64_target}/lib/python2.7/site-packages/
cp -a %{buildroot}%{python2_sitearch}/PyQt5 %{buildroot}%{_prefix}/%{mingw32_target}/lib/python2.7/site-packages/PyQt5
cp -a %{buildroot}%{python2_sitearch}/PyQt5 %{buildroot}%{_prefix}/%{mingw64_target}/lib/python2.7/site-packages/PyQt5

# Remove pylupdate, pyuic and pyrcc shell scripts
rm -f %{buildroot}%{mingw32_bindir}/py{lupdate,rcc,uic}5
rm -f %{buildroot}%{mingw64_bindir}/py{lupdate,rcc,uic}5

# Remove unused stuff
rm -rf %{buildroot}%{_libdir}
rm -rf %{buildroot}%{_bindir}
rm -rf %{buildroot}%{_datadir}

# Exclude debug files from the main files (note: the debug files are only created after %%install, so we can't search for them directly)
find %{buildroot}%{mingw32_prefix} | grep -E '.(exe|dll|pyd)$' | sed 's|^%{buildroot}\(.*\)$|%%exclude \1.debug|' > mingw32-%{pkgname}.debugfiles
find %{buildroot}%{mingw64_prefix} | grep -E '.(exe|dll|pyd)$' | sed 's|^%{buildroot}\(.*\)$|%%exclude \1.debug|' > mingw64-%{pkgname}.debugfiles


%files -n mingw32-python2-qt5 -f mingw32-%{pkgname}.debugfiles
%license LICENSE
%{_prefix}/%{mingw32_target}/lib/python2.7/site-packages/PyQt5/
%{mingw32_python2_sitearch}/PyQt5/
%{mingw32_python2_sitearch}/PyQt5-%{version}.dist-info/
%{mingw32_libdir}/qt5/plugins/designer/pyqt5.dll
%{mingw32_libdir}/qt5/plugins/PyQt5/
%{mingw32_datadir}/sip/PyQt5


%files -n mingw64-python2-qt5 -f mingw64-%{pkgname}.debugfiles
%license LICENSE
%{_prefix}/%{mingw64_target}/lib/python2.7/site-packages/PyQt5/
%{mingw64_python2_sitearch}/PyQt5/
%{mingw64_python2_sitearch}/PyQt5-%{version}.dist-info/
%{mingw64_libdir}/qt5/plugins/designer/pyqt5.dll
%{mingw64_libdir}/qt5/plugins/PyQt5/
%{mingw64_datadir}/sip/PyQt5


%changelog
* Fri Jul 20 2018 Sandro Mani <manisandro@gmail.com> - 5.11.2-1
- Update to 5.11.2
- Enable qtserialport bindings

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.10.2-0.3.dev1805251538
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Jun 21 2018 Sandro Mani <manisandro@gmail.com> - 5.10.2-0.2.dev1805251538
- Rebuild for qt5-5.11.1

* Fri Jun 01 2018 Sandro Mani <manisandro@gmail.com> - 5.10.2-0.1.dev1805251538
- Update to 5.10.2.dev1805251538

* Wed Mar 07 2018 Sandro Mani <manisandro@gmail.com> - 5.10.1-1
- Update to 5.10.1

* Mon Feb 19 2018 Sandro Mani <manisandro@gmail.com> - 5.10-5
- Add missing BR: gcc-c++, make

* Sat Feb 17 2018 Sandro Mani <manisandro@gmail.com> - 5.10-4
- Bump qt_ver to 5.10.1

* Fri Feb 16 2018 Sandro Mani <manisandro@gmail.com> - 5.10-3
- Rebuild for qt5-5.10.1

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jan 24 2018 Sandro mani <manisandro@gmail.com> - 5.10-1
- Update to 5.10

* Mon Jan 08 2018 Sandro Mani <manisandro@gmail.com> - 5.9.2-3
- Support Qt5 newer than just 5.9.3 (+5.9.4,5.10.0,5.10.1)

* Thu Dec 21 2017 Sandro Mani <manisandro@gmail.com> - 5.9.2-2
- Rebuild for qt5-5.10.0

* Mon Nov 27 2017 Sandro Mani <manisandro@gmail.com> - 5.9.2-1
- Update to 5.9.2

* Sat Nov 04 2017 Sandro Mani <manisandro@gmail.com> - 5.9.1-1
- Update to 5.9.1

* Wed Oct 11 2017 Sandro Mani <manisandro@gmail.com> - 5.9-6
- Also build qtlocation, qtmultimedia and qtsensor bindings

* Wed Oct 11 2017 Jan Grulich <jgrulich@redhat.com> - 5.9-5
- Bump qt_ver to 5.9.2

* Tue Sep 19 2017 Sandro Mani <manisandro@gmail.com> - 5.9-4
- Rebuild (mingw-filesystem)

* Tue Sep 05 2017 Sandro Mani <manisandro@gmail.com> - 5.9-3
- Require mingw{32,64}-qt5-qttools for directory ownership

* Wed Aug 09 2017 Sandro Mani <manisandro@gmail.com> - 5.9-2
- Bump qt_ver to 5.9.1

* Tue Jul 11 2017 Sandro Mani <manisandro@gmail.com> - 5.9-1
- Update to 5.9

* Sat May 06 2017 Sandro Mani <manisandro@gmail.com> - 5.8.2-1
- Initial package