-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·94 lines (84 loc) · 2.72 KB
/
build.sh
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
#!/bin/bash
set -e -x
echo "QT_VERSION = $QT_VERSION"
echo "ZLIB_VERSION: ${ZLIB_VERSION}"
echo "INSTALL_PREFIX = $INSTALL_PREFIX"
echo "MACOSX_DEPLOYMENT_TARGET = $MACOSX_DEPLOYMENT_TARGET"
echo "SUDO_CMD = $SUDO_CMD"
echo "CONFIGURE_EXTRAS = $CONFIGURE_EXTRAS"
echo "OS=$OS"
echo "PATH=$PATH"
which g++
g++ --version
# make qt dir
mkdir qt
cd qt
# build static version of zlib to use instead of Qt bundled version
# to allow other libraries to link to the same zlib version
git clone -b $ZLIB_VERSION --depth 1 https://github.com/madler/zlib.git
cd zlib
mkdir build
cd build
cmake -G "Ninja" .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
time ninja zlibstatic
# manual install to avoid shared libs being installed & issues with compiling example programs
# wildcard is used because on mingw it calls the library file libzlibstatic.a for some reason:
$SUDO_CMD mkdir -p $INSTALL_PREFIX
$SUDO_CMD mkdir -p $INSTALL_PREFIX/lib
$SUDO_CMD mkdir -p $INSTALL_PREFIX/include
$SUDO_CMD cp libz*.a $INSTALL_PREFIX/lib/libz.a
$SUDO_CMD cp zconf.h $INSTALL_PREFIX/include/.
$SUDO_CMD cp ../zlib.h $INSTALL_PREFIX/include/.
cd ../../
# download Qt sources to qt/qt5
git clone https://code.qt.io/qt/qt5.git
cd qt5
git checkout $QT_VERSION
# only need qtbase submodule
git submodule update --init qtbase
cd ..
# make build dir in qt/build and run cmake
mkdir build
cd build
cmake ../qt5/qtbase -G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_MESSAGE_LOG_LEVEL=STATUS \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DFEATURE_system_doubleconversion=OFF \
-DFEATURE_system_harfbuzz=OFF \
-DFEATURE_system_jpeg=OFF \
-DFEATURE_system_libb2=OFF \
-DFEATURE_system_pcre2=OFF \
-DFEATURE_system_png=OFF \
-DFEATURE_system_proxies=OFF \
-DFEATURE_system_textmarkdownreader=OFF \
-DFEATURE_system_zlib=ON \
-DZLIB_INCLUDE_DIR=${INSTALL_PREFIX}/include \
-DZLIB_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libz.a \
-DFEATURE_zstd=OFF \
-DFEATURE_openssl=OFF \
-DFEATURE_sql=OFF \
-DFEATURE_icu=OFF \
-DFEATURE_testlib=ON \
-DBUILD_WITH_PCH=OFF \
${CONFIGURE_EXTRAS}
time ninja
$SUDO_CMD ninja install
cd ../..
ccache --show-stats
$INSTALL_PREFIX/bin/qmake -v
# make tarball of installation
mkdir artefacts
cd artefacts
tar -zcvf sme_deps_qt_${OS}.tgz ${INSTALL_PREFIX}/*