Commit afa91271 authored by Amyspark's avatar Amyspark Committed by Dmitry Kazakov
Browse files

AppImage: add PyQt5/SIP v5 support

(cherry picked from commit 3f54b83f)
parent b263b566
SET(PREFIX_ext_pyqt "${EXTPREFIX}" )
if (UNIX)
if (APPLE)
SET(PYTHON_EXECUTABLE_PATH ${PREFIX_ext_pyqt}/bin/python3)
if(NOT EXISTS ${PYTHON_EXECUTABLE_PATH})
message("WARNING: using system python3!")
......@@ -29,6 +29,70 @@ if (UNIX)
UPDATE_COMMAND ""
)
elseif(UNIX)
SET(PYTHON_EXECUTABLE_PATH ${PREFIX_ext_pyqt}/bin/python3)
if(NOT EXISTS ${PYTHON_EXECUTABLE_PATH})
message("WARNING: using system python3!")
SET(PYTHON_EXECUTABLE_PATH python3)
endif()
ExternalProject_Add(ext_pyqtbuilder
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.io/packages/source/P/PyQt-builder/PyQt-builder-1.10.0.tar.gz
URL_HASH SHA256=86bd19fde83d92beaefacdeac1e26c6e1918c300ff78d7ec2a19973bf2cf21b5
CONFIGURE_COMMAND ""
BUILD_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py build ${_compiler} -j ${SUBMAKE_JOBS}
INSTALL_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py install --skip-build --prefix=${PREFIX_ext_pyqt} --optimize=1
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
ExternalProject_Add( ext_pyqt5
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.python.org/packages/source/P/PyQt5/PyQt5-5.15.4.tar.gz
URL_HASH SHA256=2a69597e0dd11caabe75fae133feca66387819fc9bc050f547e5551bce97e5be
CONFIGURE_COMMAND sip-build --confirm-license --no-designer-plugin --no-qml-plugin --no-dbus-python --no-tools --no-make --jobs ${SUBMAKE_JOBS}
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR>/build make -j${SUBMAKE_JOBS}
# force single-threaded installation to avoid
# race conditions in post-install .py script
INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR>/build make -j1 install
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
DEPENDS ext_sip ext_pyqtbuilder
)
ExternalProject_Add( ext_pyqt5_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.python.org/packages/source/P/PyQt5-sip/PyQt5_sip-12.9.0.tar.gz
URL_HASH SHA256=d3e4489d7c2b0ece9d203ae66e573939f7f60d4d29e089c9f11daa17cfeaae32
CONFIGURE_COMMAND ""
BUILD_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py build ${_compiler} -j ${SUBMAKE_JOBS}
# distutils already specifies the full path to the AppImage root
# it trims the first path separator and appends the rest to the root below
# if this is not set, it doesn't install the egg within site-packages
INSTALL_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py install --root=/
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
add_custom_target(ext_pyqt)
add_dependencies(ext_pyqt ext_pyqt5 ext_pyqt5_sip)
elseif(MINGW)
list(APPEND _PYQT_conf
......
SET(PREFIX_ext_sip "${EXTPREFIX}" )
if (UNIX)
if(NOT APPLE)
SET(PYTHON_EXECUTABLE_PATH ${PREFIX_ext_sip}/bin/python3)
if(NOT EXISTS ${PYTHON_EXECUTABLE_PATH})
message("WARNING: using system python3!")
SET(PYTHON_EXECUTABLE_PATH python3)
endif()
SET(PYTHON_EXECUTABLE_PATH ${PREFIX_ext_sip}/bin/python3)
if(NOT EXISTS ${PYTHON_EXECUTABLE_PATH})
message("WARNING: using system python3!")
SET(PYTHON_EXECUTABLE_PATH python3)
endif()
ExternalProject_Add( ext_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://files.kde.org/krita/build/dependencies/sip-4.19.19.tar.gz
URL_MD5 98111479309dc472410f26080d6d4a88
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://pypi.python.org/packages/source/s/sip/sip-6.1.0.tar.gz
URL_HASH SHA256=f069d550dd819609e019e5dc58fc5193e081c7f3fb4f7dc8f9be734e34d4e56e
CONFIGURE_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/configure.py -b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/lib/python3.8/site-packages -e ${PREFIX_ext_sip}/include --sipdir ${PREFIX_ext_sip}/sip --target-py-version 3.8 --sip-module PyQt5.sip
BUILD_COMMAND make
CONFIGURE_COMMAND ""
# force single-threaded installation to avoid
# race conditions in post-install .py script
INSTALL_COMMAND make -j1 install
BUILD_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py build -j ${SUBMAKE_JOBS}
INSTALL_COMMAND ${PYTHON_EXECUTABLE_PATH} <SOURCE_DIR>/setup.py install --skip-build --prefix=${PREFIX_ext_sip} --optimize=1
BUILD_IN_SOURCE 1
......
......@@ -48,9 +48,22 @@ cp -r $DEPS_INSTALL_PREFIX/share/locale $APPDIR/usr/share/krita
cp -r $DEPS_INSTALL_PREFIX/share/kf5 $APPDIR/usr/share
cp -r $DEPS_INSTALL_PREFIX/share/mime $APPDIR/usr/share
cp -r $DEPS_INSTALL_PREFIX/lib/python3.8 $APPDIR/usr/lib
if [ -d $DEPS_INSTALL_PREFIX/share/sip ] ; then
cp -r $DEPS_INSTALL_PREFIX/share/sip $APPDIR/usr/share
fi
cp -r $DEPS_INSTALL_PREFIX/translations $APPDIR/usr/
if [ -d $APPDIR/usr/lib/python3.8/site-packages ]; then
rm -rf $APPDIR/usr/lib/python3.8/site-packages/packaging*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/pip*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/pyparsing*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/PyQt_builder*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/setuptools*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/sip*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/toml*
rm -rf $APPDIR/usr/lib/python3.8/site-packages/easy-install.pth
fi
# Step 2: Relocate binaries from the architecture specific directory as required for Appimages
if [[ -d "$APPDIR/usr/lib/$TRIPLET" ]] ; then
mv $APPDIR/usr/lib/$TRIPLET/* $APPDIR/usr/lib
......@@ -73,7 +86,9 @@ done
patchelf --set-rpath '$ORIGIN/../../../..' $APPDIR/usr/lib/qml/org/krita/draganddrop/libdraganddropplugin.so
patchelf --set-rpath '$ORIGIN/../../../..' $APPDIR/usr/lib/qml/org/krita/sketch/libkritasketchplugin.so
patchelf --set-rpath '$ORIGIN/../..' $APPDIR/usr/lib/krita-python-libs/PyKrita/krita.so
if [ -f $APPDIR/usr/lib/python3.8/site-packages/PyQt5/sip.so ] ; then
patchelf --set-rpath '$ORIGIN/../..' $APPDIR/usr/lib/python3.8/site-packages/PyQt5/sip.so
fi
# Step 5: Find out what version of Krita we built and give the Appimage a proper name
cd $BUILD_PREFIX/krita-build
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment