ARG DOCKER_PREFIX=wapmobil/
FROM ${DOCKER_PREFIX}debian-base
ARG XCODE_XIP=shstk.ru/files/Xcode_10.3.xip

# 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 \
 python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools \
 python3 python3-pip python3-setuptools \
 ccache libffi-dev libssl-dev doxygen graphviz libx11-dev libxkbcommon-dev libpkgconfig-perl libfreetype6-dev libfontconfig1-dev \
 lzma-dev liblzma-dev libxml2-dev libbz2-dev libmpc-dev libmpfr-dev libgmp-dev libicu-dev libusb-1.0-0-dev libreadline-dev \
 clang cpio libglu1-mesa-dev libxml2-dev libssl-dev liblzma-dev libbz2-dev genisoimage \
 && rm -rf /var/cache/apt/archives/*

ENV PATH=/soft/osxcross/target/bin:$PATH
ENV UNATTENDED=1
WORKDIR /soft
RUN git clone --depth=1 https://git.shstk.ru/mirrors/osxcross.git \
 && wget -nv http://${XCODE_XIP} -O Xcode.xip && osxcross/tools/gen_sdk_package_pbzx.sh ./Xcode.xip && rm -rvf /soft/Xcode.xip \
 && cd /soft/osxcross && mv Mac*.sdk.tar.xz tarballs/ \
 && ./build.sh \
 && ln -s llvm-config-7 /usr/bin/llvm-config \
 && ./build_compiler_rt.sh \
 && mkdir -p /usr/lib/llvm-7/lib/clang/7.0.1/include \
 && mkdir -p /usr/lib/llvm-7/lib/clang/7.0.1/lib/darwin \
 && cp -rv /soft/osxcross/build/compiler-rt/compiler-rt/include/sanitizer /usr/lib/llvm-7/lib/clang/7.0.1/include \
 && cp -v /soft/osxcross/build/compiler-rt/compiler-rt/build/lib/darwin/*.a /usr/lib/llvm-7/lib/clang/7.0.1/lib/darwin \
 && cp -v /soft/osxcross/build/compiler-rt/compiler-rt/build/lib/darwin/*.dylib /usr/lib/llvm-7/lib/clang/7.0.1/lib/darwin \
 && rm -rvf /soft/osxcross/tarballs/* \
 && rm -rvf /soft/osxcross/build/*

ENV PATH=/soft/osxcross/target/bin:/opt/cmake/bin:$PATH 
WORKDIR /soft
