summaryrefslogtreecommitdiff
path: root/Tools/CI-linux-install.sh
blob: 93bb464124852b5c03f6d4656fa6c241ade8dc79 (plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
# Expected to be called from elsewhere with certain variables set
# e.g. RETRY=travis-retry SWIGLANG=python GCC=7
set -e # exit on failure (same as -o errexit)

if [[ -n "$GCC" ]]; then
	$RETRY sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
	$RETRY sudo apt-get -qq update
	$RETRY sudo apt-get install -qq g++-$GCC
else
	$RETRY sudo apt-get -qq update
fi

$RETRY sudo apt-get -qq install libboost-dev libpcre3-dev
# Note: testflags.py needs python, but python is pre-installed

WITHLANG=$SWIGLANG

case "$SWIGLANG" in
	"")     ;;
	"csharp")
		$RETRY sudo apt-get -qq install mono-devel
		;;
	"d")
		$RETRY wget http://downloads.dlang.org/releases/2.x/${VER}/dmd_${VER}-0_amd64.deb
		$RETRY sudo dpkg -i dmd_${VER}-0_amd64.deb
		;;
	"go")
		if [[ "$VER" ]]; then
		  mkdir -p $HOME/bin
		  curl -sL -o $HOME/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
		  chmod +x $HOME/bin/gimme
		  eval "$($HOME/bin/gimme ${VER}.x)"
		  $HOME/bin/gimme --list
		fi
		;;
	"javascript")
		case "$ENGINE" in
			"node")
				$RETRY wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.10/install.sh | bash
				export NVM_DIR="$HOME/.nvm"
				[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
				$RETRY nvm install ${VER}
				nvm use ${VER}
				if [ "$VER" == "0.10" ] || [ "$VER" == "0.12" ] || [ "$VER" == "4" ] || [ "$VER" == "6" ] ; then
#					$RETRY sudo apt-get install -qq nodejs node-gyp
					$RETRY npm install -g node-gyp@$VER
				elif [ "$VER" == "8" ] ; then
					$RETRY npm install -g node-gyp@6
				elif [ "$VER" == "10" ] || [ "$VER" == "12" ] || [ "$VER" == "14" ]  || [ "$VER" == "16" ]; then
					$RETRY npm install -g node-gyp@7
				else
					$RETRY npm install -g node-gyp
				fi
				;;
			"jsc")
				$RETRY sudo apt-get install -qq libjavascriptcoregtk-${VER}-dev
				;;
			"v8")
				$RETRY sudo apt-get install -qq libv8-dev
				;;
		esac
		;;
	"guile")
		$RETRY sudo apt-get -qq install guile-${VER:-2.0}-dev
		;;
	"lua")
		if [[ -z "$VER" ]]; then
			$RETRY sudo apt-get -qq install lua5.2 liblua5.2-dev
		else
			$RETRY sudo apt-get -qq install lua${VER} liblua${VER}-dev
		fi
		;;
	"mzscheme")
		$RETRY sudo apt-get -qq install racket
		;;
	"ocaml")
		$RETRY sudo apt-get -qq install ocaml camlp4
		;;
	"octave")
		if [[ "$VER" ]]; then
			$RETRY sudo add-apt-repository -y ppa:devacom/science
			$RETRY sudo apt-get -qq update
			$RETRY sudo apt-get -qq install "liboctave-dev=$VER.*"
		else
			$RETRY sudo apt-get -qq update
			$RETRY sudo apt-get -qq install liboctave-dev
		fi
		;;
	"php")
		if [[ "$VER" ]]; then
			$RETRY sudo apt-get -qq remove "php*-cli" "php*-dev" # Multiple versions are pre-installed
			$RETRY sudo add-apt-repository -y ppa:ondrej/php
			$RETRY sudo apt-get -qq update
			$RETRY sudo apt-get -qq install php$VER-cli php$VER-dev
		fi
		;;
	"python")
		pip install --user pycodestyle
		if [[ "$PY2" ]]; then
			WITHLANG=$SWIGLANG
		else
			WITHLANG=${SWIGLANG}3
		fi
		if [[ "$VER" ]]; then
			$RETRY sudo add-apt-repository -y ppa:deadsnakes/ppa
			$RETRY sudo apt-get -qq update
			$RETRY sudo apt-get -qq install python${VER}-dev
			WITHLANG=$WITHLANG=$SWIGLANG$VER
		elif [[ "$PY2" ]]; then
			$RETRY sudo apt-get install -qq python-dev
		else
			$RETRY sudo apt-get install -qq python3-dev
		fi
		;;
	"r")
		$RETRY sudo apt-get -qq install r-base
		;;
	"ruby")
		if [[ "$VER" ]]; then
			case "$VER" in
				3.1 | 3.2 )
					# Ruby 3.1+ support is currently only rvm master (2023-04-19)
					# YOLO
					curl -sSL https://rvm.io/mpapis.asc | gpg --import -
					curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
					curl -sSL https://get.rvm.io | bash -s stable
					set +x
					source $HOME/.rvm/scripts/rvm
					$RETRY rvm get master
					rvm reload
					rvm list known
					set -x
					;;
				* )
					# Install from PPA as that also contains packages needed for the build.
					sudo apt-add-repository -y ppa:rael-gc/rvm
					sudo apt-get update
					sudo apt-get install rvm
					sudo usermod -a -G rvm $USER
					set +x
					source /etc/profile.d/rvm.sh
					set -x
					;;
			esac
			set +x
			$RETRY rvm install $VER
			set -x
		fi
		;;
	"scilab")
		if [[ -z "$VER" ]]; then
			$RETRY sudo apt-get -qq install scilab
		else
			$RETRY wget --progress=dot:giga "https://www.scilab.org/download/$VER/scilab-$VER.bin.linux-x86_64.tar.gz"
			# $HOME/.local/bin is in PATH and writeable
			mkdir -p "$HOME/.local"
			tar -xzf "scilab-$VER.bin.linux-x86_64.tar.gz" --strip-components=1 -C "$HOME/.local"
		fi	
		;;
	"tcl")
		$RETRY sudo apt-get -qq install tcl-dev
		;;
esac

set +e # turn off exit on failure (same as +o errexit)