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