Cleanup
[carla.git] / data / linux / build-pyqt.sh
blobab76c49b50207f2528afc4e934863a5b6155a1ec
1 #!/bin/bash
3 # apt-get install build-essential autoconf libtool cmake libglib2.0-dev libgl1-mesa-dev
5 # ---------------------------------------------------------------------------------------------------------------------
6 # stop on error
8 set -e
10 # ---------------------------------------------------------------------------------------------------------------------
11 # cd to correct path
13 cd $(dirname $0)
15 # ---------------------------------------------------------------------------------------------------------------------
16 # set variables
18 source common.env
20 # ---------------------------------------------------------------------------------------------------------------------
21 # function to remove old stuff
23 cleanup()
26 rm -rf cx_Freeze-*
27 rm -rf Python-*
28 rm -rf PyQt-*
29 rm -rf PyQt5_*
30 rm -rf pyliblo-*
31 rm -rf sip-*
35 # ---------------------------------------------------------------------------------------------------------------------
36 # function to build base libs
38 build_pyqt()
41 export CC=gcc
42 export CXX=g++
44 export PREFIX=${TARGETDIR}/carla${ARCH}
45 export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
46 export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
48 export CFLAGS="-O3 -mtune=generic -msse -msse2 -mfpmath=sse -fPIC -DPIC -DNDEBUG -m${ARCH}"
49 export CXXFLAGS="${CFLAGS}"
50 export LDFLAGS="-m${ARCH} -Wl,-O1"
52 # TODO build libffi statically
54 # ---------------------------------------------------------------------------------------------------------------------
55 # python
57 if [ ! -d Python-${PYTHON_VERSION} ]; then
58 aria2c https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
59 tar -xf Python-${PYTHON_VERSION}.tgz
62 if [ ! -f Python-${PYTHON_VERSION}/build-done ]; then
63 cd Python-${PYTHON_VERSION}
64 ./configure --prefix=${PREFIX}
65 make
66 make install
67 touch build-done
68 cd ..
71 # ---------------------------------------------------------------------------------------------------------------------
72 # sip
74 if [ ! -d sip-${SIP_VERSION} ]; then
75 aria2c http://sourceforge.net/projects/pyqt/files/sip/sip-${SIP_VERSION}/sip-${SIP_VERSION}.tar.gz
76 tar -xf sip-${SIP_VERSION}.tar.gz
79 if [ ! -f sip-${SIP_VERSION}/build-done ]; then
80 cd sip-${SIP_VERSION}
81 python3 configure.py --sip-module PyQt5.sip
82 make ${MAKE_ARGS}
83 make install
84 touch build-done
85 cd ..
88 # ---------------------------------------------------------------------------------------------------------------------
89 # pyqt5
91 if [ ! -d PyQt5_gpl-${PYQT5_VERSION} ]; then
92 aria2c http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-${PYQT5_VERSION}/PyQt5_gpl-${PYQT5_VERSION}.tar.gz
93 tar -xf PyQt5_gpl-${PYQT5_VERSION}.tar.gz
96 if [ ! -f PyQt5_gpl-${PYQT5_VERSION}/build-done ]; then
97 cd PyQt5_gpl-${PYQT5_VERSION}
98 python3 configure.py --confirm-license -c
99 make ${MAKE_ARGS}
100 make install
101 touch build-done
102 cd ..
105 # ---------------------------------------------------------------------------------------------------------------------
106 # cxfreeze
108 if [ ! -d cx_Freeze-${CXFREEZE_VERSION} ]; then
109 aria2c https://github.com/anthony-tuininga/cx_Freeze/archive/${CXFREEZE_VERSION}.tar.gz
110 tar -xf cx_Freeze-${CXFREEZE_VERSION}.tar.gz
113 if [ ! -f cx_Freeze-${CXFREEZE_VERSION}/build-done ]; then
114 cd cx_Freeze-${CXFREEZE_VERSION}
115 python3 setup.py build
116 python3 setup.py install --prefix=${PREFIX}
117 touch build-done
118 cd ..
121 # ---------------------------------------------------------------------------------------------------------------------
122 # pyliblo (needs to be last as it modifies CFLAGS)
124 if [ ! -d pyliblo-${PYLIBLO_VERSION} ]; then
125 aria2c http://das.nasophon.de/download/pyliblo-${PYLIBLO_VERSION}.tar.gz
126 tar -xf pyliblo-${PYLIBLO_VERSION}.tar.gz
129 if [ ! -f pyliblo-${PYLIBLO_VERSION}/build-done ]; then
130 cd pyliblo-${PYLIBLO_VERSION}
131 if [ ! -f patched ]; then
132 patch -p1 -i ../../patches/pyliblo-python3.7.patch
133 touch patched
135 export CFLAGS="${CFLAGS} -I${PREFIX}/include -L${PREFIX}/lib"
136 python3 setup.py build
137 python3 setup.py install --prefix=${PREFIX}
138 touch build-done
139 cd ..
144 # ---------------------------------------------------------------------------------------------------------------------
145 # build base libs
147 export TARGET="${1}"
149 if [ x"${TARGET}" = x"32" ]; then
150 export ARCH=32
151 else
152 export ARCH=64
155 build_pyqt
157 # ---------------------------------------------------------------------------------------------------------------------