mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Adapt Dockerfile for Qt 6
This commit is contained in:
parent
847c01d605
commit
03a687c200
2 changed files with 104 additions and 55 deletions
|
@ -1,20 +1,28 @@
|
|||
FROM centos:7 AS builder
|
||||
|
||||
ARG QT6
|
||||
ENV GIT https://github.com
|
||||
ENV PKG_CONFIG_PATH /usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig
|
||||
ENV QT 5_15_2
|
||||
ENV QT_TAG v5.15.2
|
||||
ENV QT_PREFIX /usr/local/desktop-app/Qt-5.15.2
|
||||
ENV QT5_VER 5_15_2
|
||||
ENV QT5_TAG v5.15.2
|
||||
ENV QT5_PREFIX /usr/local/desktop-app/Qt-5.15.2
|
||||
ENV Qt5_DIR ${QT5_PREFIX}
|
||||
ENV QT6_VER 6_2_0
|
||||
ENV QT6_TAG v6.2.0
|
||||
ENV QT6_PREFIX /usr/local/desktop-app/Qt-6.2.0
|
||||
ENV Qt6_DIR ${QT6_PREFIX}
|
||||
ENV OPENSSL_VER 1_1_1
|
||||
ENV OPENSSL_PREFIX /usr/local/desktop-app/openssl-1.1.1
|
||||
ENV PATH ${PATH}:${QT_PREFIX}/bin
|
||||
ENV Qt5_DIR ${QT_PREFIX}
|
||||
ENV OPENSSL_ROOT_DIR ${OPENSSL_PREFIX}
|
||||
ENV CMAKE_VER 3.21.3
|
||||
ENV CMAKE_FILE cmake-$CMAKE_VER-Linux-x86_64.sh
|
||||
ENV PATH ${PATH}:${QT5_PREFIX}/bin:${QT6_PREFIX}/bin
|
||||
|
||||
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
|
||||
RUN yum -y install centos-release-scl
|
||||
|
||||
RUN yum -y install git cmake3 meson ninja-build autoconf automake libtool \
|
||||
RUN yum -y install git meson ninja-build autoconf automake libtool \
|
||||
fontconfig-devel freetype-devel libX11-devel at-spi2-core-devel alsa-lib-devel \
|
||||
pulseaudio-libs-devel mesa-libGL-devel mesa-libEGL-devel libudev-devel \
|
||||
webkitgtk4-devel pkgconfig bison yasm file which xorg-x11-util-macros \
|
||||
|
@ -23,23 +31,28 @@ RUN yum -y install git cmake3 meson ninja-build autoconf automake libtool \
|
|||
llvm-toolset-7.0-llvm-devel
|
||||
|
||||
SHELL [ "scl", "enable", "devtoolset-9", "--", "bash", "-c" ]
|
||||
RUN ln -s cmake3 /usr/bin/cmake
|
||||
|
||||
ENV LibrariesPath /usr/src/Libraries
|
||||
ENV HFLAGS "-fstack-protector-all -fstack-clash-protection -fPIC -D_FORTIFY_SOURCE=2"
|
||||
WORKDIR $LibrariesPath
|
||||
|
||||
RUN mkdir /opt/cmake
|
||||
RUN curl -sSLo $CMAKE_FILE $GIT/Kitware/CMake/releases/download/v$CMAKE_VER/$CMAKE_FILE
|
||||
RUN sh $CMAKE_FILE --prefix=/opt/cmake --skip-license
|
||||
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
|
||||
RUN rm $CMAKE_FILE
|
||||
|
||||
FROM builder AS patches
|
||||
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 5210855985
|
||||
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout a467abdeb9
|
||||
|
||||
FROM builder AS extra-cmake-modules
|
||||
|
||||
RUN git clone -b v5.77.0 --depth=1 $GIT/KDE/extra-cmake-modules.git
|
||||
|
||||
WORKDIR extra-cmake-modules
|
||||
RUN cmake3 -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/extra-cmake-modules-cache" cmake3 --install build
|
||||
RUN cmake -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/extra-cmake-modules-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf extra-cmake-modules
|
||||
|
@ -72,9 +85,9 @@ RUN git clone -b v5.2.5 https://git.tukaani.org/xz.git
|
|||
|
||||
WORKDIR xz
|
||||
RUN CFLAGS=\"$HFLAGS\" \
|
||||
cmake3 -B build . -DCMAKE_BUILD_TYPE=Release
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/xz-cache" cmake3 --install build
|
||||
cmake -B build . -DCMAKE_BUILD_TYPE=Release
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/xz-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf xz
|
||||
|
@ -100,14 +113,14 @@ RUN git clone -b 0.4.17 --depth=1 $GIT/libproxy/libproxy.git
|
|||
|
||||
WORKDIR libproxy
|
||||
RUN git apply ../patches/libproxy.patch
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake3 -B build . \
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake -B build . \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWITH_DBUS=OFF \
|
||||
-DWITH_NM=OFF \
|
||||
-DWITH_NMold=OFF
|
||||
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/libproxy-cache" cmake3 --install build
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/libproxy-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf libproxy
|
||||
|
@ -116,14 +129,14 @@ FROM builder AS mozjpeg
|
|||
RUN git clone -b v4.0.1-rc2 --depth=1 $GIT/mozilla/mozjpeg.git
|
||||
|
||||
WORKDIR mozjpeg
|
||||
RUN CFLAGS=\"$HFLAGS\" cmake3 -B build . \
|
||||
RUN CFLAGS=\"$HFLAGS\" cmake -B build . \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DWITH_JPEG8=ON \
|
||||
-DPNG_SUPPORTED=OFF
|
||||
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/mozjpeg-cache" cmake3 --install build
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/mozjpeg-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf mozjpeg
|
||||
|
@ -144,10 +157,10 @@ FROM builder AS rnnoise
|
|||
RUN git clone -b master --depth=1 $GIT/desktop-app/rnnoise
|
||||
|
||||
WORKDIR rnnoise
|
||||
RUN CFLAGS=\"$HFLAGS\" cmake3 -B build . \
|
||||
RUN CFLAGS=\"$HFLAGS\" cmake -B build . \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN mkdir -p "$LibrariesPath/rnnoise-cache/usr/local/include"
|
||||
RUN cp "include/rnnoise.h" "$LibrariesPath/rnnoise-cache/usr/local/include/"
|
||||
RUN mkdir -p "$LibrariesPath/rnnoise-cache/usr/local/lib"
|
||||
|
@ -352,9 +365,9 @@ COPY --from=extra-cmake-modules ${LibrariesPath}/extra-cmake-modules-cache /
|
|||
RUN git clone -b v1.1.1 --depth=1 $GIT/KDE/plasma-wayland-protocols.git
|
||||
|
||||
WORKDIR plasma-wayland-protocols
|
||||
RUN cmake3 -B build . -DCMAKE_BUILD_TYPE=Release
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/plasma-wayland-protocols-cache" cmake3 --install build
|
||||
RUN cmake -B build . -DCMAKE_BUILD_TYPE=Release
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/plasma-wayland-protocols-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf plasma-wayland-protocols
|
||||
|
@ -553,7 +566,7 @@ ADD https://api.github.com/repos/telegramdesktop/openal-soft/git/refs/heads/fix_
|
|||
RUN git clone -b fix_pulse_default --depth=1 $GIT/telegramdesktop/openal-soft.git
|
||||
|
||||
WORKDIR openal-soft
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake3 -B build . \
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake -B build . \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLIBTYPE:STRING=STATIC \
|
||||
-DALSOFT_EXAMPLES=OFF \
|
||||
|
@ -561,8 +574,8 @@ RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake3 -B build . \
|
|||
-DALSOFT_UTILS=OFF \
|
||||
-DALSOFT_CONFIG=OFF
|
||||
|
||||
RUN cmake3 --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/openal-cache" cmake3 --install build
|
||||
RUN cmake --build build -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/openal-cache" cmake --install build
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf openal
|
||||
|
@ -673,19 +686,18 @@ COPY --from=wayland ${LibrariesPath}/wayland-cache /
|
|||
COPY --from=openssl ${LibrariesPath}/openssl-cache /
|
||||
COPY --from=xkbcommon ${LibrariesPath}/xkbcommon-cache /
|
||||
|
||||
RUN git clone -b ${QT_TAG} --depth=1 git://code.qt.io/qt/qt5.git qt_${QT}
|
||||
WORKDIR qt_${QT}
|
||||
RUN perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
|
||||
RUN git submodule update qtbase qtwayland qtimageformats qtsvg
|
||||
RUN [ -n "${QT6}" ] || git clone -b ${QT5_TAG} --depth=1 git://code.qt.io/qt/qt5.git qt_${QT5_VER}
|
||||
WORKDIR qt_${QT5_VER}
|
||||
RUN [ -n "${QT6}" ] || perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
|
||||
|
||||
WORKDIR qtbase
|
||||
RUN find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
RUN [ -n "${QT6}" ] || find ../../patches/qtbase_${QT5_VER} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
WORKDIR ../qtwayland
|
||||
RUN find ../../patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
RUN [ -n "${QT6}" ] || find ../../patches/qtwayland_${QT5_VER} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
WORKDIR ..
|
||||
|
||||
# I couldn't make it work with direct ./configure call :(
|
||||
RUN echo './configure -prefix '$'\"''$QT_PREFIX'$'\"'' \
|
||||
RUN [ -n "${QT6}" ] || echo './configure -prefix '$'\"''$QT5_PREFIX'$'\"'' \
|
||||
-release \
|
||||
-force-debug-info \
|
||||
-opensource \
|
||||
|
@ -707,16 +719,52 @@ RUN echo './configure -prefix '$'\"''$QT_PREFIX'$'\"'' \
|
|||
LIBPROXY_LIBS='$'\"''-lproxy -ldl'$'\"'' \
|
||||
-nomake examples \
|
||||
-nomake tests' >> ./run_configure.sh
|
||||
RUN cat ./run_configure.sh
|
||||
RUN chmod a+x ./run_configure.sh
|
||||
RUN ./run_configure.sh
|
||||
RUN rm ./run_configure.sh
|
||||
RUN [ -n "${QT6}" ] || cat ./run_configure.sh
|
||||
RUN [ -n "${QT6}" ] || chmod a+x ./run_configure.sh
|
||||
RUN [ -n "${QT6}" ] || ./run_configure.sh
|
||||
RUN [ -n "${QT6}" ] || rm ./run_configure.sh
|
||||
|
||||
RUN make -j$(nproc)
|
||||
RUN make INSTALL_ROOT="$LibrariesPath/qt-cache" install
|
||||
RUN [ -n "${QT6}" ] || make -j$(nproc)
|
||||
RUN [ -n "${QT6}" ] || make INSTALL_ROOT="$LibrariesPath/qt-cache" install
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf qt_${QT}
|
||||
RUN [ -n "${QT6}" ] || rm -rf qt_${QT5_VER}
|
||||
|
||||
RUN [ -n "${QT6}" ] && git clone -b ${QT6_TAG} --depth=1 git://code.qt.io/qt/qt5.git qt_${QT6_VER}
|
||||
WORKDIR qt_${QT6_VER}
|
||||
RUN [ -n "${QT6}" ] && perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qt5compat
|
||||
|
||||
WORKDIR qtbase
|
||||
RUN [ -n "${QT6}" ] && find ../../patches/qtbase_${QT6_VER} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
WORKDIR ../qtwayland
|
||||
RUN [ -n "${QT6}" ] && find ../../patches/qtwayland_${QT6_VER} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
WORKDIR ../qt5compat
|
||||
RUN [ -n "${QT6}" ] && find ../../patches/qt5compat_${QT6_VER} -type f -print0 | sort -z | xargs -r0 git apply
|
||||
WORKDIR ..
|
||||
|
||||
RUN [ -n "${QT6}" ] && ./configure -prefix "$QT6_PREFIX" \
|
||||
-release \
|
||||
-force-debug-info \
|
||||
-opensource \
|
||||
-confirm-license \
|
||||
-libproxy \
|
||||
-qt-libpng \
|
||||
-qt-harfbuzz \
|
||||
-qt-pcre \
|
||||
-no-pch \
|
||||
-no-icu \
|
||||
-no-feature-xcb-sm \
|
||||
-static \
|
||||
-dbus-runtime \
|
||||
-openssl-linked \
|
||||
-nomake examples \
|
||||
-nomake tests
|
||||
|
||||
RUN [ -n "${QT6}" ] && cmake --build . -j$(nproc)
|
||||
RUN [ -n "${QT6}" ] && DESTDIR="$LibrariesPath/qt-cache" cmake --install .
|
||||
|
||||
WORKDIR ..
|
||||
RUN [ -n "${QT6}" ] && rm -rf qt_${QT6_VER}
|
||||
|
||||
FROM builder AS kwayland
|
||||
|
||||
|
@ -738,15 +786,16 @@ COPY --from=openssl ${LibrariesPath}/openssl-cache /
|
|||
COPY --from=xkbcommon ${LibrariesPath}/xkbcommon-cache /
|
||||
COPY --from=qt ${LibrariesPath}/qt-cache /
|
||||
|
||||
RUN git clone -b v5.77.0 --depth=1 $GIT/KDE/kwayland.git
|
||||
RUN [ -n "${QT6}" ] || git clone -b v5.77.0 --depth=1 $GIT/KDE/kwayland.git
|
||||
|
||||
WORKDIR kwayland
|
||||
RUN cmake3 -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
|
||||
RUN cmake3 --build build --target KF5WaylandClient -j$(nproc)
|
||||
RUN DESTDIR="$LibrariesPath/kwayland-cache" cmake3 --install build/src/client
|
||||
RUN [ -n "${QT6}" ] || cmake -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
|
||||
RUN [ -n "${QT6}" ] || cmake --build build --target KF5WaylandClient -j$(nproc)
|
||||
RUN [ -n "${QT6}" ] || DESTDIR="$LibrariesPath/kwayland-cache" cmake --install build/src/client
|
||||
RUN [ -n "${QT6}" ] && mkdir "$LibrariesPath/kwayland-cache"
|
||||
|
||||
WORKDIR ..
|
||||
RUN rm -rf kwayland
|
||||
RUN [ -n "${QT6}" ] || rm -rf kwayland
|
||||
|
||||
FROM patches AS breakpad
|
||||
RUN git clone https://chromium.googlesource.com/breakpad/breakpad.git
|
||||
|
@ -780,8 +829,8 @@ RUN sed -i 's/minidump_upload.m/minidump_upload.cc/' linux/tools_linux.gypi
|
|||
RUN ../../../gyp/gyp --depth=. --generator-output=.. -Goutput_dir=../out tools.gyp --format=cmake
|
||||
|
||||
WORKDIR ../../out/Default
|
||||
RUN cmake3 .
|
||||
RUN cmake3 --build . --target dump_syms -j$(nproc)
|
||||
RUN cmake .
|
||||
RUN cmake --build . --target dump_syms -j$(nproc)
|
||||
RUN mv dump_syms $BreakpadCache
|
||||
|
||||
WORKDIR ..
|
||||
|
@ -810,7 +859,7 @@ RUN meson build
|
|||
|
||||
WORKDIR ../../..
|
||||
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake3 -B out/Release . \
|
||||
RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake -B out/Release . \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DTG_OWT_BUILD_AUDIO_BACKENDS=OFF \
|
||||
-DTG_OWT_SPECIAL_TARGET=linux \
|
||||
|
@ -819,10 +868,10 @@ RUN CFLAGS=\"$HFLAGS\" CXXFLAGS=\"$HFLAGS\" cmake3 -B out/Release . \
|
|||
-DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \
|
||||
-DTG_OWT_FFMPEG_INCLUDE_PATH=/usr/local/include
|
||||
|
||||
RUN cmake3 --build out/Release -- -j$(nproc)
|
||||
RUN cmake --build out/Release -- -j$(nproc)
|
||||
|
||||
ENV HFLAGS_DEBUG="-fstack-protector-all -fstack-clash-protection -fPIC"
|
||||
RUN CFLAGS=\"$HFLAGS_DEBUG\" CXXFLAGS=\"$HFLAGS_DEBUG\" cmake3 -B out/Debug . \
|
||||
RUN CFLAGS=\"$HFLAGS_DEBUG\" CXXFLAGS=\"$HFLAGS_DEBUG\" cmake -B out/Debug . \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DTG_OWT_SPECIAL_TARGET=linux \
|
||||
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/local/include \
|
||||
|
@ -830,7 +879,7 @@ RUN CFLAGS=\"$HFLAGS_DEBUG\" CXXFLAGS=\"$HFLAGS_DEBUG\" cmake3 -B out/Debug . \
|
|||
-DTG_OWT_OPUS_INCLUDE_PATH=/usr/local/include/opus \
|
||||
-DTG_OWT_FFMPEG_INCLUDE_PATH=/usr/local/include
|
||||
|
||||
RUN cmake3 --build out/Debug -- -j$(nproc)
|
||||
RUN cmake --build out/Debug -- -j$(nproc)
|
||||
|
||||
FROM builder
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ cd Telegram
|
|||
./configure.sh "$@"
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
cmake3 --build ../out/Debug -j$(nproc)
|
||||
cmake --build ../out/Debug -j$(nproc)
|
||||
else
|
||||
cmake3 --build ../out/Release -j$(nproc)
|
||||
cmake --build ../out/Release -j$(nproc)
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue