t0410: make test description clearer
[git/gitster.git] / ci / install-dependencies.sh
blob126e570eb46a29d90b0c2d97cf46988a2939d544
1 #!/bin/sh
3 # Install dependencies required to build and test Git on Linux and macOS
6 . ${0%/*}/lib.sh
8 begin_group "Install dependencies"
10 P4WHENCE=https://cdist2.perforce.com/perforce/r23.2
11 LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION
12 JGITWHENCE=https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/6.8.0.202311291450-r/org.eclipse.jgit.pgm-6.8.0.202311291450-r.sh
14 # Make sudo a no-op and execute the command directly when running as root.
15 # While using sudo would be fine on most platforms when we are root already,
16 # some platforms like e.g. Alpine Linux do not have sudo available by default
17 # and would thus break.
18 if test "$(id -u)" -eq 0
19 then
20 sudo () {
21 "$@"
25 case "$distro" in
26 alpine-*)
27 apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
28 pcre2-dev python3 musl-libintl perl-utils ncurses \
29 apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
30 bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null
32 fedora-*)
33 dnf -yq update >/dev/null &&
34 dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
36 ubuntu-*|ubuntu32-*)
37 # Required so that apt doesn't wait for user input on certain packages.
38 export DEBIAN_FRONTEND=noninteractive
40 case "$distro" in
41 ubuntu-*)
42 SVN='libsvn-perl subversion'
45 SVN=
47 esac
49 sudo apt-get -q update
50 sudo apt-get -q -y install \
51 language-pack-is apache2 cvs cvsps git gnupg $SVN \
52 make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
53 tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
54 libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
55 ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
57 case "$distro" in
58 ubuntu-16.04)
59 # Does not support JGit, but we also don't really care about
60 # the others. We rather care whether Git still compiles and
61 # runs fine overall.
63 ubuntu-*)
64 mkdir --parents "$CUSTOM_PATH"
66 wget --quiet --directory-prefix="$CUSTOM_PATH" \
67 "$P4WHENCE/bin.linux26x86_64/p4d" "$P4WHENCE/bin.linux26x86_64/p4"
68 chmod a+x "$CUSTOM_PATH/p4d" "$CUSTOM_PATH/p4"
70 wget --quiet "$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
71 tar -xzf "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz" \
72 -C "$CUSTOM_PATH" --strip-components=1 "git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs"
73 rm "git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz"
75 wget --quiet "$JGITWHENCE" --output-document="$CUSTOM_PATH/jgit"
76 chmod a+x "$CUSTOM_PATH/jgit"
78 esac
80 macos-*)
81 export HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1
82 # Uncomment this if you want to run perf tests:
83 # brew install gnu-time
84 brew link --force gettext
86 mkdir -p "$CUSTOM_PATH"
87 wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
88 tar -xf helix-core-server.tgz -C "$CUSTOM_PATH" p4 p4d &&
89 sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
90 rm helix-core-server.tgz
92 if test -n "$CC_PACKAGE"
93 then
94 BREW_PACKAGE=${CC_PACKAGE/-/@}
95 brew install "$BREW_PACKAGE"
96 brew link "$BREW_PACKAGE"
99 esac
101 case "$jobname" in
102 ClangFormat)
103 sudo apt-get -q update
104 sudo apt-get -q -y install clang-format
106 StaticAnalysis)
107 sudo apt-get -q update
108 sudo apt-get -q -y install coccinelle libcurl4-openssl-dev libssl-dev \
109 libexpat-dev gettext make
111 sparse)
112 sudo apt-get -q update -q
113 sudo apt-get -q -y install libssl-dev libcurl4-openssl-dev \
114 libexpat-dev gettext zlib1g-dev
116 Documentation)
117 sudo apt-get -q update
118 sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
120 test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
121 sudo gem install --version 1.5.8 asciidoctor
122 sudo gem install concurrent-ruby
124 esac
126 if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
127 then
128 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
129 p4d -V
130 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
131 p4 -V
132 else
133 echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
136 if type git-lfs >/dev/null 2>&1
137 then
138 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
139 git-lfs version
140 else
141 echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
144 if type jgit >/dev/null 2>&1
145 then
146 echo "$(tput setaf 6)JGit Version$(tput sgr0)"
147 jgit version
148 else
149 echo >&2 "WARNING: JGit wasn't installed, see above for clues why"
152 end_group "Install dependencies"