Changeset View
Changeset View
Standalone View
Standalone View
packaging/macos/osxdeploy.sh
Context not available. | |||||
70 | export MACOSX_DEPLOYMENT_TARGET=10.11 | 70 | export MACOSX_DEPLOYMENT_TARGET=10.11 | ||
---|---|---|---|---|---|
71 | export QMAKE_MACOSX_DEPLOYMENT_TARGET=10.11 | 71 | export QMAKE_MACOSX_DEPLOYMENT_TARGET=10.11 | ||
72 | 72 | | |||
73 | # Attempt to find python_version | ||||
74 | local_PY_MAYOR_VERSION=$(python -c "import sys; print(sys.version_info[0])") | ||||
75 | local_PY_MINOR_VERSION=$(python -c "import sys; print(sys.version_info[1])") | ||||
76 | PY_VERSION="${local_PY_MAYOR_VERSION}.${local_PY_MINOR_VERSION}" | ||||
77 | echo "Detected Python ${PY_VERSION}" | ||||
78 | | ||||
73 | print_usage () { | 79 | print_usage () { | ||
74 | echo "USAGE: osxdeploy.sh [-s=<identity>] <background-image>" | 80 | echo "USAGE: osxdeploy.sh [-s=<identity>] <background-image>" | ||
75 | echo "\t -s Code sign identity for codesign" | 81 | echo "\t -s Code sign identity for codesign" | ||
Context not available. | |||||
233 | echo "Done!" | 239 | echo "Done!" | ||
234 | } | 240 | } | ||
235 | 241 | | |||
242 | strip_python_dmginstall() { | ||||
243 | # reduce size of framework python | ||||
244 | # Removes tests, installers, pyenv, distutils | ||||
245 | echo "Removing unnecesary files from Python.Framwork to be packaged..." | ||||
246 | PythonFrameworkBase="${KRITA_DMG}/krita.app/Contents/Frameworks/Python.framework" | ||||
247 | | ||||
248 | cd ${PythonFrameworkBase} | ||||
249 | find . -name "test*" -type d | xargs rm -rf | ||||
250 | find "${PythonFrameworkBase}/Versions/${PY_VERSION}/bin" -not -name "python*" | xargs rm -f | ||||
251 | cd "${PythonFrameworkBase}/Versions/${PY_VERSION}/lib/python${PY_VERSION}" | ||||
252 | rm -rf distutils tkinter ensurepip venv lib2to3 libidle | ||||
253 | } | ||||
254 | | ||||
255 | fix_python_framework() { | ||||
256 | # Fix python.framework rpath and slims down installation | ||||
257 | # fix library LD_RPATH excutable_path and loader_path. | ||||
258 | # It is intended to be used for Libraries inside Frameworks. | ||||
259 | fix_framework_library() { | ||||
260 | xargs -P4 -I FILE sh -c " | ||||
261 | install_name_tool -rpath ${KIS_INSTALL_DIR}/lib @loader_path/Frameworks \"${libFile}\" 2> /dev/null | ||||
262 | install_name_tool -add_rpath @loader_path/../../../ \"${libFile}\" 2> /dev/null | ||||
263 | " | ||||
264 | } | ||||
265 | # Start fixing all executables | ||||
266 | PythonFrameworkBase="${KRITA_DMG}/krita.app/Contents/Frameworks/Python.framework" | ||||
267 | install_name_tool -change @loader_path/../../../../libintl.9.dylib @loader_path/../../../libintl.9.dylib "${PythonFrameworkBase}/Python" | ||||
268 | install_name_tool -add_rpath @executable_path/../../../../../../../ "${PythonFrameworkBase}/Versions/Current/Resources/Python.app/Contents/MacOS/Python" | ||||
269 | install_name_tool -add_rpath @executable_path/../../../../ "${PythonFrameworkBase}/Versions/Current/bin/python${PY_VERSION}" | ||||
270 | install_name_tool -add_rpath @executable_path/../../../../ "${PythonFrameworkBase}/Versions/Current/bin/python${PY_VERSION}m" | ||||
271 | | ||||
272 | # Fix rpaths from Python.Framework | ||||
273 | # install_name_tool change @loader_path/../../../libz.1.dylib | ||||
274 | | ||||
275 | # Fix main library | ||||
276 | printf ${PythonFrameworkBase}/Python | fix_framework_library | ||||
277 | # find ${PythonFrameworkBase} -name "*.so" -not -type l | fix_framework_library | ||||
278 | } | ||||
236 | 279 | | |||
237 | krita_deploy () { | 280 | krita_deploy () { | ||
238 | # fix_boost_rpath | 281 | # fix_boost_rpath | ||
Context not available. | |||||
251 | mkdir -p ${KRITA_DMG}/krita.app/Contents/PlugIns | 294 | mkdir -p ${KRITA_DMG}/krita.app/Contents/PlugIns | ||
252 | mkdir -p ${KRITA_DMG}/krita.app/Contents/Frameworks | 295 | mkdir -p ${KRITA_DMG}/krita.app/Contents/Frameworks | ||
253 | 296 | | |||
297 | mkdir -p ${KRITA_DMG}/krita.app/Contents/Frameworks | ||||
298 | | ||||
254 | echo "Copying share..." | 299 | echo "Copying share..." | ||
255 | # Deletes old copies of translation and qml to be recreated | 300 | # Deletes old copies of translation and qml to be recreated | ||
256 | cd ${KIS_INSTALL_DIR}/share/ | 301 | cd ${KIS_INSTALL_DIR}/share/ | ||
Context not available. | |||||
302 | 347 | | |||
303 | # rsync -prul /Volumes/Osiris/programs/krita-master/i/lib/libkrita* Frameworks/ | 348 | # rsync -prul /Volumes/Osiris/programs/krita-master/i/lib/libkrita* Frameworks/ | ||
304 | 349 | | |||
305 | # activate for python enabled Krita | | |||
306 | # echo "Copying python..." | | |||
307 | # cp -r ${KIS_INSTALL_DIR}/lib/python3.5 Frameworks/ | | |||
308 | # cp -r ${KIS_INSTALL_DIR}/lib/krita-python-libs Frameworks/ | | |||
309 | | ||||
310 | # XXX: fix rpath for krita.so | | |||
311 | # echo "Copying sip..." | | |||
312 | # rsync -Prvul ${KIS_INSTALL_DIR}/sip Frameworks/ | | |||
313 | | ||||
314 | # To avoid errors macdeployqt must be run from bin location | 350 | # To avoid errors macdeployqt must be run from bin location | ||
315 | # ext_qt will not build macdeployqt by default so it must be build manually | 351 | # ext_qt will not build macdeployqt by default so it must be build manually | ||
316 | # cd ${BUILDROOT}/depbuild/ext_qt/ext_qt-prefix/src/ext_qt/qttools/src | 352 | # cd ${BUILDROOT}/depbuild/ext_qt/ext_qt-prefix/src/ext_qt/qttools/src | ||
Context not available. | |||||
330 | 366 | | |||
331 | cd ${BUILDROOT} | 367 | cd ${BUILDROOT} | ||
332 | echo "macdeployqt done!" | 368 | echo "macdeployqt done!" | ||
369 | | ||||
370 | echo "Copying python..." | ||||
371 | # Copy this framework last! | ||||
372 | # It is best that macdeployqt does not modify Python.framework | ||||
373 | # folders with period in name are treated as Frameworks for codesign | ||||
374 | rsync -prul ${KIS_INSTALL_DIR}/lib/Python.framework ${KRITA_DMG}/krita.app/Contents/Frameworks/ | ||||
375 | rsync -prul ${KIS_INSTALL_DIR}/lib/krita-python-libs ${KRITA_DMG}/krita.app/Contents/Frameworks/ | ||||
376 | # change perms on Python to allow header change | ||||
377 | chmod +w ${KRITA_DMG}/krita.app/Contents/Frameworks/Python.framework/Python | ||||
378 | | ||||
379 | fix_python_framework | ||||
380 | strip_python_dmginstall | ||||
381 | | ||||
382 | # fix python pyc | ||||
383 | # precompile all pyc so the dont alter signature | ||||
384 | echo "Precompiling all python files..." | ||||
385 | cd ${KRITA_DMG}/krita.app | ||||
386 | ${KIS_INSTALL_DIR}/bin/python -m compileall . &> /dev/null | ||||
387 | | ||||
333 | install_name_tool -delete_rpath @loader_path/../../../../lib ${KRITA_DMG}/krita.app/Contents/MacOS/krita | 388 | install_name_tool -delete_rpath @loader_path/../../../../lib ${KRITA_DMG}/krita.app/Contents/MacOS/krita | ||
334 | rm -rf ${KRITA_DMG}/krita.app/Contents/PlugIns/kf5/org.kde.kwindowsystem.platforms | 389 | rm -rf ${KRITA_DMG}/krita.app/Contents/PlugIns/kf5/org.kde.kwindowsystem.platforms | ||
335 | 390 | | |||
336 | # repair krita for plugins | 391 | # repair krita searching missing needed libs | ||
337 | krita_findmissinglibs | 392 | krita_findmissinglibs | ||
393 | | ||||
338 | } | 394 | } | ||
339 | 395 | | |||
340 | # helper to define function only once | 396 | # helper to define function only once | ||
Context not available. | |||||
349 | cd ${KRITA_DMG}/krita.app/Contents/Frameworks | 405 | cd ${KRITA_DMG}/krita.app/Contents/Frameworks | ||
350 | # remove debug version as both versions cant be signed. | 406 | # remove debug version as both versions cant be signed. | ||
351 | rm ${KRITA_DMG}/krita.app/Contents/Frameworks/QtScript.framework/Versions/Current/QtScript_debug | 407 | rm ${KRITA_DMG}/krita.app/Contents/Frameworks/QtScript.framework/Versions/Current/QtScript_debug | ||
352 | find . -type d -name "*.framework" | xargs printf "%s/Versions/Current\n" | batch_codesign | | |||
353 | find . -type f -name "*.dylib" -or -name "*.so" | batch_codesign | 408 | find . -type f -name "*.dylib" -or -name "*.so" | batch_codesign | ||
409 | find . -type d -name "*.framework" | xargs printf "%s/Versions/Current\n" | batch_codesign | ||||
354 | 410 | | |||
355 | # Sign all other files in Framework (needed) | 411 | # Sign all other files in Framework (needed) | ||
356 | # there are many files in pyton do we need to sign them? TODO | 412 | # there are many files in python do we need to sign them all? | ||
357 | # find krita-python-libs -type f | batch_codesign | 413 | find krita-python-libs -type f | batch_codesign | ||
358 | # find python -type f | batch_codesign | 414 | # find python -type f | batch_codesign | ||
359 | 415 | | |||
360 | # Sing only libraries and plugins | 416 | # Sing only libraries and plugins | ||
Context not available. |