install.sh 4.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
#!/usr/bin/env bash
set -x
set -e

function installswig() {
  # Need SWIG >= 3.0.8
  cd /tmp/ &&
    wget https://github.com/swig/swig/archive/rel-3.0.12.tar.gz &&
    tar zxf rel-3.0.12.tar.gz && cd swig-rel-3.0.12 &&
    ./autogen.sh && ./configure --prefix "${HOME}"/swig/ 1>/dev/null &&
    make >/dev/null &&
    make install >/dev/null
}

function installdotnetsdk(){
  # Installs for Ubuntu Trusty distro
  sudo apt-get update -qq
  # Need to upgrade to dpkg >= 1.17.5ubuntu5.8,
  # which fixes https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1730627
  sudo apt-get install -yq apt-transport-https dpkg
  wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
  sudo dpkg -i packages-microsoft-prod.deb
  # Install dotnet sdk 2.1
  sudo apt-get update -qq
  sudo apt-get install -yqq dotnet-sdk-2.2 dotnet-sdk-3.0
}

function installcmake(){
  # Install CMake 3.17.2
  wget "https://cmake.org/files/v3.17/cmake-3.17.2-Linux-x86_64.sh"
  chmod a+x cmake-3.17.2-Linux-x86_64.sh
  sudo ./cmake-3.17.2-Linux-x86_64.sh --prefix=/usr/local/ --skip-license
  rm cmake-3.17.2-Linux-x86_64.sh
}

################
##  MAKEFILE  ##
################
if [ "${BUILDER}" == make ]; then
  echo 'TRAVIS_OS_NAME = ${TRAVIS_OS_NAME}'
  if [ "${TRAVIS_OS_NAME}" == linux ]; then
    echo 'travis_fold:start:c++'
    sudo apt-get -qq update
    sudo apt-get -yqq install autoconf libtool zlib1g-dev gawk curl lsb-release
    echo 'travis_fold:end:c++'
    if [ "${LANGUAGE}" != cc ]; then
      echo 'travis_fold:start:swig'
      installswig
      echo 'travis_fold:end:swig'
    fi
    if [ "${LANGUAGE}" == python3 ]; then
      echo 'travis_fold:start:python3'
      pyenv global system 3.7
      python3.7 -m pip install -q virtualenv wheel six
      echo 'travis_fold:end:python3'
    elif [ "${LANGUAGE}" == dotnet ]; then
      echo 'travis_fold:start:dotnet'
      installdotnetsdk
      echo 'travis_fold:end:dotnet'
    fi
  elif [ "${TRAVIS_OS_NAME}" == linux-ppc64le ]; then
    echo 'travis_fold:start:c++'
    sudo apt-get -qq update
    sudo apt-get -yqq install autoconf libtool zlib1g-dev gawk curl lsb-release
    echo 'travis_fold:end:c++'
    if [ "${LANGUAGE}" != cc ]; then
      echo 'travis_fold:start:swig'
      installswig
      echo 'travis_fold:end:swig'
    fi
    if [ "${LANGUAGE}" == python3 ]; then
      echo 'travis_fold:start:python3'
      pyenv global system 3.7
      python3.7 -m pip install -q virtualenv wheel six
      echo 'travis_fold:end:python3'
    elif [ "${LANGUAGE}" == dotnet ]; then
      echo 'travis_fold:start:dotnet'
      installdotnetsdk
      echo 'travis_fold:end:dotnet'
    fi
  elif [ "${TRAVIS_OS_NAME}" == osx ]; then
    echo 'travis_fold:start:c++'
    brew update
    # see https://github.com/travis-ci/travis-ci/issues/10275
    brew install gcc || brew link --overwrite gcc
    brew install make ccache
    echo 'travis_fold:end:c++'
    if [ "${LANGUAGE}" != cc ]; then
      echo 'travis_fold:start:swig'
      brew install swig
      echo 'travis_fold:end:swig'
    fi
    if [ "${LANGUAGE}" == python3 ]; then
      echo 'travis_fold:start:python3'
      # brew upgrade python
      python3 -m pip install -q virtualenv wheel six
      echo 'travis_fold:end:python3'
    elif [ "${LANGUAGE}" == dotnet ]; then
      echo 'travis_fold:start:dotnet'
      brew cask install dotnet-sdk
      echo 'travis_fold:end:dotnet'
    fi
  fi
fi

#############
##  CMAKE  ##
#############
if [ "${BUILDER}" == cmake ]; then
  if [ "${TRAVIS_OS_NAME}" == linux ]; then
    installcmake
    if [ "${LANGUAGE}" != cc ]; then
      echo 'travis_fold:start:swig'
      installswig
      echo 'travis_fold:end:swig'
      echo 'travis_fold:start:python3'
      if [ "${ARCH}" == "amd64" ]; then
        pyenv global system 3.7
        python3.7 -m pip install -q virtualenv wheel six
      elif [ "${ARCH}" == "ppc64le" ]; then
        sudo apt-get install python3-dev python3-pip
        python3.5 -m pip install -q virtualenv wheel six
      elif [ "${ARCH}" == "amd64" ]; then
        sudo apt-get install python3-dev python3-pip pcre-dev
        python3 -m pip install -q virtualenv wheel six
      fi
      echo 'travis_fold:end:python3'
    fi
  elif [ "${TRAVIS_OS_NAME}" == osx ]; then
    echo 'travis_fold:start:c++'
    brew update
    # see https://github.com/travis-ci/travis-ci/issues/10275
    brew install gcc || brew link --overwrite gcc
    brew install make ccache
    echo 'travis_fold:end:c++'
    echo 'travis_fold:start:swig'
    brew install swig
    echo 'travis_fold:end:swig'
    # echo 'travis_fold:start:python3'
    # brew upgrade python
    # echo 'travis_fold:end:python3'
  fi
fi