anchor.diff:  # vim:set ft=dockerfile:
   FROM ubuntu:xenial
   
  -MAINTAINER novidee
  +MAINTAINER jdmichaud
   
   # Set the application name
   ENV APPLICATION rethinkdb-compilation-env
  
positive.code:   git checkout b65595ffb74e5853ba61916f49bdbccfc54f1300 && \
    echo "export PI_TOOLS_HOME=$HOME/rpi-toolchain" >> ~/.bashrc
  ENV PI_TOOLS_HOME /home/jedi/rpi-toolchain/
  # Retrieve the CMake toolchain configuration file
  ADD https://raw.githubusercontent.com/jdmichaud/domos/master/rpi/cmaketc/Toolchain-raspberrypi-arm.cmake /home/jedi/Toolchain-raspberrypi-arm.cmake
  # Setup the environment for cross-compiling
  ENV CROSS=/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf
  
negative.code: ENV RANLIB=$CROSS-ranlib
  
  #
  # Download, compile and package rethinkdb
  #
  RUN cd /home/jedi && \
    curl -L https://github.com/rethinkdb/rethinkdb/archive/v2.3.5.tar.gz -o rethinkdb-2.3.5.tar.gz && \
    tar zxf rethinkdb-2.3.5.tar.gz && \
    cd rethinkdb-2.3.5 && \
    # From rethinkdb build instructions
    rm -rf external/v8* && \
    # deb_buildpackage complains that dependencies are missing. There is no dependency...
    sed -i 's/rfakeroot $(DEBUILD_SIGN_OPTIONS)/rfakeroot $(DEBUILD_SIGN_OPTIONS) -d -j'`nproc`'/g' mk/packaging.mk && \
    # Here, adding allow-catch to ./configure but also forcing building ssl as described
    # in this issue: https://github.com/rethinkdb/rethinkdb/issues/5776#issuecomment-220168597
    sed -i 's@./configure@./configure --allow-fetch --ccache\n\tmake build-openssl@g' packaging/debian/rules && \
    # https://github.com/rethinkdb/rethinkdb/issues/3312
    sed -i 's@$build_dir/third_party/icu" ./configure@$build_dir/third_party/icu/source" ./configure@g' mk/support/pkg/v8.sh && \
    # v8 won't compile if we don't disable the layout...
    sed -i 's/--enable-static "$@"/--enable-static --disable-layout "$@"/g' mk/support/pkg/v8.sh && \
    # Add a space to separate options
    sed -i 's@configure_flags+="--host=$($CXX -dumpmachine)"@ configure_flags+=" --host=$($CXX -dumpmachine)"@g' mk/support/pkg/jemalloc.sh && \
    # Fix some script bug
    sed -i 's@"${configure_flags:-}"@${configure_flags:-}@g' mk/support/pkg/jemalloc.sh && \
    # Force Architecture in debian package control file
    sed -i 's/Architecture: i386 amd64/Architecture: armhf/g' packaging/debian/control.in && \
    # Point dh_shlibdeps to the raspberry compilation tool-chain shared libraries
    sed -i 's@dh_shlibdeps -a@dh_shlibdeps -a -l/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf/:/home/jedi/rpi-toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/lib/ --dpkg-shlibdeps-params=--ignore-missing-info@g' packaging/debian/rules && \
    ./configure --allow-fetch --ccache && \
    # Got to build openssl manually to have the header (sys/ssl.h) in the proper place
    make build-openssl -j `echo $(nproc) - 1 | bc` && \
    UBUNTU_RELEASE=trusty SIGN_PACKAGE=0 make build-deb -j `echo $(nproc) - 1 | bc`
  #  UBUNTU_RELEASE=trusty SIGN_PACKAGE=0 make build-deb -d `echo $(nproc) - 1 | bc` SHELL="/bin/bash -x" > ../make.log 2>&1
  
  USER root
  