merge: simplify parsing of "-n" option
[git.git] / ci / install-dependencies.sh
blob4f407530d3057552177883ad6b088f0a65b37b9a
1 #!/usr/bin/env bash
3 # Install dependencies required to build and test Git on Linux and macOS
6 . ${0%/*}/lib.sh
8 P4WHENCE=https://cdist2.perforce.com/perforce/r21.2
9 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
10 UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl-dev libexpat-dev
11 tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl
12 libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl"
14 case "$runs_on_pool" in
15 ubuntu-*)
16 sudo apt-get -q update
17 sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
18 $UBUNTU_COMMON_PKGS $CC_PACKAGE $PYTHON_PACKAGE
19 mkdir --parents "$P4_PATH"
20 pushd "$P4_PATH"
21 wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
22 wget --quiet "$P4WHENCE/bin.linux26x86_64/p4"
23 chmod u+x p4d
24 chmod u+x p4
25 popd
26 mkdir --parents "$GIT_LFS_PATH"
27 pushd "$GIT_LFS_PATH"
28 wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
29 tar --extract --gunzip --file "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
30 cp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .
31 popd
33 macos-*)
34 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
35 # Uncomment this if you want to run perf tests:
36 # brew install gnu-time
37 test -z "$BREW_INSTALL_PACKAGES" ||
38 brew install $BREW_INSTALL_PACKAGES
39 brew link --force gettext
40 mkdir -p $HOME/bin
42 cd $HOME/bin
43 wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
44 tar -xf helix-core-server.tgz &&
45 sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
47 PATH="$PATH:${HOME}/bin"
48 export PATH
50 if test -n "$CC_PACKAGE"
51 then
52 BREW_PACKAGE=${CC_PACKAGE/-/@}
53 brew install "$BREW_PACKAGE"
54 brew link "$BREW_PACKAGE"
57 esac
59 case "$jobname" in
60 StaticAnalysis)
61 sudo apt-get -q update
62 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
63 libexpat-dev gettext make
65 sparse)
66 sudo apt-get -q update -q
67 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
68 libexpat-dev gettext zlib1g-dev
70 Documentation)
71 sudo apt-get -q update
72 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
74 test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
75 sudo gem install --version 1.5.8 asciidoctor
77 linux-gcc-default)
78 sudo apt-get -q update
79 sudo apt-get -q -y install $UBUNTU_COMMON_PKGS
81 esac
83 if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
84 then
85 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
86 p4d -V
87 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
88 p4 -V
89 else
90 echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
92 if type git-lfs >/dev/null 2>&1
93 then
94 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
95 git-lfs version
96 else
97 echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"