-
Notifications
You must be signed in to change notification settings - Fork 10
/
build-deps.sh
executable file
·124 lines (85 loc) · 3.13 KB
/
build-deps.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
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ./version.sh
source ./emsdk/emsdk_env.sh
embuilder build zlib bzip2
rm -rf deps
mkdir deps && cd deps
tar xvf ../sources/xz-${XZ_VER}.tar.gz
pushd xz-${XZ_VER}
emconfigure ./configure --disable-shared --enable-static --prefix=$PWD/prefix
emmake make -j$(nproc) install
popd
tar xvf ../sources/cpython-${CPYTHON_VER}.tar.gz
mv cpython-${CPYTHON_VER} cpython
pushd cpython
mkdir -p builddir/build
pushd builddir/build
../../configure -C
make -j$(nproc)
popd
mkdir -p builddir/emscripten-browser
pushd builddir/emscripten-browser
CONFIG_SITE=../../Tools/wasm/config.site-wasm32-emscripten \
emconfigure ../../configure -C \
--host=wasm32-unknown-emscripten \
--build=$(../../config.guess) \
--with-emscripten-target=browser \
--enable-wasm-pthreads \
--with-build-python=$(pwd)/../build/python \
CFLAGS="-I ../../../xz-${XZ_VER}/prefix/include/" LDFLAGS="-L ../../../xz-${XZ_VER}/prefix/lib/"
emmake make -j$(nproc)
popd
popd
tar xvf ../sources/qt-everywhere-src-${QT_VER}.tar.xz
mv qt-everywhere-src-${QT_VER} qt5
pushd qt5/
patch -p1 < $SCRIPT_DIR/patches/qt/qt.patch
pushd qtbase
patch -p1 < $SCRIPT_DIR/patches/qt/qtcore-5.15.2-gcc11.patch
patch -p1 < $SCRIPT_DIR/patches/qt/0008-Add-missing-limits-include.patch
patch -p1 < $SCRIPT_DIR/patches/qt/wasm-settings.patch
popd
./configure -xplatform wasm-emscripten -nomake examples -prefix $PWD/qtbase -feature-thread -opensource -confirm-license
make module-qtbase module-qtdeclarative qtsvg -j$(nproc)
popd
cpython/builddir/build/python -m venv venv
source venv/bin/activate
tar -xf ../sources/sip-${SIP_VER}.tar.gz
pushd sip-${SIP_VER}
python setup.py install
popd
tar -xf ../sources/PyQt5_sip-${PYQT5SIP_VER}.tar.gz
pushd PyQt5_sip-${PYQT5SIP_VER}/
patch -p1 < $SCRIPT_DIR/patches/pyqt5sip.patch
mkdir build
for file in apiversions.c voidptr.c threads.c objmap.c descriptors.c array.c qtlib.c int_convertors.c siplib.c; do
emcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I ../cpython/Include/ -I ../cpython/builddir/emscripten-browser/ -c $file -o "build/${file%.*}.o"
done
emar cqs libsip.a build/*.o
popd
tar -xf ../sources/PyQt5-${PYQT5_VER}.tar.gz
pushd PyQt5-${PYQT5_VER}/
patch -p1 < $SCRIPT_DIR/patches/pyqt5.patch
python ./configure.py --qmake ../qt5/qtbase/bin/qmake --static --confirm-license --sip-incdir=../PyQt5_sip-${PYQT5SIP_VER}/
pushd QtCore
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
patch < $SCRIPT_DIR/patches/pyqt5-qtcore.patch
make -j$(nproc)
popd
pushd QtGui
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
make -j$(nproc)
popd
pushd QtWidgets
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
patch < $SCRIPT_DIR/patches/pyqt5-qtwidgets.patch
make -j$(nproc)
popd
pushd QtSvg
sed -i "s+-I../../cpython/Include+-I../../cpython/Include -I../../cpython/builddir/emscripten-browser/+g" Makefile
make -j$(nproc)
popd
popd
cd ..