Commit 73da6ae3 authored by Ivan Yossi's avatar Ivan Yossi 👌 Committed by Ashwin Dhakaita

packaging osx: Add Python as Framework

a Python.Framework install precompiles all python files and
also behaves better with code signing process.

To migrate:
- rebuild ext_python ext_sip ext_pyqt
- remove from BUILDROOT/i/lib python3.5 directory
parent 5f43b695
......@@ -10,7 +10,8 @@ if (UNIX)
PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/pyport_osx.diff
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/osx_fixappinstall.diff
CONFIGURE_COMMAND <SOURCE_DIR>/configure MACOSX_DEPLOYMENT_TARGET=10.11 -prefix=${PREFIX_ext_python} ${GLOBAL_AUTOMAKE_PROFILE} --enable-shared
CONFIGURE_COMMAND <SOURCE_DIR>/configure MACOSX_DEPLOYMENT_TARGET=10.11 -prefix=${PREFIX_ext_python} ${GLOBAL_AUTOMAKE_PROFILE}
CONFIGURE_COMMAND <SOURCE_DIR>/configure MACOSX_DEPLOYMENT_TARGET=10.11 -prefix=${PREFIX_ext_python} --with-cxx-main=/usr/bin/g++ --without-ensurepip --without-gcc --enable-shared
--with-cxx-main=/usr/bin/g++ --without-ensurepip --disable-tests --without-test --without-tests --enable-framework=${PREFIX_ext_python}/lib
BUILD_COMMAND make
INSTALL_COMMAND make install
......
......@@ -230,7 +230,8 @@ else( APPLE )
endif()
ExternalProject_Add(ext_qt
ExternalProject_Add(
ext_qt
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
LOG_DOWNLOAD ON
......
......@@ -21,34 +21,27 @@ if (UNIX)
UPDATE_COMMAND ""
)
else(APPLE)
find_package(PythonInterp 3.5)
if(NOT PYTHONINTERP_FOUND)
SET(PYTHON_EXECUTABLE ${PREFIX_ext_sip}/bin/python3)
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
message("WARNING: using system python3!")
SET(PYTHON_EXECUTABLE python3)
endif()
# Get PYTHONVERSION
execute_process(COMMAND ${PYTHON_EXECUTABLE} -V COMMAND awk "{print $2}" OUTPUT_VARIABLE PYTHON_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION})
list(GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
list(GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
endif()
set(PY_VER "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
ExternalProject_Add( ext_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.15.zip
URL_MD5 4a1a4760cfabef15d68f45a6920974c2
URL https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
URL_MD5 bba62b2ea7e16193c7dfcfadb8dd0d05
-b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/
CONFIGURE_COMMAND ${PYTHON_EXECUTABLE} <SOURCE_DIR>/configure.py -b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/sip -e ${PREFIX_ext_sip}/include --sipdir ${PREFIX_ext_sip}/sip --target-py-version ${PY_VER} --sip-module PyQt5.sip
CONFIGURE_COMMAND ${PYTHON_EXECUTABLE} <SOURCE_DIR>/configure.py --deployment-target=10.11
-b ${PREFIX_ext_sip}/bin -d ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/
-e ${PREFIX_ext_sip}/include --sipdir ${PREFIX_ext_sip}/share/sip --target-py-version 3.5 --sip-module PyQt5.sip
BUILD_COMMAND make
INSTALL_COMMAND make install
# COMMAND ${CMAKE_COMMAND} -E create_symlink ./PyQt5/sip.so ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/sip.so
# COMMAND ${CMAKE_COMMAND} -E create_symlink ./PyQt5/sip.pyi ${PREFIX_ext_sip}/lib/Python.framework/Versions/Current/site-packages/sip.pyi
BUILD_IN_SOURCE 1
......
......@@ -392,8 +392,6 @@ krita_deploy () {
mkdir -p ${KRITA_DMG}/krita.app/Contents/PlugIns
mkdir -p ${KRITA_DMG}/krita.app/Contents/Frameworks
mkdir -p ${KRITA_DMG}/krita.app/Contents/Frameworks
echo "Copying share..."
# Deletes old copies of translation and qml to be recreated
cd ${KIS_INSTALL_DIR}/share/
......@@ -445,12 +443,6 @@ krita_deploy () {
# rsync -prul {KIS_INSTALL_DIR}/lib/libkrita* Frameworks/
echo "Copying python..."
# folders with period in name are treated as Frameworks for codesign
# there cant be empty files
rsync -prul ${KIS_INSTALL_DIR}/lib/python3.5/ ${KRITA_DMG}/krita.app/Contents/Frameworks/python
ln -s python ${KRITA_DMG}/krita.app/Contents/Frameworks/python3.5
rsync -prul ${KIS_INSTALL_DIR}/lib/krita-python-libs ${KRITA_DMG}/krita.app/Contents/Frameworks/
# To avoid errors macdeployqt must be run from bin location
# ext_qt will not build macdeployqt by default so it must be build manually
# cd ${BUILDROOT}/depbuild/ext_qt/ext_qt-prefix/src/ext_qt/qttools/src
......@@ -497,11 +489,6 @@ krita_deploy () {
krita_findmissinglibs $(find ${KRITA_DMG}/krita.app/Contents -type f -perm 755 -or -name "*.dylib" -or -name "*.so")
echo "Done!"
# fix python
# precompile all pyc so the dont alter signature
cd ${KRITA_DMG}/krita.app
${KIS_INSTALL_DIR}/bin/python -m compileall .
}
# helper to define function only once
......
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