From 06262108948f0d66e5e1c7d535da5d176548cc0e Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Sep 05 2017 14:46:13 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b36d64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/PyQt5_gpl-5.9.zip diff --git a/PyQt5_configure.patch b/PyQt5_configure.patch new file mode 100644 index 0000000..d65936c --- /dev/null +++ b/PyQt5_configure.patch @@ -0,0 +1,121 @@ +diff -rupN PyQt5_gpl-5.9/configure.py PyQt5_gpl-5.9-new/configure.py +--- PyQt5_gpl-5.9/configure.py 2017-07-03 18:25:14.000000000 +0200 ++++ PyQt5_gpl-5.9-new/configure.py 2017-07-12 23:10:17.071698512 +0200 +@@ -473,19 +473,20 @@ class TargetConfiguration: + + def __init__(self): + """ Initialise the configuration with default values. """ ++ prefix = os.environ["PREFIX"] + + # Values based on the host Python configuration. + py_config = HostPythonConfiguration() + self.py_debug = py_config.debug +- self.py_inc_dir = py_config.inc_dir +- self.py_venv_inc_dir = py_config.venv_inc_dir +- self.py_lib_dir = py_config.lib_dir +- self.py_platform = py_config.platform ++ self.py_inc_dir = os.path.join(prefix, 'include/python2.7/') ++ self.py_venv_inc_dir = os.path.join(prefix, 'include/python2.7/') ++ self.py_lib_dir = os.path.join(prefix, 'lib') ++ self.py_platform = 'win32-g++' + self.py_version = py_config.version +- self.pyqt_bin_dir = py_config.bin_dir +- self.pyqt_module_dir = py_config.module_dir +- self.pyqt_stubs_dir = os.path.join(py_config.module_dir, 'PyQt5') +- self.pyqt_sip_dir = os.path.join(py_config.data_dir, 'sip', 'PyQt5') ++ self.pyqt_bin_dir = os.path.join(prefix, 'bin') ++ self.pyqt_module_dir = os.path.join(prefix, 'lib/python2.7/site-packages') ++ self.pyqt_stubs_dir = os.path.join(prefix, 'lib/python2.7/site-packages', 'PyQt5') ++ self.pyqt_sip_dir = os.path.join(prefix, 'share', 'sip', 'PyQt5') + self.pyuic_interpreter = py_config.pyuic_interpreter + + # Remaining values. +@@ -625,7 +626,7 @@ class TargetConfiguration: + py_major = self.py_version >> 16 + py_minor = (self.py_version >> 8) & 0x0ff + +- if sys.platform == 'win32': ++ if True: + debug_suffix = self.get_win32_debug_suffix() + + # See if we are using the limited API. +@@ -636,7 +637,7 @@ class TargetConfiguration: + if limited: + pylib_lib = 'python%d%s' % (py_major, debug_suffix) + else: +- pylib_lib = 'python%d%d%s' % (py_major, py_minor, debug_suffix) ++ pylib_lib = 'python%d.%d%s' % (py_major, py_minor, debug_suffix) + + pylib_dir = self.py_lib_dir + +@@ -1316,8 +1317,8 @@ def check_5_1_modules(target_config, dis + 'qsensor.h', 'new QSensor(QByteArray())') + check_module(target_config, disabled_modules, verbose, 'QtSerialPort', + 'qserialport.h', 'new QSerialPort()') +- check_module(target_config, disabled_modules, verbose, 'QtX11Extras', +- 'QX11Info', 'QX11Info::display()') ++ #check_module(target_config, disabled_modules, verbose, 'QtX11Extras', ++ # 'QX11Info', 'QX11Info::display()') + + + def check_5_2_modules(target_config, disabled_modules, verbose): +@@ -1918,11 +1919,11 @@ def run_make(target_config, verbose, exe + + # Guess the name of make and set the default target and platform specific + # name of the executable. +- if target_config.py_platform == 'win32': +- if target_config.qmake_spec == 'win32-g++': +- make = 'mingw32-make' +- else: ++ if target_config.py_platform.startswith('win32'): ++ if target_config.qmake_spec.startswith('win32-msvc'): + make = 'nmake' ++ else: ++ make = 'make' + + if target_config.debug: + makefile_target = 'debug' +@@ -2188,6 +2189,12 @@ def compile_test_program(target_config, + configuration. + """ + ++ host_config = TargetConfiguration() ++ host_config.qmake = "qmake-qt5" ++ host_config.qmake_spec = "linux-g++" ++ host_config.py_platform = "linux" ++ host_config.qmake_variables = "" ++ + metadata = MODULE_METADATA[mname] + + # The derived file names. +@@ -2206,7 +2213,7 @@ def compile_test_program(target_config, + + # Create the .pro file. + pro_lines = [] +- pro_add_qt_dependencies(target_config, metadata, pro_lines, debug) ++ pro_add_qt_dependencies(host_config, metadata, pro_lines, debug) + pro_lines.append('TARGET = %s' % name) + pro_lines.append('SOURCES = %s' % name_source) + +@@ -2214,10 +2221,10 @@ def compile_test_program(target_config, + f.write('\n'.join(pro_lines)) + f.close() + +- if not run_qmake(target_config, verbose, name_pro, name_makefile, fatal=False): ++ if not run_qmake(host_config, verbose, name_pro, name_makefile, fatal=False): + return None + +- return run_make(target_config, verbose, name, name_makefile) ++ return run_make(host_config, verbose, name, name_makefile) + + + def run_test_program(mname, test, verbose): +@@ -2295,7 +2302,7 @@ def get_sip_flags(target_config): + sip_flags.append('-D') + + # Handle the platform tag. +- if target_config.py_platform == 'win32': ++ if target_config.py_platform.startswith('win32'): + plattag = 'WS_WIN' + elif target_config.py_platform == 'darwin': + plattag = 'WS_MACX' diff --git a/PyQt5_wswin.patch b/PyQt5_wswin.patch new file mode 100644 index 0000000..100a5ad --- /dev/null +++ b/PyQt5_wswin.patch @@ -0,0 +1,12 @@ +diff -rupN PyQt5_gpl-5.9/configure.py PyQt5_gpl-5.9-new/configure.py +--- PyQt5_gpl-5.9/configure.py 2017-07-12 10:47:29.155073950 +0200 ++++ PyQt5_gpl-5.9-new/configure.py 2017-07-12 10:47:20.524091990 +0200 +@@ -2441,7 +2441,7 @@ def generate_sip_module_code(target_conf + os.path.join('QtCore', 'qpycore_post_init.cpp')) + + for line in in_f: +- line = line.replace('@@PYQT_SIP_FLAGS@@', sip_flags) ++ line = line.replace('@@PYQT_SIP_FLAGS@@', sip_flags.replace("WS_X11", "WS_WIN")) + out_f.write(line) + + in_f.close() diff --git a/README.md b/README.md deleted file mode 100644 index f7eea5a..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# mingw-python-qt5 - -The mingw-python-qt5 package \ No newline at end of file diff --git a/mingw-python-qt5.spec b/mingw-python-qt5.spec new file mode 100644 index 0000000..bbe45b8 --- /dev/null +++ b/mingw-python-qt5.spec @@ -0,0 +1,200 @@ +%{?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.9.1 + +Name: mingw-%{pkgname} +Summary: MinGW Windows PyQt5 +Version: 5.9 +Release: 3%{?dist} + +# GPLv2 exceptions(see GPL_EXCEPTIONS*.txt) +License: (GPLv3 or GPLv2 with exceptions) and BSD +Url: http://www.riverbankcomputing.com/software/pyqt/ +Source0: http://downloads.sourceforge.net/project/pyqt/PyQt5/PyQt-%{version}/PyQt5_gpl-%{version}.zip +# Tweak configure for cross build +Patch0: PyQt5_configure.patch +# Hack in WS_WIN instead of WS_X11 in sip-flags +Patch1: PyQt5_wswin.patch + +BuildRequires: python2-devel +BuildRequires: sip-devel +BuildRequires: qt5-qtbase-devel >= %{qt_ver} +BuildRequires: qt5-qtsvg-devel >= %{qt_ver} +BuildRequires: qt5-qttools-devel >= %{qt_ver} +BuildRequires: qt5-qtwebkit-devel >= %{qt_ver} +BuildRequires: qt5-qtxmlpatterns-devel >= %{qt_ver} + +BuildRequires: mingw32-filesystem >= 95 +BuildRequires: mingw32-gcc-c++ +BuildRequires: mingw32-python2 +BuildRequires: mingw32-qt5-qtbase >= %{qt_ver} +BuildRequires: mingw32-qt5-qtsvg >= %{qt_ver} +BuildRequires: mingw32-qt5-qttools >= %{qt_ver} +BuildRequires: mingw32-qt5-qtwebkit >= %{qt_ver} +BuildRequires: mingw32-qt5-qtxmlpatterns >= %{qt_ver} +BuildRequires: mingw32-sip + +BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw64-gcc-c++ +BuildRequires: mingw64-python2 +BuildRequires: mingw64-qt5-qtbase >= %{qt_ver} +BuildRequires: mingw64-qt5-qtsvg >= %{qt_ver} +BuildRequires: mingw64-qt5-qttools >= %{qt_ver} +BuildRequires: mingw64-qt5-qtwebkit >= %{qt_ver} +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} + +rm -rf %{native_dir} +cp -a . %{native_dir} +pushd %{native_dir} +%patch1 -p1 +popd + +%patch0 -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} + + + + +%files -n mingw32-python2-qt5 +%license LICENSE +%{_prefix}/%{mingw32_target}/lib/python2.7/site-packages/PyQt5/ +%{mingw32_python2_sitearch}/PyQt5/ +%exclude %{mingw32_python2_sitearch}/PyQt5/*.debug +%{mingw32_libdir}/qt5/plugins/designer/pyqt5.dll +%{mingw32_libdir}/qt5/plugins/PyQt5/ +%{mingw32_datadir}/sip/PyQt5 + + +%files -n mingw64-python2-qt5 +%license LICENSE +%{_prefix}/%{mingw64_target}/lib/python2.7/site-packages/PyQt5/ +%{mingw64_python2_sitearch}/PyQt5/ +%exclude %{mingw64_python2_sitearch}/PyQt5/*.debug +%{mingw64_libdir}/qt5/plugins/designer/pyqt5.dll +%{mingw64_libdir}/qt5/plugins/PyQt5/ +%{mingw64_datadir}/sip/PyQt5 + + +%changelog +* Tue Sep 05 2017 Sandro Mani - 5.9-3 +- Require mingw{32,64}-qt5-qttools for directory ownership + +* Wed Aug 09 2017 Sandro Mani - 5.9-2 +- Bump qt_ver to 5.9.1 + +* Tue Jul 11 2017 Sandro Mani - 5.9-1 +- Update to 5.9 + +* Sat May 06 2017 Sandro Mani - 5.8.2-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..04cfac8 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (PyQt5_gpl-5.9.zip) = 5997469bbd4f07e94c1d8ccd592fefa7e07a55a8753efcc4cffa17bf6eb4fd114e0dc749968db600eb1fd9b8cf099cd063d11cc5197eba9ab88daa38172391b3