diff --git a/common.docker b/common.docker index 9e5c36e..19919e3 100644 --- a/common.docker +++ b/common.docker @@ -17,16 +17,15 @@ RUN \ fi; \ rm /dockcross/install-openssl.sh /dockcross/install-cmake.sh -RUN git clone "https://github.com/ninja-build/ninja.git" && \ - cd ninja && \ - git checkout v1.7.1 && \ - ([ -e /opt/python/cp35-cp35m/bin/python ] && /opt/python/cp35-cp35m/bin/python ./configure.py --bootstrap) || python ./configure.py --bootstrap && \ - ./ninja && \ - cp ./ninja /usr/bin/ && \ - cd .. && rm -rf ninja COPY imagefiles/cmake.sh /usr/local/bin/cmake COPY imagefiles/ccmake.sh /usr/local/bin/ccmake +COPY imagefiles/install-ninja.sh /dockcross/ +RUN \ + /dockcross/install-ninja.sh \ + -python $([ -e /opt/python/cp35-cp35m/bin/python ] && echo "/opt/python/cp35-cp35m/bin/python" || echo "python") && \ + rm /dockcross/install-ninja.sh + RUN echo "root:root" | chpasswd WORKDIR /work ENTRYPOINT ["/dockcross/entrypoint.sh"] diff --git a/imagefiles/install-ninja.sh b/imagefiles/install-ninja.sh new file mode 100755 index 0000000..41d2d7a --- /dev/null +++ b/imagefiles/install-ninja.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# +# Configure, build and install ninja +# +# Usage: +# +# install-ninja.sh [-python /path/to/bin/python] + +set -e +set -o pipefail + +PYTHON=python +while [ $# -gt 0 ]; do + case "$1" in + -python) + PYTHON=$2 + shift + ;; + *) + echo "Usage: Usage: ${0##*/} [-python /path/to/bin/python]" + exit 1 + ;; + esac + shift +done + +# Download +REV=v1.7.1 +wget https://github.com/ninja-build/ninja/archive/$REV.tar.gz -O ninja.tar.gz +mkdir ninja +tar -xzvf ./ninja.tar.gz --strip-components=1 -C ./ninja + +# Configure, build and install +pushd ./ninja +echo "Configuring ninja using [$PYTHON]" +$PYTHON ./configure.py --bootstrap && ./ninja +cp ./ninja /usr/bin/ +popd + +# Clean +rm -rf ./ninja* +