Commit c36fae1d authored by Ivan Yossi's avatar Ivan Yossi 👌

macos build: update ext_sip, ext_python, ext_pyqt to build

a correct instalation of Python in OSX

update packaging script to include Python in deployed DMG
parent 4fb9f152
......@@ -8,7 +8,7 @@ if (UNIX)
PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/pyport_osx.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} --with-cxx-main=/usr/bin/g++ --without-ensurepip --without-gcc --enable-shared
BUILD_COMMAND make
INSTALL_COMMAND make install
COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_python}/bin/python3 ${PREFIX_ext_python}/bin/python
......
SET(PREFIX_ext_sip "${EXTPREFIX}" )
if (UNIX)
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()
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()
ExternalProject_Add( ext_sip
ExternalProject_Add( ext_sip
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://www.riverbankcomputing.com/static/Downloads/sip/4.19.15/sip-4.19.15.tar.gz
URL_MD5 236578d2199da630ae1251671b9a7bfe
......@@ -15,10 +16,43 @@ if (UNIX)
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
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.14.tar.gz
URL_MD5 bba62b2ea7e16193c7dfcfadb8dd0d05
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
BUILD_COMMAND make
INSTALL_COMMAND make install
COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_sip}/sip/PyQt5/sip.so ${PREFIX_ext_sip}/lib/python${PY_VER}/site-packages/PyQt5/sip.so
COMMAND ${CMAKE_COMMAND} -E copy ${PREFIX_ext_sip}/sip/PyQt5/sip.pyi ${PREFIX_ext_sip}/lib/python${PY_VER}/site-packages/PyQt5/sip.pyi
BUILD_IN_SOURCE 1
UPDATE_COMMAND ""
)
endif()
elseif (MINGW)
list(APPEND _SIP_conf
--platform win32-g++
......
......@@ -254,6 +254,8 @@ 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/
......@@ -306,9 +308,12 @@ krita_deploy () {
# rsync -prul {KIS_INSTALL_DIR}/lib/libkrita* Frameworks/
# activate for python enabled Krita
# echo "Copying python..."
# cp -r ${KIS_INSTALL_DIR}/lib/python3.5 Frameworks/
# cp -r ${KIS_INSTALL_DIR}/lib/krita-python-libs 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/
# XXX: fix rpath for krita.so
# echo "Copying sip..."
......@@ -340,6 +345,12 @@ krita_deploy () {
printf "Searching for missing libraries\n"
krita_findmissinglibs $(find ${KRITA_DMG}/krita.app/Contents -type f -name "*.dylib" -or -name "*.so" -or -perm u+x)
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