FROM ubuntu:16.04
RUN apt update && apt install
RUN apt -y install git cmake wget gcc-4.8 g++-4.8 make vim python psmisc build-essential
RUN apt -y install m4 libgmp3-dev libmpfr-dev libmpfr-doc libmpfr4 libmpfr4-dbg

# Setup gcc-4.8 and g++-4.8 for use 
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
RUN update-alternatives --set cc /usr/bin/gcc
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
RUN update-alternatives --set c++ /usr/bin/g++
RUN update-alternatives --config gcc
RUN update-alternatives --config g++

RUN export CC=/usr/bin/gcc-4.8
RUN export CXX=/usr/bin/g++-4.8

COPY XPIR.tar.gz /pir/
WORKDIR /pir/
RUN tar -xf XPIR.tar.gz

RUN git clone https://git-crysp.uwaterloo.ca/piros/XPIR.git
RUN cd XPIR && mkdir _build && ./helper_script.sh
#RUN cd XPIR/_build && cmake .. -DCMAKE_BUILD_TYPE=Release && make && make check
RUN cd XPIR/_build && cmake .. -DCMAKE_BUILD_TYPE=Release && make
