common: Introduce "install-ninja.sh"

This commit is contained in:
Jean-Christophe Fillion-Robin 2016-11-25 15:20:17 -05:00
parent 191d773e01
commit 8077008a10
No known key found for this signature in database
GPG Key ID: 15C1A2812F958BD3
2 changed files with 49 additions and 7 deletions

View File

@ -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"]

43
imagefiles/install-ninja.sh Executable file
View File

@ -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*