build-and-install-cmake.sh: Improve script to speedup build time

* faster source checkout specifying tag and depth
* remove obsolete comments
* disable testing
This commit is contained in:
Jean-Christophe Fillion-Robin 2018-06-05 13:03:35 -04:00
parent f1a8f69f4d
commit 71759485f9
No known key found for this signature in database
GPG Key ID: BAF1E1AEB9097A41

View File

@ -1,11 +1,5 @@
#!/bin/bash
#
# * build directory is /usr/src/CMake
#
# * install directory is /usr
#
# * after installation, archive, source and build directories are removed
#
set -ex
WRAPPER=""
@ -35,9 +29,7 @@ fi
cd /usr/src
git clone git://cmake.org/cmake.git CMake
(cd CMake && git checkout v$CMAKE_VERSION)
git clone git://cmake.org/cmake.git CMake -b v$CMAKE_VERSION --depth 1
mkdir /usr/src/CMake-build
cd /usr/src/CMake-build
@ -48,21 +40,22 @@ ${WRAPPER} make -j$(grep -c processor /proc/cpuinfo)
mkdir /usr/src/CMake-ssl-build
cd /usr/src/CMake-ssl-build
${WRAPPER} /usr/src/CMake-build/bin/cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_TESTING:BOOL=ON \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=/usr/src/cmake-$CMAKE_VERSION \
-DCMAKE_USE_OPENSSL:BOOL=ON \
-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl \
../CMake
${WRAPPER} make -j$(grep -c processor /proc/cpuinfo) install
# Cleanup install tree
cd /usr/src/cmake-$CMAKE_VERSION
rm -rf doc man
find . -type f -exec install -D "{}" "/usr/{}" \;
# Test
ctest -R CMake.FileDownload
# Install files
find . -type f -exec install -D "{}" "/usr/{}" \;
# Write test script
cat <<EOF > cmake-test-https-download.cmake
@ -86,4 +79,5 @@ EOF
# Execute test script
cmake -P cmake-test-https-download.cmake
# Remove source and build trees
rm -rf /usr/src/CMake*