Tidying cmake utils

This commit is contained in:
Bob Mottram 2018-02-25 14:41:52 +00:00
parent fee71d392e
commit 229a9c3091
1 changed files with 24 additions and 25 deletions

View File

@ -32,25 +32,26 @@ CMAKE_REPO="https://github.com/Kitware/CMake"
CMAKE_COMMIT='d6734eeb875ceca5d810e829ca90541918dca2b4' CMAKE_COMMIT='d6734eeb875ceca5d810e829ca90541918dca2b4'
function mesh_install_cmake { function mesh_install_cmake {
if [ ! -d $rootdir$INSTALL_DIR ]; then # shellcheck disable=SC2154
chroot "$rootdir" mkdir -p $INSTALL_DIR if [ ! -d "$rootdir$INSTALL_DIR" ]; then
chroot "$rootdir" mkdir -p "$INSTALL_DIR"
fi fi
chroot "$rootdir" apt-get -yq install build-essential chroot "$rootdir" apt-get -yq install build-essential
if [ -d /repos/cmake ]; then if [ -d /repos/cmake ]; then
mkdir $rootdir$INSTALL_DIR/cmake mkdir "$rootdir$INSTALL_DIR/cmake"
cp -r -p /repos/cmake/. $rootdir$INSTALL_DIR/cmake cp -r -p /repos/cmake/. "$rootdir$INSTALL_DIR/cmake"
cd $rootdir$INSTALL_DIR/cmake cd "$rootdir$INSTALL_DIR/cmake" || exit 678346836
git pull git pull
else else
git clone $CMAKE_REPO $rootdir$INSTALL_DIR/cmake git clone "$CMAKE_REPO" "$rootdir$INSTALL_DIR/cmake"
fi fi
cd $rootdir$INSTALL_DIR/cmake cd "$rootdir$INSTALL_DIR/cmake" || exit 734634684
git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT
cat <<EOF > $rootdir/root/install_cmake cat <<EOF > "$rootdir/root/install_cmake"
cd $INSTALL_DIR/cmake cd $INSTALL_DIR/cmake
./bootstrap ./bootstrap
make make
@ -65,18 +66,17 @@ EOF
} }
function install_cmake { function install_cmake {
if [ $INSTALLING_MESH ]; then if [ "$INSTALLING_MESH" ]; then
mesh_install_cmake mesh_install_cmake
return return
fi fi
if [ -d $INSTALL_DIR/cmake ]; then if [ -d "$INSTALL_DIR/cmake" ]; then
if ! grep -q "CMake commit:$CMAKE_COMMIT" $COMPLETION_FILE; then if ! grep -q "CMake commit:$CMAKE_COMMIT" "$COMPLETION_FILE"; then
set_repo_commit $INSTALL_DIR/cmake "CMake commit" "$CMAKE_COMMIT" $CMAKE_REPO set_repo_commit "$INSTALL_DIR/cmake" "CMake commit" "$CMAKE_COMMIT" "$CMAKE_REPO"
cd $INSTALL_DIR/cmake cd "$INSTALL_DIR/cmake" || exit 36873638
./bootstrap ./bootstrap
make if ! make; then
if [ ! "$?" = "0" ]; then
exit 72581 exit 72581
fi fi
make install make install
@ -87,26 +87,25 @@ function install_cmake {
return return
fi fi
if [ ! -d $INSTALL_DIR ]; then if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p $INSTALL_DIR mkdir -p "$INSTALL_DIR"
fi fi
apt-get -yq install build-essential apt-get -yq install build-essential
if [ -d /repos/cmake ]; then if [ -d /repos/cmake ]; then
mkdir $INSTALL_DIR/cmake mkdir "$INSTALL_DIR/cmake"
cp -r -p /repos/cmake/. $INSTALL_DIR/cmake cp -r -p /repos/cmake/. "$INSTALL_DIR/cmake"
cd $INSTALL_DIR/cmake cd "$INSTALL_DIR/cmake" || exit 374893758
git pull git pull
else else
git_clone $CMAKE_REPO $INSTALL_DIR/cmake git_clone "$CMAKE_REPO" "$INSTALL_DIR/cmake"
fi fi
cd $INSTALL_DIR/cmake cd "$INSTALL_DIR/cmake" || exit 3467384
git checkout $CMAKE_COMMIT -b $CMAKE_COMMIT git checkout "$CMAKE_COMMIT" -b "$CMAKE_COMMIT"
./bootstrap ./bootstrap
make if ! make; then
if [ ! "$?" = "0" ]; then
exit 72581 exit 72581
fi fi
make install make install