1#!/bin/bash 2set -eu 3set -o pipefail 4 5# travis_retry() is taken from 6# travis-ci/travis-build/lib/travis/build/templates/header.sh (e3400b7), 7# which is covered by the MIT licence. Two lines for "set +-x" are added. 8ANSI_RED="\033[31;1m" 9ANSI_RESET="\033[0m" 10travis_retry() { 11 set +x 12 local result=0 13 local count=1 14 while [ $count -le 3 ]; do 15 [ $result -ne 0 ] && { 16 echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2 17 } 18 "$@" && { result=0 && break; } || result=$? 19 count=$(($count + 1)) 20 sleep 1 21 done 22 [ $count -gt 3 ] && { 23 echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2 24 } 25 set -x 26 return $result 27} 28 29# Print all executed commands to the log. 30set -x 31 32if [ "x$TRAVIS_OS_NAME" = xlinux ]; then 33 case $CI_TARGET in 34 *parform*|*parvorm*) 35 # When MPI is not installed from APT, manually install MPICH. 36 if type mpicc >/dev/null 2>&1; then :; else 37 if [ ! -e ./mpich/bin/mpicc ]; then 38 # Install MPICH to "./mpich". 39 travis_retry wget http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz 40 tar xfz mpich-3.2.1.tar.gz 41 ( 42 cd mpich-3.2.1 43 ./configure --prefix=$TRAVIS_BUILD_DIR/mpich --disable-dependency-tracking --disable-fortran 44 make 45 make check 46 make install 47 ) 48 fi 49 export PATH=`pwd`/mpich/bin:$PATH 50 fi 51 ;; 52 esac 53 case $CI_TARGET in 54 *coverage*) 55 travis_retry pip install --user cpp-coveralls 56 ;; 57 esac 58 case $CI_TARGET in 59 *doc*) 60 # Install TeX Live to "./texlive". 61 if [ ! -e ./texlive/bin/`uname -m`-linux/tlmgr ]; then 62 travis_retry wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -O - | tar -x --gzip 63 echo " 64 selected_scheme scheme-minimal 65 TEXDIR ./texlive 66 TEXMFCONFIG ~/.texlive2016/texmf-config 67 TEXMFHOME ~/texmf 68 TEXMFLOCAL ./texlive/texmf-local 69 TEXMFSYSCONFIG ./texlive/texmf-config 70 TEXMFSYSVAR ./texlive/texmf-var 71 TEXMFVAR ~/.texlive2016/texmf-var 72 collection-fontsrecommended 1 73 collection-latex 1 74 option_doc 0 75 option_src 0 76 " | sed -e 's/^ *//' >texlive.profile 77 ./install-tl-20*/install-tl --profile texlive.profile 78 fi 79 export PATH=`pwd`/texlive/bin/`uname -m`-linux:$PATH 80 ;; 81 esac 82 case $CI_TARGET in 83 *doc-html*) 84 # Install LaTeX2HTML to the TeX Live directory. 85 if [ ! -e ./texlive/bin/`uname -m`-linux/latex2html ]; then 86 travis_retry wget http://mirrors.ctan.org/support/latex2html/latex2html-2018.tar.gz -O - | tar -x --gzip 87 ( 88 cd latex2html-* 89 ./configure --prefix=$TRAVIS_BUILD_DIR/texlive/texmf-local/latex2html 90 make install 91 ) 92 ( 93 cd texlive/bin/`uname -m`-linux 94 ln -s ../../texmf-local/latex2html/bin/latex2html 95 ln -s ../../texmf-local/latex2html/bin/pstoimg 96 ln -s ../../texmf-local/latex2html/bin/texexpand 97 ) 98 fi 99 ;; 100 esac 101fi 102 103if [ "x$TRAVIS_OS_NAME" = xosx ]; then 104 case $CI_TARGET in 105 *parform*|*parvorm*) 106 # See travis-ci/travis-ci#8826 107 travis_retry brew update 108 brew cask uninstall oclint 109 travis_retry brew install mpich 110 ;; 111 esac 112 case $CI_TARGET in 113 *valgrind*) 114 travis_retry brew update 115 # valgrind 3.11.0 116 travis_retry brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/7a4dabfc1a2acd9f01a1670fde4f0094c4fb6ffa/Formula/valgrind.rb 117 ;; 118 esac 119 case $CI_TARGET in 120 *coverage*) 121 # NOTE: Python needs a manual setup on osx: travis-ci/travis-ci#2312. 122 if type pyenv >/dev/null 2>&1; then :;else 123 travis_retry brew update 124 travis_retry brew install pyenv 125 fi 126 eval "$(pyenv init -)" 127 travis_retry pyenv install 2.7.12 128 pyenv global 2.7.12 129 pyenv rehash 130 travis_retry brew install openssl 131 LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" travis_retry pip install cryptography # pyca/cryptography#3367 132 travis_retry pip install cpp-coveralls 133 pyenv rehash 134 ;; 135 esac 136fi 137 138case $CI_TARGET in 139 form|tform|form-i386|tform-i386) 140 # Install Forcer to "./formlib". 141 mkdir -p formlib 142 travis_retry wget https://github.com/benruijl/forcer/archive/v1.0.0.tar.gz -O - | tar -x --gzip 143 mv forcer-1.0.0/forcer.h formlib 144 mv forcer-1.0.0/forcer formlib 145 rm -rf forcer-1.0.0 146 ;; 147esac 148 149case $CI_TARGET in 150 form-i386|tform-i386) 151 # Use Docker (travis-ci/travis-ci#5770). 152 travis_retry docker run -d --name build_test -v "$(pwd):$(pwd)" toopher/centos-i386:centos6 /sbin/init 153 docker exec -i -t build_test /bin/sh -c 'linux32 --32bit i386 sudo rpm --rebuilddb' 154 docker exec -i -t build_test /bin/sh -c 'linux32 --32bit i386 sudo yum install -y automake gcc-c++ git gmp-devel ruby zlib-devel' 155 ;; 156esac 157