Repository navigation
Expand file tree
/
Copy pathDockerfile.ubuntu
More file actions
411 lines (372 loc) · 14.1 KB
/
Copy pathDockerfile.ubuntu
File metadata and controls
411 lines (372 loc) · 14.1 KB
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
ENV INSTALL_PREFIX=/opt/qt6-static
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig
ENV CFLAGS="-fPIC"
ENV CXXFLAGS="-fPIC"
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
wget \
curl \
ca-certificates \
cmake \
ninja-build \
meson \
python3 \
python3-pip \
gperf \
git \
automake \
autoconf \
libtool \
bison \
flex \
g++ gcc \
lld \
xutils-dev \
libpcre2-dev \
libffi-dev \
libssl-dev \
x11proto-core-dev \
x11proto-kb-dev \
libxkbfile-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-cursor-dev \
libxcb-glx0-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-keysyms1-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-sync-dev \
libxcb-util-dev \
libxcb-xfixes0-dev \
libxcb-xkb-dev \
libxcb1-dev \
libxext-dev \
libxfixes-dev \
libxi-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
libxrender-dev \
libdbus-1-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libglib2.0-dev \
libgtk-3-dev \
libssl-dev \
libfontconfig1-dev \
libclang-dev \
libgl-dev \
libpcre2-dev \
libfreetype-dev \
libgl1-mesa-dev \
mesa-common-dev \
libxcb-dri2-0-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /work
# ca-certificates \
# libdbus-1-dev \
# libgl1-mesa-dev \
# libglu1-mesa-dev \
# libglib2.0-dev \
# libgtk-3-dev \
# libxcb-dri2-0-dev \
# zlib (静的ビルド強制)
RUN wget https://zlib.net/zlib-1.3.1.tar.gz && \
tar -xzf zlib-1.3.1.tar.gz && \
cd zlib-1.3.1 && \
./configure --static --prefix=/usr/local && make -j$(nproc) && make install
# libxml2 (static)
RUN wget https://github.com/GNOME/libxml2/archive/refs/tags/v2.14.2.tar.gz && \
tar -xf v2.14.2.tar.gz && cd libxml2-2.14.2 && \
cmake -B build -GNinja \
-D BUILD_SHARED_LIBS=OFF \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D LIBXML2_WITH_PYTHON=OFF \
-D LIBXML2_WITH_ZLIB=ON \
-D LIBXML2_WITH_ICONV=OFF && \
cmake --build build -j$(nproc) && \
cmake --install build
# libpng
RUN wget https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz && \
tar -xzf libpng-1.6.37.tar.gz && \
cd libpng-1.6.37 && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# FreeType (static)
RUN wget https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.gz && \
tar -xf freetype-2.9.1.tar.gz && cd freetype-2.9.1 && \
./configure \
--prefix=/usr/local \
--with-harfbuzz=yes \
--enable-static \
--disable-shared \
--with-pic \
--with-bdfformat \
--without-bzip2 \
HARFBUZZ_CFLAGS="$(pkg-config --cflags harfbuzz)" \
HARFBUZZ_LIBS="$(pkg-config --libs harfbuzz)"
# fontconfig (static)
RUN wget https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.gz && \
tar -xf fontconfig-2.15.0.tar.gz && cd fontconfig-2.15.0 && \
env \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \
CPPFLAGS="-I/usr/local/include" \
LDFLAGS="-L/usr/local/lib -lxml2 -lfreetype -lz -lpng -lXext" \
CFLAGS="-fPIC" \
./configure \
--prefix=/usr/local \
--enable-static \
--disable-shared \
--enable-libxml2
# xorgproto (プロトコル定義)
ARG XORBPRO_VERSION=2024.1
RUN wget https://xorg.freedesktop.org/archive/individual/proto/xorgproto-${XORBPRO_VERSION}.tar.gz && \
tar -xf xorgproto-${XORBPRO_VERSION}.tar.gz && \
cd xorgproto-${XORBPRO_VERSION} && \
./configure --prefix=/usr && make -j$(nproc) && make install
# xcb-proto (プロトコル定義)
ARG XCBPRO_VERSION=1.15
RUN wget https://xorg.freedesktop.org/archive/individual/proto/xcb-proto-${XCBPRO_VERSION}.tar.xz && \
tar -xf xcb-proto-${XCBPRO_VERSION}.tar.xz && \
cd xcb-proto-${XCBPRO_VERSION} && \
./configure --prefix=/usr/local && make -j$(nproc) && make install
# libXau
ARG XAU_VERSION=1.0.9
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXau-${XAU_VERSION}.tar.gz && \
tar -xf libXau-${XAU_VERSION}.tar.gz && \
cd libXau-${XAU_VERSION} && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libXdmcp
ARG XDMCP_VERSION=1.1.3
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXdmcp-${XDMCP_VERSION}.tar.gz && \
tar -xf libXdmcp-${XDMCP_VERSION}.tar.gz && \
cd libXdmcp-${XDMCP_VERSION} && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libICE
ARG ICE_VERSION=1.0.10
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libICE-${ICE_VERSION}.tar.gz && \
tar -xzf libICE-${ICE_VERSION}.tar.gz && \
cd libICE-${ICE_VERSION} && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libSM
ARG SM_VERSION=1.2.2
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libSM-${SM_VERSION}.tar.gz && \
tar -xzf libSM-${SM_VERSION}.tar.gz && \
cd libSM-${SM_VERSION} && \
./configure --prefix=/usr/local--disable-shared --enable-static && make -j$(nproc) && make install
# libxcb
#ARG XCB_VERSION=1.15
#RUN wget https://xorg.freedesktop.org/archive/individual/xcb/libxcb-${XCB_VERSION}.tar.gz && \
# tar -xzf libxcb-${XCB_VERSION}.tar.gz && \
# cd libxcb-${XCB_VERSION} && \
# ./configure --prefix=/usr/local --disable-shared --enable-static --enable-xevie --enable-xprint && make -j$(nproc) && make install
# libX11
ARG X11_VERSION=1.6.9
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libX11-${X11_VERSION}.tar.gz && \
tar -xzf libX11-${X11_VERSION}.tar.gz && \
cd libX11-${X11_VERSION} && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libpthread-stubs
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libpthread-stubs-0.1.tar.gz && \
tar -xzf libpthread-stubs-0.1.tar.gz && \
cd libpthread-stubs-0.1 && \
./configure --prefix=/usr/local --disable-shared --enable-static && \
make -j$(nproc) && make install
# xtrans
RUN wget https://xorg.freedesktop.org/archive/individual/lib/xtrans-1.2.7.tar.gz && \
tar -xzf xtrans-1.2.7.tar.gz && \
cd xtrans-1.2.7 && \
./configure --prefix=/usr/local && make -j$(nproc) && make install
# libXfixes
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXfixes-6.0.1.tar.gz && \
tar -xzf libXfixes-6.0.1.tar.gz && \
cd libXfixes-6.0.1 && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libXi
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXi-1.6.2.tar.gz && \
tar -xzf libXi-1.6.2.tar.gz && \
cd libXi-1.6.2 && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libXinerama
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXinerama-1.1.5.tar.gz && \
tar -xzf libXinerama-1.1.5.tar.gz && \
cd libXinerama-1.1.5 && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libXext
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXext-1.3.3.tar.gz && \
tar -xzf libXext-1.3.3.tar.gz && \
cd libXext-1.3.3 && \
./configure --prefix=/usr/local --disable-shared --enable-static && make -j$(nproc) && make install
# libXrender
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXrender-0.9.12.tar.gz && \
tar -xzf libXrender-0.9.12.tar.gz && \
cd libXrender-0.9.12 && \
./configure --prefix=/usr/local --disable-shared --enable-static && \
make -j$(nproc) && make install
# xcb-util family
ARG XCB_UTIL_VERSION=0.3.6
ARG XCB_UTIL_IMAGE_VERSION=0.4.1
ARG XCB_UTIL_KEYSYMS_VERSION=0.4.1
ARG XCB_UTIL_RENDERUTIL_VERSION=0.3.10
ARG XCB_UTIL_WM_VERSION=0.4.2
ARG XCB_UTIL_CURSOR_VERSION=0.1.5
# Download and build xcb-util
RUN wget https://xorg.freedesktop.org/archive/individual/xcb/xcb-util-${XCB_UTIL_VERSION}.tar.gz && \
tar -xzf xcb-util-${XCB_UTIL_VERSION}.tar.gz && \
cd xcb-util-${XCB_UTIL_VERSION} && \
./configure --prefix=/usr/local --with-xcb=/usr --disable-shared --enable-static && \
make -j$(nproc) && make install
# libXrandr
RUN wget https://xorg.freedesktop.org/archive/individual/lib/libXrandr-1.5.4.tar.gz && \
tar -xzf libXrandr-1.5.4.tar.gz && \
cd libXrandr-1.5.4 && \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig \
./configure --prefix=/usr/local --disable-shared --enable-static && \
make -j$(nproc) && make install
# ICU (static)
RUN wget https://github.com/unicode-org/icu/releases/download/release-74-2/icu4c-74_2-src.tgz && \
tar -xzf icu4c-74_2-src.tgz && \
cd icu && cd source && \
./configure --prefix=/usr/local --disable-shared --enable-static \
--with-library-bits=64 \
CXXFLAGS="-static -static-libstdc++ -static-libgcc" \
LDFLAGS="-static -static-libstdc++ -static-libgcc" && \
make -j$(nproc) && \
make install && \
cd ../.. && rm -rf icu icu4c-74_2-src.tgz
# Build libxkbcommon
ARG LIBXKBCOMMON_VERSION=1.9.0
# Step 1: Create Meson native file with static C++ link flags
RUN echo "[binaries]" > /tmp/native.txt && \
echo "c = 'gcc'" >> /tmp/native.txt && \
echo "cpp = 'g++'" >> /tmp/native.txt && \
echo "[properties]" >> /tmp/native.txt && \
echo "c_args = ['-static', '-static-libgcc']" >> /tmp/native.txt && \
echo "cpp_args = ['-static', '-static-libstdc++', '-static-libgcc']" >> /tmp/native.txt && \
echo "cpp_link_args = ['-static', '-static-libstdc++', '-static-libgcc']" >> /tmp/native.txt
# Step 2: Download and build with Meson
ENV LDFLAGS="-static -lstdc++ -lm -lpthread -ldl -static-libgcc -L/usr/local/lib -L/usr/lib -lXau -lXdmcp"
RUN wget https://github.com/xkbcommon/libxkbcommon/archive/refs/tags/xkbcommon-${LIBXKBCOMMON_VERSION}.tar.gz && \
tar -xf xkbcommon-${LIBXKBCOMMON_VERSION}.tar.gz && \
cd libxkbcommon-xkbcommon-${LIBXKBCOMMON_VERSION} && \
meson setup builddir \
--prefix=/usr/local \
--libdir=lib \
--buildtype=release \
--native-file=/tmp/native.txt \
-Ddefault_library=static \
-Denable-wayland=false \
-Denable-x11=true \
-Db_lundef=false \
-Denable-xkbregistry=true && \
# ninja -C builddir && \
# ninja -C builddir install && \
cd .. && rm -rf libxkbcommon-${LIBXKBCOMMON_VERSION} xkbcommon-${LIBXKBCOMMON_VERSION}.tar.gz /tmp/native.txt
# Qtビルドに進む (このあと別途Qtソースを取得してstaticビルドする)
# Qt6
ARG QT_VERSION=6.9.0
ARG INSTALL_PREFIX=/opt/qt6-static
ENV DEBIAN_FRONTEND=noninteractive
ENV QT_VERSION=${QT_VERSION}
ENV INSTALL_PREFIX=${INSTALL_PREFIX}
ENV PKG_CONFIG_PATH="/usr/lib/pkgconfig"
ENV CFLAGS="-I/usr/include"
ENV LDFLAGS="-L/usr/lib"
ENV CXXFLAGS="-fuse-ld=lld"
# 必須ライブラリ一覧
RUN set -ex && \
for pc in x11 xext xrender xcb xcb-util xcb-image xcb-shm xcb-icccm \
xcb-sync xcb-xfixes xcb-shape xcb-keysyms xkbcommon xkbcommon-x11; do \
echo "Checking $pc via pkg-config..." && \
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" \
pkg-config --static --exists $pc || (echo "Missing static pkg-config: $pc" && exit 1); \
done && \
echo "All required .pc files found."
# 静的ライブラリファイルの存在確認
RUN set -ex && \
for lib in X11 Xext Xrender xcb xcb-util xcb-image xcb-shm xcb-icccm \
xcb-sync xcb-xfixes xcb-shape xcb-keysyms xkbcommon xkbcommon-x11 ssl crypto; do \
echo "Checking lib$lib.a..." && \
find /usr/local/lib /usr/lib /usr/local/lib64 -name "lib$lib.a" | grep . || \
(echo "Missing static library: lib$lib.a"); \
done && \
echo "All required static libraries found."
# Qt6 ソースダウンロードとビルド
RUN curl -LO https://download.qt.io/official_releases/qt/${QT_VERSION%.*}/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz
RUN mkdir qt-build && cd qt-build && \
../qt-everywhere-src-${QT_VERSION}/configure \
PKG_CONFIG=pkg-config \
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" \
-prefix "${INSTALL_PREFIX}" \
-static -release \
-opensource -confirm-license \
-skip qtdoc \
-skip qtmqtt \
-skip qt3d \
-skip qtactiveqt \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtlanguageserver \
-skip qtshadertools \
-skip qtquick3dphysics \
-skip qtimageformats \
-skip qttranslations \
-skip qtcharts \
-skip qtlottie \
-skip qtdeclarative \
-skip qtgraphs \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qtopcua \
-skip qtpositioning \
-skip qtquick3d \
-skip qtremoteobjects \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebsockets \
-skip qtwebview \
-skip qtlocation \
-skip qthttpserver \
-skip qtcoap \
-skip qtgrpc \
-skip qtquickeffectmaker \
-skip qtquicktimeline \
-skip qtvirtualkeyboard \
-skip qt5compat \
-nomake tests \
-nomake examples \
-feature-dbus \
-feature-opengl \
-feature-openssl \
-feature-openssl-linked \
-feature-xlib \
-feature-xcb \
-feature-xcb-xlib \
-feature-xkbcommon \
-feature-xkbcommon-x11 \
-no-feature-fontconfig \
-feature-sessionmanager \
-feature-gui \
-feature-widgets \
-feature-glib \
-feature-icu \
|| true && \
echo "----- CMakeError.log -----" && cat CMakeFiles/CMakeError.log || true && \
cmake --build . --parallel && \
cmake --install .
# PATH登録
ENV PATH="/opt/qt6-static/bin:$PATH"