-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile
186 lines (175 loc) · 5.52 KB
/
Dockerfile
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
# Use Debian 12 (Bookworm) as the base image
FROM debian:bookworm
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Update and install necessary packages
RUN { \
set -e && \
apt-get update && apt-get install -y \
wget \
git \
build-essential \
make \
cmake \
rsync \
sed \
libclang-dev \
ninja-build \
gcc \
bison \
python3 \
gperf \
pkg-config \
libfontconfig1-dev \
libfreetype6-dev \
libx11-dev \
libx11-xcb-dev \
libxext-dev \
libxfixes-dev \
libxi-dev \
libxrender-dev \
libxcb1-dev \
libxcb-glx0-dev \
libxcb-keysyms1-dev \
libxcb-image0-dev \
libxcb-shm0-dev \
libxcb-icccm4-dev \
libxcb-sync-dev \
libxcb-xfixes0-dev \
libxcb-shape0-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-util-dev \
libxcb-xinerama0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
libatspi2.0-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
freeglut3-dev \
libssl-dev \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
flex \
gawk \
texinfo \
libisl-dev \
zlib1g-dev \
libtool \
autoconf \
automake \
libgdbm-dev \
libdb-dev \
libbz2-dev \
libreadline-dev \
libexpat1-dev \
liblzma-dev \
libffi-dev \
libsqlite3-dev \
libbsd-dev \
perl \
patch \
m4 \
libncurses5-dev \
gettext \
gcc-12-aarch64-linux-gnu \
g++-12-aarch64-linux-gnu \
binutils-aarch64-linux-gnu \
libc6-arm64-cross \
libc6-dev-arm64-cross \
glibc-source; \
apt-get clean && \
rm -rf /var/lib/apt/lists/*; \
} 2>&1 | tee -a /build.log
# Set the working directory to /build
WORKDIR /build
# Create sysroot directory
RUN mkdir sysroot sysroot/usr sysroot/opt
# Copy Raspberry Pi sysroot tarball (if available)
COPY rasp.tar.gz /build/rasp.tar.gz
RUN tar xvfz /build/rasp.tar.gz -C /build/sysroot
# Copy the toolchain file
COPY toolchain.cmake /build/
# Build and install CMake from source
RUN { \
echo "Building CMake from source" && \
mkdir cmakeBuild && cd cmakeBuild && \
git clone https://github.com/Kitware/CMake.git && \
cd CMake && \
./bootstrap && make -j$(nproc) && make install && \
echo "CMake build completed"; \
} 2>&1 | tee -a /build.log
RUN { \
set -e && \
echo "Fix symbollic link" && \
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py && \
chmod +x sysroot-relativelinks.py && \
python3 sysroot-relativelinks.py /build/sysroot && \
mkdir -p qt6 qt6/host qt6/pi qt6/host-build qt6/pi-build qt6/src && \
cd qt6/src && \
wget https://download.qt.io/official_releases/qt/6.8/6.8.0/submodules/qtbase-everywhere-src-6.8.0.tar.xz && \
wget https://download.qt.io/official_releases/qt/6.8/6.8.0/submodules/qtshadertools-everywhere-src-6.8.0.tar.xz && \
wget https://download.qt.io/official_releases/qt/6.8/6.8.0/submodules/qtdeclarative-everywhere-src-6.8.0.tar.xz && \
cd ../host-build && \
tar xf ../src/qtbase-everywhere-src-6.8.0.tar.xz && \
tar xf ../src/qtshadertools-everywhere-src-6.8.0.tar.xz && \
tar xf ../src/qtdeclarative-everywhere-src-6.8.0.tar.xz && \
echo "Compile qtbase for host" && \
cd qtbase-everywhere-src-6.8.0 && \
cmake -GNinja -DCMAKE_BUILD_TYPE=Release \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=/build/qt6/host && \
cmake --build . --parallel 4 && \
cmake --install . && \
echo "Compile shader for host" && \
cd ../qtshadertools-everywhere-src-6.8.0 && \
/build/qt6/host/bin/qt-configure-module . && \
cmake --build . --parallel 4 && \
cmake --install . && \
echo "Compile declerative for host" && \
cd ../qtdeclarative-everywhere-src-6.8.0 && \
/build/qt6/host/bin/qt-configure-module . && \
cmake --build . --parallel 4 && \
cmake --install . && \
cd ../../pi-build && \
tar xf ../src/qtbase-everywhere-src-6.8.0.tar.xz && \
tar xf ../src/qtshadertools-everywhere-src-6.8.0.tar.xz && \
tar xf ../src/qtdeclarative-everywhere-src-6.8.0.tar.xz && \
echo "Compile qtbase for rasp" && \
cd qtbase-everywhere-src-6.8.0 && \
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DINPUT_opengl=es2 \
-DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF \
-DQT_HOST_PATH=/build/qt6/host \
-DCMAKE_STAGING_PREFIX=/build/qt6/pi \
-DCMAKE_INSTALL_PREFIX=/usr/local/qt6 \
-DCMAKE_TOOLCHAIN_FILE=/build/toolchain.cmake \
-DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON \
-DQT_FEATURE_xlib=ON && \
cmake --build . --parallel 4 && \
cmake --install . && \
echo "Compile shader for rasp" && \
cd ../qtshadertools-everywhere-src-6.8.0 && \
/build/qt6/pi/bin/qt-configure-module . && \
cmake --build . --parallel 4 && \
cmake --install . && \
echo "Compile declerative for rasp" && \
cd ../qtdeclarative-everywhere-src-6.8.0 && \
/build/qt6/pi/bin/qt-configure-module . && \
cmake --build . --parallel 4 && \
cmake --install . && \
echo "Compilation is finished"; \
} 2>&1 | tee -a /build.log
RUN tar -czvf qt-host-binaries.tar.gz -C /build/qt6/host .
RUN tar -czvf qt-pi-binaries.tar.gz -C /build/qt6/pi .
# Set up project directory
RUN mkdir /build/project
COPY project /build/project
# Build the project using Qt for Raspberry Pi
RUN { \
cd /build/project && \
/build/qt6/pi/bin/qt-cmake . && \
cmake --build .; \
} 2>&1 | tee -a /build.log