-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
bootstrap-carla.sh
executable file
·232 lines (180 loc) · 8.07 KB
/
bootstrap-carla.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#!/bin/bash
set -e
cd $(dirname ${0})
PAWPAW_ROOT="${PWD}"
# ---------------------------------------------------------------------------------------------------------------------
# check target
target="${1}"
if [ -z "${target}" ]; then
echo "usage: ${0} <target>"
exit 1
fi
# ---------------------------------------------------------------------------------------------------------------------
# run bootstrap dependencies
export PAWPAW_SKIP_OPENSSL=1
./bootstrap-common.sh "${target}"
./bootstrap-plugins.sh "${target}"
if [ -z "${PAWPAW_SKIP_QT}" ]; then
./bootstrap-python.sh "${target}"
./bootstrap-qt.sh "${target}"
fi
# ---------------------------------------------------------------------------------------------------------------------
# source setup code
source setup/check_target.sh
source setup/env.sh
source setup/functions.sh
source setup/versions.sh
# ---------------------------------------------------------------------------------------------------------------------
# file/magic (posix only)
if [ "${WASM}" -eq 0 ] && [ "${WIN32}" -eq 0 ]; then
download file "${FILE_VERSION}" "${FILE_URL}"
build_autoconf file "${FILE_VERSION}"
fi
# ---------------------------------------------------------------------------------------------------------------------
# everything after this point requires Qt or PyQt
if [ -n "${PAWPAW_SKIP_QT}" ] && [ "${PAWPAW_SKIP_QT}" -eq 1 ]; then
exit 0
fi
# ---------------------------------------------------------------------------------------------------------------------
# custom function for sip and pyqt packages
function build_pyqt() {
local pkgname="${1}"
local version="${2}"
local extraconfrules="${3}"
local pkgdir="${PAWPAW_BUILDDIR}/${pkgname}-${version}"
local python="python$(echo ${PYTHON_VERSION} | cut -b 1,2,3)"
_prebuild "${pkgname}" "${pkgdir}"
# remove flags not compatible with python
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fvisibility=hidden//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-ffast-math//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fno-finite-math-only//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility=hidden//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility-inlines-hidden//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-ffast-math//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fno-finite-math-only//')"
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip,-dead_strip_dylibs,-x//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-O1,--gc-sections,--no-undefined//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--as-needed,--strip-all//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fno-strict-aliasing -flto//')"
export CFLAGS="${CFLAGS} $(${PAWPAW_PREFIX}/bin/pkg-config --libs python3)"
export CXXFLAGS="${CXXFLAGS} $(${PAWPAW_PREFIX}/bin/pkg-config --libs python3)"
# non-standard vars used by sip/pyqt
export LDFLAGS="${LDFLAGS} $(${PAWPAW_PREFIX}/bin/pkg-config --libs python3)"
export LFLAGS="${LDFLAGS}"
export LINK="${CXX}"
# add host/native binaries to path
if [ "${CROSS_COMPILING}" -eq 1 ]; then
export PATH="${PAWPAW_PREFIX}-host/bin:${PATH}"
elif [ "${LINUX}" -eq 1 ]; then
export LD_LIBRARY_PATH="${PAWPAW_PREFIX}/lib"
fi
if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
# Place link to Qt DLLs for PyQt tests
if [ "${WIN32}" -eq 1 ] && [ -d "pyuic" ] && [ ! -d "release" ]; then
mkdir release
ln -sf "${PAWPAW_PREFIX}/bin"/Qt* release/
fi
${python} configure.py ${extraconfrules}
if [ -f "QtCore/Makefile.Release" ]; then
if [ "${CROSS_COMPILING}" -eq 1 ]; then
sed -i -e "s|${PAWPAW_PREFIX}-host|${PAWPAW_PREFIX}|" pylupdate5 pyrcc5 pyuic5
fi
if [ -n "${EXE_WRAPPER}" ]; then
sed -i -e "s|exec /|exec ${EXE_WRAPPER} /|" pylupdate5 pyrcc5 pyuic5
fi
fi
touch .stamp_configured
popd
fi
if [ ! -f "${pkgdir}/.stamp_built" ]; then
pushd "${pkgdir}"
# build sip as host tool first
if [ "${CROSS_COMPILING}" -eq 1 ] && [ -d "sipgen" ] && [ ! -f "sipgen/sip" ]; then
pushd "sipgen"
PATH="${OLD_PATH}" make sip CC="gcc" CFLAGS= LINK="gcc" LFLAGS="-Wl,-s" ${MAKE_ARGS}
popd
fi
# CC="${TARGET_CC}" CXX="${TARGET_CXX}" LFLAGS="${LDFLAGS}" LINK="${TARGET_CXX}" PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}"
make ${MAKE_ARGS}
touch .stamp_built
popd
fi
if [ ! -f "${pkgdir}/.stamp_installed" ]; then
pushd "${pkgdir}"
# PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}"
make ${MAKE_ARGS} -j 1 install
touch .stamp_installed
popd
fi
unset LFLAGS
unset LINK
if [ "${CROSS_COMPILING}" -eq 0 ] && [ "${LINUX}" -eq 1 ]; then
unset LD_LIBRARY_PATH
fi
_postbuild
}
# ---------------------------------------------------------------------------------------------------------------------
# sip
if [ "${SIP_VERSION}" = "4.19.19" ]; then
SIP_DOWNLOAD_URL="https://files.kde.org/krita/build/dependencies"
SIP_EXTRAFLAGS="--sip-module PyQt5.sip"
else
SIP_DOWNLOAD_URL="http://sourceforge.net/projects/pyqt/files/sip/sip-${SIP_VERSION}"
fi
if [ "${WIN32}" -eq 1 ]; then
SIP_EXTRAFLAGS+=" --platform win32-g++"
SIP_EXTRAFLAGS+=" EXTENSION_PLUGIN=pyd"
fi
SIP_EXTRAFLAGS+=" --sysroot=${PAWPAW_PREFIX}"
SIP_EXTRAFLAGS+=" INCDIR=${PAWPAW_PREFIX}/include/python3.8"
SIP_EXTRAFLAGS+=" LIBDIR=${PAWPAW_PREFIX}/lib/python3.8/config-3.8"
download sip "${SIP_VERSION}" "${SIP_DOWNLOAD_URL}"
build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}"
# ---------------------------------------------------------------------------------------------------------------------
# pyqt5
if [ "${PYQT5_VERSION}" = "5.13.1" ]; then
PYQT5_DOWNLOAD_URL="https://files.kde.org/krita/build/dependencies"
PYQT5_SUFFIX="_gpl"
else
PYQT5_DOWNLOAD_URL="http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-${PYQT5_VERSION}"
PYQT5_SUFFIX="_gpl"
fi
# qmake needs this
if [ "${CROSS_COMPILING}" -eq 1 ]; then
export PKG_CONFIG_LIBDIR="${TARGET_PKG_CONFIG_PATH}"
export PKG_CONFIG_SYSROOT_DIR="/"
fi
PYQT5_EXTRAFLAGS="--qmake ${PAWPAW_PREFIX}/bin/qmake --sip ${PAWPAW_PREFIX}/bin/sip --sysroot ${PAWPAW_PREFIX}"
download PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_DOWNLOAD_URL}"
build_pyqt PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_EXTRAFLAGS} --concatenate --confirm-license"
# --verbose
if [ "${CROSS_COMPILING}" -eq 1 ]; then
unset PKG_CONFIG_LIBDIR
unset PKG_CONFIG_SYSROOT_DIR
fi
# ---------------------------------------------------------------------------------------------------------------------
# pyliblo
if [ "${WIN32}" -eq 1 ]; then
export EXTRA_CFLAGS="$(${PAWPAW_PREFIX}/bin/pkg-config --cflags python3 liblo)"
export EXTRA_LDFLAGS="-shared $(${PAWPAW_PREFIX}/bin/pkg-config --libs python3 liblo)"
export LDSHARED="${TARGET_CXX}"
fi
download pyliblo "${PYLIBLO_VERSION}" "http://das.nasophon.de/download"
build_python pyliblo "${PYLIBLO_VERSION}"
if [ "${WIN32}" -eq 1 ]; then
unset LDSHARED
fi
if [ "${WIN32}" -eq 1 ] && [ "${CROSS_COMPILING}" -eq 1 ]; then
PYTHONPATH="${PAWPAW_PREFIX}/lib/python3.8/site-packages"
if [ ! -e "${PYTHONPATH}/liblo.pyd" ]; then
ln -sv "${PYTHONPATH}"/pyliblo-*.egg/*.so "${PYTHONPATH}/liblo.pyd"
fi
unset PYTHONPATH
fi
# ---------------------------------------------------------------------------------------------------------------------