FROM centos:centos7
RUN yum install -y \
	gcc \
	gettext \
	make \
	python-devel \
	python36-devel \
	rpm-build \
	tar

# For creating repo meta data
RUN yum install -y createrepo

# To allow installing other dependencies
RUN yum install -y epel-release

# THg GUI dependencies
RUN yum install -y \
	dejavu-sans-fonts \
	dejavu-sans-mono-fonts

# THg tests dependencies
RUN yum install -y python-pip && \
	pip install nose

# RPM build dependencies
RUN yum install -y \
	desktop-file-utils

# Install rust for rust-based optimizations
RUN yum install -y cargo

# Install Mercurial (so it can be called in our scripts)
RUN pip3 install mercurial --global-option="--rust"

# Install libffi-devel for pygit2
RUN yum install -y libffi-devel

# Install recent cmake to allow libgit2 installation
RUN yum install -y wget && wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-linux-x86_64.sh && \
    echo "f582e02696ceee81818dc3378531804b2213ed41c2a8bc566253d16d894cefab  cmake-3.20.5-linux-x86_64.sh" | sha256sum --check && \
    chmod +x ./cmake-3.20.5-linux-x86_64.sh && ./cmake-3.20.5-linux-x86_64.sh --skip-license --include-subdir --prefix=/ && \
    ln -s /cmake-3.20.5-linux-x86_64/bin/cmake /usr/bin/cmake

# Install libgit2 to allow usage of pygit2
#RUN yum install -y libgit2 libgit2-devel
RUN yum install -y git openssl-devel && \
    mkdir /libgit2 && \
    git clone -b v1.1.1 https://github.com/libgit2/libgit2.git /libgit2 && \
    mkdir /libgit2/build && cd /libgit2/build && cmake .. && cmake --build . --target install

# Configure UTF-8 to avoid python3 issues
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
