# Copyright © 2021 by The qTox Project Contributors # # This program is libre software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . FROM debian:bullseye-slim SHELL ["/bin/bash", "-o", "pipefail", "-c"] ENV DEBIAN_FRONTEND=noninteractive ARG ARCH ARG WINEARCH ENV WINEARCH=${WINEARCH} ARG SCRIPT_ARCH=${WINEARCH} RUN dpkg --add-architecture i386 && \ apt-get update && apt-get install -y --no-install-recommends \ autoconf \ automake \ build-essential \ ca-certificates \ cmake \ extra-cmake-modules \ git \ libarchive-tools \ libtool \ nsis \ pkg-config \ python3-pefile \ tclsh \ texinfo \ unzip \ curl \ gnupg \ yasm \ zip \ g++-mingw-w64-${ARCH//_/-} \ gcc-mingw-w64-${ARCH//_/-} \ gdb-mingw-w64 RUN curl -L --connect-timeout 10 https://dl.winehq.org/wine-builds/winehq.key | apt-key add - RUN echo "deb https://dl.winehq.org/wine-builds/debian/ bullseye main" >> /etc/apt/sources.list.d/wine.list RUN apt-get update && apt-get install -y --no-install-recommends wine-stable RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN update-alternatives --set ${ARCH}-w64-mingw32-gcc /usr/bin/${ARCH}-w64-mingw32-gcc-posix && \ update-alternatives --set ${ARCH}-w64-mingw32-g++ /usr/bin/${ARCH}-w64-mingw32-g++-posix COPY download/common.sh /build/download/common.sh COPY build_utils.sh /build/build_utils.sh COPY download/download_openssl.sh /build/download/download_openssl.sh COPY build_openssl.sh /build/build_openssl.sh RUN mkdir -p /src/openssl && \ cd /src/openssl && \ /build/build_openssl.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/openssl COPY download/download_qt.sh /build/download/download_qt.sh COPY build_qt_windows.sh /build/build_qt_windows.sh RUN mkdir -p /src/qt && \ cd /src/qt && \ /build/build_qt_windows.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/qt COPY download/download_sqlcipher.sh /build/download/download_sqlcipher.sh COPY build_sqlcipher.sh /build/build_sqlcipher.sh RUN mkdir -p /src/sqlcipher && \ cd /src/sqlcipher && \ /build/build_sqlcipher.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/sqlcipher COPY download/download_ffmpeg.sh /build/download/download_ffmpeg.sh COPY build_ffmpeg.sh /build/build_ffmpeg.sh RUN mkdir -p /src/ffmpeg && \ cd /src/ffmpeg && \ /build/build_ffmpeg.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/ffmpeg COPY toolchain/windows-${ARCH}-toolchain.cmake /build/windows-toolchain.cmake COPY download/download_openal.sh /build/download/download_openal.sh COPY build_openal.sh /build/build_openal.sh COPY patches/openal-cmake-3-11.patch /build/patches/openal-cmake-3-11.patch RUN mkdir -p /src/openal && \ cd /src/openal && \ /build/build_openal.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/openal COPY download/download_qrencode.sh /build/download/download_qrencode.sh COPY build_qrencode.sh /build/build_qrencode.sh RUN mkdir -p /src/qrencode && \ cd /src/qrencode && \ /build/build_qrencode.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/qrencode COPY download/download_libexif.sh /build/download/download_libexif.sh COPY build_libexif.sh /build/build_libexif.sh RUN mkdir -p /src/exif && \ cd /src/exif && \ /build/build_libexif.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/exif COPY download/download_snore.sh /build/download/download_snore.sh COPY build_snore_windows.sh /build/build_snore_windows.sh RUN mkdir -p /src/snore && \ cd /src/snore && \ /build/build_snore_windows.sh && \ rm -fr /src/snore COPY download/download_opus.sh /build/download/download_opus.sh COPY build_opus.sh /build/build_opus.sh RUN mkdir -p /src/opus && \ cd /src/opus && \ /build/build_opus.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/opus COPY download/download_sodium.sh /build/download/download_sodium.sh COPY build_sodium.sh /build/build_sodium.sh RUN mkdir -p /src/sodium && \ cd /src/sodium && \ /build/build_sodium.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/sodium COPY download/download_vpx.sh /build/download/download_vpx.sh COPY build_vpx.sh /build/build_vpx.sh COPY patches/vpx-windows.patch /build/patches/vpx-windows.patch RUN mkdir -p /src/vpx && \ cd /src/vpx && \ /build/build_vpx.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/vpx COPY download/download_mingw_ldd.sh /build/download/download_mingw_ldd.sh COPY build_mingw_ldd_windows.sh /build/build_mingw_ldd_windows.sh RUN mkdir -p /src/mingw_ldd && \ cd /src/mingw_ldd && \ /build/build_mingw_ldd_windows.sh && \ rm -fr /src/mingw_ldd COPY download/download_nsisshellexecasuser.sh /build/download/download_nsisshellexecasuser.sh COPY build_nsisshellexecasuser_windows.sh /build/build_nsisshellexecasuser_windows.sh RUN mkdir -p /src/nsisshellexecasuser && \ cd /src/nsisshellexecasuser && \ /build/build_nsisshellexecasuser_windows.sh && \ rm -fr /src/nsisshellexecasuser COPY download/download_toxcore.sh /build/download/download_toxcore.sh COPY download/download_toxext.sh /build/download/download_toxext.sh COPY download/download_toxext_messages.sh /build/download/download_toxext_messages.sh COPY build_toxcore.sh /build/build_toxcore.sh RUN mkdir -p /src/tox && \ cd /src/tox && \ /build/build_toxcore.sh && \ rm -fr /src/tox RUN mkdir /export && \ cp /usr/${ARCH}-w64-mingw32/lib/libwinpthread-1.dll /export/ && \ cp /usr/lib/gcc/${ARCH}-w64-mingw32/10-posix/libgcc_s_*-1.dll /export && \ cp /usr/lib/gcc/${ARCH}-w64-mingw32/10-posix/libstdc++-6.dll /export && \ cp /usr/lib/gcc/${ARCH}-w64-mingw32/10-posix/libssp-0.dll /export && \ cp /windows/bin/Qt5Core.dll /export && \ cp /windows/bin/Qt5Gui.dll /export && \ cp /windows/bin/Qt5Network.dll /export && \ cp /windows/bin/Qt5Svg.dll /export && \ cp /windows/bin/Qt5Xml.dll /export && \ cp /windows/bin/Qt5Widgets.dll /export && \ cp /windows/bin/avcodec-*.dll /export && \ cp /windows/bin/avdevice-*.dll /export && \ cp /windows/bin/avformat-*.dll /export && \ cp /windows/bin/avutil-*.dll /export && \ cp /windows/bin/libexif-*.dll /export && \ cp /windows/lib/libqrencode.dll /export && \ cp /windows/bin/libsodium-*.dll /export && \ cp /windows/bin/libsqlcipher-*.dll /export && \ cp /windows/bin/swscale-*.dll /export && \ cp /windows/bin/libcrypto-*.dll /export && \ cp /windows/bin/libtoxcore.dll /export && \ cp /windows/bin/libopus-*.dll /export && \ cp /windows/lib/libvpx.dll /export && \ cp /windows/bin/OpenAL32.dll /export && \ cp /windows/bin/libssl-*.dll /export && \ cp /windows/bin/libsnore-qt5.dll /export && \ mkdir -p /export/libsnore-qt5/ && \ cp /windows/plugins/libsnore-qt5/libsnore_backend_windowstoast.dll /export/libsnore-qt5/ && \ cp /windows/bin/SnoreToast.exe /export && \ cp -r /windows/plugins/iconengines /export && \ cp -r /windows/plugins/imageformats /export && \ cp -r /windows/plugins/platforms /export RUN mkdir -p /debug_export COPY download/download_mingw_debug_scripts.sh /build/download/download_mingw_debug_scripts.sh RUN mkdir -p /src/mingw-debug-scripts && \ cd /src/mingw-debug-scripts && \ /build/download/download_mingw_debug_scripts.sh && \ sed -i "s|your-app-name.exe|qtox.exe|g" debug-*.bat && \ cp -a debug-*.bat /debug_export && \ rm -fr /src/mingw-debug-scripts COPY download/download_gmp.sh /build/download/download_gmp.sh COPY build_gmp_windows.sh /build/build_gmp_windows.sh RUN mkdir -p /src/gmp && \ cd /src/gmp && \ /build/build_gmp_windows.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/gmp COPY download/download_libexpat.sh /build/download/download_libexpat.sh COPY build_libexpat_windows.sh /build/build_libexpat_windows.sh RUN mkdir -p /src/libexpat && \ cd /src/libexpat && \ /build/build_libexpat_windows.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/libexpat COPY download/download_gdb.sh /build/download/download_gdb.sh COPY build_gdb_windows.sh /build/build_gdb_windows.sh RUN mkdir -p /src/gdb && \ cd /src/gdb && \ /build/build_gdb_windows.sh --arch ${SCRIPT_ARCH} && \ rm -fr /src/gdb && \ cp /windows/bin/gdb.exe /debug_export/gdb.exe RUN mkdir -p /qtox WORKDIR /qtox