Skip to content

Commit 2109d17

Browse files
committed
Change apt-get to allow external repository
1 parent 8055de5 commit 2109d17

File tree

2 files changed

+38
-21
lines changed

2 files changed

+38
-21
lines changed

.travis.yml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: cpp
22
dist: bionic
33
compiler: gcc
4-
sudo: false
4+
sudo: required # apt-get done in before_install.sh
55

66
# Only build master or PRs merging into master
77
branches:
@@ -16,33 +16,16 @@ matrix:
1616
addons:
1717
apt:
1818
packages:
19-
- gfortran
2019
- python3-sphinx
2120
- valgrind
2221
- os: linux
2322
env: FLIBCPP_DEV=OFF GENERATOR=make
2423
FLIBCPP_FORTRAN_STD=f2003
25-
CC=gcc-8 CXX=g++-8 FC=gfortran-8
26-
addons:
27-
apt:
28-
packages:
29-
- gcc-8
30-
- g++-8
31-
- gfortran-8
24+
GCC_VERSION=8
3225
- os: linux
3326
env: FLIBCPP_DEV=OFF GENERATOR=make
3427
FLIBCPP_FORTRAN_STD=f2008
35-
CC=gcc-9 CXX=g++-9 FC=gfortran-9
36-
sudo: required
37-
addons:
38-
apt:
39-
sources:
40-
- ubuntu-toolchain-r-test
41-
packages:
42-
- gcc-9
43-
- g++-9
44-
- gfortran-9
45-
28+
GCC_VERSION=9
4629
# Build phases
4730
before_install:
4831
- source ./scripts/travis/before_install.sh

scripts/travis/before_install.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,46 @@
33
# File : example/before_install.sh
44
###############################################################################
55

6+
###############################################################################
7+
# APT PACKAGE INSTALLS
8+
#
9+
# see https://docs.travis-ci.com/user/installing-dependencies
10+
###############################################################################
11+
12+
set -x
13+
14+
if [ "${GCC_VERSION}" = "9" ]; then
15+
# Special repo needed for new GCC version
16+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
17+
sudo apt-get update -q
18+
fi
19+
20+
if [ -n "${GCC_VERSION}" ]; then
21+
# Suffix for compilers and packages
22+
_GCCV="-${GCC_VERSION}"
23+
fi
24+
25+
sudo apt-get install gfortran${_GCCV} -y
26+
27+
if [ -n "${GCC_VERSION}" ]; then
28+
sudo apt-get install gcc${_GCCV} -y
29+
sudo apt-get install g++${_GCCV} -y
30+
fi
31+
32+
set +x
33+
34+
###############################################################################
35+
# ENVIRONMENT VARIABLES
36+
###############################################################################
37+
638
export SOURCE_ROOT=${PWD}
739
export BUILD_ROOT=${SOURCE_ROOT}/build
840
export INSTALL_ROOT=${HOME}/install
941
export CMAKE_PREFIX_PATH=${INSTALL_ROOT}:${CMAKE_PREFIX_PATH}
1042
export PATH=${INSTALL_ROOT}/bin:${PATH}
11-
export FC=${FC:-gfortran}
43+
export FC=${FC:-gfortran${_GCCV}}
44+
export CC=${CC:-gcc${_GCCV}}
45+
export CXX=${CXX:-g++${_GCCV}}
1246

1347
mkdir -p ${BUILD_ROOT}
1448

0 commit comments

Comments
 (0)