Sync with 2.23.4
[git] / ci / install-dependencies.sh
1 #!/usr/bin/env bash
2 #
3 # Install dependencies required to build and test Git on Linux and macOS
4 #
5
6 . ${0%/*}/lib.sh
7
8 P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION
9 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
10
11 case "$jobname" in
12 linux-clang|linux-gcc)
13         sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
14         sudo apt-get -q update
15         sudo apt-get -q -y install language-pack-is libsvn-perl apache2
16         case "$jobname" in
17         linux-gcc)
18                 sudo apt-get -q -y install gcc-8
19                 ;;
20         esac
21
22         mkdir --parents "$P4_PATH"
23         pushd "$P4_PATH"
24                 wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
25                 wget --quiet "$P4WHENCE/bin.linux26x86_64/p4"
26                 chmod u+x p4d
27                 chmod u+x p4
28         popd
29         mkdir --parents "$GIT_LFS_PATH"
30         pushd "$GIT_LFS_PATH"
31                 wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
32                 tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
33                 cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
34         popd
35         ;;
36 osx-clang|osx-gcc)
37         export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
38         # Uncomment this if you want to run perf tests:
39         # brew install gnu-time
40         test -z "$BREW_INSTALL_PACKAGES" ||
41         brew install $BREW_INSTALL_PACKAGES
42         brew link --force gettext
43         brew cask install perforce || {
44                 # Update the definitions and try again
45                 git -C "$(brew --repository)"/Library/Taps/homebrew/homebrew-cask pull &&
46                 brew cask install perforce
47         } ||
48         brew install caskroom/cask/perforce
49         case "$jobname" in
50         osx-gcc)
51                 brew link gcc ||
52                 brew link gcc@8
53                 ;;
54         esac
55         ;;
56 StaticAnalysis)
57         sudo apt-get -q update
58         sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
59                 libexpat-dev gettext
60         ;;
61 Documentation)
62         sudo apt-get -q update
63         sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns
64
65         test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
66         gem install --version 1.5.8 asciidoctor
67         ;;
68 esac
69
70 if type p4d >/dev/null && type p4 >/dev/null
71 then
72         echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
73         p4d -V | grep Rev.
74         echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
75         p4 -V | grep Rev.
76 fi
77 if type git-lfs >/dev/null
78 then
79         echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
80         git-lfs version
81 fi