FROM pdal/dependencies:latest
MAINTAINER Howard Butler <howard@hobu.co>
#ARG branch=master

ENV CC clang
ENV CXX clang++

RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
        cython \
        python-pip \
        libhpdf-dev \
    && rm -rf /var/lib/apt/lists/*


RUN git clone --depth=1 https://github.com/PDAL/PDAL \
	&& cd PDAL \
	&& git checkout master \
	&& mkdir build \
	&& cd build \
	&& cmake \
		-DBUILD_PLUGIN_CPD=OFF \
		-DBUILD_PLUGIN_GREYHOUND=ON \
		-DBUILD_PLUGIN_HEXBIN=ON \
		-DBUILD_PLUGIN_ICEBRIDGE=ON \
		-DBUILD_PLUGIN_MRSID=ON \
		-DBUILD_PLUGIN_NITF=ON \
		-DBUILD_PLUGIN_OCI=OFF \
		-DBUILD_PLUGIN_P2G=ON \
		-DBUILD_PLUGIN_PCL=ON \
		-DBUILD_PLUGIN_PGPOINTCLOUD=ON \
		-DBUILD_PLUGIN_SQLITE=ON \
		-DBUILD_PLUGIN_RIVLIB=OFF \
		-DBUILD_PLUGIN_PYTHON=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_CTEST=OFF \
		-DWITH_APPS=ON \
		-DWITH_LAZPERF=ON \
		-DWITH_GEOTIFF=ON \
		-DWITH_LASZIP=ON \
		-DWITH_TESTS=ON \
		-DCMAKE_BUILD_TYPE=Release \
		.. \
	&& make -j4 \
	&& make install \
    && rm -rf PDAL

#RUN pip install packaging \
#    && pip install PDAL


RUN git clone https://github.com/PDAL/PRC.git \
    && cd PRC \
    && git checkout master \
    && mkdir build \
    && cd build \
    && echo `pwd` \
    && ls .. \
    && cmake \
        -DCMAKE_BUILD_TYPE=Release \
        -DPDAL_DIR=/usr/lib/pdal/cmake \
        .. \
    && make \
    && make install \
    && rm -rf PRC
