Browse Source

PyQt now builds on windows

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.1
falkTX 4 years ago
parent
commit
25b8afe248
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 137 additions and 16 deletions
  1. +51
    -16
      bootstrap-carla.sh
  2. +53
    -0
      patches/PyQt5_gpl/win32/01_cfg-env-vars.patch
  3. +31
    -0
      patches/PyQt5_gpl/win32/02_qmake-xspec.patch
  4. +1
    -0
      patches/PyQt5_gpl/win64
  5. +1
    -0
      setup/versions.sh

+ 51
- 16
bootstrap-carla.sh View File

@@ -121,7 +121,22 @@ function build_pyqt() {


if [ ! -f "${pkgdir}/.stamp_configured" ]; then if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}" pushd "${pkgdir}"
${EXE_WRAPPER} "${PAWPAW_PREFIX}/bin/python3${APP_EXT}" configure.py ${extraconfrules}

# Place link to Qt DLLs for PyQt tests
if [ "${WIN32}" -eq 1 ] && [ "${name}" = "PyQt5_gpl" ]; then
mkdir -p release
ln -sf "${PAWPAW_PREFIX}/bin"/Qt* release/
fi

python3 configure.py ${extraconfrules}

# build sip as host tool first
if [ "${CROSS_COMPILING}" -eq 1 ] && [ "${name}" = "sip" ]; then
pushd "sipgen"
PATH="${OLD_PATH}" make sip LFLAGS="-Wl,-s" ${MAKE_ARGS}
popd
fi

# use env vars # use env vars
sed -i -e 's/CC = gcc/CC ?= gcc/' */Makefile sed -i -e 's/CC = gcc/CC ?= gcc/' */Makefile
sed -i -e 's/CXX = g++/CXX ?= g++/' */Makefile sed -i -e 's/CXX = g++/CXX ?= g++/' */Makefile
@@ -129,20 +144,27 @@ function build_pyqt() {
sed -i -e 's/CFLAGS *=/CFLAGS +=/' */Makefile sed -i -e 's/CFLAGS *=/CFLAGS +=/' */Makefile
sed -i -e 's/CXXFLAGS *=/CXXFLAGS +=/' */Makefile sed -i -e 's/CXXFLAGS *=/CXXFLAGS +=/' */Makefile
sed -i -e 's/LIBS *=/LIBS += $(LDFLAGS)/' */Makefile sed -i -e 's/LIBS *=/LIBS += $(LDFLAGS)/' */Makefile

# use abstract python3 path
sed -i -e 's|/usr/bin/python3|python3|g' Makefile

# use PREFIX var # use PREFIX var
sed -i -e 's|$(DESTDIR)/usr|$(DESTDIR)$(PREFIX)|g' */Makefile
sed -i -e "s|/usr|${PAWPAW_PREFIX}|g" installed.txt Makefile */Makefile

if [ -f "QtCore/Makefile.Release" ]; then
sed -i -e "s|/usr|${PAWPAW_PREFIX}|g" */Makefile.Release
fi

# fix win32 linkage # fix win32 linkage
if [ "${WIN32}" -eq 1 ]; then if [ "${WIN32}" -eq 1 ]; then
sed -i -e 's|config -lpython|config-3.8 -Wl,-Bdynamic -lpython|' */Makefile sed -i -e 's|config -lpython|config-3.8 -Wl,-Bdynamic -lpython|' */Makefile
if [ -f "QtCore/Makefile.Release" ]; then
for mak in $(find -maxdepth 2 -type f -name Makefile.Release); do
echo "LIBS += -L${PAWPAW_PREFIX}/lib/python3.8/config-3.8 -Wl,-Bdynamic -lpython3.8" >> ${mak}
done
fi
fi fi
# fix cross-compiling (wine)
if [ "${CROSS_COMPILING}" -eq 1 ]; then
sed -i -e 's|\\|/|g' Makefile */Makefile installed.txt
sed -i -e "s|H:|${HOME}|g" Makefile */Makefile installed.txt
sed -i -e "s|Z:||g" Makefile */Makefile installed.txt
sed -i -e "s|.exe.exe|.exe|g" installed.txt
sed -i -e "s|${PAWPAW_PREFIX}/bin/python3${APP_EXT}|python3|" Makefile */Makefile
fi

touch .stamp_configured touch .stamp_configured
popd popd
fi fi
@@ -157,6 +179,17 @@ function build_pyqt() {
if [ ! -f "${pkgdir}/.stamp_installed" ]; then if [ ! -f "${pkgdir}/.stamp_installed" ]; then
pushd "${pkgdir}" pushd "${pkgdir}"
make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS} -j 1 install make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS} -j 1 install

if [ "${name}" = "PyQt5_gpl" ]; then
sed -i -e "s|/usr|${PAWPAW_PREFIX}|g" ${PAWPAW_PREFIX}/bin/pylupdate5
sed -i -e "s|/usr|${PAWPAW_PREFIX}|g" ${PAWPAW_PREFIX}/bin/pyrcc5
sed -i -e "s|/usr|${PAWPAW_PREFIX}|g" ${PAWPAW_PREFIX}/bin/pyuic5
if [ -n "${EXE_WRAPPER}" ]; then
sed -i -e "s|exec /|exec ${EXE_WRAPPER} /|g" ${PAWPAW_PREFIX}/bin/pylupdate5
sed -i -e "s|exec /|exec ${EXE_WRAPPER} /|g" ${PAWPAW_PREFIX}/bin/pyrcc5
sed -i -e "s|exec /|exec ${EXE_WRAPPER} /|g" ${PAWPAW_PREFIX}/bin/pyuic5
fi
fi
touch .stamp_installed touch .stamp_installed
popd popd
fi fi
@@ -230,11 +263,6 @@ fi
download sip "${SIP_VERSION}" "${SIP_DOWNLOAD_URL}" download sip "${SIP_VERSION}" "${SIP_DOWNLOAD_URL}"
build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}" build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}"


