ARG DOCKER_PREFIX=wapmobil/
FROM ${DOCKER_PREFIX}debian-base
ARG JOBS_COUNT=8
ARG JOBS_QT_COUNT=8

# versions
ENV CUR_CMAKE_VERSION=4.3.2
ENV CUR_SODIUM_VERSION=1.0.22
ENV CUR_FFTW_VERSION=3.3.11
ENV CUR_ASSIMP_VERSION=5.4.3
ENV CUR_DISCOUNT_VERSION=3.0.1.2
ENV CUR_MICROHTTPD_VERSION=1.0.1
ENV CUR_OPENSSL_VERSION=1_1_1w
ENV CUR_OPENCV_VERSION=4.13.0
ENV CUR_CURL_VERSION=8_20_0
ENV CUR_QT_VERSION_MAJOR=5.15
ENV CUR_QT_VERSION=5.15.18
ENV QT_SELECT=5

# provided by Debian
ENV MINGW_VERSION=14

COPY *.zip /soft/
COPY *.cmake /soft/
COPY *.patch /soft/

# dev soft for our SDK
RUN apt-get update && apt-get install -y cpio libglu1-mesa-dev libgl1-mesa-dev libwayland-dev libncurses-dev flex bison gperf \
 python3 python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-pyparsing python3-pyelftools \
 ccache libffi-dev libssl-dev doxygen graphviz libx11-dev libxkbcommon-dev libpkgconfig-perl libfreetype6-dev libfontconfig1-dev \
 liblzma-dev libxml2-dev libbz2-dev libmpc-dev libmpfr-dev libgmp-dev libicu-dev libusb-1.0-0-dev libreadline-dev \
 ninja-build mingw-w64 libz-mingw-w64-dev wine64 \
 && rm -rf /var/cache/apt/archives/*
 
WORKDIR /soft
RUN wget -v https://shstk.ru/files/cmake-${CUR_CMAKE_VERSION}-Linux-x86_64.sh \
 && rm -rf /opt/cmake \
 && mkdir -p /opt/cmake \
 && bash ./cmake-${CUR_CMAKE_VERSION}-Linux-x86_64.sh --skip-license --prefix=/opt/cmake \
 && rm -rf /soft/cmake-${CUR_CMAKE_VERSION}-Linux-x86_64.sh

# Remove invalid FindGtest.cmake
RUN cd "$(find /opt/cmake/share -name FindGTest.cmake -type f -printf '%h' -quit)" && rm FindGTest.cmake

# prepare wine
RUN winecfg /v && echo "wine init done"
