forked from Sigil-Ebook/Sigil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilding_Qt5_From_Source_on_MacOSX.txt
121 lines (85 loc) · 4.15 KB
/
Building_Qt5_From_Source_on_MacOSX.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Building_Qt5_From_Source_on_MacOSX
# *** IMPORTANT ***
# Qt Pre-Built Binary Versions do NOT support proprietary codecs such as
# mpeg4 or gif multipmedia in its QWebEngine by default!
# To support these epub basic formats you will need to build your own Qt
# directly from source.
# We do highly recommend you use the same Qt versions as official Sigil builds on Mac OS X.
# which is now Qt 5.12.3 or later
# These instructions will lead you through building from source
# FIRST: make sure you have XCode 10 or later installed and the Command Line Tools
# set the deployment target (this is minimum needed for Qt 5.12.X)
export MACOSX_DEPLOYMENT_TARGET=10.12
# cd to a location to store your src tree then do
export MYQTSRC=`pwd`
# Build Prerequisites
# -------------------
# First build and install the following prerequisites for the build:
# cmake, libpng, libjpeg-turbo
# and install into /usr/local so that they can be found during qtwebkit's build
# Note: older versions of these prerequisites may work but have not been tested
# Download cmake 3.12.0 or later from https://cmake.org/download
tar -zxvf cmake-3.12.0.tar.gz
cd cmake-3.12.0
./bootstrap --prefix=/usr/local -- -DCMAKE_BUILD_TYPE:STRING=Release
make
sudo make install
# Download libpng 1.6.36 or later from png's sourceforge site: http://www.libpng.org/pub/png/libpng.html
# If you are building on MacOS 10.12, you will need to patch libpng
# to support macos 10.12
export LDFLAGS="-Wl,-macosx_version_min,10.12"
export CFLAGS="-mmacosx-version-min=10.12 -Werror=partial-availability"
tar -zxvf libpng-1.6.36.tar.gz
cd libpng-1.6.36
patch -p0 < libpng_support_macos_10.11.patch
./configure --enable-static=yes --enable-shared=no --prefix=/usr/local
make
sudo make install
unset CFLAGS
unset LDFLAGS
# libjpeg-turbo 2.0.0 or later from libjpeg-turbo.org
# https://sourceforge.net/projects/libjpeg-turbo/files/2.0.2/
tar -xvf libjpeg-turbo-2.0.2.tar.gz
mkdir buildjt
cd buildjt
cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_SHARED=0 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 \
-DCMAKE_C_FLAGS_RELEASE="-O3 -mmacosx-version-min=10.12 -Werror=partial-availability" ../libjpeg-turbo-2.0.2/
make
sudo make install
# Building Qt5.12.3 from source
# -----------------------------
# download qt-everywhere-src-5.12.3.tar.xz directly from Qt
# from: http://download.qt.io/archive/qt/5.12/5.12.3/single/
# and then unpack it
# Note to get unxz - you may need to download and build xz-5.2.4.tar.gz
# see the docs on building a relocatable python for instruction on building xz
unxz qt-everywhere-src-5.12.3.tar.xz
tar -xvf qt-everywhere-src-5.12.3.tar
cd qt-everywhere-src-5.12.3
# now copy 3 required patches from Sigil/docs/ into this directory
cp YOUR_PATH_TO_SIGIL_SRC_TREE/Sigil/docs/qt512.3_avoid_qtabbar_segfault.patch ./
cp YOUR_PATH_TO_SIGIL_SRC_TREE/Sigil/docs/qt512.3_final_fix_close_tab_icon.patch ./
cp YOUR_PATH_TO_SIGIL_SRC_TREE/Sigil/docs/qt512.3_webengine_backport.patch ./
# apply a backported fix from Qt 5.12.4 related deleting old page in QtWebEngine
patch -p0 < ./qt512.3_webengine_backport.patch
# then apply mouse press and flick on qtabbar tab fix to prevent segfault
patch -p0 < ./qt512.3_avoid_qtabbar_segfault.patch
# then apply a backported fix from Qt5.12.4 to prevent the loss of tab close icon for macOS
patch -p0 < ./qt512.3_final_fix_close_tab_icon.patch
# this is the new minimum supported by Qt 5.12.X
export MACOSX_DEPLOYMENT_TARGET=10.12
# Create a destination directory to house your complete Qt binary in your home directory
# to be similar to how stock Qt does it
cd ~/
mkdir Qt512
# Now return and create a shadow build inside a new directory to keep your Qt 5.12.X sources clean
cd ${MYQTSRC}
mkdir buildqt
cd buildqt
# Remember to include the -webengine-proprietary-codecs configure switch
../qt-everywhere-src-5.12.3/configure --prefix=/Users/${USER}/Qt512 -webengine-proprietary-codecs -opensource -nomake examples -nomake tests
# note the build itself can take a couple of hours depending on memory available, disk and cpus used
make -j4
make install
# After the install phase completes your newly built Qt should exist in ~/Qt512 ready to be used
# to build Sigil and PageEdit