1#!/bin/bash -ex 2# 3# This script is run on travis for the install stage of mac builds. 4# 5 6#debug failed install 7function debug() { 8 cat ${CACHEDIR}/qt-${QT_VERSION}.env 9 find ${CACHEDIR}/Qt -maxdepth 3 -ls 10 cat ${CACHEDIR}/Qt/InstallationLog.txt 11 cat ${CACHEDIR}/Qt/components.xml 12 echo "$1" >&2 13 exit 1 14} 15 16# validate install 17function validate() { 18 ( 19 set +e 20 source ${CACHEDIR}/qt-${QT_VERSION}.env 21 if [ "$(qmake -query QT_INSTALL_BINS)" != "${QTDIR}/bin" ]; then 22 debug "ERROR: unexpected Qt location." 23 fi 24 if [ "$(qmake -query QT_VERSION)" != "${QT_VERSION}" ]; then 25 debug "ERROR: wrong Qt version." 26 fi 27 ) 28} 29 30QT_VERSION=${1:-5.12.2} 31QT_VERSION_SHORT=${QT_VERSION//./} 32 33# our expectation is that install-qt creates $QTDIR, $QTDIR/bin. 34CACHEDIR=${HOME}/Cache 35QTDIR=${CACHEDIR}/Qt/${QT_VERSION}/gcc_64 36 37if [ -d "${QTDIR}/bin" ]; then 38 echo "Using cached Qt." 39 echo "If you need to clear the cache see" 40 echo "https://docs.travis-ci.com/user/caching/#Fetching-and-storing-caches." 41 if [ "${TRAVIS_EVENT_TYPE}" = "cron" ]; then 42 # the cache is being used. modify it to reset expiration date. 43 date > ${CACHEDIR}/timestamp 44 fi 45 if [ -f "${CACHEDIR}/timestamp" ]; then 46 echo -n "Cache timestamp: " 47 cat "${CACHEDIR}/timestamp" 48 fi 49else 50 rm -fr ${CACHEDIR} 51 mkdir -p ${CACHEDIR} 52 pushd ${CACHEDIR} 53 # install-qt creates the install at $PWD/Qt. 54 QT_CI_PACKAGES=qt.qt5.${QT_VERSION_SHORT}.gcc_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt ${QT_VERSION} 55 popd 56 validate 57 rm ${CACHEDIR}/qt-opensource*.run 58fi 59 60# prepare locale for test_encoding_latin1, requires locales package. 61sudo rm -rf /var/lib/apt/lists/* \ 62 && sudo sed -i 's/^# *\(en_US ISO-8859-1\)/\1/' /etc/locale.gen \ 63 && sudo locale-gen \ 64 && locale -a 65