# TODO: finish this
if [ "${WIN32}" -eq 1 ]; then
exit 0
fi

# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# pyqt5 # pyqt5


@@ -246,8 +274,15 @@ else
PYQT5_SUFFIX="_gpl" PYQT5_SUFFIX="_gpl"
fi fi


PYQT5_EXTRAFLAGS="--qmake ${PAWPAW_PREFIX}/bin/qmake --sip ${PAWPAW_PREFIX}/bin/sip"

download PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_DOWNLOAD_URL}" download PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_DOWNLOAD_URL}"
build_pyqt PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "--concatenate --confirm-license -c"
build_pyqt PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_EXTRAFLAGS} --concatenate --confirm-license -c"

# TODO: finish this
if [ "${WIN32}" -eq 1 ]; then
exit 0
fi


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# cython (optional) # cython (optional)


+ 53
- 0
patches/PyQt5_gpl/win32/01_cfg-env-vars.patch View File

@@ -0,0 +1,53 @@
diff --git a/configure.py b/configure.py
index d893ae8..7d13747 100644
--- a/configure.py
+++ b/configure.py
@@ -1558,7 +1558,7 @@ def generate_makefiles(target_config, verbose, parts, tracing, fatal_warnings, d
inf = open_for_writing('__init__.py')
inf.write(contents)
- if target_config.py_platform == 'win32':
+ if target_config.py_platform == 'win32' or True:
# On Windows we try and make sure the Qt DLLs can be found, either any
# bundled copies or an existing installation (using the traditional
# Windows DLL search). We don't raise an exception in case the
@@ -2124,11 +2124,8 @@ def run_make(target_config, verbose, exe, makefile_name):
# 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:
- make = 'nmake'
+ if target_config.py_platform == 'win32' or True:
+ make = 'make'
if target_config.debug:
makefile_target = 'debug'
@@ -2421,6 +2418,10 @@ def compile_test_program(target_config, verbose, mname, source=None, debug=None)
pro_lines.append('TARGET = %s' % name)
pro_lines.append('SOURCES = %s' % qmake_quote(name_source))
+ pro_lines.append('QMAKE_CXXFLAGS += $$(CXXFLAGS)')
+ pro_lines.append('QMAKE_CFLAGS += $$(CFLAGS)')
+ pro_lines.append('QMAKE_LFLAGS += $$(LDFLAGS)')
+
f = open_for_writing(name_pro)
f.write('\n'.join(pro_lines))
@@ -2442,7 +2443,13 @@ def run_test_program(mname, test, verbose):
# Create the output file, first making sure it doesn't exist.
remove_file(out_file)
- run_command(test + ' ' + out_file, verbose)
+
+ exe_wrapper = os.getenv('EXE_WRAPPER')
+ if exe_wrapper is not None:
+ exe_wrapper += ' '
+ else:
+ exe_wrapper = ''
+ run_command(exe_wrapper + test + ' ' + out_file, verbose)
if not os.access(out_file, os.F_OK):
error("%s failed to create %s. Make sure your Qt installation is correct." % (test, out_file))

+ 31
- 0
patches/PyQt5_gpl/win32/02_qmake-xspec.patch View File

@@ -0,0 +1,31 @@
diff --git a/configure.py b/configure.py
index 7d13747..a1cd0e9 100644
--- a/configure.py
+++ b/configure.py
@@ -768,7 +768,7 @@ class TargetConfiguration:
self.qsci_api = os.path.isdir(self.qsci_api_dir)
# Save the default qmake spec. and finalise the value we want to use.
- self.qmake_spec_default = qt_config.QMAKE_SPEC
+ self.qmake_spec_default = qt_config.QMAKE_XSPEC or qt_config.QMAKE_SPEC
# On Windows for Qt versions prior to v5.9.0 we need to be explicit
# about the qmake spec.
@@ -1908,7 +1908,7 @@ def pro_sources(src_dir, other_headers=None, other_sources=None):
def module_file_name(target_config, name):
""" Return the name of a file implementing a module. """
- if sys.platform == 'win32':
+ if sys.platform == 'win32' or target_config.qmake_spec == 'win32-g++':
fs = '{}.lib' if target_config.static else '{}.pyd'
else:
fs = 'lib{}.a' if target_config.static else '{}.so'
@@ -2514,7 +2514,7 @@ def get_sip_flags(target_config):
sip_flags.append('-D')
# Handle the platform tag. (Allow for win32-g++.)
- if target_config.py_platform.startswith('win32'):
+ if target_config.py_platform.startswith('win32') or target_config.qmake_spec == 'win32-g++':
plattag = 'WS_WIN'
elif target_config.py_platform == 'darwin':
plattag = 'WS_MACX'

+ 1
- 0
patches/PyQt5_gpl/win64 View File

@@ -0,0 +1 @@
win32

+ 1
- 0
setup/versions.sh View File

@@ -76,6 +76,7 @@ if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
ZIPP_VERSION=3.4.0 ZIPP_VERSION=3.4.0
elif [ "${WIN32}" -eq 1 ]; then elif [ "${WIN32}" -eq 1 ]; then
PYTHON_VERSION=3.8.7 PYTHON_VERSION=3.8.7
PYQT5_VERSION=5.13.1
SIP_VERSION=4.19.19 SIP_VERSION=4.19.19
else else
CXFREEZE_VERSION=6.1 CXFREEZE_VERSION=6.1


Loading…
Cancel
Save